wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Problem with drawing styled (attributed) text Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with drawing styled (attributed) text" Watch "Problem with drawing styled (attributed) text" New topic
Author

Problem with drawing styled (attributed) text

Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
Consider the following two code excerpts. First of them works OK, but the second does not. Why? They are almost same.





What is the problem? Is it a bug?
Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
No idea???
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
This works okay.
Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
No, it doesn't work. The string "1,2" is not subscripted.

Also, there is an error in the line:

astr.addAttribute(TextAttribute.SIZE, 36f);

It should be:

astr.addAttribute(TextAttribute.SIZE, new Float(36));
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with drawing styled (attributed) text
 
Similar Threads
Java2D : TextLayout drawing right to left
LineBreakMeasurer and Fonts
Stamps on an image
Creating a image file using TextLayout. Need to find right startYpoint
To print a document