Discussion:
[opensuse-m17n] noto-sans-cjk-fonts' config replaces "serif" with "Noto Sans CJK *" (sans)
Fuminobu TAKEYAMA
2016-08-28 07:16:07 UTC
Permalink
Hi all,

I just noticed that 59-noto-sans-cjk.conf provided by
noto-sans-cjk-fonts replaces "serif" with "Noto Sans CJK JP/TC/SC/KR".

Is there any intention to assign sans-serif fonts to serif?

<match target="pattern">
<test qual="any" name="family" compare="eq">
<string>serif</string>
</test>
<test name="lang" compare="eq">
<string>ja</string>
</test>
<edit name="family" mode="prepend">
<string>Noto Sans CJK JP</string>
</edit>
</match>

I also think changing overriding alias preference by a font config file
in each font package.

Installing noto-sans-cjk-fonts accidentally changes system fonts
even though they want to use those fonts only for printing.
This also breaks configuration by yast-fonts.

We should update the fontsconfig package in order to change default
family of "serif", "sans serif", "monospace"

--
Fuminobu TAKEYAMA
--
To unsubscribe, e-mail: opensuse-m17n+***@opensuse.org
To contact the owner, e-mail: opensuse-m17n+***@opensuse.org
Fuminobu TAKEYAMA
2016-09-01 14:51:53 UTC
Permalink
Hi,

The problem is that even though we have serif Japanese fonts (maybe Chinese
too), Noto Sans CJK * is selected as an alias of "Serif".
So, as long as Noto CJK has not serif shape, it should be ok, I think.
Font for e. g. latin text should be taken from the another (serif)
fonts, in our case 'BlaBla Serif' if it is installed on the system.
How does fontconfig understand a font provides serif glyphs?


What is strange, I cannot find IPA P Mincho (IPA P明朝), which has been the
default alias of "Serif" for Japanese, if 59-noto-sans-cjk.conf exists.

$ fc-match -s "Serif"
NotoSansCJK.ttc: "Noto Sans CJK JP" "Regular"
RobotoSlab-Regular.ttf: "Roboto Slab" "Regular"
LiberationSerif-Regular.ttf: "Liberation Serif" "Regular"
DejaVuSerif.ttf: "DejaVu Serif" "Book"
DejaVuSerif-Bold.ttf: "DejaVu Serif" "Bold"
DejaVuSerif-Italic.ttf: "DejaVu Serif" "Italic"
DejaVuSerif-BoldItalic.ttf: "DejaVu Serif" "Bold Italic"
luxirr.ttf: "Luxi Serif" "Regular"
FreeSerif.ttf: "FreeSerif" "Regular"
bsmiuee.pfb: "AR PL Mingti2L Big5" "ee"
bsmiuf6.pfb: "AR PL Mingti2L Big5" "f6"
bsmiuf7.pfb: "AR PL Mingti2L Big5" "f7"
bsmiuf8.pfb: "AR PL Mingti2L Big5" "f8"
(snip)

