mirror of https://github.com/freetype/freetype
* src/smooth/ftgrays.c: adding experimental "gamma" support. This
produces smoother glyphs at small sizes for very little cost * src/autohint/ahglyph.c, src/autohint/ahhint.c: various fixes to the auto-hinter. They merely improve the output of sans-serif fonts. Note that there are still problems with serifed fonts and composites (accented characters) * tests/gview.c: updated the debugging glyph viewer to show the hints generated by the "autohint" module
This commit is contained in:
parent
9d7e5e8b8b
commit
adf07a930c
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2001-10-29 David Turner <david@freetype.org>
|
||||
|
||||
* src/smooth/ftgrays.c: adding experimental "gamma" support. This
|
||||
produces smoother glyphs at small sizes for very little cost
|
||||
|
||||
* src/autohint/ahglyph.c, src/autohint/ahhint.c: various fixes to
|
||||
the auto-hinter. They merely improve the output of sans-serif fonts.
|
||||
Note that there are still problems with serifed fonts and composites
|
||||
(accented characters)
|
||||
|
||||
* tests/gview.c: updated the debugging glyph viewer to show the
|
||||
hints generated by the "autohint" module
|
||||
|
||||
|
||||
2001-10-27 David Turner <david@freetype.org>
|
||||
|
||||
* src/cache/ftchunk.c (ftc_chunk_cache_lookup): fixed a bug that
|
||||
|
|
|
@ -994,7 +994,7 @@
|
|||
dist = -dist;
|
||||
|
||||
if ( len < 8 )
|
||||
score = 300 + dist;
|
||||
score = 300*8 + dist - len*3;
|
||||
else
|
||||
score = dist + 300/len;
|
||||
|
||||
|
|
|
@ -169,10 +169,12 @@
|
|||
if ( base->flags & ah_edge_done )
|
||||
{
|
||||
if ( dist >= 64 )
|
||||
dist = ( dist + 8 ) & -64;
|
||||
dist = (dist+8) & -64;
|
||||
|
||||
else if ( dist <= 32 && !vertical )
|
||||
dist = ( dist + 33 ) >> 1;
|
||||
else
|
||||
dist = 0;
|
||||
}
|
||||
|
||||
serif->pos = base->pos + sign * dist;
|
||||
|
|
|
@ -84,6 +84,10 @@
|
|||
#include <string.h> /* for memcpy() */
|
||||
#include <setjmp.h>
|
||||
|
||||
|
||||
/* experimental support for gamma correction within the rasterizer */
|
||||
#define GRAYS_USE_GAMMA
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
||||
|
@ -305,6 +309,10 @@
|
|||
void* memory;
|
||||
jmp_buf jump_buffer;
|
||||
|
||||
#ifdef GRAYS_USE_GAMMA
|
||||
FT_Byte gamma[257];
|
||||
#endif
|
||||
|
||||
} TRaster, *PRaster;
|
||||
|
||||
|
||||
|
@ -1230,15 +1238,21 @@
|
|||
|
||||
for ( ; count > 0; count--, spans++ )
|
||||
{
|
||||
if ( spans->coverage )
|
||||
FT_UInt coverage = spans->coverage;
|
||||
|
||||
#ifdef GRAYS_USE_GAMMA
|
||||
coverage = raster->gamma[(FT_Byte)coverage];
|
||||
#endif
|
||||
|
||||
if ( coverage )
|
||||
#if 1
|
||||
MEM_Set( p + spans->x, (unsigned char)spans->coverage, spans->len );
|
||||
MEM_Set( p + spans->x, (unsigned char)coverage, spans->len );
|
||||
#else /* 1 */
|
||||
{
|
||||
q = p + spans->x;
|
||||
limit = q + spans->len;
|
||||
for ( ; q < limit; q++ )
|
||||
q[0] = (unsigned char)spans->coverage;
|
||||
q[0] = (unsigned char)coverage;
|
||||
}
|
||||
#endif /* 1 */
|
||||
}
|
||||
|
@ -1960,6 +1974,33 @@
|
|||
/**** RASTER OBJECT CREATION: In standalone mode, we simply use *****/
|
||||
/**** a static object. *****/
|
||||
|
||||
#ifdef GRAYS_USE_GAMMA
|
||||
|
||||
/* initialize the "gamma" table. Yes, this is really a crummy function */
|
||||
/* but the results look pretty good for something that simple.. */
|
||||
/* */
|
||||
#define M_MAX 255
|
||||
#define M_X 128
|
||||
#define M_Y 96
|
||||
|
||||
static void
|
||||
grays_init_gamma( PRaster raster )
|
||||
{
|
||||
FT_UInt x, a;
|
||||
|
||||
for ( x = 0; x < 256; x++ )
|
||||
{
|
||||
if ( x <= M_X )
|
||||
a = (x * M_Y + (M_X/2)) / M_X;
|
||||
else
|
||||
a = M_Y + ((x-M_X)*(M_MAX-M_Y) + (M_MAX-M_X)/2)/(M_MAX-M_X);
|
||||
|
||||
raster->gamma[x] = (FT_Byte)a;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* GRAYS_USE_GAMMA */
|
||||
|
||||
#ifdef _STANDALONE_
|
||||
|
||||
static int
|
||||
|
@ -1974,6 +2015,10 @@
|
|||
*araster = (FT_Raster)&the_raster;
|
||||
MEM_Set( &the_raster, 0, sizeof ( the_raster ) );
|
||||
|
||||
#ifdef GRAYS_USE_GAMMA
|
||||
grays_init_gamma( (PRaster)*araster );
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2000,6 +2045,10 @@
|
|||
{
|
||||
raster->memory = memory;
|
||||
*araster = (FT_Raster)raster;
|
||||
|
||||
#ifdef GRAYS_USE_GAMMA
|
||||
grays_init_gamma( raster );
|
||||
#endif
|
||||
}
|
||||
|
||||
return error;
|
||||
|
|
Loading…
Reference in New Issue