本文整理汇总了Java中sun.font.FontUtilities类的典型用法代码示例。如果您正苦于以下问题:Java FontUtilities类的具体用法?Java FontUtilities怎么用?Java FontUtilities使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FontUtilities类属于sun.font包,在下文中一共展示了FontUtilities类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createScaler
import sun.font.FontUtilities; //导入依赖的package包/类
public static Object createScaler() throws ReflectiveOperationException {
// these APIs are used to reproduce the specific case I encountered
// as closely as possible
Font2D font = FontUtilities.getFont2D(new Font("Noto Sans CJK JP Black", 0, 12));
// this is a reconstruction of what happens at the end of a call stack like:
// - BasicListUI.updateLayoutState()
// - JComponent.getPreferredSize()
// - JComponent.getFontMetrics(Font)
// - TrueTypeFont.getScaler
Constructor<?> constructor = Class
.forName("sun.font.T2KFontScaler")
.getConstructor(Font2D.class, int.class, boolean.class, int.class);
constructor.setAccessible(true);
return constructor.newInstance(font, 0, true, 18604592);
}
示例2: FontConfiguration
import sun.font.FontUtilities; //导入依赖的package包/类
public FontConfiguration(SunFontManager fm) {
if (FontUtilities.debugFonts()) {
FontUtilities.getLogger()
.info("Creating standard Font Configuration");
}
if (FontUtilities.debugFonts() && logger == null) {
logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
}
fontManager = fm;
setOsNameAndVersion(); /* static initialization */
setEncoding(); /* static initialization */
/* Separating out the file location from the rest of the
* initialisation, so the caller has the option of doing
* something else if a suitable file isn't found.
*/
findFontConfigFile();
}
示例3: strNeedsTextLayout
import sun.font.FontUtilities; //导入依赖的package包/类
private boolean strNeedsTextLayout(String str, Font font) {
char[] chars = str.toCharArray();
boolean isComplex = FontUtilities.isComplexText(chars, 0, chars.length);
if (!isComplex) {
return false;
} else if (!useGDITextLayout) {
return true;
} else {
if (preferGDITextLayout ||
(isXP() && FontUtilities.textLayoutIsCompatible(font))) {
return false;
} else {
return true;
}
}
}
示例4: createFontConfiguration
import sun.font.FontUtilities; //导入依赖的package包/类
protected FontConfiguration createFontConfiguration() {
/* The logic here decides whether to use a preconfigured
* fontconfig.properties file, or synthesise one using platform APIs.
* On Solaris we try to use the
* pre-configured ones, but if the files it specifies are missing
* we fail-safe to synthesising one. This might happen if Solaris
* changes its fonts.
* For Linux we require an exact match of distro and version to
* use the preconfigured file.
* If synthesising fails, we fall back to any preconfigured file
* and do the best we can. For the commercial JDK this will be
* fine as it includes the Lucida fonts. OpenJDK should not hit
* this as the synthesis should always work on its platforms.
*/
FontConfiguration mFontConfig = new MFontConfiguration(this);
if ((FontUtilities.isLinux && !mFontConfig.foundOsSpecificFile()) ||
(FontUtilities.isSolaris && !mFontConfig.fontFilesArePresent())) {
FcFontConfiguration fcFontConfig =
new FcFontConfiguration(this);
if (fcFontConfig.init()) {
return fcFontConfig;
}
}
mFontConfig.init();
return mFontConfig;
}
示例5: getFRCProperty
import sun.font.FontUtilities; //导入依赖的package包/类
private static FontRenderContext getFRCProperty(JComponent c) {
if (c != null) {
GraphicsConfiguration gc = c.getGraphicsConfiguration();
AffineTransform tx = (gc == null) ? null : gc.getDefaultTransform();
// [tav] workaround deadlock on MacOSX until fixed, JRE-226
if (!FontUtilities.isMacOSX && tx == null && !GraphicsEnvironment.isHeadless()) {
tx = GraphicsEnvironment
.getLocalGraphicsEnvironment()
.getDefaultScreenDevice()
.getDefaultConfiguration()
.getDefaultTransform();
}
AATextInfo info = (AATextInfo)c.getClientProperty(AA_TEXT_PROPERTY_KEY);
if (info != null) {
return info.getFRC(tx);
}
}
return null;
}