问题
Some sites show gibberish characters instead of the correct text. It only happens on Macs.
For example with GMapsFX:
Online site:
Might be related to OS X 10.11 or 10.12. I tested it with Java 1.8.0_121.
Is there any fix or workaround for this issue?
回答1:
The error, in my case, was not related to system font. I solved the problem by setting the user agent for the web engine. Here is the string I used (Firefox on Windows x64):
Mozilla/5.0 (Windows NT x.y; Win64; x64; rv:10.0) Gecko/20100101 Firefox/10.0
回答2:
please load all font in system when java application launched. but is not best answer...sorry
List<String> fontFamilies = Font.getFamilies();
for (String fontFamily: fontFamilies) {
Font.font(fontFamily);
}
来源:https://stackoverflow.com/questions/41952734/javafx-webview-font-issue-on-mac