[cairo-commit] 3 commits - src/cairo-ft-font.c
src/cairo-pdf-surface.c src/cairo-ps-surface.c
src/cairo-svg-surface.c
Behdad Esfahbod
behdad at kemper.freedesktop.org
Tue Aug 8 03:16:42 PDT 2006
src/cairo-ft-font.c | 17 ++++++++++++-----
src/cairo-pdf-surface.c | 1 +
src/cairo-ps-surface.c | 1 +
src/cairo-svg-surface.c | 7 ++++---
4 files changed, 18 insertions(+), 8 deletions(-)
New commits:
diff-tree 501e5cc8839e104ec21a5aba61cff3580d34f26b (from 89fc22de871d61517a4955875f12326b4dc3389a)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Aug 8 06:12:13 2006 -0400
Restructure subpixel_order handling such that the code doesn't look suspicious!
Shouldn't make /any/ difference at all in any case.
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index ca78d62..daa9e9d 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -1233,6 +1233,8 @@ _get_pattern_ft_options (FcPattern *patt
antialias = FcTrue;
if (antialias) {
+ cairo_subpixel_order_t subpixel_order;
+
if (!bitmap)
ft_options.load_flags |= FT_LOAD_NO_BITMAP;
@@ -1247,25 +1249,28 @@ _get_pattern_ft_options (FcPattern *patt
switch (rgba) {
case FC_RGBA_RGB:
- ft_options.base.subpixel_order = CAIRO_SUBPIXEL_ORDER_RGB;
+ subpixel_order = CAIRO_SUBPIXEL_ORDER_RGB;
break;
case FC_RGBA_BGR:
- ft_options.base.subpixel_order = CAIRO_SUBPIXEL_ORDER_BGR;
+ subpixel_order = CAIRO_SUBPIXEL_ORDER_BGR;
break;
case FC_RGBA_VRGB:
- ft_options.base.subpixel_order = CAIRO_SUBPIXEL_ORDER_VRGB;
+ subpixel_order = CAIRO_SUBPIXEL_ORDER_VRGB;
break;
case FC_RGBA_VBGR:
- ft_options.base.subpixel_order = CAIRO_SUBPIXEL_ORDER_VBGR;
+ subpixel_order = CAIRO_SUBPIXEL_ORDER_VBGR;
break;
case FC_RGBA_UNKNOWN:
case FC_RGBA_NONE:
default:
+ subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
break;
}
- if (ft_options.base.subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT)
+ if (subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT) {
+ ft_options.base.subpixel_order = subpixel_order;
ft_options.base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
+ }
#ifdef FC_HINT_STYLE
if (FcPatternGetInteger (pattern,
diff-tree 89fc22de871d61517a4955875f12326b4dc3389a (from 1f854fcf32e6909e4c52779f093132d8c749c285)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Aug 8 06:08:53 2006 -0400
[fontconfig] Set FC_RGBA_NONE on the pattern if we don't want subpixel.
otherwise, it looks like "I don't care" and fontconfig configuration is
allowed to decide to turn subpixel on. This fixes the bug that subpixel
colors where showing up in fallback images in PS/PDF/SVG backends, observed
in the test fallback-resolution.
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index cb90a50..ca78d62 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -2187,6 +2187,8 @@ 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)
+ FcPatternAddInteger (pattern, FC_RGBA, FC_RGBA_NONE);
}
}
diff-tree 1f854fcf32e6909e4c52779f093132d8c749c285 (from 2d483e0785b18a8bb51f5b1c1a0267029f68a64a)
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue Aug 8 06:04:01 2006 -0400
Set antialiasing to gray in default font options for PS/PDF/SVG
This only affects the image fallback in those backends, and avoids getting
colored pixels there if user's fontconfig configuration turns subpixel on.
This doesn't quite fix that problem though, more changes are needed/coming.
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index b546fcf..1749804 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -1463,6 +1463,7 @@ _cairo_pdf_surface_get_font_options (voi
cairo_font_options_set_hint_style (options, CAIRO_HINT_STYLE_NONE);
cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_OFF);
+ cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_GRAY);
}
static cairo_pdf_resource_t
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index fd58a9e..10c9e6a 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1789,6 +1789,7 @@ _cairo_ps_surface_get_font_options (void
cairo_font_options_set_hint_style (options, CAIRO_HINT_STYLE_NONE);
cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_OFF);
+ cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_GRAY);
}
static cairo_int_status_t
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index 448ddfe..988f98b 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -1637,10 +1637,11 @@ static void
_cairo_svg_surface_get_font_options (void *abstract_surface,
cairo_font_options_t *options)
{
- _cairo_font_options_init_default (options);
+ _cairo_font_options_init_default (options);
- cairo_font_options_set_hint_style (options, CAIRO_HINT_STYLE_NONE);
- cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_OFF);
+ cairo_font_options_set_hint_style (options, CAIRO_HINT_STYLE_NONE);
+ cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_OFF);
+ cairo_font_options_set_antialias (options, CAIRO_ANTIALIAS_GRAY);
}
static const cairo_surface_backend_t cairo_svg_surface_backend = {
More information about the cairo-commit
mailing list