简体   繁体   中英

Support Korean Font in Qt?

I want to use korean font in my Qt application, for that purpose I am using "JejuGothic" Font and it works fine and for English language I am using "Luxi Sans".

Now the problem is onLoad I use "Luxi Sans" font for my English language display. But when I change it to Korean from my combobox it displays blank thing. When I change the font to JejuGothic on load it works fine.

But my requirement is I want to have "Luxi Sans" font for English and "JejuGothic" for Korean. How can I do this?

QFontInfo allows to identify, which font in actually used in case the font was not fount and loaded for some reason:

QFont font("NoFont", 10, QFont::Bold);
QFontInfo fontInfo(font);
qDebug() << "Expected:" <<  font.family() << "Real:" << fontInfo.family();

QFont font2("DejaVu Serif", 10, QFont::Bold);
QFontInfo fontInfo2(font2);
qDebug() << "Expected:" <<  font2.family() << "Real:" << fontInfo2.family();

Sample application output:

Expected: "NoFont" Real: "DejaVu Sans" 
Expected: "DejaVu Serif" Real: "DejaVu Serif" 

As my system doesn't have font with family name "NoFont" it was substituted by "DejaVu Sans".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM