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);
精彩评论