Comment 82 for bug 190848

Revision history for this message
In , Bugs-freedesktop (bugs-freedesktop) wrote :

qual="all" can actually already be used to test that a value is not set because it always returns true when there are no values to test. i.e. All zero values match.

For the rgba case, overriding a value of "unknown" seems quite reasonable.

<match target="font">
  <test name="rgba" qual="all"><const>unknown</const></test>
  <edit name="rgba" mode="assign"><const>none</const></edit>
</match>

The match will apply when rgba is set to "unknown" or when rgba is not set.

For some other properties there is no unknown value, and so using qual="all" gets more obscure because we have to compare with a value that will never match an appropriately set value. e.g.

<match target="font">
  <test name="hintstyle" qual="all"><int>-1</int></test>
  <edit name="hintstyle" mode="assign"><const>hintmedium</const></edit>
</match>

I found that making these "set when not already set" rules work appropriately with Qt3 required an additional hack. Qt3 was calling FcFontMatch (and thus FcFontRenderPrepare) before XftFontMatch (which calls FcFontMatch again after
XftDefaultSubstitute). Xft screen options had not been applied in the
first FcFontRenderPrepare (before XftFontMatch), and so the rules were matching and setting values that would take precedence over Xft screen options. This situation was detectable through missing pixelsize as FcDefaultSubstitute had not been called before the first FcFontRenderPrepare. I haven't looked at Qt4.

This test matches only when pixelsize is set (-1.0 is considered an inappropriate value).

  <test name="pixelsize" target="pattern" compare="not_eq">
    <double>-1.0</double>
  </test>