#652516 ttf-wqy-zenhei: fontconfig priority should be separate from fontpackage itself

#652516#5
Date:
2011-12-18 00:56:33 UTC
From:
To:
In order to preserve original behavior, I intentionary used
64-wqy-zenhei.conf instead of 66-wqy-zenhei.conf for NMU.

At least it solved problem of killing user configuration freedom.

But this package, along with 64-arphic-uming.conf still fight for
priority automatically, when font is installed.  This is very general
problem for all CJK fonts rooted in Unicode han unification problem.

No one have a simple answer to the following.
   * Japanese fonts first
   * Chinese (zh_CN) fonts first?
   * Chinese (zh_TW) fonts first?
(You can pick any other nations sharing fonts but with different tastes)
but each has some non-overlapping set of characters to cover large set
of characters.)

I realized this can be solved by providing a set of packages for each
nonlatin fonts.

  For nonlatin font bar, create 2 packages

  * fonts-bar
    normal font package
    install 66-bar.conf (current 64-wqy-zenhei.conf equivalent)
    Recommends: fonts-bar-priority

  * fonts-bar-priority
    Installing this package put it on the top of choice for nonlatin
    fonts.
    install 64-bar.conf (the same content as 66-bar.conf)
    Provides: fonts-priority
    Conflicts: fonts-priority

  This way, no normal font package is aggressive.
  When fonts-*-priority is installed, it becomes choice for nonlatin
  range.  Always one of them are installed to ensure user selected taste
  for the font.

  Once this is done properly for all font packages including we can
  remove 65-nonlatin.conf. (We loose MS Micho but that is not supported
  and whoever smart enough ti add it manually should have no problem
  configuring it.)

Also, some package hopes font name solution is done by fontconfig and
does not provide alias entry.  fonts-takao is an example.  With this
practice as above, the mess in 65-nonlatin.conf content may be solved.
It is hard for the maintainer of that package to keep track new nonlatin
fonts.  Some alias entry such MS Gothic in it should have been VL Gothic
but someone made mistake mixing them up and reordering.

Osamu

#652516#10
Date:
2011-12-18 01:46:41 UTC
From:
To:
Hi,

On Sun, Dec 18, 2011 at 09:56:33AM +0900, Osamu Aoki wrote:
...

After reading fontconfig bug reports for farsi and latin font issue,
this problem is more generic.  What is needed may be:

For all latin font bar, create 2 packages

   * fonts-foo (latin font)
     normal font package
     install 61-foo.conf
     Recommends: fonts-foo-latin

  * fonts-foo-latin
    Installing this package put it on the top of choice for latin
    fonts.  (I.e. system default)
    install 59-bar.conf (the same content as 61-foo.conf)
    Provides: fonts-latin
    Conflicts: fonts-latin

For all latin font bar, create 3 packages
   * fonts-bar (nonlatin font)
     normal font package
     install 66-bar.conf (current 64-wqy-zenhei.conf equivalent)
     Recommends: fonts-bar-nonlatin
     Suggests: fonts-bar-default

  * fonts-bar-nonlatin
    Installing this package put it on the top of choice for nonlatin
    fonts. (I.e., default for nonlatin)
    install 64-bar.conf (the same content as 66-bar.conf)
    Provides: fonts-nonlatin
    Conflicts: fonts-nonlatin

  * fonts-bar-default
    Installing this package put it on the top of choice for latin
    fonts even before fonts-foo-latin.  (I.e. system default)
    install 58-bar.conf (the same content as 66-bar.conf)
    Provides: fonts-default
    Conflicts: fonts-default

The use of 58 and 59 are out of fontconfig README range but this is the
only sane choice.

These require 3 virtual packages to be accepted.
 fonts-default   (on the top of all)
 fonts-latin     (on the top of latin fonts)
 fonts-nonlatin  (on the top of nonlatin fonts)

The use of virtual package ensures only one package is installed to claim its position.

If all debian font package uses this convention, fontconfig needs
minimum maintenance.

Osamu

#652516#15
Date:
2014-05-07 19:15:16 UTC
From:
To:
Installing hedgewars broke system default Korean font preference! I
don't know why wqy-series maintainers keep Korean glyphs in their font
series. They just make problems than benefits.

How about using language specific pattern match, instead of <alias>? For
example I have used this in fonts-nanum until Nanum was added to the
fontconfig default config.

...
  <match target="pattern">
    <test qual="any" name="lang" compare="contains">
      <string>ko</string>
    </test>
    <test qual="any" name="family" compare="eq">
      <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend_first" binding="same">
      <string>NanumGothic</string>
    </edit>
  </match>

#652516#20
Date:
2014-05-08 13:33:58 UTC
From:
To:
Hi,

Interesting idea.

By the way, what sets "lang" to certain value.  LANG environment?

Is there any way to set priority order for LANG=en via some
configuration script?  Then we can solve this CJK font priority order
issue for fontconfig default config.

Osamu

#652516#25
Date:
2014-05-08 16:34:53 UTC
From:
To:
2014-05-08 22:33 GMT+09:00 Osamu Aoki <osamu_aoki_home@nifty.com>:

Yes it's determined by locale value. <match> with <test name="lang">
can make different configs per locale.

https://fedoraproject.org/wiki/Fontconfig_packaging_tips#Locale-specific_overrides

Only for LANG=en?

<match>
<test name="lang" compare="contains"><string>en</string></test>
...append fonts...
</match>

Or you can add such this for all non-CJK locales..

<match>
<test name="lang" compare="not_contains"><string>ja</string></test>
<test name="lang" compare="not_contains"><string>ko</string></test>
<test name="lang" compare="not_contains"><string>zh</string></test>
...append fonts...
</match>