当前位置: 首页>>代码示例>>Java>>正文


Java FontUtilities类代码示例

本文整理汇总了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);
}
 
开发者ID:CodeFX-org,项目名称:java-9-wtf,代码行数:17,代码来源:NotoSans.java

示例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();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:FontConfiguration.java

示例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;
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:WPathGraphics.java

示例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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:X11FontManager.java

示例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;
}
 
开发者ID:JetBrains,项目名称:jdk8u_jdk,代码行数:20,代码来源:SwingUtilities2.java


注:本文中的sun.font.FontUtilities类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。