$ sudo rm 59-noto-sans-cjk.conf
$ fc-match -s "Serif"
ipamp.ttf: "IPA P明朝" "Regular"
RobotoSlab-Regular.ttf: "Roboto Slab" "Regular"
LiberationSerif-Regular.ttf: "Liberation Serif" "Regular"
DejaVuSerif.ttf: "DejaVu Serif" "Book"
DejaVuSerif-Bold.ttf: "DejaVu Serif" "Bold"
DejaVuSerif-Italic.ttf: "DejaVu Serif" "Italic"
DejaVuSerif-BoldItalic.ttf: "DejaVu Serif" "Bold Italic"
luxirr.ttf: "Luxi Serif" "Regular"
FreeSerif.ttf: "FreeSerif" "Regular"
ipaexm.ttf: "IPAex明朝" "Regular"
sazanami-mincho.ttf: "さざなみ明朝" "Mincho-Regular"
gbsnu24.pfb: "AR PL SungtiL GB" "24"
gbsnu31.pfb: "AR PL SungtiL GB" "31"
gbsnu4e.pfb: "AR PL SungtiL GB" "4e"
gbsnu4f.pfb: "AR PL SungtiL GB" "4f"
gbsnu50.pfb: "AR PL SungtiL GB" "50"
(snip)
Maybe this email will answer the question.
I'm not sure if Petr already send this to you,
So I send it again.
If there are any questions, please reply this email to openSUSE M17N mail list.
Best Regards !
主题: Re: Fwd: [opensuse-m17n] noto-sans-cjk-fonts' config replaces "serif"
with "Noto Sans CJK *"
(sans)
日期: Wed, 31 Aug 2016 12:49:32 +0200
Hello Qiang,
ccing Marguerite, the author of this file and Takashi.
This is not really an assignment, this rule is _prepending_ serif
keyword whenever it appears in the family list (see also <prefer>
tag). So all families, that are prepended sooner, are in the list with
higher priority while creating a pattern. For example.
BEFORE
family: 'BlaBla Serif' 'Liberation Serif' serif
AFTER
family: 'BlaBla Serif' 'Liberation Serif' 'Noto Sans CJK JP' serif
Now, when some asks for serif, then all fonconfig rules are applied to
the pattern including that one you specified.
After that, according some metrics, the best font on the system is
chosen. Of course, it also depends on the text language (needed
characters).
So, as long as Noto CJK has not serif shape, it should be ok, I think.
Font for e. g. latin text should be taken from the another (serif)
fonts, in our case 'BlaBla Serif' if it is installed on the system.
Petr
-------- 转发的消息 --------
主题: [opensuse-m17n] noto-sans-cjk-fonts' config replaces "serif" with
"Noto Sans CJK *" (sans)
日期: Sun, 28 Aug 2016 16:16:07 +0900
Hi all,
I just noticed that 59-noto-sans-cjk.conf provided by noto-sans-cjk-fonts
replaces "serif" with "Noto Sans CJK JP/TC/SC/KR".
Is there any intention to assign sans-serif fonts to serif?
<match target="pattern">
<test qual="any" name="family" compare="eq">
<string>serif</string>
</test>
<test name="lang" compare="eq">
<string>ja</string>
</test>
<edit name="family" mode="prepend">
<string>Noto Sans CJK JP</string>
</edit>
</match>
I also think changing overriding alias preference by a font config file
in each font package.
Installing noto-sans-cjk-fonts accidentally changes system fonts
even though they want to use those fonts only for printing.
This also breaks configuration by yast-fonts.
We should update the fontsconfig package in order to change default family
of "serif", "sans serif", "monospace"
--
Fuminobu TAKEYAMA
--
--
To unsubscribe, e-mail: opensuse-m17n+***@opensuse.org
To contact the owner, e-mail: opensuse-m17n+***@opensuse.org
Fuminobu TAKEYAMA
2016-09-05 16:22:25 UTC
Permalink
Hello,

Please subscribe -m17n list since you are a maintainer of M17N:fonts
Thank you for your explanation.

My suggestion on this thread is just removing the following lines (at least for Japanese)
in order to provide a serif font such as IPA P Mincho according to precedence
defined by fonts-config (and YaST).

Adding Noto *Sans* CJK into the head of "Serif" alias list is wrong,
as far as I can understand.

<match target="pattern">
<test qual="any" name="family" compare="eq">
<string>serif</string>
</test>
<test name="lang" compare="eq">
<string>ja</string>
</test>
<edit name="family" mode="prepend">
<string>Noto Sans CJK JP</string>
</edit>
</match>

If there's no objection, I will remove assignments of Noto Sans CJK * to serif.
# not sans-serif
Where is the fontconfig rule that adds ipa mincho to serif? If the
prepend in 59-noto-sans-cjk.conf comes before the ipa mincho one
(<prefer> is doing the prepend, too), then the family preference list
'Noto Sans CJK JP' ... 'IPA Mincho' ... serif
fonts-config.rpm
60-family-prefer.conf: provides <alias> and <prefer>
fontconfig.rpm
65-nonlatin.conf: provides <alias> and <prefer>
When both noto and ipa are installed, then the prefernce is given to
noto.
So this problem happens.
Post by Fuminobu TAKEYAMA
So, as long as Noto CJK has not serif shape, it should be ok, I think.
Font for e. g. latin text should be taken from the another (serif)
fonts, in our case 'BlaBla Serif' if it is installed on the system.
How does fontconfig understand a font provides serif glyphs?
I sill cannot understand why it should be Ok.

Now Noto Sans CJK is selected for Japanese text when we request "Serif"
because Noto Sans CJK is on the top of the list.

My understanding is that fontconfig knows Noto Sans CJK provides both latin and CJK
glyphs but it cannot determine whether those glyphs are serif or not.

Do you mean if "Not Sans CJK" is included in "Sans" <prefer> lists,
fontconfig can understand it should provide sans shape?

