Bokambo
Bokambo

Reputation: 4480

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?

Upvotes: 1

Views: 1055

Answers (1)

divanov
divanov

Reputation: 6339

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".

Upvotes: 1

Related Questions