Java 类sun.font.SunFontManager 实例源码

项目:OpenJSharp    文件:FontConfiguration.java   
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();
}
项目:OpenJSharp    文件:FontConfiguration.java   
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
项目:jdk8u-jdk    文件:FontConfiguration.java   
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();
}
项目:jdk8u-jdk    文件:FontConfiguration.java   
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
项目:openjdk-jdk10    文件:FontConfiguration.java   
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();
}
项目:openjdk-jdk10    文件:FontConfiguration.java   
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
项目:openjdk9    文件:FontConfiguration.java   
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();
}
项目:openjdk9    文件:FontConfiguration.java   
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
项目:jdk8u_jdk    文件:GlyphListLoopPipe.java   
protected void drawGlyphList(SunGraphics2D sg2d, GlyphList gl,
                             int aaHint) {
    int prevBorder = 0;
    boolean isColor = false;
    int len = gl.getNumGlyphs();
    gl.startGlyphIteration();
    if (SunFontManager.getInstance().areColorGlyphsSupported()) {
        for (int i = 0; i < len; i++) {
            boolean newIsColor = gl.isColorGlyph(i);
            if (newIsColor != isColor) {
                drawGlyphListSegment(sg2d, gl, prevBorder, i, aaHint, isColor);
                prevBorder = i;
                isColor = newIsColor;
            }
        }
    }
    drawGlyphListSegment(sg2d, gl, prevBorder, len, aaHint, isColor);
}
项目:jdk8u_jdk    文件:FontConfiguration.java   
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();
}
项目:jdk8u_jdk    文件:FontConfiguration.java   
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
项目:lookaside_java-1.8.0-openjdk    文件:FontConfiguration.java   
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();
}
项目:lookaside_java-1.8.0-openjdk    文件:FontConfiguration.java   
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
项目:infobip-open-jdk-8    文件:FontConfiguration.java   
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();
}
项目:infobip-open-jdk-8    文件:FontConfiguration.java   
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
项目:jdk8u-dev-jdk    文件:FontConfiguration.java   
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();
}
项目:jdk8u-dev-jdk    文件:FontConfiguration.java   
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
项目:jdk7-jdk    文件:FontConfiguration.java   
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();
}
项目:jdk7-jdk    文件:FontConfiguration.java   
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
项目:openjdk-source-code-learn    文件:FontConfiguration.java   
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();
}
项目:openjdk-source-code-learn    文件:FontConfiguration.java   
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
项目:OLD-OpenJDK8    文件:FontConfiguration.java   
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();
}
项目:OLD-OpenJDK8    文件:FontConfiguration.java   
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
项目:openjdk-jdk7u-jdk    文件:FontConfiguration.java   
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();
}
项目:openjdk-jdk7u-jdk    文件:FontConfiguration.java   
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
项目:openjdk-icedtea7    文件:FontConfiguration.java   
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();
}
项目:openjdk-icedtea7    文件:FontConfiguration.java   
public FontConfiguration(SunFontManager fm,
                         boolean preferLocaleFonts,
                         boolean preferPropFonts) {
    fontManager = fm;
    if (FontUtilities.debugFonts()) {
        FontUtilities.getLogger()
            .info("Creating alternate Font Configuration");
    }
    this.preferLocaleFonts = preferLocaleFonts;
    this.preferPropFonts = preferPropFonts;
    /* fontConfig should be initialised by default constructor, and
     * its data tables can be shared, since readFontConfigFile doesn't
     * update any other state. Also avoid a doPrivileged block.
     */
    initFontConfig();
}
项目:OpenJSharp    文件:PlatformFont.java   
public PlatformFont(String name, int style){
    SunFontManager sfm = SunFontManager.getInstance();
    if (sfm instanceof FontSupport) {
        fontConfig = ((FontSupport)sfm).getFontConfiguration();
    }
    if (fontConfig == null) {
        return;
    }

    // map given font name to a valid logical font family name
    familyName = name.toLowerCase(Locale.ENGLISH);
    if (!FontConfiguration.isLogicalFontFamilyName(familyName)) {
        familyName = fontConfig.getFallbackFamilyName(familyName, "sansserif");
    }

    componentFonts = fontConfig.getFontDescriptors(familyName, style);

    // search default character
    //
    char missingGlyphCharacter = getMissingGlyphCharacter();

    defaultChar = '?';
    if (componentFonts.length > 0)
        defaultFont = componentFonts[0];

    for (int i = 0; i < componentFonts.length; i++){
        if (componentFonts[i].isExcluded(missingGlyphCharacter)) {
            continue;
        }

        if (componentFonts[i].encoder.canEncode(missingGlyphCharacter)) {
            defaultFont = componentFonts[i];
            defaultChar = missingGlyphCharacter;
            break;
        }
    }
}
项目:OpenJSharp    文件:WToolkit.java   
@Override
public FontMetrics getFontMetrics(Font font) {
    // This is an unsupported hack, but left in for a customer.
    // Do not remove.
    FontManager fm = FontManagerFactory.getInstance();
    if (fm instanceof SunFontManager
        && ((SunFontManager) fm).usePlatformFontMetrics()) {
        return WFontMetrics.getFontMetrics(font);
    }
    return super.getFontMetrics(font);
}
项目:OpenJSharp    文件:Win32FontManager.java   
public static void registerJREFontsForPrinting() {
    final String pathName;
    synchronized (Win32GraphicsEnvironment.class) {
        GraphicsEnvironment.getLocalGraphicsEnvironment();
        if (fontsForPrinting == null) {
            return;
        }
        pathName = fontsForPrinting;
        fontsForPrinting = null;
    }
    java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction() {
            public Object run() {
                File f1 = new File(pathName);
                String[] ls = f1.list(SunFontManager.getInstance().
                        getTrueTypeFilter());
                if (ls == null) {
                    return null;
                }
                for (int i=0; i <ls.length; i++ ) {
                    File fontFile = new File(f1, ls[i]);
                    registerFontWithPlatform(fontFile.getAbsolutePath());
                }
                return null;
            }
     });
}
项目:OpenJSharp    文件:MFontConfiguration.java   
public MFontConfiguration(SunFontManager fm) {
    super(fm);
    if (FontUtilities.debugFonts()) {
        logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
    }
    initTables();
}
项目:OpenJSharp    文件:MFontConfiguration.java   
public MFontConfiguration(SunFontManager fm,
                          boolean preferLocaleFonts,
                          boolean preferPropFonts) {
    super(fm, preferLocaleFonts, preferPropFonts);
    if (FontUtilities.debugFonts()) {
        logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
    }
    initTables();
}
项目:OpenJSharp    文件:MFontConfiguration.java   
protected String mapFileName(String fileName) {
    if (fileName != null && fileName.startsWith(fontsDirPrefix)) {
        return SunFontManager.jreFontDirName
                + fileName.substring(fontsDirPrefix.length());
    }
    return fileName;
}
项目:OpenJSharp    文件:Font.java   
/**
 * Returns a new <code>Font</code> using the specified font type
 * and the specified font file.  The new <code>Font</code> is
 * created with a point size of 1 and style {@link #PLAIN PLAIN}.
 * This base font can then be used with the <code>deriveFont</code>
 * methods in this class to derive new <code>Font</code> objects with
 * varying sizes, styles, transforms and font features.
 * @param fontFormat the type of the <code>Font</code>, which is
 * {@link #TRUETYPE_FONT TRUETYPE_FONT} if a TrueType resource is
 * specified or {@link #TYPE1_FONT TYPE1_FONT} if a Type 1 resource is
 * specified.
 * So long as the returned font, or its derived fonts are referenced
 * the implementation may continue to access <code>fontFile</code>
 * to retrieve font data. Thus the results are undefined if the file
 * is changed, or becomes inaccessible.
 * <p>
 * To make the <code>Font</code> available to Font constructors the
 * returned <code>Font</code> must be registered in the
 * <code>GraphicsEnviroment</code> by calling
 * {@link GraphicsEnvironment#registerFont(Font) registerFont(Font)}.
 * @param fontFile a <code>File</code> object representing the
 * input data for the font.
 * @return a new <code>Font</code> created with the specified font type.
 * @throws IllegalArgumentException if <code>fontFormat</code> is not
 *     <code>TRUETYPE_FONT</code>or<code>TYPE1_FONT</code>.
 * @throws NullPointerException if <code>fontFile</code> is null.
 * @throws IOException if the <code>fontFile</code> cannot be read.
 * @throws FontFormatException if <code>fontFile</code> does
 *     not contain the required font tables for the specified format.
 * @throws SecurityException if the executing code does not have
 * permission to read from the file.
 * @see GraphicsEnvironment#registerFont(Font)
 * @since 1.5
 */
