类sun.awt.CharsetString源码实例Demo

下面列出了怎么用sun.awt.CharsetString的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dragonwell8_jdk   文件: PSPrinterJob.java
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    CharsetString[] acs =
        ((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
源代码2 项目: TencentKona-8   文件: PSPrinterJob.java
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    CharsetString[] acs =
        ((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
源代码3 项目: jdk8u60   文件: PSPrinterJob.java
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    CharsetString[] acs =
        ((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
源代码4 项目: openjdk-jdk8u   文件: PSPrinterJob.java
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    CharsetString[] acs =
        ((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
源代码5 项目: openjdk-jdk8u-backup   文件: PSPrinterJob.java
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    CharsetString[] acs =
        ((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
源代码6 项目: Bytecoder   文件: PSPrinterJob.java
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    PlatformFont peer = (PlatformFont) FontAccess.getFontAccess()
                                                 .getFontPeer(font);
    CharsetString[] acs = peer.makeMultiCharsetString(str, false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
源代码7 项目: openjdk-jdk9   文件: PSPrinterJob.java
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    PlatformFont peer = (PlatformFont) FontAccess.getFontAccess()
                                                 .getFontPeer(font);
    CharsetString[] acs = peer.makeMultiCharsetString(str, false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
源代码8 项目: jdk8u-jdk   文件: PSPrinterJob.java
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    CharsetString[] acs =
        ((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
源代码9 项目: hottub   文件: PSPrinterJob.java
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    CharsetString[] acs =
        ((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
源代码10 项目: openjdk-8-source   文件: PSPrinterJob.java
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    CharsetString[] acs =
        ((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
源代码11 项目: openjdk-8   文件: PSPrinterJob.java
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    CharsetString[] acs =
        ((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
源代码12 项目: jdk8u_jdk   文件: PSPrinterJob.java
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    CharsetString[] acs =
        ((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
源代码13 项目: jdk8u-jdk   文件: PSPrinterJob.java
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    CharsetString[] acs =
        ((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
源代码14 项目: jdk8u-dev-jdk   文件: PSPrinterJob.java
protected int platformFontCount(Font font, String str) {
    if (mFontProps == null) {
        return 0;
    }
    CharsetString[] acs =
        ((PlatformFont)(font.getPeer())).makeMultiCharsetString(str,false);
    if (acs == null) {
        /* AWT can't convert all chars so use 2D path */
        return 0;
    }
    int[] psFonts = getPSFontIndexArray(font, acs);
    return (psFonts == null) ? 0 : psFonts.length;
}
 
源代码15 项目: dragonwell8_jdk   文件: PSPrinterJob.java
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
   int[] psFont = null;

   if (mFontProps != null) {
       psFont = new int[charSet.length];
   }

   for (int i = 0; i < charSet.length && psFont != null; i++){

       /* Get the encoding of the run of text.
        */
       CharsetString cs = charSet[i];

       CharsetEncoder fontCS = cs.fontDescriptor.encoder;
       String charsetName = cs.fontDescriptor.getFontCharsetName();
       /*
        * sun.awt.Symbol perhaps should return "symbol" for encoding.
        * Similarly X11Dingbats should return "dingbats"
        * Forced to check for win32 & x/unix names for these converters.
        */

       if ("Symbol".equals(charsetName)) {
           charsetName = "symbol";
       } else if ("WingDings".equals(charsetName) ||
                  "X11Dingbats".equals(charsetName)) {
           charsetName = "dingbats";
       } else {
           charsetName = makeCharsetName(charsetName, cs.charsetChars);
       }

       int styleMask = font.getStyle() |
           FontUtilities.getFont2D(font).getStyle();

       String style = FontConfiguration.getStyleString(styleMask);

       /* First we map the font name through the properties file.
        * This mapping provides alias names for fonts, for example,
        * "timesroman" is mapped to "serif".
        */
       String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
       fontName = fontName.replace(' ', '_');
       String name = mFontProps.getProperty(fontName, "");

       /* Now map the alias name, character set name, and style
        * to a PostScript name.
        */
       String psName =
           mFontProps.getProperty(name + "." + charsetName + "." + style,
                                 null);

       if (psName != null) {

           /* Get the PostScript font index for the PostScript font.
            */
           try {
               psFont[i] =
                   Integer.parseInt(mFontProps.getProperty(psName));

           /* If there is no PostScript font for this font name,
            * then we want to termintate the loop and the method
            * indicating our failure. Setting the array to null
            * is used to indicate these failures.
            */
           } catch(NumberFormatException e){
               psFont = null;
           }

       /* There was no PostScript name for the font, character set,
        * and style so give up.
        */
       } else {
           psFont = null;
       }
   }

    return psFont;
}
 
源代码16 项目: TencentKona-8   文件: PSPrinterJob.java
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
   int[] psFont = null;

   if (mFontProps != null) {
       psFont = new int[charSet.length];
   }

   for (int i = 0; i < charSet.length && psFont != null; i++){

       /* Get the encoding of the run of text.
        */
       CharsetString cs = charSet[i];

       CharsetEncoder fontCS = cs.fontDescriptor.encoder;
       String charsetName = cs.fontDescriptor.getFontCharsetName();
       /*
        * sun.awt.Symbol perhaps should return "symbol" for encoding.
        * Similarly X11Dingbats should return "dingbats"
        * Forced to check for win32 & x/unix names for these converters.
        */

       if ("Symbol".equals(charsetName)) {
           charsetName = "symbol";
       } else if ("WingDings".equals(charsetName) ||
                  "X11Dingbats".equals(charsetName)) {
           charsetName = "dingbats";
       } else {
           charsetName = makeCharsetName(charsetName, cs.charsetChars);
       }

       int styleMask = font.getStyle() |
           FontUtilities.getFont2D(font).getStyle();

       String style = FontConfiguration.getStyleString(styleMask);

       /* First we map the font name through the properties file.
        * This mapping provides alias names for fonts, for example,
        * "timesroman" is mapped to "serif".
        */
       String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
       fontName = fontName.replace(' ', '_');
       String name = mFontProps.getProperty(fontName, "");

       /* Now map the alias name, character set name, and style
        * to a PostScript name.
        */
       String psName =
           mFontProps.getProperty(name + "." + charsetName + "." + style,
                                 null);

       if (psName != null) {

           /* Get the PostScript font index for the PostScript font.
            */
           try {
               psFont[i] =
                   Integer.parseInt(mFontProps.getProperty(psName));

           /* If there is no PostScript font for this font name,
            * then we want to termintate the loop and the method
            * indicating our failure. Setting the array to null
            * is used to indicate these failures.
            */
           } catch(NumberFormatException e){
               psFont = null;
           }

       /* There was no PostScript name for the font, character set,
        * and style so give up.
        */
       } else {
           psFont = null;
       }
   }

    return psFont;
}
 
源代码17 项目: jdk8u60   文件: PSPrinterJob.java
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
   int[] psFont = null;

   if (mFontProps != null) {
       psFont = new int[charSet.length];
   }

   for (int i = 0; i < charSet.length && psFont != null; i++){

       /* Get the encoding of the run of text.
        */
       CharsetString cs = charSet[i];

       CharsetEncoder fontCS = cs.fontDescriptor.encoder;
       String charsetName = cs.fontDescriptor.getFontCharsetName();
       /*
        * sun.awt.Symbol perhaps should return "symbol" for encoding.
        * Similarly X11Dingbats should return "dingbats"
        * Forced to check for win32 & x/unix names for these converters.
        */

       if ("Symbol".equals(charsetName)) {
           charsetName = "symbol";
       } else if ("WingDings".equals(charsetName) ||
                  "X11Dingbats".equals(charsetName)) {
           charsetName = "dingbats";
       } else {
           charsetName = makeCharsetName(charsetName, cs.charsetChars);
       }

       int styleMask = font.getStyle() |
           FontUtilities.getFont2D(font).getStyle();

       String style = FontConfiguration.getStyleString(styleMask);

       /* First we map the font name through the properties file.
        * This mapping provides alias names for fonts, for example,
        * "timesroman" is mapped to "serif".
        */
       String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
       fontName = fontName.replace(' ', '_');
       String name = mFontProps.getProperty(fontName, "");

       /* Now map the alias name, character set name, and style
        * to a PostScript name.
        */
       String psName =
           mFontProps.getProperty(name + "." + charsetName + "." + style,
                                 null);

       if (psName != null) {

           /* Get the PostScript font index for the PostScript font.
            */
           try {
               psFont[i] =
                   Integer.parseInt(mFontProps.getProperty(psName));

           /* If there is no PostScript font for this font name,
            * then we want to termintate the loop and the method
            * indicating our failure. Setting the array to null
            * is used to indicate these failures.
            */
           } catch(NumberFormatException e){
               psFont = null;
           }

       /* There was no PostScript name for the font, character set,
        * and style so give up.
        */
       } else {
           psFont = null;
       }
   }

    return psFont;
}
 
源代码18 项目: openjdk-jdk8u   文件: PSPrinterJob.java
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
   int[] psFont = null;

   if (mFontProps != null) {
       psFont = new int[charSet.length];
   }

   for (int i = 0; i < charSet.length && psFont != null; i++){

       /* Get the encoding of the run of text.
        */
       CharsetString cs = charSet[i];

       CharsetEncoder fontCS = cs.fontDescriptor.encoder;
       String charsetName = cs.fontDescriptor.getFontCharsetName();
       /*
        * sun.awt.Symbol perhaps should return "symbol" for encoding.
        * Similarly X11Dingbats should return "dingbats"
        * Forced to check for win32 & x/unix names for these converters.
        */

       if ("Symbol".equals(charsetName)) {
           charsetName = "symbol";
       } else if ("WingDings".equals(charsetName) ||
                  "X11Dingbats".equals(charsetName)) {
           charsetName = "dingbats";
       } else {
           charsetName = makeCharsetName(charsetName, cs.charsetChars);
       }

       int styleMask = font.getStyle() |
           FontUtilities.getFont2D(font).getStyle();

       String style = FontConfiguration.getStyleString(styleMask);

       /* First we map the font name through the properties file.
        * This mapping provides alias names for fonts, for example,
        * "timesroman" is mapped to "serif".
        */
       String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
       fontName = fontName.replace(' ', '_');
       String name = mFontProps.getProperty(fontName, "");

       /* Now map the alias name, character set name, and style
        * to a PostScript name.
        */
       String psName =
           mFontProps.getProperty(name + "." + charsetName + "." + style,
                                 null);

       if (psName != null) {

           /* Get the PostScript font index for the PostScript font.
            */
           try {
               psFont[i] =
                   Integer.parseInt(mFontProps.getProperty(psName));

           /* If there is no PostScript font for this font name,
            * then we want to termintate the loop and the method
            * indicating our failure. Setting the array to null
            * is used to indicate these failures.
            */
           } catch(NumberFormatException e){
               psFont = null;
           }

       /* There was no PostScript name for the font, character set,
        * and style so give up.
        */
       } else {
           psFont = null;
       }
   }

    return psFont;
}
 
源代码19 项目: openjdk-jdk8u-backup   文件: PSPrinterJob.java
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
   int[] psFont = null;

   if (mFontProps != null) {
       psFont = new int[charSet.length];
   }

   for (int i = 0; i < charSet.length && psFont != null; i++){

       /* Get the encoding of the run of text.
        */
       CharsetString cs = charSet[i];

       CharsetEncoder fontCS = cs.fontDescriptor.encoder;
       String charsetName = cs.fontDescriptor.getFontCharsetName();
       /*
        * sun.awt.Symbol perhaps should return "symbol" for encoding.
        * Similarly X11Dingbats should return "dingbats"
        * Forced to check for win32 & x/unix names for these converters.
        */

       if ("Symbol".equals(charsetName)) {
           charsetName = "symbol";
       } else if ("WingDings".equals(charsetName) ||
                  "X11Dingbats".equals(charsetName)) {
           charsetName = "dingbats";
       } else {
           charsetName = makeCharsetName(charsetName, cs.charsetChars);
       }

       int styleMask = font.getStyle() |
           FontUtilities.getFont2D(font).getStyle();

       String style = FontConfiguration.getStyleString(styleMask);

       /* First we map the font name through the properties file.
        * This mapping provides alias names for fonts, for example,
        * "timesroman" is mapped to "serif".
        */
       String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
       fontName = fontName.replace(' ', '_');
       String name = mFontProps.getProperty(fontName, "");

       /* Now map the alias name, character set name, and style
        * to a PostScript name.
        */
       String psName =
           mFontProps.getProperty(name + "." + charsetName + "." + style,
                                 null);

       if (psName != null) {

           /* Get the PostScript font index for the PostScript font.
            */
           try {
               psFont[i] =
                   Integer.parseInt(mFontProps.getProperty(psName));

           /* If there is no PostScript font for this font name,
            * then we want to termintate the loop and the method
            * indicating our failure. Setting the array to null
            * is used to indicate these failures.
            */
           } catch(NumberFormatException e){
               psFont = null;
           }

       /* There was no PostScript name for the font, character set,
        * and style so give up.
        */
       } else {
           psFont = null;
       }
   }

    return psFont;
}
 
源代码20 项目: Bytecoder   文件: PSPrinterJob.java
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
   int[] psFont = null;

   if (mFontProps != null) {
       psFont = new int[charSet.length];
   }

   for (int i = 0; i < charSet.length && psFont != null; i++){

       /* Get the encoding of the run of text.
        */
       CharsetString cs = charSet[i];

       CharsetEncoder fontCS = cs.fontDescriptor.encoder;
       String charsetName = cs.fontDescriptor.getFontCharsetName();
       /*
        * sun.awt.Symbol perhaps should return "symbol" for encoding.
        * Similarly X11Dingbats should return "dingbats"
        * Forced to check for win32 & x/unix names for these converters.
        */

       if ("Symbol".equals(charsetName)) {
           charsetName = "symbol";
       } else if ("WingDings".equals(charsetName) ||
                  "X11Dingbats".equals(charsetName)) {
           charsetName = "dingbats";
       } else {
           charsetName = makeCharsetName(charsetName, cs.charsetChars);
       }

       int styleMask = font.getStyle() |
           FontUtilities.getFont2D(font).getStyle();

       String style = FontConfiguration.getStyleString(styleMask);

       /* First we map the font name through the properties file.
        * This mapping provides alias names for fonts, for example,
        * "timesroman" is mapped to "serif".
        */
       String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
       fontName = fontName.replace(' ', '_');
       String name = mFontProps.getProperty(fontName, "");

       /* Now map the alias name, character set name, and style
        * to a PostScript name.
        */
       String psName =
           mFontProps.getProperty(name + "." + charsetName + "." + style,
                                 null);

       if (psName != null) {

           /* Get the PostScript font index for the PostScript font.
            */
           try {
               psFont[i] =
                   Integer.parseInt(mFontProps.getProperty(psName));

           /* If there is no PostScript font for this font name,
            * then we want to termintate the loop and the method
            * indicating our failure. Setting the array to null
            * is used to indicate these failures.
            */
           } catch(NumberFormatException e){
               psFont = null;
           }

       /* There was no PostScript name for the font, character set,
        * and style so give up.
        */
       } else {
           psFont = null;
       }
   }

    return psFont;
}
 
源代码21 项目: openjdk-jdk9   文件: PSPrinterJob.java
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
   int[] psFont = null;

   if (mFontProps != null) {
       psFont = new int[charSet.length];
   }

   for (int i = 0; i < charSet.length && psFont != null; i++){

       /* Get the encoding of the run of text.
        */
       CharsetString cs = charSet[i];

       CharsetEncoder fontCS = cs.fontDescriptor.encoder;
       String charsetName = cs.fontDescriptor.getFontCharsetName();
       /*
        * sun.awt.Symbol perhaps should return "symbol" for encoding.
        * Similarly X11Dingbats should return "dingbats"
        * Forced to check for win32 & x/unix names for these converters.
        */

       if ("Symbol".equals(charsetName)) {
           charsetName = "symbol";
       } else if ("WingDings".equals(charsetName) ||
                  "X11Dingbats".equals(charsetName)) {
           charsetName = "dingbats";
       } else {
           charsetName = makeCharsetName(charsetName, cs.charsetChars);
       }

       int styleMask = font.getStyle() |
           FontUtilities.getFont2D(font).getStyle();

       String style = FontConfiguration.getStyleString(styleMask);

       /* First we map the font name through the properties file.
        * This mapping provides alias names for fonts, for example,
        * "timesroman" is mapped to "serif".
        */
       String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
       fontName = fontName.replace(' ', '_');
       String name = mFontProps.getProperty(fontName, "");

       /* Now map the alias name, character set name, and style
        * to a PostScript name.
        */
       String psName =
           mFontProps.getProperty(name + "." + charsetName + "." + style,
                                 null);

       if (psName != null) {

           /* Get the PostScript font index for the PostScript font.
            */
           try {
               psFont[i] =
                   Integer.parseInt(mFontProps.getProperty(psName));

           /* If there is no PostScript font for this font name,
            * then we want to termintate the loop and the method
            * indicating our failure. Setting the array to null
            * is used to indicate these failures.
            */
           } catch(NumberFormatException e){
               psFont = null;
           }

       /* There was no PostScript name for the font, character set,
        * and style so give up.
        */
       } else {
           psFont = null;
       }
   }

    return psFont;
}
 
源代码22 项目: jdk8u-jdk   文件: PSPrinterJob.java
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
   int[] psFont = null;

   if (mFontProps != null) {
       psFont = new int[charSet.length];
   }

   for (int i = 0; i < charSet.length && psFont != null; i++){

       /* Get the encoding of the run of text.
        */
       CharsetString cs = charSet[i];

       CharsetEncoder fontCS = cs.fontDescriptor.encoder;
       String charsetName = cs.fontDescriptor.getFontCharsetName();
       /*
        * sun.awt.Symbol perhaps should return "symbol" for encoding.
        * Similarly X11Dingbats should return "dingbats"
        * Forced to check for win32 & x/unix names for these converters.
        */

       if ("Symbol".equals(charsetName)) {
           charsetName = "symbol";
       } else if ("WingDings".equals(charsetName) ||
                  "X11Dingbats".equals(charsetName)) {
           charsetName = "dingbats";
       } else {
           charsetName = makeCharsetName(charsetName, cs.charsetChars);
       }

       int styleMask = font.getStyle() |
           FontUtilities.getFont2D(font).getStyle();

       String style = FontConfiguration.getStyleString(styleMask);

       /* First we map the font name through the properties file.
        * This mapping provides alias names for fonts, for example,
        * "timesroman" is mapped to "serif".
        */
       String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
       fontName = fontName.replace(' ', '_');
       String name = mFontProps.getProperty(fontName, "");

       /* Now map the alias name, character set name, and style
        * to a PostScript name.
        */
       String psName =
           mFontProps.getProperty(name + "." + charsetName + "." + style,
                                 null);

       if (psName != null) {

           /* Get the PostScript font index for the PostScript font.
            */
           try {
               psFont[i] =
                   Integer.parseInt(mFontProps.getProperty(psName));

           /* If there is no PostScript font for this font name,
            * then we want to termintate the loop and the method
            * indicating our failure. Setting the array to null
            * is used to indicate these failures.
            */
           } catch(NumberFormatException e){
               psFont = null;
           }

       /* There was no PostScript name for the font, character set,
        * and style so give up.
        */
       } else {
           psFont = null;
       }
   }

    return psFont;
}
 
源代码23 项目: hottub   文件: PSPrinterJob.java
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
   int[] psFont = null;

   if (mFontProps != null) {
       psFont = new int[charSet.length];
   }

   for (int i = 0; i < charSet.length && psFont != null; i++){

       /* Get the encoding of the run of text.
        */
       CharsetString cs = charSet[i];

       CharsetEncoder fontCS = cs.fontDescriptor.encoder;
       String charsetName = cs.fontDescriptor.getFontCharsetName();
       /*
        * sun.awt.Symbol perhaps should return "symbol" for encoding.
        * Similarly X11Dingbats should return "dingbats"
        * Forced to check for win32 & x/unix names for these converters.
        */

       if ("Symbol".equals(charsetName)) {
           charsetName = "symbol";
       } else if ("WingDings".equals(charsetName) ||
                  "X11Dingbats".equals(charsetName)) {
           charsetName = "dingbats";
       } else {
           charsetName = makeCharsetName(charsetName, cs.charsetChars);
       }

       int styleMask = font.getStyle() |
           FontUtilities.getFont2D(font).getStyle();

       String style = FontConfiguration.getStyleString(styleMask);

       /* First we map the font name through the properties file.
        * This mapping provides alias names for fonts, for example,
        * "timesroman" is mapped to "serif".
        */
       String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
       fontName = fontName.replace(' ', '_');
       String name = mFontProps.getProperty(fontName, "");

       /* Now map the alias name, character set name, and style
        * to a PostScript name.
        */
       String psName =
           mFontProps.getProperty(name + "." + charsetName + "." + style,
                                 null);

       if (psName != null) {

           /* Get the PostScript font index for the PostScript font.
            */
           try {
               psFont[i] =
                   Integer.parseInt(mFontProps.getProperty(psName));

           /* If there is no PostScript font for this font name,
            * then we want to termintate the loop and the method
            * indicating our failure. Setting the array to null
            * is used to indicate these failures.
            */
           } catch(NumberFormatException e){
               psFont = null;
           }

       /* There was no PostScript name for the font, character set,
        * and style so give up.
        */
       } else {
           psFont = null;
       }
   }

    return psFont;
}
 
源代码24 项目: openjdk-8-source   文件: PSPrinterJob.java
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
   int[] psFont = null;

   if (mFontProps != null) {
       psFont = new int[charSet.length];
   }

   for (int i = 0; i < charSet.length && psFont != null; i++){

       /* Get the encoding of the run of text.
        */
       CharsetString cs = charSet[i];

       CharsetEncoder fontCS = cs.fontDescriptor.encoder;
       String charsetName = cs.fontDescriptor.getFontCharsetName();
       /*
        * sun.awt.Symbol perhaps should return "symbol" for encoding.
        * Similarly X11Dingbats should return "dingbats"
        * Forced to check for win32 & x/unix names for these converters.
        */

       if ("Symbol".equals(charsetName)) {
           charsetName = "symbol";
       } else if ("WingDings".equals(charsetName) ||
                  "X11Dingbats".equals(charsetName)) {
           charsetName = "dingbats";
       } else {
           charsetName = makeCharsetName(charsetName, cs.charsetChars);
       }

       int styleMask = font.getStyle() |
           FontUtilities.getFont2D(font).getStyle();

       String style = FontConfiguration.getStyleString(styleMask);

       /* First we map the font name through the properties file.
        * This mapping provides alias names for fonts, for example,
        * "timesroman" is mapped to "serif".
        */
       String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
       fontName = fontName.replace(' ', '_');
       String name = mFontProps.getProperty(fontName, "");

       /* Now map the alias name, character set name, and style
        * to a PostScript name.
        */
       String psName =
           mFontProps.getProperty(name + "." + charsetName + "." + style,
                                 null);

       if (psName != null) {

           /* Get the PostScript font index for the PostScript font.
            */
           try {
               psFont[i] =
                   Integer.parseInt(mFontProps.getProperty(psName));

           /* If there is no PostScript font for this font name,
            * then we want to termintate the loop and the method
            * indicating our failure. Setting the array to null
            * is used to indicate these failures.
            */
           } catch(NumberFormatException e){
               psFont = null;
           }

       /* There was no PostScript name for the font, character set,
        * and style so give up.
        */
       } else {
           psFont = null;
       }
   }

    return psFont;
}
 
源代码25 项目: openjdk-8   文件: PSPrinterJob.java
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
   int[] psFont = null;

   if (mFontProps != null) {
       psFont = new int[charSet.length];
   }

   for (int i = 0; i < charSet.length && psFont != null; i++){

       /* Get the encoding of the run of text.
        */
       CharsetString cs = charSet[i];

       CharsetEncoder fontCS = cs.fontDescriptor.encoder;
       String charsetName = cs.fontDescriptor.getFontCharsetName();
       /*
        * sun.awt.Symbol perhaps should return "symbol" for encoding.
        * Similarly X11Dingbats should return "dingbats"
        * Forced to check for win32 & x/unix names for these converters.
        */

       if ("Symbol".equals(charsetName)) {
           charsetName = "symbol";
       } else if ("WingDings".equals(charsetName) ||
                  "X11Dingbats".equals(charsetName)) {
           charsetName = "dingbats";
       } else {
           charsetName = makeCharsetName(charsetName, cs.charsetChars);
       }

       int styleMask = font.getStyle() |
           FontUtilities.getFont2D(font).getStyle();

       String style = FontConfiguration.getStyleString(styleMask);

       /* First we map the font name through the properties file.
        * This mapping provides alias names for fonts, for example,
        * "timesroman" is mapped to "serif".
        */
       String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
       fontName = fontName.replace(' ', '_');
       String name = mFontProps.getProperty(fontName, "");

       /* Now map the alias name, character set name, and style
        * to a PostScript name.
        */
       String psName =
           mFontProps.getProperty(name + "." + charsetName + "." + style,
                                 null);

       if (psName != null) {

           /* Get the PostScript font index for the PostScript font.
            */
           try {
               psFont[i] =
                   Integer.parseInt(mFontProps.getProperty(psName));

           /* If there is no PostScript font for this font name,
            * then we want to termintate the loop and the method
            * indicating our failure. Setting the array to null
            * is used to indicate these failures.
            */
           } catch(NumberFormatException e){
               psFont = null;
           }

       /* There was no PostScript name for the font, character set,
        * and style so give up.
        */
       } else {
           psFont = null;
       }
   }

    return psFont;
}
 
源代码26 项目: jdk8u_jdk   文件: PSPrinterJob.java
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
   int[] psFont = null;

   if (mFontProps != null) {
       psFont = new int[charSet.length];
   }

   for (int i = 0; i < charSet.length && psFont != null; i++){

       /* Get the encoding of the run of text.
        */
       CharsetString cs = charSet[i];

       CharsetEncoder fontCS = cs.fontDescriptor.encoder;
       String charsetName = cs.fontDescriptor.getFontCharsetName();
       /*
        * sun.awt.Symbol perhaps should return "symbol" for encoding.
        * Similarly X11Dingbats should return "dingbats"
        * Forced to check for win32 & x/unix names for these converters.
        */

       if ("Symbol".equals(charsetName)) {
           charsetName = "symbol";
       } else if ("WingDings".equals(charsetName) ||
                  "X11Dingbats".equals(charsetName)) {
           charsetName = "dingbats";
       } else {
           charsetName = makeCharsetName(charsetName, cs.charsetChars);
       }

       int styleMask = font.getStyle() |
           FontUtilities.getFont2D(font).getStyle();

       String style = FontConfiguration.getStyleString(styleMask);

       /* First we map the font name through the properties file.
        * This mapping provides alias names for fonts, for example,
        * "timesroman" is mapped to "serif".
        */
       String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
       fontName = fontName.replace(' ', '_');
       String name = mFontProps.getProperty(fontName, "");

       /* Now map the alias name, character set name, and style
        * to a PostScript name.
        */
       String psName =
           mFontProps.getProperty(name + "." + charsetName + "." + style,
                                 null);

       if (psName != null) {

           /* Get the PostScript font index for the PostScript font.
            */
           try {
               psFont[i] =
                   Integer.parseInt(mFontProps.getProperty(psName));

           /* If there is no PostScript font for this font name,
            * then we want to termintate the loop and the method
            * indicating our failure. Setting the array to null
            * is used to indicate these failures.
            */
           } catch(NumberFormatException e){
               psFont = null;
           }

       /* There was no PostScript name for the font, character set,
        * and style so give up.
        */
       } else {
           psFont = null;
       }
   }

    return psFont;
}
 
源代码27 项目: jdk8u-jdk   文件: PSPrinterJob.java
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
   int[] psFont = null;

   if (mFontProps != null) {
       psFont = new int[charSet.length];
   }

   for (int i = 0; i < charSet.length && psFont != null; i++){

       /* Get the encoding of the run of text.
        */
       CharsetString cs = charSet[i];

       CharsetEncoder fontCS = cs.fontDescriptor.encoder;
       String charsetName = cs.fontDescriptor.getFontCharsetName();
       /*
        * sun.awt.Symbol perhaps should return "symbol" for encoding.
        * Similarly X11Dingbats should return "dingbats"
        * Forced to check for win32 & x/unix names for these converters.
        */

       if ("Symbol".equals(charsetName)) {
           charsetName = "symbol";
       } else if ("WingDings".equals(charsetName) ||
                  "X11Dingbats".equals(charsetName)) {
           charsetName = "dingbats";
       } else {
           charsetName = makeCharsetName(charsetName, cs.charsetChars);
       }

       int styleMask = font.getStyle() |
           FontUtilities.getFont2D(font).getStyle();

       String style = FontConfiguration.getStyleString(styleMask);

       /* First we map the font name through the properties file.
        * This mapping provides alias names for fonts, for example,
        * "timesroman" is mapped to "serif".
        */
       String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
       fontName = fontName.replace(' ', '_');
       String name = mFontProps.getProperty(fontName, "");

       /* Now map the alias name, character set name, and style
        * to a PostScript name.
        */
       String psName =
           mFontProps.getProperty(name + "." + charsetName + "." + style,
                                 null);

       if (psName != null) {

           /* Get the PostScript font index for the PostScript font.
            */
           try {
               psFont[i] =
                   Integer.parseInt(mFontProps.getProperty(psName));

           /* If there is no PostScript font for this font name,
            * then we want to termintate the loop and the method
            * indicating our failure. Setting the array to null
            * is used to indicate these failures.
            */
           } catch(NumberFormatException e){
               psFont = null;
           }

       /* There was no PostScript name for the font, character set,
        * and style so give up.
        */
       } else {
           psFont = null;
       }
   }

    return psFont;
}
 
源代码28 项目: jdk8u-dev-jdk   文件: PSPrinterJob.java
/**
* Given an array of CharsetStrings that make up a run
* of text, this routine converts each CharsetString to
* an index into our PostScript font list. If one or more
* CharsetStrings can not be represented by a PostScript
* font, then this routine will return a null array.
*/
private int[] getPSFontIndexArray(Font font, CharsetString[] charSet) {
   int[] psFont = null;

   if (mFontProps != null) {
       psFont = new int[charSet.length];
   }

   for (int i = 0; i < charSet.length && psFont != null; i++){

       /* Get the encoding of the run of text.
        */
       CharsetString cs = charSet[i];

       CharsetEncoder fontCS = cs.fontDescriptor.encoder;
       String charsetName = cs.fontDescriptor.getFontCharsetName();
       /*
        * sun.awt.Symbol perhaps should return "symbol" for encoding.
        * Similarly X11Dingbats should return "dingbats"
        * Forced to check for win32 & x/unix names for these converters.
        */

       if ("Symbol".equals(charsetName)) {
           charsetName = "symbol";
       } else if ("WingDings".equals(charsetName) ||
                  "X11Dingbats".equals(charsetName)) {
           charsetName = "dingbats";
       } else {
           charsetName = makeCharsetName(charsetName, cs.charsetChars);
       }

       int styleMask = font.getStyle() |
           FontUtilities.getFont2D(font).getStyle();

       String style = FontConfiguration.getStyleString(styleMask);

       /* First we map the font name through the properties file.
        * This mapping provides alias names for fonts, for example,
        * "timesroman" is mapped to "serif".
        */
       String fontName = font.getFamily().toLowerCase(Locale.ENGLISH);
       fontName = fontName.replace(' ', '_');
       String name = mFontProps.getProperty(fontName, "");

       /* Now map the alias name, character set name, and style
        * to a PostScript name.
        */
       String psName =
           mFontProps.getProperty(name + "." + charsetName + "." + style,
                                 null);

       if (psName != null) {

           /* Get the PostScript font index for the PostScript font.
            */
           try {
               psFont[i] =
                   Integer.parseInt(mFontProps.getProperty(psName));

           /* If there is no PostScript font for this font name,
            * then we want to termintate the loop and the method
            * indicating our failure. Setting the array to null
            * is used to indicate these failures.
            */
           } catch(NumberFormatException e){
               psFont = null;
           }

       /* There was no PostScript name for the font, character set,
        * and style so give up.
        */
       } else {
           psFont = null;
       }
   }

    return psFont;
}
 
 类所在包
 类方法
 同包方法