Java Code Examples for sun.font.FontUtilities#debugFonts()

The following examples show how to use sun.font.FontUtilities#debugFonts() . 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 dragonwell8_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 jdk8u-dev-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 3
Source File: FontConfiguration.java    From openjdk-jdk8u-backup 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 4
Source File: FontConfiguration.java    From TencentKona-8 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: FontConfiguration.java    From openjdk-8-source 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 6
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 7
Source File: MFontConfiguration.java    From dragonwell8_jdk 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 8
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 9
Source File: X11FontManager.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private String specificFontIDForName(String name) {

        int[] hPos = new int[14];
        int hyphenCnt = 1;
        int pos = 1;

        while (pos != -1 && hyphenCnt < 14) {
            pos = name.indexOf('-', pos);
            if (pos != -1) {
                hPos[hyphenCnt++] = pos;
                    pos++;
            }
        }

        if (hyphenCnt != 14) {
            if (FontUtilities.debugFonts()) {
                FontUtilities.getLogger()
                    .severe("Font Configuration Font ID is malformed:" + name);
            }
            return name; // what else can we do?
        }

        StringBuffer sb =
            new StringBuffer(name.substring(hPos[FAMILY_NAME_FIELD-1],
                                            hPos[SETWIDTH_NAME_FIELD]));
        sb.append(name.substring(hPos[CHARSET_REGISTRY_FIELD-1]));
        String retval = sb.toString().toLowerCase (Locale.ENGLISH);
        return retval;
    }
 
Example 10
Source File: X11FontManager.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private String specificFontIDForName(String name) {

        int[] hPos = new int[14];
        int hyphenCnt = 1;
        int pos = 1;

        while (pos != -1 && hyphenCnt < 14) {
            pos = name.indexOf('-', pos);
            if (pos != -1) {
                hPos[hyphenCnt++] = pos;
                    pos++;
            }
        }

        if (hyphenCnt != 14) {
            if (FontUtilities.debugFonts()) {
                FontUtilities.getLogger()
                    .severe("Font Configuration Font ID is malformed:" + name);
            }
            return name; // what else can we do?
        }

        StringBuffer sb =
            new StringBuffer(name.substring(hPos[FAMILY_NAME_FIELD-1],
                                            hPos[SETWIDTH_NAME_FIELD]));
        sb.append(name.substring(hPos[CHARSET_REGISTRY_FIELD-1]));
        String retval = sb.toString().toLowerCase (Locale.ENGLISH);
        return retval;
    }
 
Example 11
Source File: FontConfiguration.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void readFontConfigFile(File f) {
    /* This is invoked here as readFontConfigFile is only invoked
     * once per VM, and always in a privileged context, thus the
     * directory containing installed fall back fonts is accessed
     * from this context
     */
    getInstalledFallbackFonts(javaLib);

    if (f != null) {
        try {
            FileInputStream in = new FileInputStream(f.getPath());
            if (isProperties) {
                loadProperties(in);
            } else {
                loadBinary(in);
            }
            in.close();
            if (FontUtilities.debugFonts()) {
                logger.config("Read logical font configuration from " + f);
            }
        } catch (IOException e) {
            if (FontUtilities.debugFonts()) {
                logger.config("Failed to read logical font configuration from " + f);
            }
        }
    }
    String version = getVersion();
    if (!"1".equals(version) && FontUtilities.debugFonts()) {
        logger.config("Unsupported fontconfig version: " + version);
    }
}
 
Example 12
Source File: X11FontManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void getPlatformFontPathFromFontConfig() {
    if (fontConfigDirs == null) {
        fontConfigDirs = getFontConfiguration().getAWTFontPathSet();
        if (FontUtilities.debugFonts() && fontConfigDirs != null) {
            String[] names = fontConfigDirs.toArray(new String[0]);
            for (int i=0;i<names.length;i++) {
                FontUtilities.getLogger().info("awtfontpath : " + names[i]);
            }
        }
    }
}
 
