[autofit] Remove (unused) support for composite glyphs. We never have to deal with composite glyphs in the autohinter, as those will be loaded into FORMAT_OUTLINE by the recursed `FT_Load_Glyph' function. In the rare cases that FT_LOAD_NO_RECURSE is set, it will imply FT_LOAD_NO_SCALE as per `FT_Load_Glyph', which then implies FT_LOAD_NO_HINTING: /* resolve load flags dependencies */ if ( load_flags & FT_LOAD_NO_RECURSE ) load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM; if ( load_flags & FT_LOAD_NO_SCALE ) { load_flags |= FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP; load_flags &= ~FT_LOAD_RENDER; } and as such the auto-hinter is never called. Thus, the recursion in `af_loader_load_g' never actually happens. So remove the depth counter as well. * src/autofit/afloader.c (af_loader_load_g): Remove `depth' parameter. <FT_GLYPH_FORMAT_COMPOSITE>: Remove associated code. (af_loader_load_glyph): Updated.
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 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
diff --git a/ChangeLog b/ChangeLog
index 72e4a7c..ba8c3ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,40 @@
2015-01-14 Behdad Esfahbod <behdad@behdad.org>
+ [autofit] Remove (unused) support for composite glyphs.
+
+ We never have to deal with composite glyphs in the autohinter, as
+ those will be loaded into FORMAT_OUTLINE by the recursed
+ `FT_Load_Glyph' function.
+
+ In the rare cases that FT_LOAD_NO_RECURSE is set, it will imply
+ FT_LOAD_NO_SCALE as per `FT_Load_Glyph', which then implies
+ FT_LOAD_NO_HINTING:
+
+ /* resolve load flags dependencies */
+
+ if ( load_flags & FT_LOAD_NO_RECURSE )
+ load_flags |= FT_LOAD_NO_SCALE |
+ FT_LOAD_IGNORE_TRANSFORM;
+
+ if ( load_flags & FT_LOAD_NO_SCALE )
+ {
+ load_flags |= FT_LOAD_NO_HINTING |
+ FT_LOAD_NO_BITMAP;
+
+ load_flags &= ~FT_LOAD_RENDER;
+ }
+
+ and as such the auto-hinter is never called. Thus, the recursion in
+ `af_loader_load_g' never actually happens. So remove the depth
+ counter as well.
+
+ * src/autofit/afloader.c (af_loader_load_g): Remove `depth'
+ parameter.
+ <FT_GLYPH_FORMAT_COMPOSITE>: Remove associated code.
+ (af_loader_load_glyph): Updated.
+
+2015-01-14 Behdad Esfahbod <behdad@behdad.org>
+
[raster] Fix uninitialized memory access.
Apparently `ras.cProfile' might be uninitialized. This will be the
diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c
index 612103c..a4c4968 100644
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -89,16 +89,17 @@
}
- /* Load a single glyph component. This routine calls itself */
- /* recursively, if necessary, and does the main work of */
- /* `af_loader_load_glyph.' */
+ /* Do the main work of `af_loader_load_glyph'. Note that we never */
+ /* have to deal with composite glyphs as those get loaded into */
+ /* FT_GLYPH_FORMAT_OUTLINE by the recursed `FT_Load_Glyph' function. */
+ /* In the rare cases where FT_LOAD_NO_RECURSE is set, it implies */
+ /* FT_LOAD_NO_SCALE and as such the auto-hinter is never called. */
static FT_Error
af_loader_load_g( AF_Loader loader,
AF_Scaler scaler,
FT_UInt glyph_index,
- FT_Int32 load_flags,
- FT_UInt depth )
+ FT_Int32 load_flags )
{
FT_Error error;
FT_Face face = loader->face;
@@ -265,133 +266,12 @@
FT_GlyphLoader_Add( gloader );
break;
- case FT_GLYPH_FORMAT_COMPOSITE:
- {
- FT_UInt nn, num_subglyphs = slot->num_subglyphs;
- FT_UInt num_base_subgs, start_point;
- FT_SubGlyph subglyph;
-
-
- start_point = gloader->base.outline.n_points;
-
- /* first of all, copy the subglyph descriptors in the glyph loader */
- error = FT_GlyphLoader_CheckSubGlyphs( gloader, num_subglyphs );
- if ( error )
- goto Exit;
-
- FT_ARRAY_COPY( gloader->current.subglyphs,
- slot->subglyphs,
- num_subglyphs );
-
- gloader->current.num_subglyphs = num_subglyphs;
- num_base_subgs = gloader->base.num_subglyphs;
-
- /* now read each subglyph independently */
- for ( nn = 0; nn < num_subglyphs; nn++ )
- {
- FT_Vector pp1, pp2;
- FT_Pos x, y;
- FT_UInt num_points, num_new_points, num_base_points;
-
-
- /* gloader.current.subglyphs can change during glyph loading due */
- /* to re-allocation -- we must recompute the current subglyph on */
- /* each iteration */
- subglyph = gloader->base.subglyphs + num_base_subgs + nn;
-
- pp1 = loader->pp1;
- pp2 = loader->pp2;
-
- num_base_points = gloader->base.outline.n_points;
-
- error = af_loader_load_g( loader, scaler, subglyph->index,
- load_flags, depth + 1 );
- if ( error )
- goto Exit;
-
- /* recompute subglyph pointer */
- subglyph = gloader->base.subglyphs + num_base_subgs + nn;
-
- if ( !( subglyph->flags & FT_SUBGLYPH_FLAG_USE_MY_METRICS ) )
- {
- loader->pp1 = pp1;
- loader->pp2 = pp2;
- }
-
- num_points = gloader->base.outline.n_points;
- num_new_points = num_points - num_base_points;
-
- /* now perform the transformation required for this subglyph */
-
- if ( subglyph->flags & ( FT_SUBGLYPH_FLAG_SCALE |
- FT_SUBGLYPH_FLAG_XY_SCALE |
- FT_SUBGLYPH_FLAG_2X2 ) )
- {
- FT_Vector* cur = gloader->base.outline.points +
- num_base_points;
- FT_Vector* limit = cur + num_new_points;
-
-
- for ( ; cur < limit; cur++ )
- FT_Vector_Transform( cur, &subglyph->transform );
- }
-
- /* apply offset */
-
- if ( !( subglyph->flags & FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ) )
- {
- FT_Int k = subglyph->arg1;
- FT_UInt l = subglyph->arg2;
- FT_Vector* p1;
- FT_Vector* p2;
-
-
- if ( start_point + k >= num_base_points ||
- l >= (FT_UInt)num_new_points )
- {
- error = FT_THROW( Invalid_Composite );
- goto Exit;
- }
-
- l += num_base_points;
-
- /* for now, only use the current point coordinates; */
- /* we eventually may consider another approach */
- p1 = gloader->base.outline.points + start_point + k;
- p2 = gloader->base.outline.points + start_point + l;
-
- x = p1->x - p2->x;
- y = p1->y - p2->y;
- }
- else
- {
- x = FT_MulFix( subglyph->arg1, hints->x_scale ) + hints->x_delta;
- y = FT_MulFix( subglyph->arg2, hints->y_scale ) + hints->y_delta;
-
- x = FT_PIX_ROUND( x );
- y = FT_PIX_ROUND( y );
- }
-
- {
- FT_Outline dummy = gloader->base.outline;
-
-
- dummy.points += num_base_points;
- dummy.n_points = (short)num_new_points;
-
- FT_Outline_Translate( &dummy, x, y );
- }
- }
- }
- break;
-
default:
/* we don't support other formats (yet?) */
error = FT_THROW( Unimplemented_Feature );
}
Hint_Metrics:
- if ( depth == 0 )
{
FT_BBox bbox;
FT_Vector vvector;
@@ -558,7 +438,7 @@
goto Exit;
}
- error = af_loader_load_g( loader, &scaler, gindex, load_flags, 0 );
+ error = af_loader_load_g( loader, &scaler, gindex, load_flags );
}
}
Exit: