* src/truetype/ttgload.c (load_truetype_glyph): fixed a bug in the composite loader spotted by Keith Packard.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
diff --git a/ChangeLog b/ChangeLog
index e499c51..ab801af 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 64bc0be..00877f1 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 7b287c5..ec81e1e 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 );
+ }
}
/*******************************************************************/