Example 13
Source File: MFontConfiguration.java    From hottub 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 14
Source File: FontConfiguration.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public boolean needToSearchForFile(String fileName) {
    if (!FontUtilities.isLinux) {
        return false;
    } else if (existsMap == null) {
       existsMap = new HashMap<String, Boolean>();
    }
    Boolean exists = existsMap.get(fileName);
    if (exists == null) {
        /* call getNumberCoreFonts() to ensure these are initialised, and
         * if this file isn't for a core component, ie, is a for a fallback
         * font which very typically isn't available, then can't afford
         * to take the start-up penalty to search for it.
         */
        getNumberCoreFonts();
        if (!coreFontFileNames.contains(fileName)) {
            exists = Boolean.TRUE;
        } else {
            exists = Boolean.valueOf((new File(fileName)).exists());
            existsMap.put(fileName, exists);
            if (FontUtilities.debugFonts() &&
                exists == Boolean.FALSE) {
                logger.warning("Couldn't locate font file " + fileName);
            }
        }
    }
    return exists == Boolean.FALSE;
}
 
Example 15
Source File: X11FontManager.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void getPlatformFontPathFromFontConfig() {
    if (fontConfigDirs == null) {
        fontConfigDirs = getFontConfiguration().getAWTFontPathSet();
        if (FontUtilities.debugFonts() && fontConfigDirs != null) {
            String[] names = fontConfigDirs.toArray(new String[0]);
            for (int i=0;i<names.length;i++) {
                FontUtilities.getLogger().info("awtfontpath : " + names[i]);
            }
        }
    }
}
 
Example 16
Source File: X11FontManager.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void getPlatformFontPathFromFontConfig() {
    if (fontConfigDirs == null) {
        fontConfigDirs = getFontConfiguration().getAWTFontPathSet();
        if (FontUtilities.debugFonts() && fontConfigDirs != null) {
            String[] names = fontConfigDirs.toArray(new String[0]);
            for (int i=0;i<names.length;i++) {
                FontUtilities.getLogger().info("awtfontpath : " + names[i]);
            }
        }
    }
}
 
Example 17
Source File: FontConfiguration.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private int[] parseExclusions(String key, String exclusions) {
    if (exclusions == null) {
        return EMPTY_INT_ARRAY;
    }
    // range format is xxxx-XXXX,yyyyyy-YYYYYY,.....
    int numExclusions = 1;
    int pos = 0;
    while ((pos = exclusions.indexOf(',', pos)) != -1) {
        numExclusions++;
        pos++;
    }
    int[] exclusionRanges = new int[numExclusions * 2];
    pos = 0;
    int newPos = 0;
    for (int j = 0; j < numExclusions * 2; ) {
        String lower, upper;
        int lo = 0, up = 0;
        try {
            newPos = exclusions.indexOf('-', pos);
            lower = exclusions.substring(pos, newPos);
            pos = newPos + 1;
            newPos = exclusions.indexOf(',', pos);
            if (newPos == -1) {
                newPos = exclusions.length();
            }
            upper = exclusions.substring(pos, newPos);
            pos = newPos + 1;
            int lowerLength = lower.length();
            int upperLength = upper.length();
            if (lowerLength != 4 && lowerLength != 6
                || upperLength != 4 && upperLength != 6) {
                throw new Exception();
            }
            lo = Integer.parseInt(lower, 16);
            up = Integer.parseInt(upper, 16);
            if (lo > up) {
                throw new Exception();
            }
        } catch (Exception e) {
            if (FontUtilities.debugFonts() &&
                logger != null) {
                logger.config("Failed parsing " + key +
                          " property of font configuration.");

            }
            return EMPTY_INT_ARRAY;
        }
        exclusionRanges[j++] = lo;
        exclusionRanges[j++] = up;
    }
    return exclusionRanges;
}
 
