* src/truetype/ttgload.c (load_truetype_glyph): Fix compiler warnings. Formatting.
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 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
diff --git a/ChangeLog b/ChangeLog
index e2bcad9..5339b07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-19 Werner Lemberg <wl@gnu.org>
+
+ * src/truetype/ttgload.c (load_truetype_glyph): Fix compiler
+ warnings.
+
2005-08-16 Chia I Wu <b90201047@ntu.edu.tw>
* src/truetype/ttinterp.c, src/truetype/ttinterp.h: Update copyright
@@ -6,37 +11,48 @@
2005-08-16 Chia I Wu <b90201047@ntu.edu.tw>
* src/truetype/ttinterp.c, src/truetype/ttinterp.h: Remove original
- TT_Done_Context and rename TT_Destroy_Context to TT_Done_Context with
- slight changes.
+ TT_Done_Context and rename TT_Destroy_Context to TT_Done_Context
+ with slight changes.
+ Update all callers.
+ (TT_New_Context): Now takes TT_Driver argument directly.
+ Update all callers.
* src/truetype/ttobjs.h (tt_slot_init): New function.
-
- * src/truetype/ttobjs.c (tt_driver_init): Initialize execution context
- here.
+ * src/truetype/ttobjs.c (tt_driver_init): Initialize execution
+ context here.
(tt_slot_init): New function to create extra points for the internal
- glyph loader. We then use it directly, instead of face's glyph loader,
- when loading glyph.
+ glyph loader. We then use it directly, instead of face's glyph
+ loader, when loading glyph.
- * src/truetype/ttdriver.c: Use tt_slot_init for glyph slot
- initialization.
- (TT_Load_Glyph): Load flag dependencies are handled here.
- Return error if size is NULL.
+ * src/truetype/ttdriver.c (tt_driver_class): Use tt_slot_init for
+ glyph slot initialization.
+ (Load_Glyph): Load flag dependencies are handled here. Return error
+ if size is NULL.
- * src/truetype/ttgload.c: Heavy cleanup and refactor.
+ * src/truetype/ttgload.c: Heavy cleanup and refactoring.
+ (org_to_cur): Removed.
+ (TT_Load_Simple_Glyph): Call FT_GlyphLoader_CheckPoints.
(TT_Hint_Glyph): New funcion to hint a zone, prepared by caller.
- (TT_Process_Simple_Glyph): Use loader->pp's instead of recalculating.
+ (TT_Process_Simple_Glyph): s/load/loader/.
+ Use loader->pp values instead of recalculation.
Use TT_Hint_Glyph.
- No need to save/restore loader->stream before/after
+ No need to save/restore loader->stream before and after
TT_Vary_Get_Glyph_Deltas now.
- (TT_LOADER_SET_PP): New macro to calculate and set the four phantom points.
- (TT_Process_Composite_Component, TT_Process_Composite_Glyph,
- load_truetype_glyph): Refactor load_truetype_glyph into these three functions.
- Never set exec->glyphSize to 0. (close #13107)
+ (TT_LOADER_SET_PP): New macro to calculate and set the four phantom
+ points.
+ (load_truetype_glyph): Never set exec->glyphSize to 0. This closes
+ Savannah bug #13107.
Forget glyph frame before calling TT_Process_Simple_Glyph.
- (TT_Load_Glyph, load_sbit_image, tt_loader_init): Refactor TT_Load_Glyph into
- these three functions.
- Set various fields of `glyph' here, instead of in load_truetype_glyph
- and compute_glyph_metrics.
+ Use TT_LOADER_SET_PP.
+ Scale all four phantom points.
+ Split off some functionality to ...
+ (TT_Process_Composite_Component, TT_Process_Composite_Glyph): These
+ new functions.
+ (TT_Load_Glyph): Set various fields of `glyph' here, not in
+ load_truetype_glyph and compute_glyph_metrics.
+ Split off some functionality to ...
+ (load_sbit_image, tt_loader_init): These new functions.
+ (compute_glyph_metrics): Call FT_Outline_Get_CBox.
2005-08-08 Werner Lemberg <wl@gnu.org>
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index c3dbcfd..dd4264d 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -955,14 +955,14 @@
FT_Pos x, y;
- have_scale = ( subglyph->flags & ( WE_HAVE_A_SCALE |
- WE_HAVE_AN_XY_SCALE |
- WE_HAVE_A_2X2 ) );
+ have_scale = subglyph->flags & ( WE_HAVE_A_SCALE |
+ WE_HAVE_AN_XY_SCALE |
+ WE_HAVE_A_2X2 );
/* perform the transform required for this subglyph */
if ( have_scale )
{
- FT_UInt i;
+ FT_UInt i;
for ( i = num_base_points; i < num_points; i++ )
@@ -978,17 +978,15 @@
FT_Vector* p2;
- /* match l-th point of the newly loaded component to the k-th point of */
- /* the previously loaded components. */
+ /* match l-th point of the newly loaded component to the k-th point */
+ /* of the previously loaded components. */
/* change to the point numbers used by our outline */
k += start_point;
l += num_base_points;
- if ( k >= (FT_UInt)num_base_points ||
- l >= (FT_UInt)num_points )
- {
+ if ( k >= num_base_points ||
+ l >= num_points )
return TT_Err_Invalid_Composite;
- }
p1 = gloader->base.outline.points + k;
p2 = gloader->base.outline.points + l;
@@ -1004,9 +1002,9 @@
if ( !x && !y )
return TT_Err_Ok;
-/* Use a default value dependent on */
-/* TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED. This is useful for old TT */
-/* fonts which don't set the xxx_COMPONENT_OFFSET bit. */
+ /* Use a default value dependent on */
+ /* TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED. This is useful for old TT */
+ /* fonts which don't set the xxx_COMPONENT_OFFSET bit. */
if ( have_scale &&
#ifdef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
@@ -1017,10 +1015,10 @@
{
#if 0
-/*************************************************************************/
-/* */
-/* This algorithm is what Apple documents. But it doesn't work. */
-/* */
+ /*************************************************************************/
+ /* */
+ /* This algorithm is what Apple documents. But it doesn't work. */
+ /* */
int a = subglyph->transform.xx > 0 ? subglyph->transform.xx
: -subglyph->transform.xx;
int b = subglyph->transform.yx > 0 ? subglyph->transform.yx
@@ -1042,10 +1040,10 @@
#else /* 0 */
-/*************************************************************************/
-/* */
-/* This algorithm is a guess and works much better than the above. */
-/* */
+ /*************************************************************************/
+ /* */
+ /* This algorithm is a guess and works much better than the above. */
+ /* */
FT_Fixed mac_xscale = FT_SqrtFixed(
FT_MulFix( subglyph->transform.xx,
subglyph->transform.xx ) +
@@ -1067,8 +1065,8 @@
if ( !( loader->load_flags & FT_LOAD_NO_SCALE ) )
{
- FT_Fixed x_scale = ((TT_Size)loader->size)->metrics.x_scale;
- FT_Fixed y_scale = ((TT_Size)loader->size)->metrics.y_scale;
+ FT_Fixed x_scale = ((TT_Size)loader->size)->metrics.x_scale;
+ FT_Fixed y_scale = ((TT_Size)loader->size)->metrics.y_scale;
x = FT_MulFix( x, x_scale );
@@ -1113,7 +1111,9 @@
outline = &loader->gloader->base.outline;
/* make room for phantom points */
- error = FT_GlyphLoader_CheckPoints( loader->gloader, outline->n_points + 4, 0 );
+ error = FT_GlyphLoader_CheckPoints( loader->gloader,
+ outline->n_points + 4,
+ 0 );
if ( error )
return error;
@@ -1137,7 +1137,7 @@
/* TT_Load_Composite_Glyph only gives us the offset of instructions */
/* so we read them here */
if ( FT_STREAM_SEEK( loader->ins_pos ) ||
- FT_READ_USHORT( n_ins ) )
+ FT_READ_USHORT( n_ins ) )
return error;
FT_TRACE5(( " Instructions size = %d\n", n_ins ));
@@ -1161,7 +1161,8 @@
#endif
- tt_prepare_zone( &loader->zone, &loader->gloader->base, start_point, start_contour );
+ tt_prepare_zone( &loader->zone, &loader->gloader->base,
+ start_point, start_contour );
loader->zone.n_points += 4;
return TT_Hint_Glyph( loader, 1 );
@@ -1283,9 +1284,10 @@
goto Exit;
left_bearing = (FT_Short)metrics.bearing_x;
advance_width = (FT_UShort)metrics.advance;
+
# if 0
- /* GWW: Do I do the same for vertical metrics ??? */
+ /* GWW: Do I do the same for vertical metrics ??? */
metrics.bearing_x = 0;
metrics.bearing_y = top_bearing;
metrics.advance = advance_height;
@@ -1316,7 +1318,7 @@
}
/* Set `offset' to the start of the glyph relative to the start of */
- /* the 'glyf' table, and `byte_len' to the length of the glyph in */
+ /* the `glyf' table, and `byte_len' to the length of the glyph in */
/* bytes. */
#ifdef FT_CONFIG_OPTION_INCREMENTAL
@@ -1346,7 +1348,8 @@
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
- offset = tt_face_get_location( face, glyph_index, (FT_UInt*)&loader->byte_len );
+ offset = tt_face_get_location( face, glyph_index,
+ (FT_UInt*)&loader->byte_len );
if ( loader->byte_len == 0 )
{
@@ -1525,7 +1528,7 @@
/*********************************************************************/
{
- FT_Int n, num_base_points;
+ FT_UInt n, num_base_points;
FT_SubGlyph subglyph = 0;
FT_UInt num_points = start_point;
@@ -1536,7 +1539,7 @@
FT_GlyphLoader_Add( gloader );
/* read each subglyph independently */
- for ( n = 0; n < (FT_Int)num_subglyphs; n++ )
+ for ( n = 0; n < num_subglyphs; n++ )
{
FT_Vector pp[4];
@@ -1815,6 +1818,7 @@
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+
static FT_Error
load_sbit_image( TT_Size size,
TT_GlyphSlot glyph,
@@ -1827,6 +1831,7 @@
FT_Error error;
TT_SBit_MetricsRec metrics;
+
face = (TT_Face)glyph->face;
sfnt = (SFNT_Service)face->sfnt;
stream = face->root.stream;
@@ -1869,7 +1874,8 @@
return error;
}
-#endif
+
+#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
static FT_Error
@@ -1878,11 +1884,11 @@
TT_GlyphSlot glyph,
FT_Int32 load_flags )
{
- TT_Face face;
- FT_Stream stream;
+ TT_Face face;
+ FT_Stream stream;
- face = (TT_Face)glyph->face;
+ face = (TT_Face)glyph->face;
stream = face->root.stream;
FT_MEM_ZERO( loader, sizeof ( TT_LoaderRec ) );
@@ -1934,6 +1940,8 @@
{
FT_Error error = face->goto_table( face, TTAG_glyf, stream, 0 );
+
+
if ( error )
{
FT_ERROR(( "TT_Load_Glyph: could not access glyph table\n" ));
@@ -1946,6 +1954,7 @@
{
FT_GlyphLoader gloader = glyph->internal->loader;
+
FT_GlyphLoader_Rewind( gloader );
loader->gloader = gloader;
}
@@ -2010,7 +2019,7 @@
/* */
/* XXX: The convention should be emphasized in */
/* the documents because it can be confusing. */
- if ( size->strike_index != 0xFFFFU &&
+ if ( size->strike_index != 0xFFFFU &&
( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
{
error = load_sbit_image( size, glyph, glyph_index, load_flags );
@@ -2042,7 +2051,7 @@
}
else
{
- glyph->outline = loader.gloader->base.outline;
+ glyph->outline = loader.gloader->base.outline;
glyph->outline.flags &= ~FT_OUTLINE_SINGLE_PASS;
/* translate array so that (0,0) is the glyph's origin */
diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h
index 17491a0..71ed88e 100644
--- a/src/truetype/ttobjs.h
+++ b/src/truetype/ttobjs.h
@@ -444,7 +444,7 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
- /* Slot functions */
+ /* Slot functions */
/* */
FT_LOCAL( FT_Error )
tt_slot_init( FT_GlyphSlot slot );