本文整理汇总了Java中sun.font.FontAccess类的典型用法代码示例。如果您正苦于以下问题:Java FontAccess类的具体用法?Java FontAccess怎么用?Java FontAccess使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FontAccess类属于sun.font包,在下文中一共展示了FontAccess类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFontConfigFUIR
import sun.font.FontAccess; //导入依赖的package包/类
@Override
protected FontUIResource getFontConfigFUIR(String family, int style, int size) {
CompositeFont font2D = getFontConfigManager().getFontConfigFont(family, style);
if (font2D == null) { // Not expected, just a precaution.
return new FontUIResource(family, style, size);
}
/* The name of the font will be that of the physical font in slot,
* but by setting the handle to that of the CompositeFont it
* renders as that CompositeFont.
* It also needs to be marked as a created font which is the
* current mechanism to signal that deriveFont etc must copy
* the handle from the original font.
*/
FontUIResource fuir =
new FontUIResource(font2D.getFamilyName(null), style, size);
FontAccess.getFontAccess().setFont2D(fuir, font2D.handle);
FontAccess.getFontAccess().setCreatedFont(fuir);
return fuir;
}
示例2: platformFontCount
import sun.font.FontAccess; //导入依赖的package包/类
protected int platformFontCount(Font font, String str) {
if (mFontProps == null) {
return 0;
}
PlatformFont peer = (PlatformFont) FontAccess.getFontAccess()
.getFontPeer(font);
CharsetString[] acs = peer.makeMultiCharsetString(str, false);
if (acs == null) {
/* AWT can't convert all chars so use 2D path */
return 0;
}
int[] psFonts = getPSFontIndexArray(font, acs);
return (psFonts == null) ? 0 : psFonts.length;
}