本文整理汇总了Java中sun.font.SunFontManager.FONTFORMAT_TRUETYPE属性的典型用法代码示例。如果您正苦于以下问题:Java SunFontManager.FONTFORMAT_TRUETYPE属性的具体用法?Java SunFontManager.FONTFORMAT_TRUETYPE怎么用?Java SunFontManager.FONTFORMAT_TRUETYPE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类sun.font.SunFontManager
的用法示例。
在下文中一共展示了SunFontManager.FONTFORMAT_TRUETYPE属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerFontFile
protected void registerFontFile(String fontFileName, String[] nativeNames,
int fontRank, boolean defer) {
// REMIND: case compare depends on platform
if (registeredFontFiles.contains(fontFileName)) {
return;
}
registeredFontFiles.add(fontFileName);
int fontFormat;
if (getTrueTypeFilter().accept(null, fontFileName)) {
fontFormat = SunFontManager.FONTFORMAT_TRUETYPE;
} else if (getType1Filter().accept(null, fontFileName)) {
fontFormat = SunFontManager.FONTFORMAT_TYPE1;
} else {
/* on windows we don't use/register native fonts */
return;
}
if (fontPath == null) {
fontPath = getPlatformFontPath(noType1Font);
}
/* Look in the JRE font directory first.
* This is playing it safe as we would want to find fonts in the
* JRE font directory ahead of those in the system directory
*/
String tmpFontPath = jreFontDirName+File.pathSeparator+fontPath;
StringTokenizer parser = new StringTokenizer(tmpFontPath,
File.pathSeparator);
boolean found = false;
try {
while (!found && parser.hasMoreTokens()) {
String newPath = parser.nextToken();
boolean isJREFont = newPath.equals(jreFontDirName);
File theFile = new File(newPath, fontFileName);
if (theFile.canRead()) {
found = true;
String path = theFile.getAbsolutePath();
if (defer) {
registerDeferredFont(fontFileName, path,
nativeNames,
fontFormat, isJREFont,
fontRank);
} else {
registerFontFile(path, nativeNames,
fontFormat, isJREFont,
fontRank);
}
break;
}
}
} catch (NoSuchElementException e) {
System.err.println(e);
}
if (!found) {
addToMissingFontFileList(fontFileName);
}
}