For now, "Noto Sans CJK" is not included in any <prefer> lists.
What exactly you want to see? Which fonts should be prefered for
CJK? Maybe the best thing would be to drop custom fontconfig snippets
in packages and move the solution to fonts-config package level.
Even if we have the wrong 59-noto-sans-cjk.conf, I still be able to
find IPA Mincho, which should be just after Noto Sans CJK JP"

$ fc-match -s "Serif"
NotoSansCJK.ttc: "Noto Sans CJK JP" "Regular"
<<< ipamp.ttf should be here >>>
RobotoSlab-Regular.ttf: "Roboto Slab" "Regular"
LiberationSerif-Regular.ttf: "Liberation Serif" "Regular"
DejaVuSerif.ttf: "DejaVu Serif" "Book"
DejaVuSerif-Bold.ttf: "DejaVu Serif" "Bold"
DejaVuSerif-Italic.ttf: "DejaVu Serif" "Italic"
DejaVuSerif-BoldItalic.ttf: "DejaVu Serif" "Bold Italic"
luxirr.ttf: "Luxi Serif" "Regular"
FreeSerif.ttf: "FreeSerif" "Regular"
bsmiuee.pfb: "AR PL Mingti2L Big5" "ee"
bsmiuf6.pfb: "AR PL Mingti2L Big5" "f6"
bsmiuf7.pfb: "AR PL Mingti2L Big5" "f7"
bsmiuf8.pfb: "AR PL Mingti2L Big5" "f8"
(snip)
So what you intend to achieve?
Tell me.
I could look at it when time permits.
JP is the same as 42.1 with Noto Sans

| JP | KO | CN | ...
--------------------------------------------------------
sans |IPA PGothic| | | --------------------------------------------------------
serif |IPA PMincho| | |
--------------------------------------------------------
monospace |IPA Gothic | | |

Not that I wanted to ask about CN.
Is it really OK that serif is Noto *Sans* CJK SC/TC?
There are no Noto Serif CJK for now.


