sun.font.SunFontManager Java Examples

The following examples show how to use sun.font.SunFontManager. 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: FontConfiguration.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
 
Example #2
Source File: FontConfiguration.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public FontConfiguration(SunFontManager fm) {
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating standard Font Configuration");
    }
    if (FontUtilities.debugFonts() && logger == null) {
        logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
    }
    fontManager = fm;
    setOsNameAndVersion();  /* static initialization */
    setEncoding();          /* static initialization */
    /* Separating out the file location from the rest of the
     * initialisation, so the caller has the option of doing
     * something else if a suitable file isn't found.
     */
    findFontConfigFile();
}
 
Example #3
Source File: FontConfiguration.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
 
Example #4
Source File: FontConfiguration.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public FontConfiguration(SunFontManager fm) {
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating standard Font Configuration");
    }
    if (FontUtilities.debugFonts() && logger == null) {
        logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
    }
    fontManager = fm;
    setOsNameAndVersion();  /* static initialization */
    setEncoding();          /* static initialization */
    /* Separating out the file location from the rest of the
     * initialisation, so the caller has the option of doing
     * something else if a suitable file isn't found.
     */
    findFontConfigFile();
}
 
Example #5
Source File: GlyphListLoopPipe.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl,
                             int aaHint) {
    int prevBorder = 0;
    boolean isColor = false;
    int len = gl.getNumGlyphs();
    gl.startGlyphIteration();
    if (SunFontManager.getInstance().areColorGlyphsSupported()) {
        for (int i = 0; i < len; i++) {
            boolean newIsColor = gl.isColorGlyph(i);
            if (newIsColor != isColor) {
                drawGlyphListSegment(sg2d, gl, prevBorder, i, aaHint, isColor);
                prevBorder = i;
                isColor = newIsColor;
            }
        }
    }
    drawGlyphListSegment(sg2d, gl, prevBorder, len, aaHint, isColor);
}
 
Example #6
Source File: FontConfiguration.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
 
Example #7
Source File: FontConfiguration.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
 
Example #8
Source File: FontConfiguration.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
 
Example #9
Source File: FontConfiguration.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public FontConfiguration(SunFontManager fm) {
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating standard Font Configuration");
    }
    if (FontUtilities.debugFonts() && logger == null) {
        logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
    }
    fontManager = fm;
    setOsNameAndVersion();  /* static initialization */
    setEncoding();          /* static initialization */
    /* Separating out the file location from the rest of the
     * initialisation, so the caller has the option of doing
     * something else if a suitable file isn't found.
     */
    findFontConfigFile();
}
 
Example #10
Source File: MFontConfiguration.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected String mapFileName(String fileName) {
    if (fileName != null && fileName.startsWith(fontsDirPrefix)) {
        return SunFontManager.jreFontDirName
                + fileName.substring(fontsDirPrefix.length());
    }
    return fileName;
}
 
Example #11
Source File: MFontConfiguration.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public MFontConfiguration(SunFontManager fm) {
    super(fm);
    if (FontUtilities.debugFonts()) {
        logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
    }
    initTables();
}
 
Example #12
Source File: MFontConfiguration.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected String mapFileName(String fileName) {
    if (fileName != null && fileName.startsWith(fontsDirPrefix)) {
        return SunFontManager.jreFontDirName
                + fileName.substring(fontsDirPrefix.length());
    }
    return fileName;
}
 
