OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* t1gload.c */ | 3 /* t1gload.c */ |
4 /* */ | 4 /* */ |
5 /* Type 1 Glyph Loader (body). */ | 5 /* Type 1 Glyph Loader (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 1996-2006, 2008-2010, 2013 by */ | 7 /* Copyright 1996-2006, 2008-2010, 2013, 2014 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 /* */ | 9 /* */ |
10 /* This file is part of the FreeType project, and may only be used, */ | 10 /* This file is part of the FreeType project, and may only be used, */ |
11 /* modified, and distributed under the terms of the FreeType project */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
15 /* */ | 15 /* */ |
16 /***************************************************************************/ | 16 /***************************************************************************/ |
17 | 17 |
18 | 18 |
19 #include "../../include/ft2build.h" | 19 #include <ft2build.h> |
20 #include "t1gload.h" | 20 #include "t1gload.h" |
21 #include "../../include/freetype/internal/ftcalc.h" | 21 #include FT_INTERNAL_CALC_H |
22 #include "../../include/freetype/internal/ftdebug.h" | 22 #include FT_INTERNAL_DEBUG_H |
23 #include "../../include/freetype/internal/ftstream.h" | 23 #include FT_INTERNAL_STREAM_H |
24 #include "../../include/freetype/ftoutln.h" | 24 #include FT_OUTLINE_H |
25 #include "../../include/freetype/internal/psaux.h" | 25 #include FT_INTERNAL_POSTSCRIPT_AUX_H |
26 | 26 |
27 #include "t1errors.h" | 27 #include "t1errors.h" |
28 | 28 |
29 | 29 |
30 /*************************************************************************/ | 30 /*************************************************************************/ |
31 /* */ | 31 /* */ |
32 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ | 32 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ |
33 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ | 33 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ |
34 /* messages during execution. */ | 34 /* messages during execution. */ |
35 /* */ | 35 /* */ |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 decoder.buildchar = face->buildchar; | 187 decoder.buildchar = face->buildchar; |
188 decoder.len_buildchar = face->len_buildchar; | 188 decoder.len_buildchar = face->len_buildchar; |
189 | 189 |
190 *max_advance = 0; | 190 *max_advance = 0; |
191 | 191 |
192 /* for each glyph, parse the glyph charstring and extract */ | 192 /* for each glyph, parse the glyph charstring and extract */ |
193 /* the advance width */ | 193 /* the advance width */ |
194 for ( glyph_index = 0; glyph_index < type1->num_glyphs; glyph_index++ ) | 194 for ( glyph_index = 0; glyph_index < type1->num_glyphs; glyph_index++ ) |
195 { | 195 { |
196 /* now get load the unscaled outline */ | 196 /* now get load the unscaled outline */ |
197 error = T1_Parse_Glyph( &decoder, glyph_index ); | 197 (void)T1_Parse_Glyph( &decoder, glyph_index ); |
198 if ( glyph_index == 0 || decoder.builder.advance.x > *max_advance ) | 198 if ( glyph_index == 0 || decoder.builder.advance.x > *max_advance ) |
199 *max_advance = decoder.builder.advance.x; | 199 *max_advance = decoder.builder.advance.x; |
200 | 200 |
201 /* ignore the error if one occurred - skip to next glyph */ | 201 /* ignore the error if one occurred - skip to next glyph */ |
202 } | 202 } |
203 | 203 |
204 psaux->t1_decoder_funcs->done( &decoder ); | 204 psaux->t1_decoder_funcs->done( &decoder ); |
205 | 205 |
206 return FT_Err_Ok; | 206 return FT_Err_Ok; |
207 } | 207 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 T1_GlyphSlot glyph = (T1_GlyphSlot)t1glyph; | 274 T1_GlyphSlot glyph = (T1_GlyphSlot)t1glyph; |
275 FT_Error error; | 275 FT_Error error; |
276 T1_DecoderRec decoder; | 276 T1_DecoderRec decoder; |
277 T1_Face face = (T1_Face)t1glyph->face; | 277 T1_Face face = (T1_Face)t1glyph->face; |
278 FT_Bool hinting; | 278 FT_Bool hinting; |
279 T1_Font type1 = &face->type1; | 279 T1_Font type1 = &face->type1; |
280 PSAux_Service psaux = (PSAux_Service)face->psaux; | 280 PSAux_Service psaux = (PSAux_Service)face->psaux; |
281 const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs; | 281 const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs; |
282 | 282 |
283 FT_Matrix font_matrix; | 283 FT_Matrix font_matrix; |
284 FT_Vector font_offset = {0, 0}; | 284 FT_Vector font_offset; |
285 FT_Data glyph_data; | 285 FT_Data glyph_data; |
286 FT_Bool must_finish_decoder = FALSE; | 286 FT_Bool must_finish_decoder = FALSE; |
287 #ifdef FT_CONFIG_OPTION_INCREMENTAL | 287 #ifdef FT_CONFIG_OPTION_INCREMENTAL |
288 FT_Bool glyph_data_loaded = 0; | 288 FT_Bool glyph_data_loaded = 0; |
289 #endif | 289 #endif |
290 | 290 |
291 | 291 |
292 #ifdef FT_CONFIG_OPTION_INCREMENTAL | 292 #ifdef FT_CONFIG_OPTION_INCREMENTAL |
293 if ( glyph_index >= (FT_UInt)face->root.num_glyphs && | 293 if ( glyph_index >= (FT_UInt)face->root.num_glyphs && |
294 !face->root.internal->incremental_interface ) | 294 !face->root.internal->incremental_interface ) |
295 #else | 295 #else |
296 if ( glyph_index >= (FT_UInt)face->root.num_glyphs ) | 296 if ( glyph_index >= (FT_UInt)face->root.num_glyphs ) |
297 #endif /* FT_CONFIG_OPTION_INCREMENTAL */ | 297 #endif /* FT_CONFIG_OPTION_INCREMENTAL */ |
298 { | 298 { |
299 error = FT_THROW( Invalid_Argument ); | 299 error = FT_THROW( Invalid_Argument ); |
300 goto Exit; | 300 goto Exit; |
301 } | 301 } |
302 | 302 |
| 303 FT_TRACE1(( "T1_Load_Glyph: glyph index %d\n", glyph_index )); |
| 304 |
303 FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) ); | 305 FT_ASSERT( ( face->len_buildchar == 0 ) == ( face->buildchar == NULL ) ); |
304 | 306 |
305 if ( load_flags & FT_LOAD_NO_RECURSE ) | 307 if ( load_flags & FT_LOAD_NO_RECURSE ) |
306 load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; | 308 load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; |
307 | 309 |
308 if ( t1size ) | 310 if ( t1size ) |
309 { | 311 { |
310 glyph->x_scale = t1size->metrics.x_scale; | 312 glyph->x_scale = t1size->metrics.x_scale; |
311 glyph->y_scale = t1size->metrics.y_scale; | 313 glyph->y_scale = t1size->metrics.y_scale; |
312 } | 314 } |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 #endif | 510 #endif |
509 | 511 |
510 if ( must_finish_decoder ) | 512 if ( must_finish_decoder ) |
511 decoder_funcs->done( &decoder ); | 513 decoder_funcs->done( &decoder ); |
512 | 514 |
513 return error; | 515 return error; |
514 } | 516 } |
515 | 517 |
516 | 518 |
517 /* END */ | 519 /* END */ |
OLD | NEW |