本文整理汇总了Java中sun.font.FontConfigManager.FontConfigInfo类的典型用法代码示例。如果您正苦于以下问题:Java FontConfigInfo类的具体用法?Java FontConfigInfo怎么用?Java FontConfigInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FontConfigInfo类属于sun.font.FontConfigManager包,在下文中一共展示了FontConfigInfo类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeFcInfo
import sun.font.FontConfigManager.FontConfigInfo; //导入依赖的package包/类
private void writeFcInfo() {
Properties props = new Properties();
props.setProperty("version", fileVersion);
X11FontManager fm = (X11FontManager) fontManager;
FontConfigManager fcm = fm.getFontConfigManager();
FontConfigInfo fcInfo = fcm.getFontConfigInfo();
props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
if (fcInfo.cacheDirs != null) {
for (int i=0;i<fcInfo.cacheDirs.length;i++) {
if (fcInfo.cacheDirs[i] != null) {
props.setProperty("cachedir."+i, fcInfo.cacheDirs[i]);
}
}
}
for (int i=0; i<fcCompFonts.length; i++) {
FcCompFont fci = fcCompFonts[i];
String styleKey = fci.jdkName+"."+fci.style;
props.setProperty(styleKey+".length",
Integer.toString(fci.allFonts.length));
for (int j=0; j<fci.allFonts.length; j++) {
props.setProperty(styleKey+"."+j+".family",
fci.allFonts[j].familyName);
props.setProperty(styleKey+"."+j+".file",
fci.allFonts[j].fontFile);
}
}
try {
/* This writes into a temp file then renames when done.
* Since the rename is an atomic action within the same
* directory no client will ever see a partially written file.
*/
File fcInfoFile = getFcInfoFile();
File dir = fcInfoFile.getParentFile();
dir.mkdirs();
File tempFile = Files.createTempFile(dir.toPath(), "fcinfo", null).toFile();
FileOutputStream fos = new FileOutputStream(tempFile);
props.store(fos,
"JDK Font Configuration Generated File: *Do Not Edit*");
fos.close();
boolean renamed = tempFile.renameTo(fcInfoFile);
if (!renamed && FontUtilities.debugFonts()) {
System.out.println("rename failed");
warning("Failed renaming file to "+ getFcInfoFile());
}
} catch (Exception e) {
if (FontUtilities.debugFonts()) {
warning("IOException writing to "+ getFcInfoFile());
}
}
}
示例2: writeFcInfo
import sun.font.FontConfigManager.FontConfigInfo; //导入依赖的package包/类
private void writeFcInfo() {
Properties props = new Properties();
props.setProperty("version", fileVersion);
FcFontManager fm = (FcFontManager) fontManager;
FontConfigManager fcm = fm.getFontConfigManager();
FontConfigInfo fcInfo = fcm.getFontConfigInfo();
props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
if (fcInfo.cacheDirs != null) {
for (int i=0;i<fcInfo.cacheDirs.length;i++) {
if (fcInfo.cacheDirs[i] != null) {
props.setProperty("cachedir."+i, fcInfo.cacheDirs[i]);
}
}
}
for (int i=0; i<fcCompFonts.length; i++) {
FcCompFont fci = fcCompFonts[i];
String styleKey = fci.jdkName+"."+fci.style;
props.setProperty(styleKey+".length",
Integer.toString(fci.allFonts.length));
for (int j=0; j<fci.allFonts.length; j++) {
props.setProperty(styleKey+"."+j+".family",
fci.allFonts[j].familyName);
props.setProperty(styleKey+"."+j+".file",
fci.allFonts[j].fontFile);
}
}
try {
/* This writes into a temp file then renames when done.
* Since the rename is an atomic action within the same
* directory no client will ever see a partially written file.
*/
File fcInfoFile = getFcInfoFile();
File dir = fcInfoFile.getParentFile();
dir.mkdirs();
File tempFile = Files.createTempFile(dir.toPath(), "fcinfo", null).toFile();
FileOutputStream fos = new FileOutputStream(tempFile);
props.store(fos,
"JDK Font Configuration Generated File: *Do Not Edit*");
fos.close();
boolean renamed = tempFile.renameTo(fcInfoFile);
if (!renamed && FontUtilities.debugFonts()) {
System.out.println("rename failed");
warning("Failed renaming file to "+ getFcInfoFile());
}
} catch (Exception e) {
if (FontUtilities.debugFonts()) {
warning("IOException writing to "+ getFcInfoFile());
}
}
}
示例3: writeFcInfo
import sun.font.FontConfigManager.FontConfigInfo; //导入依赖的package包/类
private void writeFcInfo() {
Properties props = new Properties();
props.setProperty("version", fileVersion);
X11FontManager fm = (X11FontManager) fontManager;
FontConfigManager fcm = fm.getFontConfigManager();
FontConfigInfo fcInfo = fcm.getFontConfigInfo();
props.setProperty("fcversion", Integer.toString(fcInfo.fcVersion));
if (fcInfo.cacheDirs != null) {
for (int i=0;i<fcInfo.cacheDirs.length;i++) {
if (fcInfo.cacheDirs[i] != null) {
props.setProperty("cachedir."+i, fcInfo.cacheDirs[i]);
}
}
}
for (int i=0; i<fcCompFonts.length; i++) {
FcCompFont fci = fcCompFonts[i];
String styleKey = fci.jdkName+"."+fci.style;
props.setProperty(styleKey+".length",
Integer.toString(fci.allFonts.length));
for (int j=0; j<fci.allFonts.length; j++) {
props.setProperty(styleKey+"."+j+".family",
fci.allFonts[j].familyName);
props.setProperty(styleKey+"."+j+".file",
fci.allFonts[j].fontFile);
}
}
try {
/* This writes into a temp file then renames when done.
* Since the rename is an atomic action within the same
* directory no client will ever see a partially written file.
*/
File fcInfoFile = getFcInfoFile();
File dir = fcInfoFile.getParentFile();
dir.mkdirs();
File tempFile = File.createTempFile("fcinfo", null, dir);
FileOutputStream fos = new FileOutputStream(tempFile);
props.store(fos,
"JDK Font Configuration Generated File: *Do Not Edit*");
fos.close();
boolean renamed = tempFile.renameTo(fcInfoFile);
if (!renamed && FontUtilities.debugFonts()) {
System.out.println("rename failed");
warning("Failed renaming file to "+ getFcInfoFile());
}
} catch (Exception e) {
if (FontUtilities.debugFonts()) {
warning("IOException writing to "+ getFcInfoFile());
}
}
}