开发者

Java not smoothing custom fonts

开发者 https://www.devze.com 2023-03-02 14:42 出处:网络
Me and my group are creating a web applet (entirely applet). However, I created a custom font to use for a banner but it won\'t use anti aliasing/font smoothing on it.

Me and my group are creating a web applet (entirely applet). However, I created a custom font to use for a banner but it won't use anti aliasing/font smoothing on it. All the other normal fonts used work just fine but my custom font refuses to.

I开发者_JS百科'm using an opentype windows ttf font called FoundryMonoline.

    try {
        fontAd = Font.createFont(Font.TRUETYPE_FONT, new File("D:\\ATWDemo\\src\\FoundMonMed.ttf"));
    } catch (FontFormatException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    fontAd = fontAd.deriveFont(Font.TRUETYPE_FONT, 22);

    SimpleAttributeSet sa = new SimpleAttributeSet();
    StyleConstants.setAlignment(sa, StyleConstants.ALIGN_CENTER);

                    text_title.getStyledDocument().setParagraphAttributes(0,text_title.getStyledDocument().getLength(),sa,false);

    text_title.setFont(fontAd);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号