Enable weston-terminal support display Chinese character

Document created by Gnar Fang Employee on Dec 4, 2018
Version 1Show Document
  • View in full screen mode

The native Yocto not support chinese, so need to add chinese font .

The first step should download Chinese font  files such as  MSYHMONO.ttf and DroidSansFallback.ttf.Then copy

fonts files to /usr/share/fonts/truetype and run command  fc-cache .update font cache.

use fc-list :lang=zh can see which Chinese fonts are installed:

         /usr/share/fonts/truetype/MSYHMONO.ttf: Microsoft YaHei Mono:style=Regular
         /usr/share/fonts/truetype/DroidSansFallbackFull.ttf: Droid Sans Fallback:style=Regular

The secend step is to change default fonts. In weston-terminal.c we can see:

          3119   weston_config_section_get_string(s, "font", &option_font, "mono");
          3120   weston_config_section_get_int(s, "font-size", &option_font_size, 14);

 weston-terminal default use mono font.Just to modify /etc/fonts/fonts.conf

          <edit name="family" mode="assign" binding="same">


to   <string>Microsoft YaHei Mono</string> or <string>Droid Sans Fallback</string> could display Chinese character


But it have some problem such like as :


use Microsoft YaHei Mono use Droid Sans Fallback

the left use Microsoft YaHei Mono font the Chinese character is overlapping ,the right use Droid Sans Fallback font is en-font could not display.

If you have a better way to welcome a message!