On Fri, May 20, 2005 at 06:15:15AM +0200, Werner LEMBERG wrote: > > > > > As fontconfig and xft already have the code to "embolden" and > > > > rely on FT_GlyphSlot_Embolden to do the real job, I think > > > > FT_GlyphSlot_Embolden should be made standard API. This is an > > > > important feature for Chinese (maybe also Japanese and Korean) > > > > users, as most Chinese fonts don't have a real bold style. > > > > After some more inspection, I find there is already FT_Glyph for > > glyph manipulation. Then, why not > > > > FT_Glyph_Embolden > > FT_Glyph_Oblique > > ? > > Are these new structures? Do you suggest them because you can't > modify the public `FT_Glyph'? They are new function calls.
We already have FT_Glyph_Translate to translate glyphs, FT_Glyph_Transform to transform glyphs, FT_Glyph_Stroke to stroke glyphs, then why not FT_Glyph_Embolden to embolden glyphs? > > > Also I tried to modify the embolden algorithm for outline glyph, and > > it now uses similar algorithm as the one I use for bitmap glyph. > > This is done because the old algorithm generates some artifact. > > Aah, another user has reported problems. Can you post the patch to > the freetype-devel list, please? Check the patch (algorithm only) in the attachment.
Index: src/base/ftsynth.c =================================================================== RCS file: /home/cvs/freetype2/src/base/ftsynth.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 ftsynth.c --- src/base/ftsynth.c 15 May 2005 07:10:28 -0000 1.1.1.1 +++ src/base/ftsynth.c 20 May 2005 05:24:57 -0000 @@ -115,7 +115,9 @@ { FT_Pos d; FT_Vector in, out; +#ifdef OLD_ALGORITHM FT_Fixed scale; +#endif FT_Angle angle_diff; @@ -132,6 +134,7 @@ angle_in = FT_Atan2( in.x, in.y ); angle_out = FT_Atan2( out.x, out.y ); angle_diff = FT_Angle_Diff( angle_in, angle_out ); +#ifdef OLD_ALGORITHM scale = FT_Cos( angle_diff/2 ); if ( scale < 0x400L && scale > -0x400L ) @@ -148,6 +151,23 @@ outline->points[n].x = v_cur.x + distance + in.x; outline->points[n].y = v_cur.y + distance + in.y; +#else + angle_diff = angle_in + angle_diff / 2 - rotate; + angle_diff = FT_Angle_Diff( 0, angle_diff ); + + d = distance * 2; /* strength */ + + if ( -FT_ANGLE_PI2 < angle_diff && angle_diff <= 0 ) { + outline->points[n].x = v_cur.x + d; + } + else if ( 0 < angle_diff && angle_diff < FT_ANGLE_PI2 ) { + outline->points[n].x = v_cur.x + d; + outline->points[n].y = v_cur.y + d; + } + else if ( FT_ANGLE_PI2 <= angle_diff && angle_diff < FT_ANGLE_PI ) { + outline->points[n].y = v_cur.y + d; + } +#endif v_prev = v_cur; v_cur = v_next;
_______________________________________________ Freetype-devel mailing list Freetype-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/freetype-devel