Bug 114450 - font switching code in YaST2 does not (always) work.
Summary: font switching code in YaST2 does not (always) work.
Status: RESOLVED WONTFIX
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: YaST2 (show other bugs)
Version: Beta 4
Hardware: Other All
: P5 - None : Normal
Target Milestone: ---
Assignee: Mike Fabian
QA Contact: Klaus Kämpf
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-31 15:43 UTC by Mike Fabian
Modified: 2007-01-24 17:20 UTC (History)
2 users (show)

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
yast2-000.png (42.47 KB, image/png)
2005-08-31 15:44 UTC, Mike Fabian
Details
YaST2-font-switching-does-not-work.tar.bz2 (28.93 KB, application/x-bzip2)
2005-08-31 16:37 UTC, Mike Fabian
Details
yast2-000.png (114.86 KB, image/png)
2005-08-31 17:20 UTC, Mike Fabian
Details
yast2-001.png (116.20 KB, image/png)
2005-08-31 17:21 UTC, Mike Fabian
Details
YaST2-font-switching-works.tar.bz2 (39.51 KB, application/x-bzip2)
2005-08-31 17:29 UTC, Mike Fabian
Details
screen shot which demonstrates the problem, in the scenario both Chinese and Japanese fonts are installed. (169.64 KB, image/jpeg)
2005-09-19 05:04 UTC, Sam Lau
Details
screen shot which demonstrates the problem, in the scenario only Chinese fonts are installed. (173.04 KB, image/jpeg)
2005-09-19 05:05 UTC, Sam Lau
Details
screen shot which demonstrates the problem, in the scenario both Chinese and Japanese fonts are installed with QT patch 36 (fix-chinese-font-detection.diff) (92.07 KB, image/jpeg)
2005-09-19 05:08 UTC, Sam Lau
Details
hk.yahoo.com-zh_HK-locale-default-font.png (386.65 KB, image/png)
2005-09-20 15:41 UTC, Mike Fabian
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Fabian 2005-08-31 15:43:07 UTC
font switching code in YaST2 does not (always) work.
Comment 1 Mike Fabian 2005-08-31 15:44:42 UTC
Created attachment 48330 [details]
yast2-000.png

screen shot which demonstrates the problem.
Comment 2 Mike Fabian 2005-08-31 15:48:48 UTC
Explanation of the screen shot in comment #1 and how to reproduce it:

Boot and select Japanese in linuxrc.

Continue the installation until the screen with the installation
options is shown (the screen where you can select "Partitioning",
"Language", "Mouse", ...).

Choose the expert tab to see all options.

Click on "Language".

Change the language from Japanese to simplified Chinese.

The translation of the user interface switches from Japanese to
simplified Chinese.  But the font used is not changed, IPAGothic is
still used. This Japanese font has not enough glyphs for Chinese,
therefore many glyphs are missing in the screen shot.

Comment 3 Mike Fabian 2005-08-31 15:52:32 UTC
Just a guess what the problem might be:

I think a call to the font switching code implemented by Stefan
Hundhammer might be missing here.

I observed that font switching code works well in another screen of
the installation, therefore I guess this fontswitching code is not
called here.

Comment 4 Mike Fabian 2005-08-31 16:37:39 UTC
Created attachment 48338 [details]
YaST2-font-switching-does-not-work.tar.bz2

YaST2 log files from the case described above when font-switching did not work.
Comment 5 Mike Fabian 2005-08-31 16:42:23 UTC
Now I tried the following procedure:

Boot and do *not* select any language in linuxrc.

Soon a YaST2 screen appears which offers to select a language (This
screen is skipped when a language is already selected in linuxrc).

In that screen I selected Japanese and then switched to Chinese.  The
fonts used were switched. When clicking on "Japanese", the 16 pixel
efont-unicode is used (a gothic, i.e. sans-serif style font), when
clicking on Chinese, the Gnu Unifont is used (a mincho (Ming, Song),
i.e. serif style font).

That means font switching works well here.

TrueType fonts cannot be used in that test case because I didn't
select any language in linuxrc, CJK TrueType are only loaded into
instsys if a CJK language is already selected in linuxrc.

Comment 6 Mike Fabian 2005-08-31 17:20:30 UTC
Created attachment 48341 [details]
yast2-000.png

Japanese screen shot for the scenario described in comment #5.
Comment 7 Mike Fabian 2005-08-31 17:21:40 UTC
Created attachment 48342 [details]
yast2-001.png

Chinese screen shot for the scenario described in comment #5.
Comment 8 Mike Fabian 2005-08-31 17:22:54 UTC
Comparing the screen shots in comment #6 and #7 reveals that different
fonts are used, 16 pixel efont-unicode in comment #6 and Gnu Unifont in
comment #7, i.e. the font switching works fine here.
Comment 9 Mike Fabian 2005-08-31 17:25:12 UTC
When I continue the installation after the procedure described
in comment #5 and proceed until the summary screen and switch
languages again there, font switching still works!

With the procedure described in comment #2, it did *not* work at the
same place in the installation.

I.e. it seems to depend on how exactly I got there.


Comment 10 Mike Fabian 2005-08-31 17:29:22 UTC
Created attachment 48343 [details]
YaST2-font-switching-works.tar.bz2

YaST2 log files for the case described in the second procedure where
no TrueType fonts were available and the font switching works fine.
Comment 11 Mike Fabian 2005-08-31 17:38:29 UTC
Grepping for setLangFonts in the YaST2 log files for the case where
font-switching did not work yields:


mfabian@magellan:/tmp/YaST2$ grep setLangFonts *
y2log:2005-08-31 15:39:19 <1> 10.10.3.198(2938) [qt-ui] YQUI_x11.cc(setLangFonts):454 /usr/share/YaST2/data/lang_fonts read OK
y2log:2005-08-31 15:39:19 <1> 10.10.3.198(2938) [qt-ui] YQUI_x11.cc(setLangFonts):471 font[ja] = "Albany AMT,SUSE Sans,HGPGothicB,IPAPGothic,IPAGothic,Sazanami Gothic,Efont Biwidth,Gnu Unifont,Sans Serif"
y2log:2005-08-31 15:39:19 <1> 10.10.3.198(2938) [qt-ui] YQUI_x11.cc(setLangFonts):488 Reloading fonts - now using "Albany AMT,SUSE Sans,HGPGothicB,IPAPGothic,IPAGothic,Sazanami Gothic,Efont Biwidth,Gnu Unifont,Sans Serif,12,-1,5,50,0,0,0,0,0"
y2log:2005-08-31 15:46:58 <1> linux(2938) [qt-ui] YQUI_x11.cc(setLangFonts):471 font[ja] = "Albany AMT,SUSE Sans,HGPGothicB,IPAPGothic,IPAGothic,Sazanami Gothic,Efont Biwidth,Gnu Unifont,Sans Serif"
y2log:2005-08-31 15:47:19 <1> linux(2938) [qt-ui] YQUI_x11.cc(setLangFonts):471 font[zh_CN] = "Albany AMT,SUSE Sans,FZSongTi,FZMingTiB,AR PL SungtiL GB,Gnu Unifont,Efont Biwidth,Sans Serif"
y2log:2005-08-31 15:47:19 <1> linux(2938) [qt-ui] YQUI_x11.cc(setLangFonts):488 Reloading fonts - now using "Albany AMT,SUSE Sans,FZSongTi,FZMingTiB,AR PL SungtiL GB,Gnu Unifont,Efont Biwidth,Sans Serif,12,-1,5,50,0,0,0,0,0"
y2log:2005-08-31 15:47:19 <1> linux(2938) [qt-ui] YQUI_x11.cc(setLangFonts):471 font[zh_CN] = "Albany AMT,SUSE Sans,FZSongTi,FZMingTiB,AR PL SungtiL GB,Gnu Unifont,Efont Biwidth,Sans Serif"
mfabian@magellan:/tmp/YaST2$

This looks correct!

The last call to setLangFonts does not contain IPAGothic (Japanese TT
font) but contains FZSongTi (Chinese TT font) with high priority.

Nevertheless yast continues to use IPAGothic as can be seen by
grepping through /proc/*/maps. Output of "grep X11/fonts
/proc/*/maps":

/proc/2889/maps:2aaaac6db000-2aaaac99d000 r--p 00000000 07:01 52                         /mounts/instsys2/usr/X11R6/lib/X11/fonts/truetype/ipag.ttf
/proc/2932/maps:2aaab1ef7000-2aaab1f05000 r--p 00000000 07:00 14707724                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/SUSESans-Roman.ttf
/proc/2932/maps:2aaab1f0e000-2aaab21d0000 r--p 00000000 07:01 52                         /mounts/instsys2/usr/X11R6/lib/X11/fonts/truetype/ipag.ttf
/proc/2932/maps:2aaab21f6000-2aaab2204000 r--p 00000000 07:00 14594380                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/SUSESans-Bold.ttf
/proc/2932/maps:2aaab2f00000-2aaab2f2e000 r--p 00000000 07:00 14524224                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/MuktiNarrow.ttf
/proc/2932/maps:2aaab2f2e000-2aaab2fe4000 r--p 00000000 07:00 13482464                   /mounts/instsys/usr/X11R6/lib/X11/fonts/misc/b16.pcf.gz
/proc/2932/maps:2aaab3054000-2aaab308e000 r--p 00000000 07:00 14128368                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/FreeSans.ttf
/proc/2932/maps:2aaab308e000-2aaab309d000 r--p 00000000 07:00 14873612                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/lohit_pa.ttf
/proc/2932/maps:2aaab314f000-2aaab3255000 r--p 00000000 07:00 14904848                   /mounts/instsys/usr/X11R6/lib/X11/fonts/uni/newunifont.pcf.gz
/proc/2937/maps:2aaab1ef7000-2aaab1f05000 r--p 00000000 07:00 14707724                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/SUSESans-Roman.ttf
/proc/2937/maps:2aaab1f0e000-2aaab21d0000 r--p 00000000 07:01 52                         /mounts/instsys2/usr/X11R6/lib/X11/fonts/truetype/ipag.ttf
/proc/2937/maps:2aaab21f6000-2aaab2204000 r--p 00000000 07:00 14594380                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/SUSESans-Bold.ttf
/proc/2937/maps:2aaab2f00000-2aaab2f2e000 r--p 00000000 07:00 14524224                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/MuktiNarrow.ttf
/proc/2937/maps:2aaab2f2e000-2aaab2fe4000 r--p 00000000 07:00 13482464                   /mounts/instsys/usr/X11R6/lib/X11/fonts/misc/b16.pcf.gz
/proc/2937/maps:2aaab3054000-2aaab308e000 r--p 00000000 07:00 14128368                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/FreeSans.ttf
/proc/2937/maps:2aaab308e000-2aaab309d000 r--p 00000000 07:00 14873612                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/lohit_pa.ttf
/proc/2937/maps:2aaab314f000-2aaab3255000 r--p 00000000 07:00 14904848                   /mounts/instsys/usr/X11R6/lib/X11/fonts/uni/newunifont.pcf.gz
/proc/2938/maps:2aaab1ef7000-2aaab1f05000 r--p 00000000 07:00 14707724                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/SUSESans-Roman.ttf
/proc/2938/maps:2aaab1f0e000-2aaab21d0000 r--p 00000000 07:01 52                         /mounts/instsys2/usr/X11R6/lib/X11/fonts/truetype/ipag.ttf
/proc/2938/maps:2aaab21f6000-2aaab2204000 r--p 00000000 07:00 14594380                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/SUSESans-Bold.ttf
/proc/2938/maps:2aaab2f00000-2aaab2f2e000 r--p 00000000 07:00 14524224                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/MuktiNarrow.ttf
/proc/2938/maps:2aaab2f2e000-2aaab2fe4000 r--p 00000000 07:00 13482464                   /mounts/instsys/usr/X11R6/lib/X11/fonts/misc/b16.pcf.gz
/proc/2938/maps:2aaab3054000-2aaab308e000 r--p 00000000 07:00 14128368                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/FreeSans.ttf
/proc/2938/maps:2aaab308e000-2aaab309d000 r--p 00000000 07:00 14873612                   /mounts/instsys/usr/X11R6/lib/X11/fonts/truetype/lohit_pa.ttf
/proc/2938/maps:2aaab314f000-2aaab3255000 r--p 00000000 07:00 14904848                   /mounts/instsys/usr/X11R6/lib/X11/fonts/uni/newunifont.pcf.gz

Comment 12 Mike Fabian 2005-08-31 17:39:30 UTC
According to the last comment, I think it is possible that YaST2 does
everthing correctly and it is a Qt problem after all.

Adding Coolo to CC:.

Comment 13 Stefan Hundhammer 2005-09-01 09:10:07 UTC
Mike, how should we continue with this? 
Comment 14 Mike Fabian 2005-09-01 10:04:46 UTC
Do you also think the font changing code is called correctly in both
dialogs where the language can be selected? I'm not sure whether I
understand the logs correctly.

According to the logs I have the impression that the font changing
code is called correctly. Then it is a Qt bug.

In that case, let's assign the bug to me for the moment, I'll try to
find a simple test case to reproduce the problem in a small Qt program
only.
Comment 15 Sam Lau 2005-09-19 05:04:06 UTC
Created attachment 50259 [details]
screen shot which demonstrates the problem, in the scenario both Chinese and Japanese fonts are installed.
Comment 16 Sam Lau 2005-09-19 05:05:44 UTC
Created attachment 50260 [details]
screen shot which demonstrates the problem, in the scenario only Chinese fonts are installed.
Comment 17 Sam Lau 2005-09-19 05:08:19 UTC
Created attachment 50261 [details]
screen shot which demonstrates the problem, in the scenario both Chinese and Japanese fonts are installed with QT patch 36 (fix-chinese-font-detection.diff)
Comment 18 Sam Lau 2005-09-19 05:11:57 UTC
I think this is a QT bug and it happen to other Linux distribution.   
   
   
Fonts installed from SuSE:   
agfa-fonts, bitstream-vera, ifnteuro, ttf-arphic-bkai00mp,   
ttf-arphic-bsmi00lp, ttf-arphic-gbsn00lp, ttf-arphic-gkai00mp   
   
Addon fonts:   
ttf-arphic-uming        AR PL ShanHeiSun Uni   
ttf-fireflysung         AR PL New Sung   
  
Fontconfig:  suse-post-user.conf  
I have the following font alias in suse-post-user.conf  
  
<family>serif</family>  
    <prefer>  
           <family>Bitstream Vera Serif</family>  
           <family>AR PL ShanHeiSun Uni</family>  
           <family>AR PL New Sung</family>  
           <family>AR PL Mingti2L Big5</family>  
           <family>Sazanami Mincho</family>  
  
<family>sans-serif</family>  
    <prefer>  
           <family>Bitstream Vera Sans</family>  
           <family>AR PL ShanHeiSun Uni</family>  
           <family>AR PL New Sung</family>  
           <family>AR PL Mingti2L Big5</family>  
           <family>Sazanami Gothic</family>  
  
<family>monospace</family>  
    <prefer>  
           <family>Bitstream Vera Sans Mono</family>  
           <family>AR PL ShanHeiSun Uni</family>  
           <family>AR PL New Sung</family>  
           <family>AR PL Mingti2L Big5</family>  
           <family>Sazanami Gothic</family>  
  
To reproduce this bug  
  
Install sazanami-fonts (or any other Japanese fonts)  
Run strace -o konqueror-1.strace konqueror --profile webbrowsing  
and goto hk.yahoo.com.  
  
The strace log shows sazanami-gothic.ttf was loaded, but it don't 
have enough glyphs for Chinese.  Konsole has the same result, by 
copy & paste the character to it. (comment #15) 
 
15481 brk(0x844d000)                          = 0x844d000 
15482 open("/usr/X11R6/lib/X11/fonts/truetype/sazanami-gothic.ttf", O_RDONLY)         
= 26 
15483 fcntl64(26, F_SETFD, FD_CLOEXEC)        = 0 
 
 
Uninstall sazanami-fonts (or any otehr Japanese fonts) 
Run strace -o konqueror-1.strace konqueror --profile webbrowsing 
and goto hk.yahoo.com. (comment #16) 
 
The strace log show bsmi00lp.ttf (AR PL Mingti2L Big5) was loaded, 
but uming.tff (AR PL ShanHeiSun Uni) is the 1st Chinese fonts listed 
in suse-post-user.conf 
 
16855 brk(0x8439000)                          = 0x8439000 
16856 open("/usr/X11R6/lib/X11/fonts/truetype/bsmi00lp.ttf", O_RDONLY) = 26 
16857 fcntl64(26, F_SETFD, FD_CLOEXEC)        = 0 
 
If I rebuild qt3 without patch 36 (fix-chinese-font-detection.diff). 
The strace shows uming.tff (AR PL ShanHeiSun Uni) was loaded. 
 
brk(0x83d3000)                          = 0x83d3000 
open("/usr/X11R6/lib/X11/fonts/truetype/uming.ttf", O_RDONLY) = 22 
fcntl64(22, F_SETFD, FD_CLOEXEC)        = 0 
 
But without patch 36, and sazanami-fonts installed. The Japanese font 
is not loaded. (comment #17) 
Comment 19 Mike Fabian 2005-09-20 13:58:29 UTC
Sam,

which locale are you using?

The patch "fix-chinese-font-detection.diff" will only work as intended
if you use the correct locale. As you are apparently using traditional
Chinese, you should use zh_TW.UTF-8 or zh_HK.UTF-8.  Are you using one
of these locales?

Comment 20 Mike Fabian 2005-09-20 14:05:27 UTC
Of course you can use any locales starting with "zh_HK" or "zh_TW",
it doesn not have to be UTF-8 encoding. But only if your locale
starts with "zh_HK" or "zh_TW", the following part of
fix-chinese-font-detection.diff will work:

+	    else if (locale.contains("zh_TW") || locale.contains("zh_HK"))
 		defaultHan = QFont::Han_TraditionalChinese;


Comment 21 Mike Fabian 2005-09-20 14:23:53 UTC
If you use a traditional Chinese locale, qt3 with the patch
"fix-chinese-font-detection.diff" will require that the font
has the following glyphs:

+    // Han_TraditionalChinese, 0xF6B1 is optional
+    // OR Han_HongkongChinese, 0x3435, 0xE000, 0xF6B1 are optional
+    { 0x4e00, 0x201C, 0x3002, 0x6236, 0x9F98, 0xFFE5, 0 },

Both "Sazanami Gothic" and "Sazanami Mincho" lack the glyphs 0x6236
and 0x9F98.  Therefore, "Sazanami Gothic" and "Sazanami Mincho" will
not be selected if you use a traditional Chinese locale.

Comment 22 Mike Fabian 2005-09-20 15:41:54 UTC
Created attachment 50432 [details]
hk.yahoo.com-zh_HK-locale-default-font.png

I cannot reproduce your problem when running in zh_HK.UTF-8 locale.

When not running in a traditional Chinese locale, I can reproduce your
problem. For example when running in ja_JP.UTF-8 locale, I see the
same problem as in the screen shot you attached in comment #15.

But when I run in zh_HK.UTF-8 locale (or zh_HK.BIG5-HKSCS locale,
which is the same as zh_HK locale), I get your sample page displayed
correctly. See the attached screen shot.

The font which was used for this page is:

/usr/X11R6/lib/X11/fonts/truetype/FZMingTiB.ttf

from the ttf-founder-traditional package.

Note that the menus of Konqueror are still Japanese because I didn't
change the KDE language settings in kcontrol. But even those Japanese
menus are displayed with the Chinese FZMingTiB font.

I.e. when running in zh_HK.<something> locale, qt3 chooses the default
font for traditional Chinese correctly.
Comment 23 Mike Fabian 2005-09-20 16:03:52 UTC
Both "AR PL ShanHeiSun Uni" and "AR PL Mingti2L Big5" have all the
glyphs required by qt3 in zh_HK.<something> locale with the
fix-chinese-font-detection.diff, i.e. both have

    0x4e00, 0x201C, 0x3002, 0x6236, 0x9F98, 0xFFE5

i.e. as long as you run in a zh_HK.<something> locale, this should
work (and it works for me here).

If you do *not* want to run in a traditional Chinese locale, this
mechanism in fix-chinese-font-detection.diff will not work.  In that
case the only workaround is to select usable fonts manually in the
setup of Konqueror.

Comment 24 Mike Fabian 2007-01-24 17:20:13 UTC
I think we cannot fix such font switching bugs in Qt3 applications anymore.

I'll close this as WONTFIX and hope that it will get better with Qt4.