How can i see korean text on QT-application?

device : toradex Apalis iMX6D

build : Desktop Ubuntu 18.04

I followed guide :

guide1 : https://developer.toradex.com/knowledge-base/how-to-set-up-qt-creator-to-cross-compile-for-embedded-linux#contents

QT 5 is installed by “Directly from the distribution repository”

“Build with OpenEmbedded Layers”

guide2 : https://developer.toradex.com/knowledge-base/board-support-package/openembedded-core
Building a Reference Image with Yocto Project > 2.8

because i need GUI, QT



$ vi ./conf/local.conf

MACHINE ?= “apalis-imx6”

ACCEPT_FSL_EULA = “1”

IMAGE_INSTALL_append = " qt3d qt5-plugin-generic-vboxtouch qtbase qtcanvas3d qtcharts qtconnectivity
qtdatavis3d qtdeclarative qtenginio qtgraphicaleffects qtimageformats qtlocation qtmultimedia qtquick1
qtquickcontrols2 qtquickcontrols qtscript qtsensors qtserialbus qtserialport qtsvg qtsystems qttools
qttranslations qtvirtualkeyboard qtwebchannel qtwebkit-examples qtwebkit qtwebsockets qtxmlpatterns
openssh-sftp-server gdb gdbserver glibc-utils localedef "

GLIBC_GENERATE_LOCALES = “ko_KR.UTF-8 en_US.UTF-8”

LOCALE_UTF8_ONLY=“1”



$ vi ~/oe-core/layers/meta-toradex-demos/recipes-images/images/angstrom-lxde-image.bb

inherit populate_sdk populate_sdk_qt5

IMAGE_LINGUAS = “ko-kr en-us”



bitbake -k angstrom-lxde-image



I flashed image to iMX6D



root@apalis-imx6:~# locale

LANG=en_US.UTF-8

LC_CTYPE=“en_US.UTF-8”

LC_NUMERIC=“en_US.UTF-8”

LC_TIME=“en_US.UTF-8”

LC_COLLATE=“en_US.UTF-8”

LC_MONETARY=“en_US.UTF-8”

LC_MESSAGES=“en_US.UTF-8”

LC_PAPER=“en_US.UTF-8”

LC_NAME=“en_US.UTF-8”

LC_ADDRESS=“en_US.UTF-8”

LC_TELEPHONE=“en_US.UTF-8”

LC_MEASUREMENT=“en_US.UTF-8”

LC_IDENTIFICATION=“en_US.UTF-8”

LC_ALL=



root@apalis-imx6:~# locale -a

C

en_US

ko_KR

POSIX



root@apalis-imx6:~# locale -m

locale: cannot read character map directory /usr/share/i18n/charmaps’: No such file or directory



root@apalis-imx6:~# export LANG=“ko_KR.UTF-8”

root@apalis-imx6:~# locale

LANG=ko_KR.UTF-8

LC_CTYPE=“ko_KR.UTF-8”

LC_NUMERIC=“ko_KR.UTF-8”

LC_TIME=“ko_KR.UTF-8”

LC_COLLATE=“ko_KR.UTF-8”

LC_MONETARY=“ko_KR.UTF-8”

LC_MESSAGES=“ko_KR.UTF-8”

LC_PAPER=“ko_KR.UTF-8”

LC_NAME=“ko_KR.UTF-8”

LC_ADDRESS=“ko_KR.UTF-8”

LC_TELEPHONE=“ko_KR.UTF-8”

LC_MEASUREMENT=“ko_KR.UTF-8”

LC_IDENTIFICATION=“ko_KR.UTF-8”

LC_ALL=



When i run QT widget-based application on my device(iMX6D),

korean text is not displayed.

Korean text is displayed as rectangle box.

before and after export LANG="ko_KR.UTF-8", korean text is rectangle box.

How can i see korean text on QT-application?



alt text

Hello,

the way you followed is to install corresponding font for linux os, related to Qt5 applicaiton, you have to add below kind of code in main.cpp file to assign the font you want to implement.

+    int fontid = QFontDatabase::addApplicationFont("Path of your font TTF file");
+    if(fontid != -1)
+    {
+        QString msyh = QFontDatabase::applicationFontFamilies(fontid).at(0);
+        QFont font(msyh,10);
+        font.setPointSize(10);
+        app.setFont(font);
+    }

Thank you very much for your attention.

However, the problem cannot be solved.



Korean is not visible in the linux system as well as in the Qt-app.



I add following.

vi /etc/profile
export LANG="ko_KR.UTF-8"
export QT_QPA_FONTDIR=/usr/share/fonts/ttf

Still, Korean is not visible.

alt text

Problem is solved.

I download

unzip and copy *.ttf to /usr/share/fonts/ttf/

Thank you very much~!!

You are welcome.
Glad to hear that and thanks for updating!