Unsolved How do I get non-latin characters to display?
-
Hi All,
I am attempting to display Chinese and Japanese characters on a Raspberry Pi without any luck.
I am utilising Buildroot for the OS and QT 4.8.6.
I have tried installing my own font with QFontDatabase::addApplicationFont using a simsun file added to the resources.
I have tried with both FreeType on and off.
All I am attempting to do at this stage is to draw a QLabel with Chinese characters in it.The same program on Ubuntu and on Windows, the characters that there just fine so I am pretty sure it is a font issue but I can't find any help on the internet that describes exactly what one needs to do to get non-latin characters to display.
Anyone here able to help - I would be most appreciative as I have been at this for four days now with zero progress !Thanks
-
Hi and welcome to devnet,
Did you check that the font was added properly to QFontDatabase ?
Also, did you set it on the label where you want to show these Chinese characters ? -
@SGaist , Thanks for taking the time to reply.
On the target, I have set it to display QFontDataBase::families() and on the screen and I see the following displayed:
BitStream Vera Sans, BitStream Vera Sans Mono, BitStream Vera Serif, DejaVu Sans, DejaVu Sans Mono, DejaVu Serif, fixed, helvetica, japanese, micro and unifont. So from that I conclude that the fonts are in the system and should be accessible.On a form I set one QLabel and put in Chinese characters and a second QLabel and put in Japanese characters.
In code I include the following:
QFont newFont;
newFont.setFamily("Deja Vu Sans");
ui->label_Chinese->setFont(newFont);
newFont.setFamily("japanese");
ui->label_Japanese->setFont(newFont);On PC and Ubuntu the characters display perfectly but on embedded they are blank.
-
Are you using the same version of Qt on both your desktop and target ?
-
4.8.5 on Ubuntu and Embedded.
4.8.6 on PC -
You really should use the same version everywhere. Also, if possible you should update to 4.8.7 which is the latest and also version of the Qt 4 series.
-
Yes I agree, but I don't think that is the root of the problem.
I have inherited this project so I am trying not to change too many things at once until I get this issue sorted out.
A slight typo in my previouis post - the Ubuntu installatiion is 4.8.5 and the embedded and PC are 4.8.6
Any further suggestions would be much appreciated. -
You should verify on your target that you are getting what you asked for i.e. that the font is really what you asked.