* src/autohint/ahglyph.h, src/autohint/ahglyph.c, src/autohint/ahglobal.c,

src/autohint/ahhint.c: fixed blue-scale problem

    * src/cache/ftccache.c: fixed small bug that could crash the cache
    in rare circumstances (mostly with broken fonts)
This commit is contained in:
David Turner 2003-03-20 20:58:57 +00:00
parent 956884724d
commit 389a365b09
6 changed files with 71 additions and 46 deletions

View File

@ -2,6 +2,26 @@
* docs/*: serious rewriting of the documentation
* include/freetype/internal/ftobjs.h, src/base/ftobjs.c, src/bdf/bdfdrivr.c,
src/pcf/pcfdriver.c, src/pfr/pfrsbit.c, src/sfnt/ttsbit.c,
src/type42/t42objs.c, src/winfonts/winfnt.c: introduced three new functions
to deal with glyph bitmaps within FT_GlyphSlot objects. these are:
ft_glyphslot_free_bitmap
ft_glyphslot_alloc_bitmap
ft_glyphslot_set_bitmap
these are much more convenient to use than managing the FT_GLYPH_OWN_BITMAP
flag manually. the font drivers have been modified to use them as well.
* src/cache/ftlru.c: fixed an invalid assertion check
* src/autohint/ahglyph.h, src/autohint/ahglyph.c, src/autohint/ahglobal.c,
src/autohint/ahhint.c: fixed blue-scale problem
* src/cache/ftccache.c: fixed small bug that could crash the cache
in rare circumstances (mostly with broken fonts)
2003-03-15 David Turner <david@freetype.org>

View File

@ -323,7 +323,7 @@
if ( error )
goto Exit;
error = ah_outline_load( hinter->glyph, hinter->face );
error = ah_outline_load( hinter->glyph, 0x10000L, 0x10000L, hinter->face );
if ( error )
goto Exit;

View File

@ -389,6 +389,8 @@
/* */
FT_LOCAL_DEF( FT_Error )
ah_outline_load( AH_Outline outline,
FT_Fixed x_scale,
FT_Fixed y_scale,
FT_Face face )
{
FT_Memory memory = outline->memory;
@ -461,8 +463,8 @@
outline->horz_major_dir = AH_DIR_RIGHT;
}
outline->x_scale = face->size->metrics.x_scale;
outline->y_scale = face->size->metrics.y_scale;
outline->x_scale = x_scale;
outline->y_scale = y_scale;
points = outline->points;
if ( outline->num_points == 0 )
@ -478,8 +480,6 @@
/* compute coordinates */
{
FT_Vector* vec = source->points;
FT_Fixed x_scale = outline->x_scale;
FT_Fixed y_scale = outline->y_scale;
for ( point = points; point < point_limit; vec++, point++ )

View File

@ -58,6 +58,8 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Error )
ah_outline_load( AH_Outline outline,
FT_Fixed x_scale,
FT_Fixed y_scale,
FT_Face face );
FT_LOCAL( void )

View File

@ -1391,7 +1391,7 @@
/* now, load the slot image into the auto-outline, and run the */
/* automatic hinting process */
error = ah_outline_load( outline, face ); /* XXX: change to slot */
error = ah_outline_load( outline, x_scale, y_scale, face );
if ( error )
goto Exit;

83
src/cache/ftccache.c vendored
View File

@ -362,7 +362,7 @@
if ( manager->num_nodes == 0 )
FT_ERROR(( "ftc_node_destroy: invalid cache node count! = %d\n",
manager->num_nodes ));
#endif
#endif
}
@ -407,11 +407,14 @@
FT_EXPORT_DEF( void )
ftc_family_done( FTC_Family family )
{
FTC_Manager manager = family->cache->manager;
if ( family && family->cache )
{
FTC_Manager manager = family->cache->manager;
/* remove from manager's family table */
ftc_family_table_free( &manager->families, family->fam_index );
/* remove from manager's family table */
ftc_family_table_free( &manager->families, family->fam_index );
}
}
@ -592,7 +595,7 @@
FT_LruList list = cache->families;
FT_LruNode fam, *pfam;
FT_LruNode_CompareFunc compare = list->clazz->node_compare;
pfam = &list->nodes;
for (;;)
{
@ -602,18 +605,18 @@
error = FT_LruList_Lookup( list, query, &lru );
if ( error )
goto Fail;
goto Skip;
}
if ( compare( fam, query, list->data ) )
break;
pfam = &fam->next;
}
FT_ASSERT( fam != NULL );
/* move to top of list when needed */
if ( fam != list->nodes )
{
@ -621,9 +624,9 @@
fam->next = list->nodes;
list->nodes = fam;
}
lru = fam;
Skip:
;
}
@ -634,15 +637,15 @@
FT_UFast hash = query->hash;
FTC_Node* bucket;
FT_UInt idx;
idx = hash & cache->mask;
if ( idx < cache->p )
idx = hash & ( cache->mask * 2 + 1 );
bucket = cache->buckets + idx;
if ( query->family != family ||
family->fam_index >= manager->families.size )
{
@ -651,22 +654,22 @@
error = FTC_Err_Invalid_Argument;
goto Exit;
}
if ( *bucket )
{
FTC_Node* pnode = bucket;
FTC_Node_CompareFunc compare = cache->clazz->node_compare;
for ( ;; )
{
FTC_Node node;
node = *pnode;
if ( node == NULL )
break;
if ( node->hash == hash &&
(FT_UInt)node->fam_index == family->fam_index &&
compare( node, query, cache ) )
@ -678,40 +681,40 @@
node->link = *bucket;
*bucket = node;
}
/* move to head of MRU list */
if ( node != manager->nodes_list )
ftc_node_mru_up( node, manager );
*anode = node;
goto Exit;
}
pnode = &node->link;
}
}
/* didn't find a node, create a new one */
{
FTC_Cache_Class clazz = cache->clazz;
FT_Memory memory = cache->memory;
FTC_Node node;
if ( FT_ALLOC( node, clazz->node_size ) )
goto Fail;
node->fam_index = (FT_UShort) family->fam_index;
node->hash = query->hash;
node->ref_count = 0;
error = clazz->node_init( node, query, cache );
if ( error )
{
FT_FREE( node );
goto Fail;
}
error = ftc_node_hash_link( node, cache );
if ( error )
{
@ -719,11 +722,11 @@
FT_FREE( node );
goto Fail;
}
ftc_node_mru_link( node, cache->manager );
cache->manager->cur_weight += clazz->node_weight( node, cache );
/* now try to compress the node pool when necessary */
if ( manager->cur_weight >= manager->max_weight )
{
@ -731,19 +734,19 @@
FTC_Manager_Compress( manager );
node->ref_count--;
}
*anode = node;
}
/* all is well, exit now
*/
goto Exit;
}
Fail:
if ( error != FT_Err_Out_Of_Memory )
goto Exit;
/* there is not enough memory, try to release some unused nodes
* from the cache to make room for a new one.
*/
@ -757,7 +760,7 @@
goto Exit;
free_count = new_count;
/* try to remove "new_count" nodes from the list */
{
FTC_Node first = manager->nodes_list;
@ -781,7 +784,7 @@
/* if there are no unused nodes in the list, we'd better exit */
if ( new_count == free_count )
goto Exit;
break;
}