Don't warn if an unknown element is used in an expression

The type will be resolved at runtime...

For example, we can do this now without getting a warning:

<match target="font">
  <test name="scalable" compare="eq">
    <bool>false</bool>
  </test>
  <edit name="pixelsizefixupfactor" mode="assign">
    <divide>
      <name target="pattern">pixelsize</name>
      <name target="font"   >pixelsize</name>
    </divide>
  </edit>
  <edit name="matrix" mode="assign">
    <times>
      <name>matrix</name>
      <matrix>
        <name>pixelsizefixupfactor</name> <double>0</double>
        <double>0</double> <name>pixelsizefixupfactor</name>
       </matrix>
    </times>
  </edit>
  <edit name="size" mode="assign">
    <divide>
      <name>size</name>
      <name>pixelsizefixupfactor</name>
    </divide>
  </edit>
</match>

Previously the last edit was generating:

Fontconfig warning: "/home/behdad/.local/etc/fonts/conf.d/00-scale-bitmap-fonts.conf", line 29: saw unknown, expected number
This commit is contained in:
Behdad Esfahbod 2012-12-30 19:08:42 -06:00
parent 51b0044648
commit 1fbb0b3b15
1 changed files with 4 additions and 0 deletions

View File

@ -594,6 +594,10 @@ FcTypecheckValue (FcConfigParse *parse, FcType value, FcType type)
return; return;
if (type == (FcType) -1) if (type == (FcType) -1)
return; return;
/* It's perfectly fine to use user-define elements in expressions,
* so don't warn in that case. */
if (value == (FcType) -1)
return;
FcConfigMessage (parse, FcSevereWarning, "saw %s, expected %s", FcConfigMessage (parse, FcSevereWarning, "saw %s, expected %s",
FcTypeName (value), FcTypeName (type)); FcTypeName (value), FcTypeName (type));
} }