diff options
author | Akira TAGOH <akira@tagoh.org> | 2019-07-26 07:24:16 +0000 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2019-07-26 07:42:36 +0000 |
commit | f555f50a207a96689dd6cf8ef96fd7f01b37a952 (patch) | |
tree | 4691b3698995c7663c8f7d4ebb0ac11f643ed5ef /fc-lang | |
parent | e2f9f28aed1470a07c33a57940d68b6a3cbe235b (diff) | |
download | fontconfig-f555f50a207a96689dd6cf8ef96fd7f01b37a952.tar.gz |
Add 35-lang-normalize.conf
This avoids a situation where the score of lang becomes lower or equal to others
and then figures out the best font according to other properties and the order
of family names.
This typically happens only when our orthography files are the subset of lang
in patterns. i.e. fc-match :lang=en-us to match on en.orth.
In this case, the score is lower than the exact match (en to en) and the partial
match (en to en-us). thus, the result of 'fc-match :lang=en-us' isn't necessarily
same to 'fc-match :lang=en'.
So 35-lang-normalize.conf contains languages only which is available as orth
without countries and tries to update properties to match on orth exactly like:
<match>
<test name="lang" compare="contains">
<string>en</string>
</test>
<edit name="lang" mode="assign" binding="same">
<string>en</string>
</edit>
</match>
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/155
Diffstat (limited to 'fc-lang')
-rw-r--r-- | fc-lang/Makefile.am | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fc-lang/Makefile.am b/fc-lang/Makefile.am index 5fdccea..f8a9503 100644 --- a/fc-lang/Makefile.am +++ b/fc-lang/Makefile.am @@ -285,4 +285,19 @@ ORTH = \ und_zmth.orth # ^-------------- Add new orth files here +BUILT_SOURCES += $(top_builddir)/conf.d/35-lang-normalize.conf + +DISTCLEANFILES = $(BUILT_SOURCES) + +$(top_builddir)/conf.d/35-lang-normalize.conf: $(ORTH) Makefile + $(AM_V_GEN) echo "<fontconfig>" > $@ && \ + for i in `echo $(ORTH) | sed -e 's/ /\n/g' | grep -v _ | sed -e 's/\.orth$$//g' | sort`; do \ + echo " <!-- $$i* -> $$i -->" >> $@; \ + echo " <match>" >> $@; \ + echo " <test name=\"lang\" compare=\"contains\"><string>$$i</string></test>" >> $@; \ + echo " <edit name=\"lang\" mode=\"assign\" binding=\"same\"><string>$$i</string></edit>" >> $@; \ + echo " </match>" >> $@; \ + done && \ + echo "</fontconfig>" >> $@ + -include $(top_srcdir)/git.mk |