Java 类sun.font.FontConfigManager 实例源码

项目:OpenJSharp    文件:X11FontManager.java   
@Override
protected String[] getDefaultPlatformFont() {
    final String[] info = new String[2];
    getFontConfigManager().initFontConfigFonts(false);
    FontConfigManager.FcCompFont[] fontConfigFonts =
        getFontConfigManager().getFontConfigFonts();
    for (int i=0; i<fontConfigFonts.length; i++) {
        if ("sans".equals(fontConfigFonts[i].fcFamily) &&
            0 == fontConfigFonts[i].style) {
            info[0] = fontConfigFonts[i].firstFont.familyName;
            info[1] = fontConfigFonts[i].firstFont.fontFile;
            break;
        }
    }
    /* Absolute last ditch attempt in the face of fontconfig problems.
     * If we didn't match, pick the first, or just make something
     * up so we don't NPE.
     */
    if (info[0] == null) {
        if (fontConfigFonts.length > 0 &&
            fontConfigFonts[0].firstFont.fontFile != null) {
            info[0] = fontConfigFonts[0].firstFont.familyName;
            info[1] = fontConfigFonts[0].firstFont.fontFile;
        } else {
            info[0] = "Dialog";
            info[1] = "/dialog.ttf";
        }
    }
    return info;
}
项目:jdk8u-jdk    文件:FcFontManager.java   
@Override
protected String[] getDefaultPlatformFont() {
    final String[] info = new String[2];
    getFontConfigManager().initFontConfigFonts(false);
    FontConfigManager.FcCompFont[] fontConfigFonts =
        getFontConfigManager().getFontConfigFonts();
    for (int i=0; i<fontConfigFonts.length; i++) {
        if ("sans".equals(fontConfigFonts[i].fcFamily) &&
            0 == fontConfigFonts[i].style) {
            info[0] = fontConfigFonts[i].firstFont.familyName;
            info[1] = fontConfigFonts[i].firstFont.fontFile;
            break;
        }
    }
    /* Absolute last ditch attempt in the face of fontconfig problems.
     * If we didn't match, pick the first, or just make something
     * up so we don't NPE.
     */
    if (info[0] == null) {
        if (fontConfigFonts.length > 0 &&
            fontConfigFonts[0].firstFont.fontFile != null) {
            info[0] = fontConfigFonts[0].firstFont.familyName;
            info[1] = fontConfigFonts[0].firstFont.fontFile;
        } else {
            info[0] = "Dialog";
            info[1] = "/dialog.ttf";
        }
    }
    return info;
}
项目:openjdk-jdk10    文件:XToolkit.java   
/**
 * Initializes XAWTXSettings if a property for a given property name is provided by
 * XSettings and they are not initialized yet.
 *
 * @return true if the method has initialized XAWTXSettings.
 */
private boolean initXSettingsIfNeeded(final String propName) {
    if (!loadedXSettings &&
        (propName.startsWith("gnome.") ||
         propName.equals(SunToolkit.DESKTOPFONTHINTS) ||
         propName.startsWith(dndPrefix)))
    {
        loadedXSettings = true;
        if (!GraphicsEnvironment.isHeadless()) {
            loadXSettings();
            /* If no desktop font hint could be retrieved, check for
             * KDE running KWin and retrieve settings from fontconfig.
             * If that isn't found let SunToolkit will see if there's a
             * system property set by a user.
             */
            if (desktopProperties.get(SunToolkit.DESKTOPFONTHINTS) == null) {
                if (XWM.isKDE2()) {
                    Object hint = FontConfigManager.getFontConfigAAHint();
                    if (hint != null) {
                        /* set the fontconfig/KDE property so that
                         * getDesktopHints() below will see it
                         * and set the public property.
                         */
                        desktopProperties.put(UNIXToolkit.FONTCONFIGAAHINT,
                                              hint);
                    }
                }
                desktopProperties.put(SunToolkit.DESKTOPFONTHINTS,
                                      SunToolkit.getDesktopFontHints());
            }

            return true;
        }
    }
    return false;
}
项目:openjdk-jdk10    文件:FcFontManager.java   
@Override
protected String[] getDefaultPlatformFont() {
    final String[] info = new String[2];
    getFontConfigManager().initFontConfigFonts(false);
    FontConfigManager.FcCompFont[] fontConfigFonts =
        getFontConfigManager().getFontConfigFonts();
    for (int i=0; i<fontConfigFonts.length; i++) {
        if ("sans".equals(fontConfigFonts[i].fcFamily) &&
            0 == fontConfigFonts[i].style) {
            info[0] = fontConfigFonts[i].firstFont.familyName;
            info[1] = fontConfigFonts[i].firstFont.fontFile;
            break;
        }
    }
    /* Absolute last ditch attempt in the face of fontconfig problems.
     * If we didn't match, pick the first, or just make something
     * up so we don't NPE.
     */
    if (info[0] == null) {
        if (fontConfigFonts.length > 0 &&
            fontConfigFonts[0].firstFont.fontFile != null) {
            info[0] = fontConfigFonts[0].firstFont.familyName;
            info[1] = fontConfigFonts[0].firstFont.fontFile;
        } else {
            info[0] = "Dialog";
            info[1] = "/dialog.ttf";
        }
    }
    return info;
}
项目:openjdk9    文件:XToolkit.java   
/**
 * Initializes XAWTXSettings if a property for a given property name is provided by
 * XSettings and they are not initialized yet.
 *
 * @return true if the method has initialized XAWTXSettings.
 */
