Use the right flags when loading glyphs for freetype >=2.1.3. Anti-alias by default if GSFontAntiAlias isn't set.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@17083 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2003-07-01 14:39:34 +00:00
parent e04b025363
commit 9c3ad84a95
2 changed files with 29 additions and 20 deletions

View file

@ -1,3 +1,9 @@
2003-07-01 16:37 Alexander Malmberg <alexander@malmberg.org>
* Source/art/ftfont.m: Use the correct set of flags when loading
glyphs for freetype >=2.1.3. Anti-alias by default if there is no
defaults value for GSFontAntiAlias.
2003-06-30 18:11 Alexander Malmberg <alexander@malmberg.org> 2003-06-30 18:11 Alexander Malmberg <alexander@malmberg.org>
* Source/xlib/XGFont.m (-xCharStructForGlyph:): Don't try to treat * Source/xlib/XGFont.m (-xCharStructForGlyph:): Don't try to treat

View file

@ -852,7 +852,7 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type = ftc_image_grays; cur.type = ftc_image_grays;
#else #else
cur.flags = ftc_image_grays; cur.flags = FT_LOAD_TARGET_NORMAL;
#endif #endif
rh = (rh >> 8) & 0xff; rh = (rh >> 8) & 0xff;
} }
@ -861,7 +861,7 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type = ftc_image_mono; cur.type = ftc_image_mono;
#else #else
cur.flags = ftc_image_mono; cur.flags = FT_LOAD_TARGET_MONO;
#endif #endif
rh = rh & 0xff; rh = rh & 0xff;
} }
@ -869,26 +869,26 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type |= ftc_image_flag_autohinted; cur.type |= ftc_image_flag_autohinted;
#else #else
cur.flags |= ftc_image_flag_autohinted; cur.flags |= FT_LOAD_FORCE_AUTOHINT;
#endif #endif
if (!(rh & 2)) if (!(rh & 2))
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type |= ftc_image_flag_unhinted; cur.type |= ftc_image_flag_unhinted;
#else #else
cur.flags |= ftc_image_flag_unhinted; cur.flags |= FT_LOAD_NO_HINTING;
#endif #endif
} }
else if (xx < 8) else if (xx < 8)
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type = ftc_image_grays | ftc_image_flag_unhinted; cur.type = ftc_image_grays | ftc_image_flag_unhinted;
#else #else
cur.flags = ftc_image_grays | ftc_image_flag_unhinted; cur.flags = FT_LOAD_TARGET_NORMAL | FT_LOAD_NO_HINTING;
#endif #endif
else else
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type = ftc_image_grays; cur.type = ftc_image_grays;
#else #else
cur.flags = ftc_image_grays; cur.flags = FT_LOAD_TARGET_NORMAL;
#endif #endif
} }
else else
@ -1295,7 +1295,7 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type = ftc_image_grays; cur.type = ftc_image_grays;
#else #else
cur.flags = ftc_image_grays; cur.flags = FT_LOAD_TARGET_NORMAL;
#endif #endif
rh = (rh >> 8) & 0xff; rh = (rh >> 8) & 0xff;
} }
@ -1304,7 +1304,7 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type = ftc_image_mono; cur.type = ftc_image_mono;
#else #else
cur.flags = ftc_image_mono; cur.flags = FT_LOAD_TARGET_MONO;
#endif #endif
rh = rh & 0xff; rh = rh & 0xff;
} }
@ -1312,26 +1312,26 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type |= ftc_image_flag_autohinted; cur.type |= ftc_image_flag_autohinted;
#else #else
cur.flags |= ftc_image_flag_autohinted; cur.flags |= FT_LOAD_FORCE_AUTOHINT;
#endif #endif
if (!(rh & 2)) if (!(rh & 2))
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type |= ftc_image_flag_unhinted; cur.type |= ftc_image_flag_unhinted;
#else #else
cur.flags |= ftc_image_flag_unhinted; cur.flags |= FT_LOAD_NO_HINTING;
#endif #endif
} }
else if (xx < 8) else if (xx < 8)
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type = ftc_image_grays | ftc_image_flag_unhinted; cur.type = ftc_image_grays | ftc_image_flag_unhinted;
#else #else
cur.flags = ftc_image_grays | ftc_image_flag_unhinted; cur.flags = FT_LOAD_TARGET_NORMAL | FT_LOAD_NO_HINTING;
#endif #endif
else else
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type = ftc_image_grays; cur.type = ftc_image_grays;
#else #else
cur.flags = ftc_image_grays; cur.flags = FT_LOAD_TARGET_NORMAL;
#endif #endif
} }
else else
@ -1642,7 +1642,7 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type = ftc_image_grays; cur.type = ftc_image_grays;
#else #else
cur.flags = ftc_image_grays; cur.flags = FT_LOAD_TARGET_NORMAL;
#endif #endif
rh = (rh >> 8) & 0xff; rh = (rh >> 8) & 0xff;
} }
@ -1651,7 +1651,7 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type = ftc_image_mono; cur.type = ftc_image_mono;
#else #else
cur.flags = ftc_image_mono; cur.flags = FT_LOAD_TARGET_MONO;
#endif #endif
rh = rh & 0xff; rh = rh & 0xff;
} }
@ -1659,26 +1659,26 @@ static FT_Error ft_get_face(FTC_FaceID fid, FT_Library lib, FT_Pointer data, FT_
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type |= ftc_image_flag_autohinted; cur.type |= ftc_image_flag_autohinted;
#else #else
cur.flags |= ftc_image_flag_autohinted; cur.flags |= FT_LOAD_FORCE_AUTOHINT;
#endif #endif
if (!(rh & 2)) if (!(rh & 2))
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type |= ftc_image_flag_unhinted; cur.type |= ftc_image_flag_unhinted;
#else #else
cur.flags |= ftc_image_flag_unhinted; cur.flags |= FT_LOAD_NO_HINTING;
#endif #endif
} }
else if (xx < 8) else if (xx < 8)
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type = ftc_image_grays | ftc_image_flag_unhinted; cur.type = ftc_image_grays | ftc_image_flag_unhinted;
#else #else
cur.flags = ftc_image_grays | ftc_image_flag_unhinted; cur.flags = FT_LOAD_TARGET_NORMAL | FT_LOAD_NO_HINTING;
#endif #endif
else else
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type = ftc_image_grays; cur.type = ftc_image_grays;
#else #else
cur.flags = ftc_image_grays; cur.flags = FT_LOAD_TARGET_NORMAL;
#endif #endif
if ((error=FTC_SBitCache_Lookup(ftc_sbitcache, &cur, glyph, &sbit, NULL))) if ((error=FTC_SBitCache_Lookup(ftc_sbitcache, &cur, glyph, &sbit, NULL)))
@ -2278,7 +2278,10 @@ static int filters[3][7]=
subpixel_text = [ud integerForKey: @"back-art-subpixel-text"]; subpixel_text = [ud integerForKey: @"back-art-subpixel-text"];
if ([ud objectForKey: @"GSFontAntiAlias"])
anti_alias_by_default = [ud boolForKey: @"GSFontAntiAlias"]; anti_alias_by_default = [ud boolForKey: @"GSFontAntiAlias"];
else
anti_alias_by_default = YES;
/* To make it easier to find an optimal (or at least good) filter, /* To make it easier to find an optimal (or at least good) filter,
the filters are configurable (for now). */ the filters are configurable (for now). */
@ -2401,7 +2404,7 @@ static int filters[3][7]=
#ifdef FT212_STUFF #ifdef FT212_STUFF
cur.type = ftc_image_grays, subpixel = YES, cur.font.pix_width *= 3, x *= 3; cur.type = ftc_image_grays, subpixel = YES, cur.font.pix_width *= 3, x *= 3;
#else #else
cur.flags = ftc_image_grays, subpixel = YES, cur.font.pix_width *= 3, x *= 3; cur.flags = FT_LOAD_TARGET_NORMAL, subpixel = YES, cur.font.pix_width *= 3, x *= 3;
#endif #endif
// imgd.type|=|ftc_image_flag_unhinted; /* TODO? when? */ // imgd.type|=|ftc_image_flag_unhinted; /* TODO? when? */
} }