JavaFX WebView font issue on Mac

亡梦爱人 提交于 2021-02-17 20:26:36

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!