I\'ve just started porting my Swing app from OS X to Windows and things are painful with JLabel
s.
I\'ve noticed that the font specified to setFont
registerFont()
I found this little gem while Googling about if I could copy a .ttf
into the JRE at runtime. It does exactly what it's supposed to. If you use Font.createFont
to load a font at runtime, just do:
GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(myCreatedFont)
to register it with the JRE.
This allows the font to show up in HTML'd text as well as plaintext on Windows!