Example #13
Source File: PlatformFont.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public PlatformFont(String name, int style){
    SunFontManager sfm = SunFontManager.getInstance();
    if (sfm instanceof FontSupport) {
        fontConfig = ((FontSupport)sfm).getFontConfiguration();
    }
    if (fontConfig == null) {
        return;
    }

    // map given font name to a valid logical font family name
    familyName = name.toLowerCase(Locale.ENGLISH);
    if (!FontConfiguration.isLogicalFontFamilyName(familyName)) {
        familyName = fontConfig.getFallbackFamilyName(familyName, "sansserif");
    }

    componentFonts = fontConfig.getFontDescriptors(familyName, style);

    // search default character
    //
    char missingGlyphCharacter = getMissingGlyphCharacter();

    defaultChar = '?';
    if (componentFonts.length > 0)
        defaultFont = componentFonts[0];

    for (int i = 0; i < componentFonts.length; i++){
        if (componentFonts[i].isExcluded(missingGlyphCharacter)) {
            continue;
        }

        if (componentFonts[i].encoder.canEncode(missingGlyphCharacter)) {
            defaultFont = componentFonts[i];
            defaultChar = missingGlyphCharacter;
            break;
        }
    }
}
 
Example #14
Source File: WToolkit.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public FontMetrics getFontMetrics(Font font) {
    // This is an unsupported hack, but left in for a customer.
    // Do not remove.
    FontManager fm = FontManagerFactory.getInstance();
    if (fm instanceof SunFontManager
        && ((SunFontManager) fm).usePlatformFontMetrics()) {
        return WFontMetrics.getFontMetrics(font);
    }
    return super.getFontMetrics(font);
}
 
Example #15
Source File: Win32FontManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void registerJREFontsForPrinting() {
    final String pathName;
    synchronized (Win32GraphicsEnvironment.class) {
        GraphicsEnvironment.getLocalGraphicsEnvironment();
        if (fontsForPrinting == null) {
            return;
        }
        pathName = fontsForPrinting;
        fontsForPrinting = null;
    }
    java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction() {
            public Object run() {
                File f1 = new File(pathName);
                String[] ls = f1.list(SunFontManager.getInstance().
                        getTrueTypeFilter());
                if (ls == null) {
                    return null;
                }
                for (int i=0; i <ls.length; i++ ) {
                    File fontFile = new File(f1, ls[i]);
                    registerFontWithPlatform(fontFile.getAbsolutePath());
                }
                return null;
            }
     });
}
 
Example #16
Source File: WToolkit.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public FontMetrics getFontMetrics(Font font) {
    // This is an unsupported hack, but left in for a customer.
    // Do not remove.
    FontManager fm = FontManagerFactory.getInstance();
    if (fm instanceof SunFontManager
        && ((SunFontManager) fm).usePlatformFontMetrics()) {
        return WFontMetrics.getFontMetrics(font);
    }
    return super.getFontMetrics(font);
}
 
Example #17
Source File: WToolkit.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public FontMetrics getFontMetrics(Font font) {
    // This is an unsupported hack, but left in for a customer.
    // Do not remove.
    FontManager fm = FontManagerFactory.getInstance();
    if (fm instanceof SunFontManager
        && ((SunFontManager) fm).usePlatformFontMetrics()) {
        return WFontMetrics.getFontMetrics(font);
    }
    return super.getFontMetrics(font);
}
 
Example #18
Source File: MFontConfiguration.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public MFontConfiguration(SunFontManager fm,
                          boolean preferLocaleFonts,
                          boolean preferPropFonts) {
    super(fm, preferLocaleFonts, preferPropFonts);
    if (FontUtilities.debugFonts()) {
        logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
    }
    initTables();
}
 
Example #19
Source File: WToolkit.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public FontMetrics getFontMetrics(Font font) {
    // This is an unsupported hack, but left in for a customer.
    // Do not remove.
    FontManager fm = FontManagerFactory.getInstance();
    if (fm instanceof SunFontManager
        && ((SunFontManager) fm).usePlatformFontMetrics()) {
        return WFontMetrics.getFontMetrics(font);
    }
    return super.getFontMetrics(font);
}
 
Example #20
Source File: PlatformFont.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public PlatformFont(String name, int style){
    SunFontManager sfm = SunFontManager.getInstance();
    if (sfm instanceof FontSupport) {
        fontConfig = ((FontSupport)sfm).getFontConfiguration();
    }
    if (fontConfig == null) {
        return;
    }

    // map given font name to a valid logical font family name
    familyName = name.toLowerCase(Locale.ENGLISH);
    if (!FontConfiguration.isLogicalFontFamilyName(familyName)) {
        familyName = fontConfig.getFallbackFamilyName(familyName, "sansserif");
    }

    componentFonts = fontConfig.getFontDescriptors(familyName, style);

    // search default character
    //
    char missingGlyphCharacter = getMissingGlyphCharacter();

    defaultChar = '?';
    if (componentFonts.length > 0)
        defaultFont = componentFonts[0];

    for (int i = 0; i < componentFonts.length; i++){
        if (componentFonts[i].isExcluded(missingGlyphCharacter)) {
            continue;
        }

        if (componentFonts[i].encoder.canEncode(missingGlyphCharacter)) {
            defaultFont = componentFonts[i];
            defaultChar = missingGlyphCharacter;
            break;
        }
    }
}
 
Example #21
Source File: Win32FontManager.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void registerJREFontsForPrinting() {
    final String pathName;
    synchronized (Win32GraphicsEnvironment.class) {
        GraphicsEnvironment.getLocalGraphicsEnvironment();
        if (fontsForPrinting == null) {
            return;
        }
        pathName = fontsForPrinting;
        fontsForPrinting = null;
    }
    java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction() {
            public Object run() {
                File f1 = new File(pathName);
                String[] ls = f1.list(SunFontManager.getInstance().
                        getTrueTypeFilter());
                if (ls == null) {
                    return null;
                }
                for (int i=0; i <ls.length; i++ ) {
                    File fontFile = new File(f1, ls[i]);
                    registerFontWithPlatform(fontFile.getAbsolutePath());
                }
                return null;
            }
     });
}
 
Example #22
Source File: PlatformFont.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public PlatformFont(String name, int style){
    SunFontManager sfm = SunFontManager.getInstance();
    if (sfm instanceof FontSupport) {
        fontConfig = ((FontSupport)sfm).getFontConfiguration();
    }
    if (fontConfig == null) {
        return;
    }

    // map given font name to a valid logical font family name
    familyName = name.toLowerCase(Locale.ENGLISH);
    if (!FontConfiguration.isLogicalFontFamilyName(familyName)) {
        familyName = fontConfig.getFallbackFamilyName(familyName, "sansserif");
    }

    componentFonts = fontConfig.getFontDescriptors(familyName, style);

    // search default character
    //
    char missingGlyphCharacter = getMissingGlyphCharacter();

    defaultChar = '?';
    if (componentFonts.length > 0)
        defaultFont = componentFonts[0];

    for (int i = 0; i < componentFonts.length; i++){
        if (componentFonts[i].isExcluded(missingGlyphCharacter)) {
            continue;
        }

        if (componentFonts[i].encoder.canEncode(missingGlyphCharacter)) {
            defaultFont = componentFonts[i];
            defaultChar = missingGlyphCharacter;
            break;
        }
    }
}
 
Example #23
Source File: MFontConfiguration.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public MFontConfiguration(SunFontManager fm,
                          boolean preferLocaleFonts,
                          boolean preferPropFonts) {
    super(fm, preferLocaleFonts, preferPropFonts);
    if (FontUtilities.debugFonts()) {
        logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
    }
    initTables();
}
 
Example #24
Source File: Win32FontManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void registerJREFontsForPrinting() {
    final String pathName;
    synchronized (Win32GraphicsEnvironment.class) {
        GraphicsEnvironment.getLocalGraphicsEnvironment();
        if (fontsForPrinting == null) {
            return;
        }
        pathName = fontsForPrinting;
        fontsForPrinting = null;
    }
    java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction() {
            public Object run() {
                File f1 = new File(pathName);
                String[] ls = f1.list(SunFontManager.getInstance().
                        getTrueTypeFilter());
                if (ls == null) {
                    return null;
                }
                for (int i=0; i <ls.length; i++ ) {
                    File fontFile = new File(f1, ls[i]);
                    registerFontWithPlatform(fontFile.getAbsolutePath());
                }
                return null;
            }
     });
}
 
