I’m sure the font file has been installed correctly on my Windows system.When I try to use this font by Chinese font name, it throws execption:
FontRepository.findFont("宋体");
class com.aspose.pdf.exceptions.FontNotFoundException: Font 宋体 was not found
While if i use the English font name,it runs successfully:
FontRepository.findFont(“SimSun”);
I want to know why it is unable to use Chinese font name to find the font.It is very inconvenient.As in jdk, we can create font with Chinese font name successfully:
new java.awt.Font('宋体', java.awt.Font.PLAIN, 12)
Can you please share the font image like below for our reference? What Name for your font does the OS shows at your end?
image.png (16.6 KB)
Also, have you tried setting locale? e.g. Locale.setDefault(new Locale("tr_TR"));
Thanks for your reply.Here is the image at my end.It shows “宋体”.
企业微信截图_20230908094610.png (16.1 KB)
And I tried to set locale,but it does not work.
System.out.println(Locale.getDefault()); // zh_CN
Locale.setDefault(Locale.CHINA);
System.out.println(Locale.getDefault()); //zh_CN
FontRepository.findFont("宋体"); // throws FontNotFoundException
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFJAVA-43109
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
The issues you have found earlier (filed as PDFJAVA-43109) have been fixed in Aspose.PDF for Java 23.10.