conf.d/Makefile.am | 10 +++++++++- fc-lang/Makefile.am | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) New commits: commit f555f50a207a96689dd6cf8ef96fd7f01b37a952 Author: Akira TAGOH <akira@xxxxxxxxx> Date: Fri Jul 26 07:24:16 2019 +0000 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 diff --git a/conf.d/Makefile.am b/conf.d/Makefile.am index d0f3f26..3bb92dd 100644 --- a/conf.d/Makefile.am +++ b/conf.d/Makefile.am @@ -21,7 +21,11 @@ # TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -BUILT_SOURCES = README +NULL = +BUILT_SOURCES = \ + README \ + 35-lang-normalize.conf \ + $(NULL) DOC_SOURCES = README.in DOC_FILES = $(DOC_SOURCES:.in=) @@ -71,6 +75,7 @@ template_DATA = \ 20-unhint-small-vera.conf \ 25-unhint-nonlatin.conf \ 30-metric-aliases.conf \ + 35-lang-normalize.conf \ 40-nonlatin.conf \ 45-generic.conf \ 45-latin.conf \ @@ -91,6 +96,9 @@ template_DATA = \ README: $(srcdir)/README.in sed "s|\@TEMPLATEDIR\@|$(templatedir)|" $< > $@ +35-lang-normalize.conf: ../fc-lang/Makefile.am + cd ../fc-lang && $(MAKE) $(AM_MAKEFLAGS) $(top_builddir)/conf.d/35-lang-normalize.conf + install-data-hook: mkdir -p $(DESTDIR)$(configdir) @(echo cd $(DESTDIR)$(configdir); \ 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 _______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/fontconfig