Example #25
Source File: PlatformFont.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public PlatformFont(String name, int style){
    SunFontManager sfm = SunFontManager.getInstance();
    if (sfm instanceof FontSupport) {
        fontConfig = ((FontSupport)sfm).getFontConfiguration();
    }
    if (fontConfig == null) {
        return;
    }

    // map given font name to a valid logical font family name
    familyName = name.toLowerCase(Locale.ENGLISH);
    if (!FontConfiguration.isLogicalFontFamilyName(familyName)) {
        familyName = fontConfig.getFallbackFamilyName(familyName, "sansserif");
    }

    componentFonts = fontConfig.getFontDescriptors(familyName, style);

    // search default character
    //
    char missingGlyphCharacter = getMissingGlyphCharacter();

    defaultChar = '?';
    if (componentFonts.length > 0)
        defaultFont = componentFonts[0];

    for (int i = 0; i < componentFonts.length; i++){
        if (componentFonts[i].isExcluded(missingGlyphCharacter)) {
            continue;
        }

        if (componentFonts[i].encoder.canEncode(missingGlyphCharacter)) {
            defaultFont = componentFonts[i];
            defaultChar = missingGlyphCharacter;
            break;
        }
    }
}
 
Example #26
Source File: MFontConfiguration.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public MFontConfiguration(SunFontManager fm) {
    super(fm);
    if (FontUtilities.debugFonts()) {
        logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
    }
    initTables();
}
 
Example #27
Source File: WToolkit.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public FontMetrics getFontMetrics(Font font) {
    // This is an unsupported hack, but left in for a customer.
    // Do not remove.
    FontManager fm = FontManagerFactory.getInstance();
    if (fm instanceof SunFontManager
        && ((SunFontManager) fm).usePlatformFontMetrics()) {
        return WFontMetrics.getFontMetrics(font);
    }
    return super.getFontMetrics(font);
}
 
Example #28
Source File: MFontConfiguration.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public MFontConfiguration(SunFontManager fm,
                          boolean preferLocaleFonts,
                          boolean preferPropFonts) {
    super(fm, preferLocaleFonts, preferPropFonts);
    if (FontUtilities.debugFonts()) {
        logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
    }
    initTables();
}
 
Example #29
Source File: PlatformFont.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public PlatformFont(String name, int style){
    SunFontManager sfm = SunFontManager.getInstance();
    if (sfm instanceof FontSupport) {
        fontConfig = ((FontSupport)sfm).getFontConfiguration();
    }
    if (fontConfig == null) {
        return;
    }

    // map given font name to a valid logical font family name
    familyName = name.toLowerCase(Locale.ENGLISH);
    if (!FontConfiguration.isLogicalFontFamilyName(familyName)) {
        familyName = fontConfig.getFallbackFamilyName(familyName, "sansserif");
    }

    componentFonts = fontConfig.getFontDescriptors(familyName, style);

    // search default character
    //
    char missingGlyphCharacter = getMissingGlyphCharacter();

    defaultChar = '?';
    if (componentFonts.length > 0)
        defaultFont = componentFonts[0];

    for (int i = 0; i < componentFonts.length; i++){
        if (componentFonts[i].isExcluded(missingGlyphCharacter)) {
            continue;
        }

        if (componentFonts[i].encoder.canEncode(missingGlyphCharacter)) {
            defaultFont = componentFonts[i];
            defaultChar = missingGlyphCharacter;
            break;
        }
    }
}
 
Example #30
Source File: MFontConfiguration.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected String mapFileName(String fileName) {
    if (fileName != null && fileName.startsWith(fontsDirPrefix)) {
        return SunFontManager.jreFontDirName
                + fileName.substring(fontsDirPrefix.length());
    }
    return fileName;
}