private boolean initXSettingsIfNeeded(final String propName) {
    if (!loadedXSettings &&
        (propName.startsWith("gnome.") ||
         propName.equals(SunToolkit.DESKTOPFONTHINTS) ||
         propName.startsWith(dndPrefix)))
    {
        loadedXSettings = true;
        if (!GraphicsEnvironment.isHeadless()) {
            loadXSettings();
            /* If no desktop font hint could be retrieved, check for
             * KDE running KWin and retrieve settings from fontconfig.
             * If that isn't found let SunToolkit will see if there's a
             * system property set by a user.
             */
            if (desktopProperties.get(SunToolkit.DESKTOPFONTHINTS) == null) {
                if (XWM.isKDE2()) {
                    Object hint = FontConfigManager.getFontConfigAAHint();
                    if (hint != null) {
                        /* set the fontconfig/KDE property so that
                         * getDesktopHints() below will see it
                         * and set the public property.
                         */
                        desktopProperties.put(UNIXToolkit.FONTCONFIGAAHINT,
                                              hint);
                    }
                }
                desktopProperties.put(SunToolkit.DESKTOPFONTHINTS,
                                      SunToolkit.getDesktopFontHints());
            }

            return true;
        }
    }
    return false;
}
项目:openjdk9    文件:FcFontManager.java   
@Override
protected String[] getDefaultPlatformFont() {
    final String[] info = new String[2];
    getFontConfigManager().initFontConfigFonts(false);
    FontConfigManager.FcCompFont[] fontConfigFonts =
        getFontConfigManager().getFontConfigFonts();
    for (int i=0; i<fontConfigFonts.length; i++) {
        if ("sans".equals(fontConfigFonts[i].fcFamily) &&
            0 == fontConfigFonts[i].style) {
            info[0] = fontConfigFonts[i].firstFont.familyName;
            info[1] = fontConfigFonts[i].firstFont.fontFile;
            break;
        }
    }
    /* Absolute last ditch attempt in the face of fontconfig problems.
     * If we didn't match, pick the first, or just make something
     * up so we don't NPE.
     */
    if (info[0] == null) {
        if (fontConfigFonts.length > 0 &&
            fontConfigFonts[0].firstFont.fontFile != null) {
            info[0] = fontConfigFonts[0].firstFont.familyName;
            info[1] = fontConfigFonts[0].firstFont.fontFile;
        } else {
            info[0] = "Dialog";
            info[1] = "/dialog.ttf";
        }
    }
    return info;
}
项目:jdk8u_jdk    文件:FcFontManager.java   
@Override
protected String[] getDefaultPlatformFont() {
    final String[] info = new String[2];
    getFontConfigManager().initFontConfigFonts(false);
    FontConfigManager.FcCompFont[] fontConfigFonts =
        getFontConfigManager().getFontConfigFonts();
    for (int i=0; i<fontConfigFonts.length; i++) {
        if ("sans".equals(fontConfigFonts[i].fcFamily) &&
            0 == fontConfigFonts[i].style) {
            info[0] = fontConfigFonts[i].firstFont.familyName;
            info[1] = fontConfigFonts[i].firstFont.fontFile;
            break;
        }
    }
    /* Absolute last ditch attempt in the face of fontconfig problems.
     * If we didn't match, pick the first, or just make something
     * up so we don't NPE.
     */
    if (info[0] == null) {
        if (fontConfigFonts.length > 0 &&
            fontConfigFonts[0].firstFont.fontFile != null) {
            info[0] = fontConfigFonts[0].firstFont.familyName;
            info[1] = fontConfigFonts[0].firstFont.fontFile;
        } else {
            info[0] = "Dialog";
            info[1] = "/dialog.ttf";
        }
    }
    return info;
}
项目:lookaside_java-1.8.0-openjdk    文件:FcFontManager.java   
@Override
protected String[] getDefaultPlatformFont() {
    final String[] info = new String[2];
    getFontConfigManager().initFontConfigFonts(false);
    FontConfigManager.FcCompFont[] fontConfigFonts =
        getFontConfigManager().getFontConfigFonts();
    for (int i=0; i<fontConfigFonts.length; i++) {
        if ("sans".equals(fontConfigFonts[i].fcFamily) &&
            0 == fontConfigFonts[i].style) {
            info[0] = fontConfigFonts[i].firstFont.familyName;
            info[1] = fontConfigFonts[i].firstFont.fontFile;
            break;
        }
    }
    /* Absolute last ditch attempt in the face of fontconfig problems.
     * If we didn't match, pick the first, or just make something
     * up so we don't NPE.
     */
    if (info[0] == null) {
        if (fontConfigFonts.length > 0 &&
            fontConfigFonts[0].firstFont.fontFile != null) {
            info[0] = fontConfigFonts[0].firstFont.familyName;
            info[1] = fontConfigFonts[0].firstFont.fontFile;
        } else {
            info[0] = "Dialog";
            info[1] = "/dialog.ttf";
        }
    }
    return info;
}
项目:infobip-open-jdk-8    文件:X11FontManager.java   
@Override
protected String[] getDefaultPlatformFont() {
    final String[] info = new String[2];
    getFontConfigManager().initFontConfigFonts(false);
    FontConfigManager.FcCompFont[] fontConfigFonts =
        getFontConfigManager().getFontConfigFonts();
    for (int i=0; i<fontConfigFonts.length; i++) {
        if ("sans".equals(fontConfigFonts[i].fcFamily) &&
            0 == fontConfigFonts[i].style) {
            info[0] = fontConfigFonts[i].firstFont.familyName;
            info[1] = fontConfigFonts[i].firstFont.fontFile;
            break;
        }
    }
    /* Absolute last ditch attempt in the face of fontconfig problems.
     * If we didn't match, pick the first, or just make something
     * up so we don't NPE.
     */
    if (info[0] == null) {
        if (fontConfigFonts.length > 0 &&
            fontConfigFonts[0].firstFont.fontFile != null) {
            info[0] = fontConfigFonts[0].firstFont.familyName;
            info[1] = fontConfigFonts[0].firstFont.fontFile;
        } else {
            info[0] = "Dialog";
            info[1] = "/dialog.ttf";
        }
    }
    return info;
}
项目:jdk8u-dev-jdk    文件:X11FontManager.java   
@Override
protected String[] getDefaultPlatformFont() {
    final String[] info = new String[2];
    getFontConfigManager().initFontConfigFonts(false);
    FontConfigManager.FcCompFont[] fontConfigFonts =
        getFontConfigManager().getFontConfigFonts();
    for (int i=0; i<fontConfigFonts.length; i++) {
        if ("sans".equals(fontConfigFonts[i].fcFamily) &&
            0 == fontConfigFonts[i].style) {
            info[0] = fontConfigFonts[i].firstFont.familyName;
            info[1] = fontConfigFonts[i].firstFont.fontFile;
            break;
        }
    }
    /* Absolute last ditch attempt in the face of fontconfig problems.
     * If we didn't match, pick the first, or just make something
     * up so we don't NPE.
     */
    if (info[0] == null) {
        if (fontConfigFonts.length > 0 &&
            fontConfigFonts[0].firstFont.fontFile != null) {
            info[0] = fontConfigFonts[0].firstFont.familyName;
            info[1] = fontConfigFonts[0].firstFont.fontFile;
        } else {
            info[0] = "Dialog";
            info[1] = "/dialog.ttf";
        }
    }
    return info;
}
项目:jdk7-jdk    文件:X11FontManager.java   
public String[] getDefaultPlatformFont() {
    if (defaultPlatformFont != null) {
        return defaultPlatformFont;
    }
    String[] info = new String[2];
    getFontConfigManager().initFontConfigFonts(false);
    FontConfigManager.FcCompFont[] fontConfigFonts =
        getFontConfigManager().getFontConfigFonts();
    for (int i=0; i<fontConfigFonts.length; i++) {
        if ("sans".equals(fontConfigFonts[i].fcFamily) &&
            0 == fontConfigFonts[i].style) {
            info[0] = fontConfigFonts[i].firstFont.familyName;
            info[1] = fontConfigFonts[i].firstFont.fontFile;
            break;
        }
    }
    /* Absolute last ditch attempt in the face of fontconfig problems.
     * If we didn't match, pick the first, or just make something
     * up so we don't NPE.
     */
    if (info[0] == null) {
        if (fontConfigFonts.length > 0 &&
            fontConfigFonts[0].firstFont.fontFile != null) {
            info[0] = fontConfigFonts[0].firstFont.familyName;
            info[1] = fontConfigFonts[0].firstFont.fontFile;
        } else {
            info[0] = "Dialog";
            info[1] = "/dialog.ttf";
        }
    }
    defaultPlatformFont = info;
    return defaultPlatformFont;
}
项目:openjdk-source-code-learn    文件:X11FontManager.java   
public String[] getDefaultPlatformFont() {
    if (defaultPlatformFont != null) {
        return defaultPlatformFont;
    }
    String[] info = new String[2];
    getFontConfigManager().initFontConfigFonts(false);
    FontConfigManager.FcCompFont[] fontConfigFonts =
        getFontConfigManager().getFontConfigFonts();
    for (int i=0; i<fontConfigFonts.length; i++) {
        if ("sans".equals(fontConfigFonts[i].fcFamily) &&
            0 == fontConfigFonts[i].style) {
            info[0] = fontConfigFonts[i].firstFont.familyName;
            info[1] = fontConfigFonts[i].firstFont.fontFile;
            break;
        }
    }
    /* Absolute last ditch attempt in the face of fontconfig problems.
     * If we didn't match, pick the first, or just make something
     * up so we don't NPE.
     */
    if (info[0] == null) {
        if (fontConfigFonts.length > 0 &&
            fontConfigFonts[0].firstFont.fontFile != null) {
            info[0] = fontConfigFonts[0].firstFont.familyName;
            info[1] = fontConfigFonts[0].firstFont.fontFile;
        } else {
            info[0] = "Dialog";
            info[1] = "/dialog.ttf";
        }
    }
    defaultPlatformFont = info;
    return defaultPlatformFont;
}
项目:OLD-OpenJDK8    文件:X11FontManager.java   
public String[] getDefaultPlatformFont() {
    if (defaultPlatformFont != null) {
        return defaultPlatformFont;
    }
    String[] info = new String[2];
    getFontConfigManager().initFontConfigFonts(false);
    FontConfigManager.FcCompFont[] fontConfigFonts =
        getFontConfigManager().getFontConfigFonts();
    for (int i=0; i<fontConfigFonts.length; i++) {
        if ("sans".equals(fontConfigFonts[i].fcFamily) &&
            0 == fontConfigFonts[i].style) {
            info[0] = fontConfigFonts[i].firstFont.familyName;
            info[1] = fontConfigFonts[i].firstFont.fontFile;
            break;
        }
    }
    /* Absolute last ditch attempt in the face of fontconfig problems.
     * If we didn't match, pick the first, or just make something
     * up so we don't NPE.
     */
    if (info[0] == null) {
        if (fontConfigFonts.length > 0 &&
            fontConfigFonts[0].firstFont.fontFile != null) {
            info[0] = fontConfigFonts[0].firstFont.familyName;
            info[1] = fontConfigFonts[0].firstFont.fontFile;
        } else {
            info[0] = "Dialog";
            info[1] = "/dialog.ttf";
        }
    }
    defaultPlatformFont = info;
    return defaultPlatformFont;
}
项目:openjdk-jdk7u-jdk    文件:X11FontManager.java   
public String[] getDefaultPlatformFont() {
    if (defaultPlatformFont != null) {
        return defaultPlatformFont;
    }
    String[] info = new String[2];
    getFontConfigManager().initFontConfigFonts(false);
    FontConfigManager.FcCompFont[] fontConfigFonts =
        getFontConfigManager().getFontConfigFonts();
    for (int i=0; i<fontConfigFonts.length; i++) {
        if ("sans".equals(fontConfigFonts[i].fcFamily) &&
            0 == fontConfigFonts[i].style) {
            info[0] = fontConfigFonts[i].firstFont.familyName;
            info[1] = fontConfigFonts[i].firstFont.fontFile;
            break;
        }
    }
    /* Absolute last ditch attempt in the face of fontconfig problems.
     * If we didn't match, pick the first, or just make something
     * up so we don't NPE.
     */
    if (info[0] == null) {
        if (fontConfigFonts.length > 0 &&
            fontConfigFonts[0].firstFont.fontFile != null) {
            info[0] = fontConfigFonts[0].firstFont.familyName;
            info[1] = fontConfigFonts[0].firstFont.fontFile;
        } else {
            info[0] = "Dialog";
            info[1] = "/dialog.ttf";
        }
    }
    defaultPlatformFont = info;
    return defaultPlatformFont;
}
项目:openjdk-icedtea7    文件:X11FontManager.java   
public String[] getDefaultPlatformFont() {
    if (defaultPlatformFont != null) {
        return defaultPlatformFont;
    }
    String[] info = new String[2];
    getFontConfigManager().initFontConfigFonts(false);
    FontConfigManager.FcCompFont[] fontConfigFonts =
        getFontConfigManager().getFontConfigFonts();
    for (int i=0; i<fontConfigFonts.length; i++) {
        if ("sans".equals(fontConfigFonts[i].fcFamily) &&
            0 == fontConfigFonts[i].style) {
            info[0] = fontConfigFonts[i].firstFont.familyName;
            info[1] = fontConfigFonts[i].firstFont.fontFile;
            break;
        }
    }
    /* Absolute last ditch attempt in the face of fontconfig problems.
     * If we didn't match, pick the first, or just make something
     * up so we don't NPE.
     */
    if (info[0] == null) {
        if (fontConfigFonts.length > 0 &&
            fontConfigFonts[0].firstFont.fontFile != null) {
            info[0] = fontConfigFonts[0].firstFont.familyName;
            info[1] = fontConfigFonts[0].firstFont.fontFile;
        } else {
            info[0] = "Dialog";
            info[1] = "/dialog.ttf";
        }
    }
    defaultPlatformFont = info;
    return defaultPlatformFont;
}