Java 类sun.font.FontManagerFactory 实例源码

项目:OpenJSharp    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:OpenJSharp    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:OpenJSharp    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:OpenJSharp    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:jdk8u-jdk    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:jdk8u-jdk    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:openjdk-jdk10    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:openjdk-jdk10    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:openjdk-jdk10    文件:Font.java   
private Font(File fontFile, int fontFormat,
             boolean isCopy, CreatedFontTracker tracker)
    throws FontFormatException {
    this.createdFont = true;
    /* Font2D instances created by this method track their font file
     * so that when the Font2D is GC'd it can also remove the file.
     */
    FontManager fm = FontManagerFactory.getInstance();
    Font2D[] fonts =
        fm.createFont2D(fontFile, fontFormat, false, isCopy, tracker);
    this.font2DHandle = fonts[0].handle;
    this.name = this.font2DHandle.font2D.getFontName(Locale.getDefault());
    this.style = Font.PLAIN;
    this.size = 1;
    this.pointSize = 1f;
}
项目:openjdk9    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:openjdk9    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:openjdk9    文件:Font.java   
private Font(File fontFile, int fontFormat,
             boolean isCopy, CreatedFontTracker tracker)
    throws FontFormatException {
    this.createdFont = true;
    /* Font2D instances created by this method track their font file
     * so that when the Font2D is GC'd it can also remove the file.
     */
    FontManager fm = FontManagerFactory.getInstance();
    Font2D[] fonts =
        fm.createFont2D(fontFile, fontFormat, false, isCopy, tracker);
    this.font2DHandle = fonts[0].handle;
    this.name = this.font2DHandle.font2D.getFontName(Locale.getDefault());
    this.style = Font.PLAIN;
    this.size = 1;
    this.pointSize = 1f;
}
项目:Java8CN    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:Java8CN    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:jdk8u_jdk    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:jdk8u_jdk    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:lookaside_java-1.8.0-openjdk    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:jdk-1.7-annotated    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:jdk-1.7-annotated    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:infobip-open-jdk-8    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:infobip-open-jdk-8    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:jdk8u-dev-jdk    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:jdk8u-dev-jdk    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:jdk7-jdk    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:jdk7-jdk    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:openjdk-source-code-learn    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:openjdk-source-code-learn    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:OLD-OpenJDK8    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:OLD-OpenJDK8    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:openjdk-jdk7u-jdk    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:openjdk-jdk7u-jdk    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:openjdk-icedtea7    文件:Font.java   
private Font2D getFont2D() {
    FontManager fm = FontManagerFactory.getInstance();
    if (fm.usingPerAppContextComposites() &&
        font2DHandle != null &&
        font2DHandle.font2D instanceof CompositeFont &&
        ((CompositeFont)(font2DHandle.font2D)).isStdComposite()) {
        return fm.findFont2D(name, style,
                                      FontManager.LOGICAL_FALLBACK);
    } else if (font2DHandle == null) {
        font2DHandle =
            fm.findFont2D(name, style,
                          FontManager.LOGICAL_FALLBACK).handle;
    }
    /* Do not cache the de-referenced font2D. It must be explicitly
     * de-referenced to pick up a valid font in the event that the
     * original one is marked invalid
     */
    return font2DHandle.font2D;
}
项目:openjdk-icedtea7    文件:Font.java   
private Font(String name, int style, float sizePts,
             boolean created, Font2DHandle handle) {
    this(name, style, sizePts);
    this.createdFont = created;
    /* Fonts created from a stream will use the same font2D instance
     * as the parent.
     * One exception is that if the derived font is requested to be
     * in a different style, then also check if its a CompositeFont
     * and if so build a new CompositeFont from components of that style.
     * CompositeFonts can only be marked as "created" if they are used
     * to add fall backs to a physical font. And non-composites are
     * always from "Font.createFont()" and shouldn't get this treatment.
     */
    if (created) {
        if (handle.font2D instanceof CompositeFont &&
            handle.font2D.getStyle() != style) {
            FontManager fm = FontManagerFactory.getInstance();
            this.font2DHandle = fm.getNewComposite(null, style, handle);
        } else {
            this.font2DHandle = handle;
        }
    }
}
项目:OpenJSharp    文件:Font.java   
private Font(File fontFile, int fontFormat,
             boolean isCopy, CreatedFontTracker tracker)
    throws FontFormatException {
    this.createdFont = true;
    /* Font2D instances created by this method track their font file
     * so that when the Font2D is GC'd it can also remove the file.
     */
    FontManager fm = FontManagerFactory.getInstance();
    this.font2DHandle = fm.createFont2D(fontFile, fontFormat, isCopy,
                                        tracker).handle;
    this.name = this.font2DHandle.font2D.getFontName(Locale.getDefault());
    this.style = Font.PLAIN;
    this.size = 1;
    this.pointSize = 1f;
}
项目:OpenJSharp    文件:Font.java   
private Font(AttributeValues values, String oldName, int oldStyle,
             boolean created, Font2DHandle handle) {

    this.createdFont = created;
    if (created) {
        this.font2DHandle = handle;

        String newName = null;
        if (oldName != null) {
            newName = values.getFamily();
            if (oldName.equals(newName)) newName = null;
        }
        int newStyle = 0;
        if (oldStyle == -1) {
            newStyle = -1;
        } else {
            if (values.getWeight() >= 2f)   newStyle  = BOLD;
            if (values.getPosture() >= .2f) newStyle |= ITALIC;
            if (oldStyle == newStyle)       newStyle  = -1;
        }
        if (handle.font2D instanceof CompositeFont) {
            if (newStyle != -1 || newName != null) {
                FontManager fm = FontManagerFactory.getInstance();
                this.font2DHandle =
                    fm.getNewComposite(newName, newStyle, handle);
            }
        } else if (newName != null) {
            this.createdFont = false;
            this.font2DHandle = null;
        }
    }
    initFromValues(values);
}
项目: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    文件:Font.java   
private Font(AttributeValues values, String oldName, int oldStyle,
             boolean created, Font2DHandle handle) {

    this.createdFont = created;
    if (created) {
        this.font2DHandle = handle;

        String newName = null;
        if (oldName != null) {
            newName = values.getFamily();
            if (oldName.equals(newName)) newName = null;
        }
        int newStyle = 0;
        if (oldStyle == -1) {
            newStyle = -1;
        } else {
            if (values.getWeight() >= 2f)   newStyle  = BOLD;
            if (values.getPosture() >= .2f) newStyle |= ITALIC;
            if (oldStyle == newStyle)       newStyle  = -1;
        }
        if (handle.font2D instanceof CompositeFont) {
            if (newStyle != -1 || newName != null) {
                FontManager fm = FontManagerFactory.getInstance();
                this.font2DHandle =
                    fm.getNewComposite(newName, newStyle, handle);
            }
        } else if (newName != null) {
            this.createdFont = false;
            this.font2DHandle = null;
        }
    }
    initFromValues(values);
}
项目:jdk8u-jdk    文件:Font.java   
private Font(File fontFile, int fontFormat,
             boolean isCopy, CreatedFontTracker tracker)
    throws FontFormatException {
    this.createdFont = true;
    /* Font2D instances created by this method track their font file
     * so that when the Font2D is GC'd it can also remove the file.
     */
    FontManager fm = FontManagerFactory.getInstance();
    this.font2DHandle = fm.createFont2D(fontFile, fontFormat, isCopy,
                                        tracker).handle;
    this.name = this.font2DHandle.font2D.getFontName(Locale.getDefault());
    this.style = Font.PLAIN;
    this.size = 1;
    this.pointSize = 1f;
}
项目:jdk8u-jdk    文件:Font.java   
private Font(AttributeValues values, String oldName, int oldStyle,
             boolean created, Font2DHandle handle) {

    this.createdFont = created;
    if (created) {
        this.font2DHandle = handle;

        String newName = null;
        if (oldName != null) {
            newName = values.getFamily();
            if (oldName.equals(newName)) newName = null;
        }
        int newStyle = 0;
        if (oldStyle == -1) {
            newStyle = -1;
        } else {
            if (values.getWeight() >= 2f)   newStyle  = BOLD;
            if (values.getPosture() >= .2f) newStyle |= ITALIC;
            if (oldStyle == newStyle)       newStyle  = -1;
        }
        if (handle.font2D instanceof CompositeFont) {
            if (newStyle != -1 || newName != null) {
                FontManager fm = FontManagerFactory.getInstance();
                this.font2DHandle =
                    fm.getNewComposite(newName, newStyle, handle);
            }
        } else if (newName != null) {
            this.createdFont = false;
            this.font2DHandle = null;
        }
    }
    initFromValues(values);
}