[cairo-commit] src/cairo-ft-font.c
Behdad Esfahbod
behdad at kemper.freedesktop.org
Tue Aug 8 11:05:01 PDT 2006
src/cairo-ft-font.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)
New commits:
diff-tree 356e646dc66f3df0d97e2c26e9328650df745c1e (from db06681b487873788b51a6766894fc619eb8d8f2)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Aug 8 13:39:17 2006 -0400
[FreeType] Unset and set to FC_RGBA_NONE the FC_RGBA attribute on pattern
if we don't want it. This stuff is tricky, but I hope to explain: In your
fontconfig configuration, you may match on "font", or on "pattern". Turning
subpixel on typically looks like:
<match target="font">
<test qual="all" name="rgba">
<const>unknown</const>
</test>
<edit name="rgba" mode="assign"><const>rgb</const></edit>
</match>
This works good enough, and if you set to ANTIALIAS_GRAY, this will not
override that. Now one may forget to match on "font" target, or intentionally
match on the pattern. That happens before cairo font options are substituted
in the pattern. So, to give a hint of subpixel in your config file, you can
write:
<match target="pattern">
<edit name="rgba" mode="assign"><const>rgb</const></edit>
</match>
You don't really need to check for current values, as FcConfigSubstitute is
run before merging cairo_font_options_t in. What this patch does, is to reset
pattern's rgba property if the font options explicitly ask for ANTIALIAS_GRAY.
This is the only place in cairo-ft-font.c that we use FcPatternDel, so I
thought some explanation is needed.
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index daa9e9d..3091767 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -2192,8 +2192,10 @@ cairo_ft_font_options_substitute (const
if (FcPatternGet (pattern, FC_ANTIALIAS, 0, &v) == FcResultNoMatch)
{
FcPatternAddBool (pattern, FC_ANTIALIAS, options->antialias != CAIRO_ANTIALIAS_NONE);
- if (options->antialias != CAIRO_ANTIALIAS_SUBPIXEL)
+ if (options->antialias != CAIRO_ANTIALIAS_SUBPIXEL) {
+ FcPatternDel (pattern, FC_RGBA);
FcPatternAddInteger (pattern, FC_RGBA, FC_RGBA_NONE);
+ }
}
}
More information about the cairo-commit
mailing list