[Fontconfig-bugs] [Bug 33644] Fontconfig doesn't match correctly in <test>

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Apr 2 01:17:14 PDT 2012


https://bugs.freedesktop.org/show_bug.cgi?id=33644

Akira TAGOH <akira at tagoh.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|fontconfig-bugs at lists.freed |akira at tagoh.org
                   |esktop.org                  |
                 CC|                            |fontconfig-bugs at lists.freed
                   |                            |esktop.org

--- Comment #9 from Akira TAGOH <akira at tagoh.org> 2012-04-02 01:17:14 PDT ---
Ah, I think this isn't a bug...

(In reply to comment #0)
> $ fc-match "Courier"
> DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
> 
> $fc-match "Courier New"
> cour.ttf: "Courier New" "Normal"

This is because you have "Courier New" font and it appears earlier in the
pattern. the default qual is "any". as I wrote in comment#8, that is equal to
"or". if you have "Courier" in the pattern, fontconfig will apply the rules for
the first matched value in the test pattern. thus, the above doesn't work,
because fontconfig adds "monospace" prior to "Courier" in the family object. it
looks like:

[..., "Courier New", ... "monospace", "Courier", ...] then. so the folowing
rule just works:

> But after I just swap 2 line:
>         <match target="pattern">
>                 <test name="family">
>                         <string>Courier New</string>
>                         <string>Courier</string>
>                 </test>
>                 <edit binding="strong" mode="prepend" name="family">
>                         <string>monospace</string>
>                 </edit>
>         </match>
> 
> The result changes!

This really depends on how the family names appears in the pattern.
To do what you want regardless of the order of the family name in the pattern,
you may want to try:

<edit name="family" mode="prepend_first" binding="strong">
  <string>monospace</string>
</edit>

BTW I will check the code if test element supports the multiple values. we need
to update docs at least.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Fontconfig-bugs mailing list