public static Font createFont(int fontFormat, File fontFile)
    throws java.awt.FontFormatException, java.io.IOException {

    fontFile = new File(fontFile.getPath());

    if (fontFormat != Font.TRUETYPE_FONT &&
        fontFormat != Font.TYPE1_FONT) {
        throw new IllegalArgumentException ("font format not recognized");
    }
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        FilePermission filePermission =
            new FilePermission(fontFile.getPath(), "read");
        sm.checkPermission(filePermission);
    }
    if (!fontFile.canRead()) {
        throw new IOException("Can't read " + fontFile);
    }
    // create a private Font Collection and add the font data
    PrivateFontCollection pfc = new PrivateFontCollection();
    try {
        String fileName = fontFile.getPath();
        pfc.AddFontFile( fileName );
        RemoveFontResourceEx( fileName );// hack for bug http://stackoverflow.com/questions/26671026/how-to-delete-the-file-of-a-privatefontcollection-addfontfile
        if (false) throw new cli.System.IO.FileNotFoundException();
    } catch( cli.System.IO.FileNotFoundException fnfe ) {
        FileNotFoundException ex = new FileNotFoundException(fnfe.getMessage());
        ex.initCause( fnfe );
        throw ex;
    }
    // create the font object
    Font2D font2D = SunFontManager.createFont2D( pfc.get_Families()[0], 0 );
    Font2DHandle font2DHandle = font2D.handle;
    Font font = new Font( font2D.getFontName( Locale.getDefault() ), PLAIN, 1, true, font2DHandle );
    return font;
}
项目:jdk8u-jdk    文件:PlatformFont.java   
public PlatformFont(String name, int style){
    SunFontManager sfm = SunFontManager.getInstance();
    if (sfm instanceof FontSupport) {
        fontConfig = ((FontSupport)sfm).getFontConfiguration();
    }
    if (fontConfig == null) {
        return;
    }

    // map given font name to a valid logical font family name
    familyName = name.toLowerCase(Locale.ENGLISH);
    if (!FontConfiguration.isLogicalFontFamilyName(familyName)) {
        familyName = fontConfig.getFallbackFamilyName(familyName, "sansserif");
    }

    componentFonts = fontConfig.getFontDescriptors(familyName, style);

    // search default character
    //
    char missingGlyphCharacter = getMissingGlyphCharacter();

    defaultChar = '?';
    if (componentFonts.length > 0)
        defaultFont = componentFonts[0];

    for (int i = 0; i < componentFonts.length; i++){
        if (componentFonts[i].isExcluded(missingGlyphCharacter)) {
            continue;
        }

        if (componentFonts[i].encoder.canEncode(missingGlyphCharacter)) {
            defaultFont = componentFonts[i];
            defaultChar = missingGlyphCharacter;
            break;
        }
    }
}
项目:jdk8u-jdk    文件:WToolkit.java   
@Override
public FontMetrics getFontMetrics(Font font) {
    // This is an unsupported hack, but left in for a customer.
    // Do not remove.
    FontManager fm = FontManagerFactory.getInstance();
    if (fm instanceof SunFontManager
        && ((SunFontManager) fm).usePlatformFontMetrics()) {
        return WFontMetrics.getFontMetrics(font);
    }
    return super.getFontMetrics(font);
}
项目:jdk8u-jdk    文件:Win32FontManager.java   
public static void registerJREFontsForPrinting() {
    final String pathName;
    synchronized (Win32GraphicsEnvironment.class) {
        GraphicsEnvironment.getLocalGraphicsEnvironment();
        if (fontsForPrinting == null) {
            return;
        }
        pathName = fontsForPrinting;
        fontsForPrinting = null;
    }
    java.security.AccessController.doPrivileged(
        new java.security.PrivilegedAction() {
            public Object run() {
                File f1 = new File(pathName);
                String[] ls = f1.list(SunFontManager.getInstance().
                        getTrueTypeFilter());
                if (ls == null) {
                    return null;
                }
                for (int i=0; i <ls.length; i++ ) {
                    File fontFile = new File(f1, ls[i]);
                    registerFontWithPlatform(fontFile.getAbsolutePath());
                }
                return null;
            }
     });
}
项目:jdk8u-jdk    文件:MFontConfiguration.java   
public MFontConfiguration(SunFontManager fm) {
    super(fm);
    if (FontUtilities.debugFonts()) {
        logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
    }
    initTables();
}
项目:jdk8u-jdk    文件:MFontConfiguration.java   
public MFontConfiguration(SunFontManager fm,
                          boolean preferLocaleFonts,
                          boolean preferPropFonts) {
    super(fm, preferLocaleFonts, preferPropFonts);
    if (FontUtilities.debugFonts()) {
        logger = PlatformLogger.getLogger("sun.awt.FontConfiguration");
    }
    initTables();
}
项目:jdk8u-jdk    文件:MFontConfiguration.java   
protected String mapFileName(String fileName) {
    if (fileName != null && fileName.startsWith(fontsDirPrefix)) {
        return SunFontManager.jreFontDirName
                + fileName.substring(fontsDirPrefix.length());
    }
    return fileName;
}