This is off topic but the 58-noto-sans also overrides family preferences
generated by the YaST font module.
Hello,
I have sent following mail to opensuse-m17n, but the list seem to be
moderated for not-subscribers but none had accepted my mail until
now. So sending again (slightly modified).
Post by Fuminobu TAKEYAMA
Hi,
The problem is that even though we have serif Japanese fonts (maybe Chinese
too), Noto Sans CJK * is selected as an alias of "Serif".
Where is the fontconfig rule that adds ipa mincho to serif? If the
prepend in 59-noto-sans-cjk.conf comes before the ipa mincho one
(<prefer> is doing the prepend, too), then the family preference list
'Noto Sans CJK JP' ... 'IPA Mincho' ... serif
When both noto and ipa are installed, then the prefernce is given to
noto.
Post by Fuminobu TAKEYAMA
So, as long as Noto CJK has not serif shape, it should be ok, I think.
Font for e. g. latin text should be taken from the another (serif)
fonts, in our case 'BlaBla Serif' if it is installed on the system.
How does fontconfig understand a font provides serif glyphs?
I am under impression that
<alias>
<family>sans-serif</family>
<prefer>
<family>Roboto</family>
[...]
</prefer>
</alias>
says that families inside <prefer> </prefer> should be used (in that
order) whenever sans-serif alias is requested. You can even define
another aliases, for example (or see 'fantasy' or 'cursive' aliases in
45-latin.conf)
<alias>
<family>myalias</family>
<prefer>
<family>AnotherFamily</family>
[...]
</prefer>
</alias>
Then $(fc-match myalias) will return font from AnotherFamily, when
installed.
Maybe offtopic, but there is also an <default> alias (see
49-family-default.conf). That rule adds an alias (such as 'serif' for
example) at the end of the preference family list in the pattern. So
when 'Georgia' is requested, then, first, 'serif' is added at the end
... Georgia ... serif
Later on, serif is prepended with the bunch of families in, for
... Georiga ... 'Times New Roman' 'Thorndale AMT' ... serif
Hence, when Georgia is NOT installed, then its installed fellow in
'serif' group is returned.
Post by Fuminobu TAKEYAMA
What is strange, I cannot find IPA P Mincho (IPA P明朝), which has been the
default alias of "Serif" for Japanese, if 59-noto-sans-cjk.conf exists.
That is weird on the first sight indeed.
Post by Fuminobu TAKEYAMA
$ fc-match -s "Serif"
NotoSansCJK.ttc: "Noto Sans CJK JP" "Regular"
RobotoSlab-Regular.ttf: "Roboto Slab" "Regular"
LiberationSerif-Regular.ttf: "Liberation Serif" "Regular"
DejaVuSerif.ttf: "DejaVu Serif" "Book"
DejaVuSerif-Bold.ttf: "DejaVu Serif" "Bold"
DejaVuSerif-Italic.ttf: "DejaVu Serif" "Italic"
DejaVuSerif-BoldItalic.ttf: "DejaVu Serif" "Bold Italic"
luxirr.ttf: "Luxi Serif" "Regular"
FreeSerif.ttf: "FreeSerif" "Regular"
bsmiuee.pfb: "AR PL Mingti2L Big5" "ee"
bsmiuf6.pfb: "AR PL Mingti2L Big5" "f6"
bsmiuf7.pfb: "AR PL Mingti2L Big5" "f7"
bsmiuf8.pfb: "AR PL Mingti2L Big5" "f8"
(snip)
$ sudo rm 59-noto-sans-cjk.conf
$ fc-match -s "Serif"
ipamp.ttf: "IPA P明朝" "Regular"
RobotoSlab-Regular.ttf: "Roboto Slab" "Regular"
LiberationSerif-Regular.ttf: "Liberation Serif" "Regular"
DejaVuSerif.ttf: "DejaVu Serif" "Book"
DejaVuSerif-Bold.ttf: "DejaVu Serif" "Bold"
DejaVuSerif-Italic.ttf: "DejaVu Serif" "Italic"
DejaVuSerif-BoldItalic.ttf: "DejaVu Serif" "Bold Italic"
luxirr.ttf: "Luxi Serif" "Regular"
FreeSerif.ttf: "FreeSerif" "Regular"
ipaexm.ttf: "IPAex明朝" "Regular"
sazanami-mincho.ttf: "さざなみ明朝" "Mincho-Regular"
gbsnu24.pfb: "AR PL SungtiL GB" "24"
gbsnu31.pfb: "AR PL SungtiL GB" "31"
gbsnu4e.pfb: "AR PL SungtiL GB" "4e"
gbsnu4f.pfb: "AR PL SungtiL GB" "4f"
gbsnu50.pfb: "AR PL SungtiL GB" "50"
(snip)
What exactly you want to see? Which fonts should be prefered for
CJK? Maybe the best thing would be to drop custom fontconfig snippets
in packages and move the solution to fonts-config package level.
So what you intend to achieve?
Tell me.
I could look at it when time permits.
| JP | KO | CN | ...
--------------------------------------------------------
sans | | | |
--------------------------------------------------------
serif | | | |
--------------------------------------------------------
monospace | | | |
Petr
--
To unsubscribe, e-mail: opensuse-m17n+***@opensuse.org
To contact the owner, e-mail: opensuse-m17n+***@opensuse.org
Fuminobu TAKEYAMA
2016-09-06 17:13:17 UTC
Permalink
Hi,

Thank you for using your time for this help.
I am sorry. I just wanted to ask the intention (requirement) of the latest package,
which force to use Noto Sans as a serif font.

As a quick fix for 42.2 and Tumbleweed, I will remove the following part from the
config file:
(1) appending Noto Sans CJK JP/SC/TC/KR to serif
(2) appending Noto Sans (Mono) CJK Japanese to sans-serif (monospace) respectively

About (2), we have discussed on the previous thread. We do not make it default
sans/monospace for Japanese for now when the package is manually installed.


Maybe I misunderstood some current situation. I will do more investigation
e.g. fonts-config really works with the Noto's config file or not.

Thanks,

Fuminobu TAKEYAMA
Post by Fuminobu TAKEYAMA
| JP | KO | CN | ...
--------------------------------------------------------
sans |IPA PGothic| | | --------------------------------------------------------
serif |IPA PMincho| | |
--------------------------------------------------------
monospace |IPA Gothic | | |
[...]
for something to implement in fontconfig/fonts-config, feel free to
file a clear (!) bug report against it and try to assign it to me.
Hey, we are japanese guys and we do not feel comfortable with new
default, Noto Sans for serif, we have nice serif font, IPA Mincho. We
also agreed to IPA PGothic stand for sans most preferably and so IPA
Gothic for monospace again.
We think it is caused by new 59-noto-sans-cjk.conf.
Then I will happily implement your requirement. Unfortunately I got
several emails before I really had understood the problem. Not that I
would dare to go trough opensuse-m17n discussion. Define requirement
and ask me for implementation.
Petr
--
To unsubscribe, e-mail: opensuse-m17n+***@opensuse.org
To contact the owner, e-mail: opensuse-m17n+***@opensuse.org
Fuminobu TAKEYAMA
2016-09-11 14:12:04 UTC
Permalink
Hi

