获取系统默认字体 [英] Get system default font
本文介绍了获取系统默认字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
JavaFX使得这很容易:
import javafx.scene.text.Font;
然后使用:
Font defaultFont = Font.getDefault();
或
//其中14是字体大小
字体defaultFont = new Font(14);
Is there any way to get the system default font name in Java? The default font can differ from os. So it can create trouble if we use font Arial and the jar is running in Linux without having Arial font installed.
解决方案
JavaFX makes this a lot easier:
import javafx.scene.text.Font;
then use:
Font defaultFont = Font.getDefault();
or
// Where 14 is the font size
Font defaultFont = new Font(14);
这篇关于获取系统默认字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文