I'm making an application with some custom fonts.
I have several JLabels, one of which has simple html text (starts and ends with html tag + has BR tags). My font's are A, B, C and D (loaded from disk).
Setting the font for the html JLabel only gives a visible effect if using font A or B. (the JLabel will not use the provided font, but a default font)
Removing the html tags form the JLabel makes font C and D work as well.
Setting the font for any non-html JLabel works fine with all fonts.
Anyone know why only some fonts work with html JLabels, is there a way around this? and is there a way to tell which fonts will not work with it?
when you use html tags java uses a html engine to render the html content .. this means that the font names defined in your markup would be referencing the system's cache of fonts and not your app .. this is the reason why your app isn't displaying the font you've defined..
you can try and install the font locally on the machine and use it in your HTML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With