I move the config file from noto-sans-cjk-fonts to fonts-config
https://build.opensuse.org/package/view_file/home:ftake:branches:M17N/
fonts-config/59-family-prefer-locale-specific.conf

As far as I read 60-family-prefer.conf, the preferred serif font for Chinese
is not clear. (There are some sans font in preference list.)

After some investigation, I set following fonts

zh-cn: AR PL UMing CN
zh-sg: AR PL UMing CN
zh-tw: AR PL CMEXSong UMing TW
zh-hk: AR PL CMEXSong UMing HK
zh-mo: AR PL CMEXSong UMing HK
ko: NanumMyeongjo

Chinese maintainers, is this configuration appropriate?
I _guess_ that the consequence would be that, if e. g. IPA PMincho
contains latin characters, then that ones will be used for given
locale instead of that ones in 60-family-prefer.conf.
Well, before the problematic conf file is not installed,
IPA PMincho has been used for latin characters.

However, IPA* fonts does not provide good glyphs (suitable for FreeType).
1. adding prefered latin fonts before that cjk ones to
59-family-prefer-cjk.conf
I put "Roboto Slab" before IPA* fonts.

Here, the binding="strong" is important. Without it, fc-match picks IPAMincho
before Roboto Slab.

<match target="pattern">
<test qual="any" name="family" compare="eq">
<string>serif</string>
</test>
<test name="lang" compare="eq">
<string>ja</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<!-- use latin font for non Japanese characters -->
<string>Roboto Slab</string>
<string>IPAPMincho</string>
<string>IPAexMincho</string>
</edit>
</match>

I am finding the best latin font used with IPA* fonts.


BTW, 60-family-prefer.conf is still important when CJK character is used
under non-CJK environment where LC_CTYPE is, for example, en.

Fuminobu TAKEYAMA
Fuminobu,
Post by Fuminobu TAKEYAMA
Thank you for using your time for this help.
I am sorry. I just wanted to ask the intention (requirement) of the latest package,
which force to use Noto Sans as a serif font.
You do not need to sorry, your mail was actally that one which
kick me to understand.
I vaguely remember there was a problem with overlapping unicode points
in CJK. Perhaps Japanese variant of noto cjk ttc was chosen just
because of alphabet order even for chinese text, or so. But I had not
participated on the solution of the problem, so I do not know about it
more.
Post by Fuminobu TAKEYAMA
As a quick fix for 42.2 and Tumbleweed, I will remove the following part from the
(1) appending Noto Sans CJK JP/SC/TC/KR to serif
(2) appending Noto Sans (Mono) CJK Japanese to sans-serif (monospace) respectively
Just to be correct, _prepending_. Appending is also possible via
append/<accept> alias.
Post by Fuminobu TAKEYAMA
About (2), we have discussed on the previous thread. We do not make it default
sans/monospace for Japanese for now when the package is manually installed.
That is one option, as you say, quick. But let me propose a permanent
solution and be critical.
What about somewhat copy the idea of 59-noto-sans-cjk.conf and
generalize it, say to 59-family-prefer-cjk.conf, or maybe even
59-family-prefer-lang.conf for matter of future requests. I. e.
introduce language specific variants of default preference lists and
prepend them to that in 60-family-prefer.conf.
<!-- Japanese -->
<match target="pattern">
<test qual="any" name="family" compare="eq">
<string>sans-serif</string>
</test>
<test name="lang" compare="eq">
<string>ja</string>
</test>
<edit name="family" mode="prepend">
<string>IPA PGothic</string>
[.. another families better then noto ..]
<string>Noto Sans CJK JP</string>
[.. another families worse then noto ..]
</edit>
</match>
<match target="pattern">
<test qual="any" name="family" compare="eq">
<string>serif</string>
</test>
<test name="lang" compare="eq">
<string>ja</string>
</test>
<edit name="family" mode="prepend">
<string>IPA PMincho</string>
[.. another families ..]
</edit>
</match>
<match target="pattern">
<test qual="any" name="family" compare="eq">
<string>monospace</string>
</test>
<test name="lang" compare="eq">
<string>ja</string>
</test>
<edit name="family" mode="prepend">
<string>IPA Gothic</string>
[.. another families better then noto ..]
<string>Noto Sans Mono CJK JP</string>
[.. another families worse then noto ..]
</edit>
</match>
The same way for another languages, for now just Korean and Chinese.
Of course, these families could be then removed from
60-family-prefer.conf and the rest of lists in there could be perhaps
reviewed and lightened a bit.
Because of 59- prefix it would be read after 56-user.conf (user
conf from custom fonts.conf) and after 58-family-prefer-local.conf
(fonts-config written configuration derived from
/etc/sysconfig/fonts-config), it should not override the settings
there.
I _guess_ that the consequence would be that, if e. g. IPA PMincho
contains latin characters, then that ones will be used for given
locale instead of that ones in 60-family-prefer.conf. YOU, C J and K
guys need to decide if it is wrong for you or not. If not, that can be
1. adding prefered latin fonts before that cjk ones to
59-family-prefer-cjk.conf
2. remove surely all fonts from 60-family-prefer.conf that contains
CJK characters and exchange order of 59-family-prefer-lang.conf and
60-family-prefer.conf, i. e. 59-family-prefer.conf and
60-family-prefer-lang.conf.
I would prefer the first variant slightly, when there would not be
high duplication of 60-family-prefer.conf for each locale (one or two
fonts at maximum). Each lang would have a freedom to decide which
latin font match best in addition to their CJK-font-preference.
DISCLAIMER: all of this I wrote from top of my head, so sorry when I
talk rubbish. Needs to be tested for sure.
Post by Fuminobu TAKEYAMA
Maybe I misunderstood some current situation. I will do more investigation
e.g. fonts-config really works with the Noto's config file or not.
I do not think you misunderstood something. I recently unsubscribed as
maintainer/bugowner of fontconfig/fonts-config for openSUSE because of
the reasons I have already wrote in my previous email.
If you would like to take partly over, I will return myself as
comaintainer with you.
Thanks,
Petr
--
To unsubscribe, e-mail: opensuse-m17n+***@opensuse.org
To contact the owner, e-mail: opensuse-m17n+***@opensuse.org
Fuminobu TAKEYAMA
2016-09-15 15:21:28 UTC
Permalink
Hi

