sun.font.FontConfigManager Java Examples

The following examples show how to use sun.font.FontConfigManager. 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: FcFontManager.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #2
Source File: FcFontManager.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #3
Source File: X11FontManager.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #4
Source File: FcFontManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #5
Source File: FcFontManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #6
Source File: XToolkit.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #7
Source File: FcFontManager.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #8
Source File: FcFontManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #9
Source File: FcFontManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #10
Source File: X11FontManager.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #11
Source File: X11FontManager.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #12
Source File: FcFontManager.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected String[] getDefaultPlatformFont() {
    final String[] info = new String[2];
    getFontConfigManager().initFontConfigFonts(false);
    FontConfigManager.FcCompFont[] fontConfigFonts =
        getFontConfigManager().getFontConfigFonts();
    if (fontConfigFonts != null) {
        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 != null && 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;
}
 
Example #13
Source File: X11FontManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@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;
}
 
Example #14
Source File: X11FontManager.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@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;
}