summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner <david@freetype.org>2001-05-16 17:49:07 +0000
committerDavid Turner <david@freetype.org>2001-05-16 17:49:07 +0000
commit9b00ad6469411de6a494d027b32a44777b2d8dd3 (patch)
treeda7e3f13b317378cb858eabf842343c657f55e73
parent8e86015f3955e3acc038b3f24a764da7fe76a394 (diff)
downloadfreetype2-9b00ad6469411de6a494d027b32a44777b2d8dd3.tar.gz
* src/truetype/ttgload.c (load_truetype_glyph): fixed a bug in the
composite loader spotted by Keith Packard.
-rw-r--r--ChangeLog5
-rw-r--r--src/base/ftobjs.c43
-rw-r--r--src/truetype/ttgload.c13
3 files changed, 38 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index e499c511c..ab801afd1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-05-16 David Turner <david@freetype.org>
+
+ * src/truetype/ttgload.c (load_truetype_glyph): fixed a bug in the
+ composite loader spotted by Keith Packard.
+
2001-05-14 David Turner <david@freetype.org>
* src/base/ftcalc.c (FT_DivFix): fixed a bug in the 64-bit code that
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 64bc0beee..00877f122 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -423,22 +423,23 @@
FT_Outline* current = &loader->current.outline;
FT_Bool adjust = 1;
- FT_UInt new_max;
+ FT_UInt new_max, old_max;
/* check points & tags */
new_max = base->n_points + current->n_points + n_points;
- if ( new_max > loader->max_points )
+ old_max = loader->max_points;
+
+ if ( new_max > old_max )
{
new_max = ( new_max + 7 ) & -8;
- if ( REALLOC_ARRAY( base->points, base->n_points,
- new_max, FT_Vector ) ||
- REALLOC_ARRAY( base->tags, base->n_points,
- new_max, FT_Byte ) )
+
+ if ( REALLOC_ARRAY( base->points, old_max, new_max, FT_Vector ) ||
+ REALLOC_ARRAY( base->tags, old_max, new_max, FT_Byte ) )
goto Exit;
if ( loader->use_extra &&
- REALLOC_ARRAY( loader->base.extra_points, base->n_points,
+ REALLOC_ARRAY( loader->base.extra_points, old_max,
new_max, FT_Vector ) )
goto Exit;
@@ -447,13 +448,13 @@
}
/* check contours */
+ old_max = loader->max_contours;
new_max = base->n_contours + current->n_contours +
n_contours;
- if ( new_max > loader->max_contours )
+ if ( new_max > old_max )
{
new_max = ( new_max + 3 ) & -4;
- if ( REALLOC_ARRAY( base->contours, base->n_contours,
- new_max, FT_Short ) )
+ if ( REALLOC_ARRAY( base->contours, old_max, new_max, FT_Short ) )
goto Exit;
adjust = 1;
@@ -478,18 +479,18 @@
{
FT_Memory memory = loader->memory;
FT_Error error = FT_Err_Ok;
- FT_UInt new_max;
+ FT_UInt new_max, old_max;
FT_GlyphLoad* base = &loader->base;
FT_GlyphLoad* current = &loader->current;
new_max = base->num_subglyphs + current->num_subglyphs + n_subs;
- if ( new_max > loader->max_subglyphs )
+ old_max = loader->max_subglyphs;
+ if ( new_max > old_max )
{
new_max = ( new_max + 1 ) & -2;
- if ( REALLOC_ARRAY( base->subglyphs, base->num_subglyphs,
- new_max, FT_SubGlyph ) )
+ if ( REALLOC_ARRAY( base->subglyphs, old_max, new_max, FT_SubGlyph ) )
goto Exit;
loader->max_subglyphs = new_max;
@@ -759,7 +760,7 @@
FT_Vector* delta )
{
FT_Face_Internal internal;
-
+
if ( !face )
return;
@@ -901,8 +902,8 @@
if ( ( load_flags & FT_LOAD_IGNORE_TRANSFORM ) == 0 )
{
FT_Face_Internal internal = face->internal;
-
-
+
+
/* now, transform the glyph image if needed */
if ( internal->transform_flags )
{
@@ -1066,7 +1067,7 @@
if ( ALLOC( internal, sizeof ( *internal ) ) )
goto Fail;
-
+
face->internal = internal;
face->driver = driver;
@@ -1299,13 +1300,13 @@
/* initialize internal face data */
{
FT_Face_Internal internal = face->internal;
-
+
internal->transform_matrix.xx = 0x10000L;
internal->transform_matrix.xy = 0;
internal->transform_matrix.yx = 0;
internal->transform_matrix.yy = 0x10000L;
-
+
internal->transform_delta.x = 0;
internal->transform_delta.y = 0;
}
@@ -1454,7 +1455,7 @@
goto Exit;
size->face = face;
-
+
/* for now, do not use any internal fields in size objects */
size->internal = 0;
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 7b287c581..ec81e1e73 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -891,6 +891,7 @@
if ( error )
goto Fail;
+ /* restore subglyph pointer */
subglyph = gloader->base.subglyphs + num_base_subgs + n;
if ( subglyph->flags & USE_MY_METRICS )
@@ -971,8 +972,16 @@
}
}
- translate_array( num_new_points, loader->zone.cur, x, y );
- cur_to_org( num_new_points, &loader->zone );
+ if ( x | y )
+ {
+ translate_array( num_new_points,
+ gloader->base.outline.points + num_base_points,
+ x, y );
+
+ translate_array( num_new_points,
+ gloader->base.extra_points + num_base_points,
+ x, y );
+ }
}
/*******************************************************************/