* src/pshinter/pshalgo.c: slight modification to the Postscript hinter

to slightly increase the contrast of smooth hinting. This is very similar
    to what the auto-hinter does when it comes to stem width computations.
    However, it produces better results with well-hinted fonts..
This commit is contained in:
David Turner 2002-08-29 22:50:17 +00:00
parent 71afa750bf
commit b40b8d6eda
2 changed files with 72 additions and 14 deletions

View File

@ -1,12 +1,19 @@
2002-08-29 David Turner <david@freetype.org>
* src/pshinter/pshalgo.c: slight modification to the Postscript hinter
to slightly increase the contrast of smooth hinting. This is very similar
to what the auto-hinter does when it comes to stem width computations.
However, it produces better results with well-hinted fonts..
2002-08-27 David Turner <david@freetype.org>
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
@ -14,7 +21,7 @@
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
@ -23,12 +30,12 @@
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
@ -185,7 +192,7 @@
2002-08-15 Graham Asher <graham.asher@btinternet.com>
Implemented the incremental font loading system for the CFF driver.
Implemented the incremental font loading system for the CFF driver.
Tested using the GhostScript-to-FreeType bridge (under development).
* src/cff/cffgload.c (cff_get_glyph_data, cff_free_glyph_data): New
@ -300,7 +307,7 @@
2002-07-18 Graham Asher <graham.asher@btinternet.com>
Added types and structures to support incremental typeface loading.
Added types and structures to support incremental typeface loading.
The FT_Incremental_Interface structure, defined in freetype.h, is
designed to be passed to FT_Open_Face to provide callback functions
to obtain glyph recipes and metrics, for fonts like those passed

View File

@ -33,10 +33,8 @@
#endif
#undef SNAP_STEMS
#undef ONLY_ALIGN_Y
#define COMPUTE_INFLEXS
#define COMPUTE_INFLEXS /* compute inflection points to optimize "S" and others */
#define STRONGER /* slightly increase the contrast of smooth hinting */
/*************************************************************************/
/*************************************************************************/
@ -412,7 +410,7 @@
/* perform stem snapping when requested */
no_snapping = ( dimension == 0 && !glyph->no_horz_snapping ) ||
( dimension == 1 && !glyph->no_vert_snapping );
if ( !no_snapping )
{
/* compute fitted width/height */
@ -499,6 +497,58 @@
}
else
{
#ifdef STRONGER
if ( len <= 64 )
{
/* the stem is less than one pixel, we will center it */
/* around the nearest pixel center */
/* */
pos = ( pos + (len >> 1) & -64 );
len = 64;
}
else
{
FT_Pos delta = len - dim->stdw.widths[0].cur;
if ( delta < 0 )
delta = -delta;
if ( delta < 40 )
{
len = dim->stdw.widths[0].cur;
if ( len < 32 )
len = 32;
}
if ( len < 3 * 64 )
{
delta = ( len & 63 );
len &= -64;
if ( delta < 10 )
len += delta;
else if ( delta < 32 )
len += 10;
else if ( delta < 54 )
len += 54;
else
len += delta;
}
else
len = ( len + 32 ) & -64;
}
/* now that we have a good hinted stem width, try to position */
/* the stem along a pixel grid integer coordinate */
hint->cur_pos = pos + psh3_hint_snap_stem_side_delta( pos, len );
hint->cur_len = len;
#else /* !STRONGER */
/* Stems less than one pixel wide are easy - we want to
* make them as dark as possible, so they must fall within
* one pixel. If the stem is split between two pixels
@ -541,7 +591,7 @@
FT_Fixed delta_a, delta_b;
if ( len & 64 )
if ( len & 64 )
{
delta_a = ( center & -64 ) + 32 - center;
delta_b = ( ( center + 32 ) & - 64 ) - center;
@ -573,6 +623,7 @@
pos += delta_b;
}
hint->cur_pos = pos;
#endif /* !STRONGER */
}
}
}
@ -1712,7 +1763,7 @@
glyph->no_horz_hints = 0;
glyph->no_vert_hints = 0;
glyph->no_horz_snapping = FT_BOOL( hint_mode == FT_RENDER_MODE_NORMAL ||
hint_mode == FT_RENDER_MODE_LCD_V );