I've implemented a multiline label by extending a JTextPane. The constructor sets various properties to make it look like a label, including disabling any border/setting margins to 0 which works well.
Environment:
- using jgoodies-looks-2.6.0
- setting the
com.jgoodies.looks.windows.WindowsLookAndFeel
L&F (also tested withjavax.swing.plaf.metal.MetalLookAndFeel
, same problem) - Windows 8 x64
- Java SE 1.7
When I increase the font size, the first letter sometimes has "blank space"/a margin of ~1px at 19pt (probably increasing with font size) to its left. This happens at least for letters B, F and L, but certainly not for A. Here's an example:
On the left you can clearly see that the layout looks broken with the title having this weird margin on the left. Please note that the first line with the number (1861) is a regular JLabel.
Zooming in confirms this (the pink line is for illustration):
So from what I can see the typesetting is improper.
Can this be considered a bug in swing? Is there a way to solve this? Eg. is there an easy and clean (ie. not paint()-ing) way to have fine-grained control over typographic features in swing in this context?
EDIT:
This is similar to what I would expect:
vs before: