Most of CCJK fonts have English and native font names. Prism only supports font names in list from com.sun.javafx.font.PrismFontFactory.getFontFactory().getFontFamilyNames()
Usually above method return all English font names, but in some cases, the list has native font names. When setting font by :
font = Font.font(fontName, size); or font = new Font(fontName, size);
fontName here must be in the list of com.sun.javafx.font.PrismFontFactory.getFontFactory().getFontFamilyNames() , otherwise, it fallbacks to "System" font.
For example:
SimHei font has English name "SimHei" and Chinese name "黑体". If PrismFontFactory.getFontFactory().getFontFamilyNames() returns "黑体", we can only use
font = Font.font("黑体", size);
but
font = Font.font("SimHei", size);
doesn't work, and vice versa.
Howerver, jdk awt font supports both English and native font names, in above example, both
font = Font.font("黑体", size);
and
font = Font.font("SimHei", size);
can set font correctly.
Usually above method return all English font names, but in some cases, the list has native font names. When setting font by :
font = Font.font(fontName, size); or font = new Font(fontName, size);
fontName here must be in the list of com.sun.javafx.font.PrismFontFactory.getFontFactory().getFontFamilyNames() , otherwise, it fallbacks to "System" font.
For example:
SimHei font has English name "SimHei" and Chinese name "黑体". If PrismFontFactory.getFontFactory().getFontFamilyNames() returns "黑体", we can only use
font = Font.font("黑体", size);
but
font = Font.font("SimHei", size);
doesn't work, and vice versa.
Howerver, jdk awt font supports both English and native font names, in above example, both
font = Font.font("黑体", size);
and
font = Font.font("SimHei", size);
can set font correctly.