I noticed that using latin font under Japanese environment is difficult
as system default settings. (as user's custom setting, it's possible.)

The configuration below in 59-faimily-prefer-by-locale.conf disables the preference
list defined in 58-family-prefer-local.conf.
Post by Fuminobu TAKEYAMA
Here, the binding="strong" is important. Without it, fc-match picks IPAMincho
before Roboto Slab.
<match target="pattern">
<test qual="any" name="family" compare="eq">
<string>serif</string>
</test>
<test name="lang" compare="eq">
<string>ja</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<!-- use latin font for non Japanese characters -->
<string>Roboto Slab</string>
<string>IPAPMincho</string>
<string>IPAexMincho</string>
</edit>
</match>
Suppose that 58-family-prefer-local.conf have
<alias><family>serif</family><prefer><family>FooBar Mincho</family></prefer></alias>

The resulting family list will be
FooBar Mincho, Robot Slab, IPAPMincho, IPAexMincho, ..., serif

However, the font fontconfig selects Robot Slab.

This is because the selected font is not the one of the top of the family list
but the family that have highest score.

The scoring rule of fontconfig is not clear. It seems that its factor might be
(a) The position of the family in the family list
(b) The character sets provided by the family
(c) The strength of binding

The rule (b) precedes (a). This is why the CJK font is selected even though
there are many latin families before the CJK family.

For example, when we have a family list like:
Roboto Slab, IPA Mincho, ..., serif (defined without strong binding)
$ fc-match serif
returns "IPA Mincho" under Japanese environment.

To use "Robot Slab" for latin character under Japanese env.,
we need to use (c) "strong" binding as I mentioned before,
which gives much higher score than (a) and (b).

This enables us to use latin font for alphabets and Arabic numbers but
the binding breaks other preference rules.


I will give up using latin font for Japanese environment and revert to
use always Japanese fonts as before.


--
Fuminobu TAKEYAMA
Post by Fuminobu TAKEYAMA
Hi
I move the config file from noto-sans-cjk-fonts to fonts-config
https://build.opensuse.org/package/view_file/home:ftake:branches:M17N/
fonts-config/59-family-prefer-locale-specific.conf
As far as I read 60-family-prefer.conf, the preferred serif font for Chinese
is not clear. (There are some sans font in preference list.)
After some investigation, I set following fonts
zh-cn: AR PL UMing CN
zh-sg: AR PL UMing CN
zh-tw: AR PL CMEXSong UMing TW
zh-hk: AR PL CMEXSong UMing HK
zh-mo: AR PL CMEXSong UMing HK
ko: NanumMyeongjo
Chinese maintainers, is this configuration appropriate?
I _guess_ that the consequence would be that, if e. g. IPA PMincho
contains latin characters, then that ones will be used for given
locale instead of that ones in 60-family-prefer.conf.
Well, before the problematic conf file is not installed,
IPA PMincho has been used for latin characters.
However, IPA* fonts does not provide good glyphs (suitable for FreeType).
1. adding prefered latin fonts before that cjk ones to
59-family-prefer-cjk.conf
I put "Roboto Slab" before IPA* fonts.
Here, the binding="strong" is important. Without it, fc-match picks IPAMincho
before Roboto Slab.
<match target="pattern">
<test qual="any" name="family" compare="eq">
<string>serif</string>
</test>
<test name="lang" compare="eq">
<string>ja</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<!-- use latin font for non Japanese characters -->
<string>Roboto Slab</string>
<string>IPAPMincho</string>
<string>IPAexMincho</string>
</edit>
</match>
I am finding the best latin font used with IPA* fonts.
BTW, 60-family-prefer.conf is still important when CJK character is used
under non-CJK environment where LC_CTYPE is, for example, en.
Fuminobu TAKEYAMA
Fuminobu,
Post by Fuminobu TAKEYAMA
Thank you for using your time for this help.
I am sorry. I just wanted to ask the intention (requirement) of the latest package,
which force to use Noto Sans as a serif font.
You do not need to sorry, your mail was actally that one which
kick me to understand.
I vaguely remember there was a problem with overlapping unicode points
in CJK. Perhaps Japanese variant of noto cjk ttc was chosen just
because of alphabet order even for chinese text, or so. But I had not
participated on the solution of the problem, so I do not know about it
more.
Post by Fuminobu TAKEYAMA
As a quick fix for 42.2 and Tumbleweed, I will remove the following part from the
(1) appending Noto Sans CJK JP/SC/TC/KR to serif
(2) appending Noto Sans (Mono) CJK Japanese to sans-serif (monospace) respectively
Just to be correct, _prepending_. Appending is also possible via
append/<accept> alias.
Post by Fuminobu TAKEYAMA
About (2), we have discussed on the previous thread. We do not make it default
sans/monospace for Japanese for now when the package is manually installed.
That is one option, as you say, quick. But let me propose a permanent
solution and be critical.
What about somewhat copy the idea of 59-noto-sans-cjk.conf and
generalize it, say to 59-family-prefer-cjk.conf, or maybe even
59-family-prefer-lang.conf for matter of future requests. I. e.
introduce language specific variants of default preference lists and
prepend them to that in 60-family-prefer.conf.
<!-- Japanese -->
<match target="pattern">
<test qual="any" name="family" compare="eq">
<string>sans-serif</string>
</test>
<test name="lang" compare="eq">
<string>ja</string>
</test>
<edit name="family" mode="prepend">
<string>IPA PGothic</string>
[.. another families better then noto ..]
<string>Noto Sans CJK JP</string>
[.. another families worse then noto ..]
</edit>
</match>
<match target="pattern">
<test qual="any" name="family" compare="eq">
<string>serif</string>
</test>
<test name="lang" compare="eq">
<string>ja</string>
</test>
<edit name="family" mode="prepend">
<string>IPA PMincho</string>
[.. another families ..]
</edit>
</match>
<match target="pattern">
<test qual="any" name="family" compare="eq">
<string>monospace</string>
</test>
<test name="lang" compare="eq">
<string>ja</string>
</test>
<edit name="family" mode="prepend">
<string>IPA Gothic</string>
[.. another families better then noto ..]
<string>Noto Sans Mono CJK JP</string>
[.. another families worse then noto ..]
</edit>
</match>
The same way for another languages, for now just Korean and Chinese.
Of course, these families could be then removed from
60-family-prefer.conf and the rest of lists in there could be perhaps
reviewed and lightened a bit.
Because of 59- prefix it would be read after 56-user.conf (user
conf from custom fonts.conf) and after 58-family-prefer-local.conf
(fonts-config written configuration derived from
/etc/sysconfig/fonts-config), it should not override the settings
there.
I _guess_ that the consequence would be that, if e. g. IPA PMincho
contains latin characters, then that ones will be used for given
locale instead of that ones in 60-family-prefer.conf. YOU, C J and K
guys need to decide if it is wrong for you or not. If not, that can be
1. adding prefered latin fonts before that cjk ones to
59-family-prefer-cjk.conf
2. remove surely all fonts from 60-family-prefer.conf that contains
CJK characters and exchange order of 59-family-prefer-lang.conf and
60-family-prefer.conf, i. e. 59-family-prefer.conf and
60-family-prefer-lang.conf.
I would prefer the first variant slightly, when there would not be
high duplication of 60-family-prefer.conf for each locale (one or two
fonts at maximum). Each lang would have a freedom to decide which
latin font match best in addition to their CJK-font-preference.
DISCLAIMER: all of this I wrote from top of my head, so sorry when I
talk rubbish. Needs to be tested for sure.
Post by Fuminobu TAKEYAMA
Maybe I misunderstood some current situation. I will do more investigation
e.g. fonts-config really works with the Noto's config file or not.
I do not think you misunderstood something. I recently unsubscribed as
maintainer/bugowner of fontconfig/fonts-config for openSUSE because of
the reasons I have already wrote in my previous email.
If you would like to take partly over, I will return myself as
comaintainer with you.
Thanks,
Petr
--
To unsubscribe, e-mail: opensuse-m17n+***@opensuse.org
To contact the owner, e-mail: opensuse-m17n+***@opensuse.org
Fuminobu TAKEYAMA
2016-09-20 17:07:48 UTC
Permalink
Hi,
(1)
<edit name="lang" mode="prepend">
<string>en</string>
</edit>
Interesting trick!
(2) Another possibility (and maybe real fix (tm)) is to remove latin
characters from the cjk font, if license allows.
Creating a new font by forking existing fonts will be fine from the viewpoint
of licenses.

