[Fontconfig-bugs] [Bug 82582] New: Warn if config is wrong

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Aug 13 13:46:32 PDT 2014


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

          Priority: medium
            Bug ID: 82582
          Assignee: fontconfig-bugs at lists.freedesktop.org
           Summary: Warn if config is wrong
        QA Contact: freedesktop at behdad.org
          Severity: normal
    Classification: Unclassified
                OS: All
          Reporter: freedesktop at behdad.org
          Hardware: Other
            Status: NEW
           Version: unspecified
         Component: library
           Product: fontconfig

I know we don't do full xml validation against the DTD, but at least, we should
be able to catch many nonsensical configs, for example, someone trying this:

<match target="font">
    <or>
      <test name="family" compare="contains">
        <string>MYingHeiB5HK</string>
      </test>
      <test name="family" compare="contains">
        <string>MYingHeiGB18030</string>
      </test>
      <test name="family" compare="contains">
        <string>MSung GB18030</string>
      </test>
      <test name="family" compare="contains">
        <string>MSung B5HK</string>
      </test>
    </or>
    <!-- Turn on light auto-hint -->
    <!-- Turn off sub-pixel anti-aliasing -->
    <edit name="hinting" mode="assign"><bool>true</bool></edit>
    <edit name="autohint" mode="assign"><bool>true</bool></edit>
    <edit name="hintstyle" mode="assign"><const>hintslight</const></edit>
    <edit name="antialias" mode="assign"><bool>true</bool></edit>
    <edit name="rgba" mode="assign"><const>none</const></edit>
 </match>

The problem is, <or> doesn't go in <match>, and <test> doesn't go in <or>.  It
just edits the pattern unconditionally! 

I *think* the correct way to write it is:

 <match target="font"> 
    <test name="family" compare="contains"> 
      <or> 
        <string>MYingHeiB5HK</string> 
        <string>MYingHeiGB18030</string> 
        <string>MSung GB18030</string> 
        <string>MSung B5HK</string> 
      </or> 
    </test> 

I hear in the past (with 2.7.x), this used to work:

<match target="font">
   <test name="family" compare="contains">
        <string>MYingHeiB5HK</string>
        <string>MYingHeiGB18030</string>
        <string>MSung GB18030</string>
        <string>MSung B5HK</string>
    </test>
    <!-- Turn on light auto-hint -->
    <!-- Turn off sub-pixel anti-aliasing -->
    <edit name="hinting" mode="assign"><bool>true</bool></edit>
    <edit name="autohint" mode="assign"><bool>true</bool></edit>
    <edit name="hintstyle" mode="assign"><const>hintslight</const></edit>
    <edit name="antialias" mode="assign"><bool>true</bool></edit>
    <edit name="rgba" mode="assign"><const>none</const></edit>
 </match>

but with 2.11.x started warning about multiple strings in <test>...

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/fontconfig-bugs/attachments/20140813/d1c5bc9a/attachment.html>


More information about the Fontconfig-bugs mailing list