Bug 1004732

Summary: [vi] Ugly font rendering for Vietnamese in anaconda
Product: [Fedora] Fedora Reporter: Mike FABIAN <mfabian>
Component: gtk3Assignee: Matthias Clasen <mclasen>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: anaconda-maint-list, ccecchi, dshea, fonts-bugs, g.kaviyarasu, jonathan, lijli, mclasen, mfabian, mkolman, psatpute, sbueno, vanmeeuwen+fedora, vpodzime
Target Milestone: ---Keywords: i18n
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-18 01:35:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
font-rendering-comparison-vietnamese-anaconda-gedit.png
none
fonts-used-by-anaconda-in-fedora-20-tc6.png
none
cantarell-font-used-for-vietnamese-pango-view-falls-back-to-dejavu-sans.png
none
pango-view-cantarell-specified-on-command-line-run-in-ja_JP-and-vi_VN-locale.png
none
vietnamese-font-rendering-on-the-welcome-page-fedora-23-release.png
none
language switch test none

Description Mike FABIAN 2013-09-05 11:23:23 UTC
Created attachment 794229 [details]
font-rendering-comparison-vietnamese-anaconda-gedit.png

Tested on Fedora-20-Alpha-TC3-x86_64-netinst.iso

See screenshot.

The screenshot shows that the text renders nicely in gedit
using the "DejaVu Sans" font.

But in anaconda, the glyphs for

ố 
ữ 
ặ

are much less bold than the other glyphs.

Comment 1 Mike FABIAN 2013-10-28 15:12:55 UTC
The problem still exists in Fedora-20-Beta-TC6-x86_64-DVD.iso.