Example 18
Source File: FontConfiguration.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private int[] parseExclusions(String key, String exclusions) {
    if (exclusions == null) {
        return EMPTY_INT_ARRAY;
    }
    // range format is xxxx-XXXX,yyyyyy-YYYYYY,.....
    int numExclusions = 1;
    int pos = 0;
    while ((pos = exclusions.indexOf(',', pos)) != -1) {
        numExclusions++;
        pos++;
    }
    int[] exclusionRanges = new int[numExclusions * 2];
    pos = 0;
    int newPos = 0;
    for (int j = 0; j < numExclusions * 2; ) {
        String lower, upper;
        int lo = 0, up = 0;
        try {
            newPos = exclusions.indexOf('-', pos);
            lower = exclusions.substring(pos, newPos);
            pos = newPos + 1;
            newPos = exclusions.indexOf(',', pos);
            if (newPos == -1) {
                newPos = exclusions.length();
            }
            upper = exclusions.substring(pos, newPos);
            pos = newPos + 1;
            int lowerLength = lower.length();
            int upperLength = upper.length();
            if (lowerLength != 4 && lowerLength != 6
                || upperLength != 4 && upperLength != 6) {
                throw new Exception();
            }
            lo = Integer.parseInt(lower, 16);
            up = Integer.parseInt(upper, 16);
            if (lo > up) {
                throw new Exception();
            }
        } catch (Exception e) {
            if (FontUtilities.debugFonts() &&
                logger != null) {
                logger.config("Failed parsing " + key +
                          " property of font configuration.");

            }
            return EMPTY_INT_ARRAY;
        }
        exclusionRanges[j++] = lo;
        exclusionRanges[j++] = up;
    }
    return exclusionRanges;
}
 
Example 19
Source File: FontConfiguration.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
private int[] parseExclusions(String key, String exclusions) {
    if (exclusions == null) {
        return EMPTY_INT_ARRAY;
    }
    // range format is xxxx-XXXX,yyyyyy-YYYYYY,.....
    int numExclusions = 1;
    int pos = 0;
    while ((pos = exclusions.indexOf(',', pos)) != -1) {
        numExclusions++;
        pos++;
    }
    int[] exclusionRanges = new int[numExclusions * 2];
    pos = 0;
    int newPos = 0;
    for (int j = 0; j < numExclusions * 2; ) {
        String lower, upper;
        int lo = 0, up = 0;
        try {
            newPos = exclusions.indexOf('-', pos);
            lower = exclusions.substring(pos, newPos);
            pos = newPos + 1;
            newPos = exclusions.indexOf(',', pos);
            if (newPos == -1) {
                newPos = exclusions.length();
            }
            upper = exclusions.substring(pos, newPos);
            pos = newPos + 1;
            int lowerLength = lower.length();
            int upperLength = upper.length();
            if (lowerLength != 4 && lowerLength != 6
                || upperLength != 4 && upperLength != 6) {
                throw new Exception();
            }
            lo = Integer.parseInt(lower, 16);
            up = Integer.parseInt(upper, 16);
            if (lo > up) {
                throw new Exception();
            }
        } catch (Exception e) {
            if (FontUtilities.debugFonts() &&
                logger != null) {
                logger.config("Failed parsing " + key +
                          " property of font configuration.");

            }
            return EMPTY_INT_ARRAY;
        }
        exclusionRanges[j++] = lo;
        exclusionRanges[j++] = up;
    }
    return exclusionRanges;
}
 
Example 20
Source File: FontConfiguration.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private int[] parseExclusions(String key, String exclusions) {
    if (exclusions == null) {
        return EMPTY_INT_ARRAY;
    }
    // range format is xxxx-XXXX,yyyyyy-YYYYYY,.....
    int numExclusions = 1;
    int pos = 0;
    while ((pos = exclusions.indexOf(',', pos)) != -1) {
        numExclusions++;
        pos++;
    }
    int[] exclusionRanges = new int[numExclusions * 2];
    pos = 0;
    int newPos = 0;
    for (int j = 0; j < numExclusions * 2; ) {
        String lower, upper;
        int lo = 0, up = 0;
        try {
            newPos = exclusions.indexOf('-', pos);
            lower = exclusions.substring(pos, newPos);
            pos = newPos + 1;
            newPos = exclusions.indexOf(',', pos);
            if (newPos == -1) {
                newPos = exclusions.length();
            }
            upper = exclusions.substring(pos, newPos);
            pos = newPos + 1;
            int lowerLength = lower.length();
            int upperLength = upper.length();
            if (lowerLength != 4 && lowerLength != 6
                || upperLength != 4 && upperLength != 6) {
                throw new Exception();
            }
            lo = Integer.parseInt(lower, 16);
            up = Integer.parseInt(upper, 16);
            if (lo > up) {
                throw new Exception();
            }
        } catch (Exception e) {
            if (FontUtilities.debugFonts() &&
                logger != null) {
                logger.config("Failed parsing " + key +
                          " property of font configuration.");

            }
            return EMPTY_INT_ARRAY;
        }
        exclusionRanges[j++] = lo;
        exclusionRanges[j++] = up;
    }
    return exclusionRanges;
}