本文整理汇总了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;
}
示例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;
}
示例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;
}