Comment 2 Vratislav Podzimek 2013-10-30 15:48:41 UTC
(In reply to Mike FABIAN from comment #1)
> The problem still exists in Fedora-20-Beta-TC6-x86_64-DVD.iso.
Any idea on which fonts may be missing?

Comment 3 Mike FABIAN 2013-10-31 09:45:11 UTC
Created attachment 817785 [details]
fonts-used-by-anaconda-in-fedora-20-tc6.png

mfabian@ari:~/bugs/redhat/1004732
$ fc-list "DejaVu Sans:style=Book" lang
:lang=aa|ab|af|ar|ast|av|ay|az-az|az-ir|ba|bm|be|bg|bi|bin|br|bs|bua|ca|ce|ch|chm|co|cs|cu|cv|cy|da|de|el|en|eo|es|et|eu|fa|fi|fj|fo|fr|ff|fur|fy|ga|gd|gl|gn|gv|ha|haw|he|ho|hr|hu|hy|ia|ig|id|ie|ik|io|is|it|iu|ka|kaa|ki|kk|kl|ku-am|ku-ir|kum|kv|kw|ky|la|lb|lez|ln|lo|lt|lv|mg|mh|mi|mk|mo|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ro|ru|sah|sco|se|sel|sh|shs|sk|sl|sm|sma|smj|smn|sms|so|sq|sr|ss|st|sv|sw|tg|tk|tl|tn|to|tr|ts|tt|tw|tyv|uk|uz|ve|vi|vo|vot|wa|wen|wo|xh|yap|yi|yo|zu|ak|an|ber-dz|ber-ma|crh|csb|ee|fat|fil|hsb|ht|hz|jv|kab|kj|kr|ku-iq|ku-tr|kwm|lg|li|mn-mn|ms|na|ng|nv|ota|pap-an|pap-aw|qu|rn|rw|sc|sd|sg|sn|su|ty|za
mfabian@ari:~/bugs/redhat/1004732
$ fc-list "Cantarell" lang
:lang=aa|af|av|ay|ba|be|bg|bi|br|bs|bua|ca|ce|ch|co|cs|cv|cy|da|de|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|ga|gd|gl|gv|ho|hr|hu|ia|id|ie|ik|io|is|it|kaa|ki|kk|kl|kum|kv|ky|la|lb|lez|lt|lv|mg|mh|mk|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ru|se|sel|sh|sk|sl|sma|smj|smn|so|sq|sr|ss|st|sv|sw|tk|tl|tn|tr|ts|tt|tyv|uz|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|mn-mn|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za
mfabian@ari:~/bugs/redhat/1004732
$

Comment 4 Mike FABIAN 2013-10-31 09:48:14 UTC
The screen shot attached to comment#3 shows a list of fonts used
by anaconda. “Cantarell” does not support Vietnamese, “DejaVu Sans” does
support Vietnamese (as shown by fc-list in comment#3).

That makes me guess what we see is a mix of “Cantarell” and “DejaVu Sans”,
“Cantarell” is used as long as it has the the glyphs, for the glyphs
missing in “Cantarell”, “DejaVu Sans” is used as a fallback.

Comment 5 Mike FABIAN 2013-10-31 10:26:31 UTC
Created attachment 817811 [details]
cantarell-font-used-for-vietnamese-pango-view-falls-back-to-dejavu-sans.png

pango-view --font="Cantarell" --waterfall --background=#ededed vi.txt &

mfabian@ari:~/bugs/redhat/1004732
$ grep fonts /proc/$(pidof pango-view)/maps
7ffa60db2000-7ffa60e62000 r--p 00000000 fd:01 2496700                    /usr/share/fonts/dejavu/DejaVuSans.ttf
7ffa60e62000-7ffa60e76000 r--p 00000000 fd:01 2525534                    /usr/share/fonts/abattis-cantarell/Cantarell-Regular.otf
mfabian@ari:~/bugs/redhat/1004732
$ cat vi.txt
Bạn muốn dùng ngôn ngữ nào khi cài đặt?
mfabian@ari:~/bugs/redhat/1004732
$ 

I tried the above on my main workstation running f19.

When pango-view is used to display that Vietnamese text using
the “Cantarell” font, it falls back to “DejaVu Sans” for the glyphs
missing in “Cantarell”.

Comment 6 Mike FABIAN 2013-10-31 11:38:09 UTC
Created attachment 817844 [details]
pango-view-cantarell-specified-on-command-line-run-in-ja_JP-and-vi_VN-locale.png

Left screen shot:

LANG=ja_JP.UTF-8 pango-view --font="Cantarell" --waterfall --background=#ededed vi.txt

Right screen shot:

LANG=vi_VN.UTF-8 pango-view --font="Cantarell" --waterfall --background=#ededed vi.txt

(LC_* unset).

So if the locale is non-Vietnamese, pango-view tries Cantarell
and falls back to “DejaVu Sans” for the glyphs lacking in Cantarell.

But if the locale is Vietnamese, pango-view avoids Cantarell completely
and renders the whole line in “DejaVu Sans”.

Comment 7 Vratislav Podzimek 2013-11-01 18:08:25 UTC
(In reply to Mike FABIAN from comment #6)
> Created attachment 817844 [details]
> pango-view-cantarell-specified-on-command-line-run-in-ja_JP-and-vi_VN-locale.
> png
> 
> Left screen shot:
> 
> LANG=ja_JP.UTF-8 pango-view --font="Cantarell" --waterfall
> --background=#ededed vi.txt
> 
> Right screen shot:
> 
> LANG=vi_VN.UTF-8 pango-view --font="Cantarell" --waterfall
> --background=#ededed vi.txt
> 
> (LC_* unset).
> 
> So if the locale is non-Vietnamese, pango-view tries Cantarell
> and falls back to “DejaVu Sans” for the glyphs lacking in Cantarell.
> 
> But if the locale is Vietnamese, pango-view avoids Cantarell completely
> and renders the whole line in “DejaVu Sans”.
I'm not sure we can tell Pango to "reinitialize" itself on locale selection change.

Comment 8 Vratislav Podzimek 2013-11-01 18:14:55 UTC
I believe that the Cantarell font should support Vietnamese. Reassigning

Comment 9 Mike FABIAN 2013-11-04 00:57:01 UTC
(In reply to Vratislav Podzimek from comment #8)
> I believe that the Cantarell font should support Vietnamese. Reassigning

Yes, that would be a very good solution.

Comment 10 Mike FABIAN 2014-09-03 06:13:10 UTC
The problem still exists in Fedora-Workstation-netinst-x86_64-21-Alpha-TC5

Comment 11 Mike FABIAN 2015-04-20 15:29:27 UTC
Cantarell still does not support Vietnamese on 
Fedora-Live-Workstation-x86_64-22_Beta-3.iso
i.e. the problem is unchanged.

Comment 12 Fedora End Of Life 2015-11-04 12:35:56 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 13 Nicolas Mailhot 2015-11-04 14:50:21 UTC
(In reply to Mike FABIAN from comment #4)
> The screen shot attached to comment#3 shows a list of fonts used
> by anaconda. “Cantarell” does not support Vietnamese, “DejaVu Sans” does
> support Vietnamese (as shown by fc-list in comment#3).
> 
> That makes me guess what we see is a mix of “Cantarell” and “DejaVu Sans”,
> “Cantarell” is used as long as it has the the glyphs, for the glyphs
> missing in “Cantarell”, “DejaVu Sans” is used as a fallback.

Same problem as with urdu, for font substitution will only work properly in anaconda if anaconda tags its text runs with the locale they're intended for

Comment 14 Pravin Satpute 2015-11-25 13:47:51 UTC
Is this bug still exist in F23? Is not please close else move to F23.

Comment 15 Mike FABIAN 2015-12-01 14:58:40 UTC
The bug still exists unchanged in the final release of Fedora 23.

Comment 16 Mike FABIAN 2015-12-01 15:01:28 UTC
Created attachment 1100936 [details]
vietnamese-font-rendering-on-the-welcome-page-fedora-23-release.png

Comment 17 David Shea 2015-12-01 15:42:11 UTC
Vietnamese is 7% translated in Fedora 23 anaconda. Is there a reason to keep support for it in anaconda?

Comment 18 Mike FABIAN 2015-12-02 11:40:56 UTC
(In reply to David Shea from comment #17)
> Vietnamese is 7% translated in Fedora 23 anaconda. Is there a reason to keep
> support for it in anaconda?

I guess not, 7% is really not much. Solving the the font problem
in a generic way (I.e. not just by adding the missing glyphs for 
Vietnamese to the Cantarelle font but by making switching
to fonts appropriate for the selected language work) might benefit
other languages as well (like Urdu for example).

Comment 19 David Shea 2015-12-02 16:44:18 UTC
Created attachment 1101562 [details]
language switch test

We need support in gtk to make this work. I've attached a small script that will change the language between English and Vietnamese and then open a dialog with Vietnamese text (I apologize if it's gibberish, I just ran "Hello, world!" through google translate). On the language switch I do everything we can (as far as I know) to indicate that the language has changed: I update the LANG environment variable, I call setlocale with the new language, and I update the language in the Pango context for the original window. Even with all of this the ế and ớ characters render in a different font from the rest of the string, and the dialog's Pango context uses the original language.

In order for language switching like this to work we need some way of indicating to Gtk (or Pango?) that the global language to use for new widgets has changed.

Adding <span lang=... tags everywhere is not feasible.

Comment 20 Matthias Clasen 2015-12-18 01:35:45 UTC
Not something that is realistically going to happen. It is a lot more complicated than you think. You have to reformat all strings, which may require data that is no longer available, etc, etc