Typical approach similar to this is replacing latin glyphs of a CJK font with ones
from another latin font. There are many mixed fonts created in this approach.


For 42.2, I will keep sans serif the same as before, which uses IPA PGothic
for both latin and CJK characters.

For Tumbleweed, I will test (1). Then I will consider (2) or find a mixed font.

I will do SR of fonts-config and noto-sans-fonts tomorrow.

Thanks,
Fuminobu TAKEYAMA
Post by Fuminobu TAKEYAMA
The resulting family list will be
FooBar Mincho, Robot Slab, IPAPMincho, IPAexMincho, ..., serif
However, the font fontconfig selects Robot Slab.
This is because the selected font is not the one of the top of the family list
but the family that have highest score.
The scoring rule of fontconfig is not clear. It seems that its factor might be
(a) The position of the family in the family list
(b) The character sets provided by the family
(c) The strength of binding
The rule (b) precedes (a). This is why the CJK font is selected even though
there are many latin families before the CJK family.
Yes, thanks for your test. When I try with the simple html (attached)
and run with
$ LC_ALL=ja_JP firefox index.html
with just
<match target="pattern">
<test name="lang" compare="eq">
<string>ja</string>
</test>
<test name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend">
<string>Roboto Slab</string>
<family>IPAPMincho</family>
<family>IPAMincho</family>
<family>IPAexMincho</family>
</edit>
</match>
the latin string in the html rendered by ipa. Perhaps possible
(1)
<match target="pattern">
<test name="lang" compare="eq">
<string>ja</string>
</test>
<test name="family">
<string>serif</string>
</test>
<edit name="lang" mode="prepend">
<string>en</string>
</edit>
<edit name="family" mode="prepend">
<string>Roboto Slab</string>
<family>IPAPMincho</family>
<family>IPAMincho</family>
<family>IPAexMincho</family>
</edit>
</match>
Prepending en before ja so that the requested pattern contains then
lang: "en"(w) "ja"(w)
will shift up Roboto Slab in the metrics you noted here. The latin
string in the html is then rendered by to Roboto Slab. I am not
sure though, how many tools will be confused by the
<edit name="lang" mode="prepend">
<string>en</string>
</edit>
snippet. For example, `LC_ALL=ja_JP fc-match serif` will return
'Roboto Slab'.
(2) Another possibility (and maybe real fix (tm)) is to remove latin
characters from the cjk font, if license allows. We do modify fonts
already, for example, see indic-fonts, where the instructions are
removed for latin symbols due bsc#977195. I believe that the removing
of the glyphs could be done via a fontforge script.
I can try to work out, just decide what way we could try. In case of
(1), I would ask you for trying that for some time for your real
japanese system and even for sans, perhaps.
Or, we can just give up, as you already wrote.
Thanks,
Petr
--
To unsubscribe, e-mail: opensuse-m17n+***@opensuse.org
To contact the owner, e-mail: opensuse-m17n+***@opensuse.org
Loading...