当前位置: 首页>>代码示例>>Java>>正文


Java FontConfigManager类代码示例

本文整理汇总了Java中sun.font.FontConfigManager的典型用法代码示例。如果您正苦于以下问题:Java FontConfigManager类的具体用法?Java FontConfigManager怎么用?Java FontConfigManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FontConfigManager类属于sun.font包,在下文中一共展示了FontConfigManager类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDefaultPlatformFont

import sun.font.FontConfigManager; //导入依赖的package包/类
@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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:X11FontManager.java

示例2: initXSettingsIfNeeded

import sun.font.FontConfigManager; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:42,代码来源:XToolkit.java

示例3: getDefaultPlatformFont

import sun.font.FontConfigManager; //导入依赖的package包/类
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;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:34,代码来源:X11FontManager.java


注:本文中的sun.font.FontConfigManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。