Results 1 to 2 of 2
Thread: Font trouble in Java 2D
- 09-24-2010, 03:42 PM #1
Member
- Join Date
- Sep 2010
- Location
- UK
- Posts
- 1
- Rep Power
- 0
Font trouble in Java 2D
Hi all,
I'm trying to write a string on top of a BufferedImage in a non-standard font, loaded via
But if I try, for exampleJava Code:f = Font.createFont(Font.TRUETYPE_FONT, new File("nashvill.ttf")); f = f.deriveFont(36f);
only the letters 'N' and 'Q' will display properly. If I change the argument of the deriveFont method, different letters will display. I have tried different .ttf files, and have found the same problem. I have also installed the .ttf file into /jre/lib/fonts, and loaded the font usingJava Code:g2d.drawString("ABCDEF\nGHIJKLM\nNOPQRST\nUVWXYZ", 50, 50);
but I still get the same problem. Any ideas?Java Code:new Font("Nashville", Font.PLAIN,36);
Thanks!
Chris
- 10-24-2010, 08:29 PM #2
Member
- Join Date
- Sep 2010
- Posts
- 33
- Rep Power
- 0
You can not use newlines in drawString. If you want draw multiple line then you need to call multiple drawString.
Volker Berlin
www.inetsoftware.de
Similar Threads
-
Set Font Color, Font Style & Font Family While Replacing Text
By sherazam in forum Java SoftwareReplies: 0Last Post: 08-18-2010, 10:31 AM -
Font.PLAIN - won't set font style to PLAIN!
By Unsub in forum New To JavaReplies: 3Last Post: 03-11-2010, 12:13 PM -
How to change font/ font color etc in a graphic object using JCombobox?
By JavaInLove in forum AWT / SwingReplies: 5Last Post: 04-25-2009, 08:00 PM -
[New to java]: HoW to set font from the available list in the system
By pndiwakar in forum AWT / SwingReplies: 4Last Post: 03-10-2009, 06:31 AM -
Trouble with Dr Java.
By davefanelli in forum New To JavaReplies: 1Last Post: 10-22-2008, 06:20 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks