Cleanups.

This commit is contained in:
Werner Lemberg 2003-04-23 15:17:43 +00:00
parent 17de481806
commit 3e13e4934e
3 changed files with 119 additions and 76 deletions

View File

@ -103,8 +103,15 @@
* src/pfr/pfrsbit.c (pfr_slot_load_bitmap): Use
`ft_glyphslot_alloc_bitmap'.
* src/sfnt/ttsbit.c, src/type42/t42objs.c,
src/winfonts/winfnt.c:
* src/sfnt/ttsbit.c (Load_SBit_Image): Change 5th argument to type
`FT_GlyphSlot'.
Adding argument `depth' to handle recursive calls.
Use `ft_glyphslot_alloc_bitmap'.
(tt_face_load_sbit_image): Remove unused variable `memory'.
Don't handle `FT_GLYPH_OWN_BITMAP'.
Update call to Load_SBit_Image.
* src/type42/t42objs.c, src/winfonts/winfnt.c:
* src/cache/ftlru.c (FT_LruList_Lookup): Fixed an invalid assertion
check.
@ -126,8 +133,9 @@
2003-03-14 David Turner <david@freetype.org>
* src/truetype/ttdriver.c: Fixing the small TrueType native
rendering glitches, they came from a small rounding error.
* src/truetype/ttdriver.c (Set_Char_Sizes): Fixing the small
TrueType native rendering glitches, they came from a small rounding
error.
2003-03-13 David Turner <david@freetype.org>
@ -161,10 +169,11 @@
leak) that only happened when a try to resize an array would end in
an out-of-memory condition.
* src/smooth/ftgrays.c: Removed compiler warnings / volatile bug.
* src/smooth/ftgrays.c (gray_convert_glyph): Removed compiler
warnings / volatile bug.
* src/truetype/ttobjs.c: Removed segmentation fault that happened in
tight memory environments.
* src/truetype/ttobjs.c (tt_glyphzone_done): Removed segmentation
fault that happened in tight memory environments.
2003-02-28 Pixel <pixel@mandrakesoft.com>
@ -232,8 +241,17 @@
* src/base/ftobjs.c (ft_recompute_scaled_metrics): Fix rounding.
* src/truetype/ttdriver.c, src/truetype/ttobjs.h,
src/truetype/ttobjs.c, src/truetype/ttinterp.c:
* src/truetype/ttdriver.c (Set_Char_Sizes): New variable `metrics2'.
[!TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Removed.
* src/truetype/ttobjs.h (TT_SizeRec): New field `metrics'.
* src/truetype/ttobjs.c (Reset_Outline_Size): Fix initialization of
`metrics'.
[FT_CONFIG_CHESTER_ASCENDER]: Code removed.
(Reset_SBit_Size): Fix initialization of `metrics'.
* src/truetype/ttinterp.c (TT_Load_Context): Fix initialization of
`exec->metrics'.
* src/autohint/ahhint.c (ah_hinter_load): Disabled the advance width
"correction" which seemed to provide more trouble than benefits.
@ -249,8 +267,14 @@
Allow metrics to be overridden.
* src/cid/cidgload.c (cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL]:
Ditto.
* src/truetype/ttgload.c, src/type1/t1gload.c
[FT_CONFIG_OPTION_INCREMENTAL]:
* src/truetype/ttgload.c (load_truetype_glyph)
[FT_CONFIG_OPTION_INCREMENTAL]: Simplify.
(compute_glyph_metrics) [FT_CONFIG_OPTION_INCREMENTAL]: Code block
moved down.
* src/type1/t1gload.c [FT_CONFIG_OPTION_INCREMENTAL]:
* include/freetype/ftincrem.h: Updated.
2003-01-31 David Turner <david@freetype.org>
@ -285,7 +309,12 @@
* src/base/ftobjs.c (FT_Set_Char_Size)
[FT_CONFIG_CHESTER_BLUE_SCALE]: Round differently.
* src/truetype/ttobjs.c:
* src/truetype/ttdriver.c (Set_Char_Sizes)
[TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Do some rounding only
if this macro is defined.
* src/truetype/ttobjs.c (Reset_Outline_Size)
[FT_CONFIG_CHESTER_ASCENDER]: Round differently.
* src/pshinter/pshalgo3.c: Improved the Postscript hinter. Getting
rid of stem snapping seems to work well here (though the stems are
@ -464,6 +493,11 @@
* src/truetype/ttgload.c: Fixing the TrueType loader to handle
invalid composites correctly by limiting the recursion depth.
(TT_MAX_COMPOSITE_RECURSE): New macro.
(load_truetype_glyph): Add argument `recurse_count'.
Load a composite only if the numbers of contours is -1, emit error
otherwise.
(TT_Load_Glyph): Updated.
2003-01-08 David Turner <david@freetype.org>
@ -517,6 +551,9 @@
* include/freetype/tttables.h (FT_Load_Sfnt_Table): New function.
* src/base/ftobjs.c: Implement it.
* src/sfnt/sfdriver.c (sfnt_get_interface): Handle `load_sfnt'
module request.
2002-12-17 David Turner <david@freetype.org>
* src/base/ftobjs.c (find_unicode_charmap): Added some comments to
@ -4244,7 +4281,7 @@
* include/freetype/internal/ftmemory.h, src/base/ftdbgmem.c:
Improvements to the memory debugger to report more information in
case of errors. Also, some allocations that occured through REALLOC
case of errors. Also, some allocations that occurred through REALLOC
couldn't be previously catched correctly.
* src/autohint/ahglyph.c (ah_outline_compute_segments,
@ -4318,7 +4355,7 @@
* src/type1/t1load.c (parse_font_name, parse_subrs): Added a test
for when loading synthetic fonts to make sure that the font name
and subrotuines are not loaded twice. This is to remove a memory
leak that occured because the original memory blocks for these
leak that occurred because the original memory blocks for these
objects were not deallocated when the objects were parsed the
second time.
@ -5569,7 +5606,7 @@
* src/cff/cffobjs.c, src/cff/cffobjs.h, src/cff/cffparse.c,
src/cff/cffdrivr.c, src/cff/cff.c, src/cff/cffload.c,
src/cff/cffgload.c, src/cff/cffgload.h: Changed to use
cffgload.{c,h} instead of t2gload.{c,h}. All occurences of t2_
cffgload.{c,h} instead of t2gload.{c,h}. All occurrences of t2_
(T2_) were replaced with cff_ (CFF_, respectively).
* src/cff/t2gload.h: Renamed cffgload.h.

View File

@ -4,7 +4,7 @@
/* */
/* Auxiliary functions for PostScript fonts (body). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -178,8 +178,9 @@
while ( new_size < table->cursor + length )
{
/* increase size by 25% and round up to the nearest multiple of 1024 */
new_size += (new_size >> 2) + 1;
/* increase size by 25% and round up to the nearest multiple
of 1024 */
new_size += ( new_size >> 2 ) + 1;
new_size = ( new_size + 1023 ) & -1024;
}

View File

@ -4,7 +4,7 @@
/* */
/* PostScript hinting algorithm 3 (body). */
/* */
/* Copyright 2001, 2002 by */
/* Copyright 2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used */
@ -458,9 +458,9 @@
return;
}
/* perform stem snapping when requested - this is necessary
* for monochrome and LCD hinting modes only
*/
/* perform stem snapping when requested - this is necessary
* for monochrome and LCD hinting modes only
*/
do_snapping = ( dimension == 0 && glyph->do_horz_snapping ) ||
( dimension == 1 && glyph->do_vert_snapping );
@ -520,22 +520,22 @@
hint->cur_pos = pos;
hint->cur_len = fit_len;
/* stem adjustment tries to snap stem widths to standard
* ones. this is important to prevent unpleasant rounding
* artefacts...
*/
/* Stem adjustment tries to snap stem widths to standard
* ones. This is important to prevent unpleasant rounding
* artefacts.
*/
if ( glyph->do_stem_adjust )
{
if ( len <= 64 )
{
/* the stem is less than one pixel, we will center it
* around the nearest pixel center
*/
/* the stem is less than one pixel; we will center it
* around the nearest pixel center
*/
#if 1
pos = ( pos + (len >> 1) ) & -64;
pos = ( pos + ( len >> 1 ) ) & -64;
#else
/* this seems to be a bug !! */
pos = ( pos + ( (len >> 1) & -64 ) );
/* this seems to be a bug! */
pos = ( pos + ( ( len >> 1 ) & -64 ) );
#endif
len = 64;
}
@ -626,6 +626,7 @@
PSH_AlignmentRec align;
/* ignore stem alignments when requested through the hint flags */
if ( ( dimension == 0 && !glyph->do_horz_hints ) ||
( dimension == 1 && !glyph->do_vert_hints ) )
@ -684,53 +685,55 @@
if ( !psh3_hint_is_fitted( parent ) )
psh3_hint_align_light( parent, globals, dimension, glyph );
par_org_center = parent->org_pos + ( parent->org_len / 2);
par_cur_center = parent->cur_pos + ( parent->cur_len / 2);
cur_org_center = hint->org_pos + ( hint->org_len / 2);
par_org_center = parent->org_pos + ( parent->org_len / 2 );
par_cur_center = parent->cur_pos + ( parent->cur_len / 2 );
cur_org_center = hint->org_pos + ( hint->org_len / 2 );
cur_delta = FT_MulFix( cur_org_center - par_org_center, scale );
pos = par_cur_center + cur_delta - ( len >> 1 );
}
/* 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
* then snap the edge that is nearer to the pixel boundary
* to the pixel boundary
*/
if (len <= 64)
/* 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
* then snap the edge that is nearer to the pixel boundary
* to the pixel boundary.
*/
if ( len <= 64 )
{
if ( ( pos + len + 63 ) / 64 != pos / 64 + 1 )
pos += psh3_hint_snap_stem_side_delta ( pos, len );
}
/* Position stems other to minimize the amount of mid-grays.
* There are, in general, two positions that do this,
* illustrated as A) and B) below.
*
* + + + +
*
* A) |--------------------------------|
* B) |--------------------------------|
* C) |--------------------------------|
*
* Position A) (split the excess stem equally) should be better
* for stems of width N + f where f < 0.5
*
* Position B) (split the deficiency equally) should be better
* for stems of width N + f where f > 0.5
*
* It turns out though that minimizing the total number of lit
* pixels is also important, so position C), with one edge
* aligned with a pixel boundary is actually preferable
* to A). There are also more possibile positions for C) than
* for A) or B), so it involves less distortion of the overall
* character shape.
*/
/* Position stems other to minimize the amount of mid-grays.
* There are, in general, two positions that do this,
* illustrated as A) and B) below.
*
* + + + +
*
* A) |--------------------------------|
* B) |--------------------------------|
* C) |--------------------------------|
*
* Position A) (split the excess stem equally) should be better
* for stems of width N + f where f < 0.5.
*
* Position B) (split the deficiency equally) should be better
* for stems of width N + f where f > 0.5.
*
* It turns out though that minimizing the total number of lit
* pixels is also important, so position C), with one edge
* aligned with a pixel boundary is actually preferable
* to A). There are also more possibile positions for C) than
* for A) or B), so it involves less distortion of the overall
* character shape.
*/
else /* len > 64 */
{
FT_Fixed frac_len = len & 63;
FT_Fixed center = pos + ( len >> 1 );
FT_Fixed delta_a, delta_b;
FT_Fixed frac_len = len & 63;
FT_Fixed center = pos + ( len >> 1 );
FT_Fixed delta_a, delta_b;
if ( ( len / 64 ) & 1 )
{
@ -743,18 +746,20 @@
delta_b = ( center & -64 ) + 32 - center;
}
/* We choose between B) and C) above based on the amount
* of fractinal stem width; for small amounts, choose
* C) always, for large amounts, B) always, and inbetween,
* pick whichever one involves less stem movement.
*/
if (frac_len < 32)
/* We choose between B) and C) above based on the amount
* of fractinal stem width; for small amounts, choose
* C) always, for large amounts, B) always, and inbetween,
* pick whichever one involves less stem movement.
*/
if ( frac_len < 32 )
{
pos += psh3_hint_snap_stem_side_delta ( pos, len );
}
else if (frac_len < 48)
else if ( frac_len < 48 )
{
FT_Fixed side_delta = psh3_hint_snap_stem_side_delta ( pos, len );
FT_Fixed side_delta = psh3_hint_snap_stem_side_delta ( pos,
len );
if ( ABS( side_delta ) < ABS( delta_b ) )
pos += side_delta;