Solved Not displaying Chinese characters
-
i gave the ttf file path, it did not work.
QFontDatabase::addApplicationFont( "/usr/lib/fonts/NanumGothic.ttf" );Is that file path relative to the exe or the qt libraries' location?
I should mention that Qt is not installed on the embedded device, only added libraries.
-
@J.Hilk I'm not on android platform, rather on TI am335x-evm-07.00.00.00, but I'm not sure about any issues between the two? If anyone can detail more on this, it would be helpful.
-
Hi
Update: if i set the font manually, i can see chinese but if i add it using addApplicationFont(), Qt does not pick it up. I want the application to support mulitple language in different font families automatically, any way to do this? And does this have something to do with fontconfig?? -
What do you mean by "set the font manually" ?
How would your application support multiple languages ?
-
Hi, sorry for the late reply.
i set NanumGothic as default font using setFont(). Hence, I think maybe my embedded qt doesnt know NanumGothic is present.i have another question, i copied the ttf files to the embedded devices, is that the proper way or is there way to install the font in the embedded device? ( i don't know what installing a font means, i saw it across the web, if you can explain it would be helpful)
-
Did you check the return values of your font setup code ?
-
The application chooses DejaVuSans.
-
Hence my question, did you check the return value of
addApplicationFont
? -
The return of addApplicationFont() is 0 for /usr/lib/fonts/NanumGothic.ttf
-
And how are you selecting and setting that font in your application ?
-
QFont font("/usr/lib/fonts/NanumGothic.ttf");
font.setPointSize(FONT_SIZE);
font.setBold(true);
QApplication::setFont(font); -
QFont doesn't have any constructor that takes a file path.
-
Hi,
The chinese characters are being displayed on the target, but i didn't change my code, this has me stumped, unable to figure out why it is being displayed out of the blue?!
Anyway thank you SGaist for all your help :) I will close this thread for now -
Update, it seems that the fontconfig was choosing NanumBrush and NanumPen over NanumGothic, hence i was unable to see the Chinese characters previously.