Bug 23758 - Can't modify lang in target="scan"
Summary: Can't modify lang in target="scan"
Alias: None
Product: fontconfig
Classification: Unclassified
Component: library (show other bugs)
Version: 2.4
Hardware: Other All
: medium normal
Assignee: Keith Packard
QA Contact: Behdad Esfahbod
Depends on:
Reported: 2009-09-06 19:03 UTC by Behdad Esfahbod
Modified: 2010-12-28 06:41 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:

Allow to modify langset and charset (6.98 KB, patch)
2010-06-27 19:59 UTC, Akira TAGOH
Details | Splinter Review

Description Behdad Esfahbod 2009-09-06 19:03:31 UTC
Problem is, it's a LangSet, so one can't, say, delete the "ja" lang from a font upon scan.
Comment 1 Behdad Esfahbod 2009-11-18 08:48:40 UTC
Thought about it again.  We should add special rules for modifying a langset, like we have for matrix (multiply, etc).
Comment 2 Akira TAGOH 2010-06-27 19:59:55 UTC
Created attachment 36555 [details] [review]
Allow to modify langset and charset

This patch would allows to modify the langset and the charset by e.g.

        <match target="scan">
                <test name="family">
                <edit name="charset" mode="assign" binding="strong">
                <edit name="lang" mode="assign" binding="strong">

After running fc-cache -f again, HanaMin becomes matching with serif:lang=ja say.
which originally is only capable for zh-hk|zh-mo|zh-tw unexpectedly.
Comment 3 Behdad Esfahbod 2010-09-21 10:21:10 UTC
Assigning 'ja' to charset makes no sense.  Humm, oh you mean you are copying the ja.orth charset to it.  I see!  Interesting...  Lemme poke.
Comment 4 Behdad Esfahbod 2010-09-21 10:28:00 UTC
Ok.  This is a good start.

First, please keep FcVStackCharSet/LangSet and the respective FcVStack members in the same block as other types.

Next, the langset handling looks about right, except that we should support 1. multiple strings, 2. add, delete, etc, as opposed to plain assign.

For charset, the way you've done it is wrong.  We want to be able to add/delete specific unicode characters or ranges.
Comment 5 Akira TAGOH 2010-09-26 23:44:49 UTC
Thank you for the comment. let me clean up a bit.
Comment 6 Akira TAGOH 2010-11-29 04:37:35 UTC
just filed a separate bug for charset as Bug#31969.
some code for add/remove could be re-used for langset too. FYI.
Comment 7 Akira TAGOH 2010-12-01 23:31:43 UTC
re-worked a bit based on the patch at Bug#31969:


the syntax is similar to that.
Comment 8 Behdad Esfahbod 2010-12-02 05:47:14 UTC
Looks good generally.  Lets add FcLangSetUnion and FcLangSetSubtract and use them.
Comment 9 Akira TAGOH 2010-12-02 10:02:42 UTC
(In reply to comment #8)
> Looks good generally.  Lets add FcLangSetUnion and FcLangSetSubtract and use
> them.


also added langset thing into fonts.dtd too.
Comment 10 Akira TAGOH 2010-12-02 10:21:20 UTC
Hm, it seems some garbages was slipped into commits in this branch. doh.

assuming that both editing langset and charset will be into fontconfig master, tha would be easier to do review the patch generated by "git diff master" on langset-modification-take2 branch, but anyway.
Comment 13 Behdad Esfahbod 2010-12-28 01:01:54 UTC
Pushed to master.  Please test.  Thanks!
Comment 14 Akira TAGOH 2010-12-28 06:41:39 UTC
That works for me. thanks!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.