[cairo-commit] Changes to 'BRANCH_1_0'
Carl Worth
cworth at kemper.freedesktop.org
Thu Feb 23 17:14:54 PST 2006
src/cairo-ft-font.c | 127 +++++++++++++++++++----------------
test/text-antialias-subpixel-ref.png |binary
test/text-antialias-subpixel.c | 42 ++++++-----
3 files changed, 94 insertions(+), 75 deletions(-)
New commits:
diff-tree d8d8694ac424f1c9b1ef57a5a08c6f4ad1a208ce (from 65c32ae36fe90d69131435a25e6b15a05339df47)
Author: Frederic Crozat <fcrozat at mandriva.com>
Date: Thu Feb 23 17:09:47 2006 -0800
Fix usage of freetype to match Xft and follow David Turner's recommendations.
Change a little the logic in hinting to follow the same
logic as Xft and doesn't try to mix FT_LOAD_TARGET which should not be
mixed (based on David Turner comments)
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 7ef6a82..bc56dca 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -1343,8 +1343,7 @@ _get_pattern_load_flags (FcPattern *patt
#ifdef FC_HINT_STYLE
int hintstyle;
#endif
- int load_flags = 0;
- int target_flags = 0;
+ int load_flags = FT_LOAD_DEFAULT;
/* disable antialiasing if requested */
if (FcPatternGetBool (pattern,
@@ -1369,48 +1368,46 @@ _get_pattern_load_flags (FcPattern *patt
load_flags |= FT_LOAD_NO_HINTING;
if (antialias) {
- switch (hintstyle) {
- case FC_HINT_SLIGHT:
- case FC_HINT_MEDIUM:
- target_flags = FT_LOAD_TARGET_LIGHT;
- break;
- default:
- target_flags = FT_LOAD_TARGET_NORMAL;
- break;
- }
+ if (FcPatternGetInteger (pattern,
+ FC_RGBA, 0, &rgba) != FcResultMatch)
+ rgba = FC_RGBA_UNKNOWN;
+
+ switch (rgba) {
+ case FC_RGBA_UNKNOWN:
+ case FC_RGBA_NONE:
+ switch (hintstyle) {
+ case FC_HINT_NONE:
+ break;
+ case FC_HINT_SLIGHT:
+ case FC_HINT_MEDIUM:
+ load_flags |= FT_LOAD_TARGET_LIGHT;
+ break;
+ default:
+ load_flags |= FT_LOAD_TARGET_NORMAL;
+ break;
+ }
+ break;
+ case FC_RGBA_BGR:
+ load_flags |= PRIVATE_FLAG_BGR;
+ case FC_RGBA_RGB:
+ load_flags |= FT_LOAD_TARGET_LCD;
+ break;
+ case FC_RGBA_VBGR:
+ load_flags |= PRIVATE_FLAG_BGR;
+ case FC_RGBA_VRGB:
+ load_flags |= FT_LOAD_TARGET_LCD_V;
+ break;
+ }
} else {
#ifdef FT_LOAD_TARGET_MONO
- target_flags = FT_LOAD_TARGET_MONO;
+ load_flags |= FT_LOAD_TARGET_MONO;
#endif
}
#else /* !FC_HINT_STYLE */
if (!hinting)
- target_flags = FT_LOAD_NO_HINTING;
+ load_flags |= FT_LOAD_NO_HINTING;
#endif /* FC_FHINT_STYLE */
- if (FcPatternGetInteger (pattern,
- FC_RGBA, 0, &rgba) != FcResultMatch)
- rgba = FC_RGBA_UNKNOWN;
-
- switch (rgba) {
- case FC_RGBA_UNKNOWN:
- case FC_RGBA_NONE:
- default:
- break;
- case FC_RGBA_BGR:
- target_flags |= PRIVATE_FLAG_BGR;
- case FC_RGBA_RGB:
- target_flags |= FT_LOAD_TARGET_LCD;
- break;
- case FC_RGBA_VBGR:
- target_flags |= PRIVATE_FLAG_BGR;
- case FC_RGBA_VRGB:
- target_flags |= FT_LOAD_TARGET_LCD_V;
- break;
- }
-
- load_flags |= target_flags;
-
/* force autohinting if requested */
if (FcPatternGetBool (pattern,
FC_AUTOHINT, 0, &autohint) != FcResultMatch)
@@ -1445,7 +1442,7 @@ _get_pattern_load_flags (FcPattern *patt
static int
_get_options_load_flags (const cairo_font_options_t *options)
{
- int load_flags = 0;
+ int load_flags = FT_LOAD_DEFAULT;
/* disable antialiasing if requested */
switch (options->antialias) {
@@ -1456,6 +1453,7 @@ _get_options_load_flags (const cairo_fon
load_flags |= FT_LOAD_MONOCHROME;
break;
case CAIRO_ANTIALIAS_SUBPIXEL:
+ load_flags |= FT_LOAD_NO_BITMAP;
switch (options->subpixel_order) {
case CAIRO_SUBPIXEL_ORDER_BGR:
load_flags |= PRIVATE_FLAG_BGR;
@@ -1469,28 +1467,29 @@ _get_options_load_flags (const cairo_fon
load_flags |= FT_LOAD_TARGET_LCD_V;
break;
}
+ break;
+
/* fall through ... */
case CAIRO_ANTIALIAS_DEFAULT:
case CAIRO_ANTIALIAS_GRAY:
load_flags |= FT_LOAD_NO_BITMAP;
+ /* disable hinting if requested */
+ switch (options->hint_style) {
+ case CAIRO_HINT_STYLE_NONE:
+ load_flags |= FT_LOAD_NO_HINTING;
+ break;
+ case CAIRO_HINT_STYLE_SLIGHT:
+ case CAIRO_HINT_STYLE_MEDIUM:
+ load_flags |= FT_LOAD_TARGET_LIGHT;
+ break;
+ case CAIRO_HINT_STYLE_FULL:
+ default:
+ load_flags |= FT_LOAD_TARGET_NORMAL;
+ break;
+ }
break;
}
- /* disable hinting if requested */
- switch (options->hint_style) {
- case CAIRO_HINT_STYLE_NONE:
- load_flags |= FT_LOAD_NO_HINTING;
- break;
- case CAIRO_HINT_STYLE_SLIGHT:
- case CAIRO_HINT_STYLE_MEDIUM:
- load_flags |= FT_LOAD_TARGET_LIGHT;
- break;
- case CAIRO_HINT_STYLE_FULL:
- default:
- load_flags |= FT_LOAD_TARGET_NORMAL;
- break;
- }
-
return load_flags;
}
More information about the cairo-commit
mailing list