sun.awt.CharsetString Java Examples

The following examples show how to use sun.awt.CharsetString. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PSPrinterJob.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #2
Source File: PSPrinterJob.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #3
Source File: PSPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #4
Source File: PSPrinterJob.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: PSPrinterJob.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #6
Source File: PSPrinterJob.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #7
Source File: PSPrinterJob.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #8
Source File: PSPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #9
Source File: PSPrinterJob.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #10
Source File: PSPrinterJob.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #11
Source File: PSPrinterJob.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #12
Source File: PSPrinterJob.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #13
Source File: PSPrinterJob.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #14
Source File: PSPrinterJob.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #15
Source File: PSPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
* 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;
}
 
Example #16
Source File: PSPrinterJob.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
* 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;
}
 
Example #17
Source File: PSPrinterJob.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
* 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;
}
 
Example #18
Source File: PSPrinterJob.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
* 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;
}
 
Example #19
Source File: PSPrinterJob.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
* 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;
}
 
Example #20
Source File: PSPrinterJob.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
* 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;
}
 
Example #21
Source File: PSPrinterJob.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
* 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;
}
 
Example #22
Source File: PSPrinterJob.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
* 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;
}
 
Example #23
Source File: PSPrinterJob.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
* 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;
}
 
Example #24
Source File: PSPrinterJob.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
* 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;
}
 
Example #25
Source File: PSPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
* 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;
}
 
Example #26
Source File: PSPrinterJob.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
* 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;
}
 
Example #27
Source File: PSPrinterJob.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
* 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;
}
 
Example #28
Source File: PSPrinterJob.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
* 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;
}