OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* t1objs.c */ | 3 /* t1objs.c */ |
4 /* */ | 4 /* */ |
5 /* Type 1 objects manager (body). */ | 5 /* Type 1 objects manager (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 1996-2009, 2011, 2013 by */ | 7 /* Copyright 1996-2015 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 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 if ( size->root.internal ) | 80 if ( size->root.internal ) |
81 { | 81 { |
82 PSH_Globals_Funcs funcs; | 82 PSH_Globals_Funcs funcs; |
83 | 83 |
84 | 84 |
85 funcs = T1_Size_Get_Globals_Funcs( size ); | 85 funcs = T1_Size_Get_Globals_Funcs( size ); |
86 if ( funcs ) | 86 if ( funcs ) |
87 funcs->destroy( (PSH_Globals)size->root.internal ); | 87 funcs->destroy( (PSH_Globals)size->root.internal ); |
88 | 88 |
89 size->root.internal = 0; | 89 size->root.internal = NULL; |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 | 93 |
94 FT_LOCAL_DEF( FT_Error ) | 94 FT_LOCAL_DEF( FT_Error ) |
95 T1_Size_Init( FT_Size t1size ) /* T1_Size */ | 95 T1_Size_Init( FT_Size t1size ) /* T1_Size */ |
96 { | 96 { |
97 T1_Size size = (T1_Size)t1size; | 97 T1_Size size = (T1_Size)t1size; |
98 FT_Error error = FT_Err_Ok; | 98 FT_Error error = FT_Err_Ok; |
99 PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size ); | 99 PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size ); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 /*************************************************************************/ | 138 /*************************************************************************/ |
139 /* */ | 139 /* */ |
140 /* SLOT FUNCTIONS */ | 140 /* SLOT FUNCTIONS */ |
141 /* */ | 141 /* */ |
142 /*************************************************************************/ | 142 /*************************************************************************/ |
143 | 143 |
144 FT_LOCAL_DEF( void ) | 144 FT_LOCAL_DEF( void ) |
145 T1_GlyphSlot_Done( FT_GlyphSlot slot ) | 145 T1_GlyphSlot_Done( FT_GlyphSlot slot ) |
146 { | 146 { |
147 slot->internal->glyph_hints = 0; | 147 slot->internal->glyph_hints = NULL; |
148 } | 148 } |
149 | 149 |
150 | 150 |
151 FT_LOCAL_DEF( FT_Error ) | 151 FT_LOCAL_DEF( FT_Error ) |
152 T1_GlyphSlot_Init( FT_GlyphSlot slot ) | 152 T1_GlyphSlot_Init( FT_GlyphSlot slot ) |
153 { | 153 { |
154 T1_Face face; | 154 T1_Face face; |
155 PSHinter_Service pshinter; | 155 PSHinter_Service pshinter; |
156 | 156 |
157 | 157 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 if ( face->buildchar ) | 218 if ( face->buildchar ) |
219 { | 219 { |
220 FT_FREE( face->buildchar ); | 220 FT_FREE( face->buildchar ); |
221 | 221 |
222 face->buildchar = NULL; | 222 face->buildchar = NULL; |
223 face->len_buildchar = 0; | 223 face->len_buildchar = 0; |
224 } | 224 } |
225 | 225 |
226 T1_Done_Blend( face ); | 226 T1_Done_Blend( face ); |
227 face->blend = 0; | 227 face->blend = NULL; |
228 #endif | 228 #endif |
229 | 229 |
230 /* release font info strings */ | 230 /* release font info strings */ |
231 { | 231 { |
232 PS_FontInfo info = &type1->font_info; | 232 PS_FontInfo info = &type1->font_info; |
233 | 233 |
234 | 234 |
235 FT_FREE( info->version ); | 235 FT_FREE( info->version ); |
236 FT_FREE( info->notice ); | 236 FT_FREE( info->notice ); |
237 FT_FREE( info->full_name ); | 237 FT_FREE( info->full_name ); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 /* open the tokenizer; this will also check the font format */ | 338 /* open the tokenizer; this will also check the font format */ |
339 error = T1_Open_Face( face ); | 339 error = T1_Open_Face( face ); |
340 if ( error ) | 340 if ( error ) |
341 goto Exit; | 341 goto Exit; |
342 | 342 |
343 /* if we just wanted to check the format, leave successfully now */ | 343 /* if we just wanted to check the format, leave successfully now */ |
344 if ( face_index < 0 ) | 344 if ( face_index < 0 ) |
345 goto Exit; | 345 goto Exit; |
346 | 346 |
347 /* check the face index */ | 347 /* check the face index */ |
348 if ( face_index > 0 ) | 348 if ( ( face_index & 0xFFFF ) > 0 ) |
349 { | 349 { |
350 FT_ERROR(( "T1_Face_Init: invalid face index\n" )); | 350 FT_ERROR(( "T1_Face_Init: invalid face index\n" )); |
351 error = FT_THROW( Invalid_Argument ); | 351 error = FT_THROW( Invalid_Argument ); |
352 goto Exit; | 352 goto Exit; |
353 } | 353 } |
354 | 354 |
355 /* now load the font program into the face object */ | 355 /* now load the font program into the face object */ |
356 | 356 |
357 /* initialize the face object fields */ | 357 /* initialize the face object fields */ |
358 | 358 |
359 /* set up root face fields */ | 359 /* set up root face fields */ |
360 { | 360 { |
361 FT_Face root = (FT_Face)&face->root; | 361 FT_Face root = (FT_Face)&face->root; |
362 | 362 |
363 | 363 |
364 root->num_glyphs = type1->num_glyphs; | 364 root->num_glyphs = type1->num_glyphs; |
365 root->face_index = 0; | 365 root->face_index = 0; |
366 | 366 |
367 root->face_flags |= FT_FACE_FLAG_SCALABLE | | 367 root->face_flags |= FT_FACE_FLAG_SCALABLE | |
368 FT_FACE_FLAG_HORIZONTAL | | 368 FT_FACE_FLAG_HORIZONTAL | |
369 FT_FACE_FLAG_GLYPH_NAMES | | 369 FT_FACE_FLAG_GLYPH_NAMES | |
370 FT_FACE_FLAG_HINTER; | 370 FT_FACE_FLAG_HINTER; |
371 | 371 |
372 if ( info->is_fixed_pitch ) | 372 if ( info->is_fixed_pitch ) |
373 root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; | 373 root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; |
374 | 374 |
375 if ( face->blend ) | 375 if ( face->blend ) |
376 root->face_flags |= FT_FACE_FLAG_MULTIPLE_MASTERS; | 376 root->face_flags |= FT_FACE_FLAG_MULTIPLE_MASTERS; |
377 | 377 |
378 /* XXX: TODO -- add kerning with .afm support */ | |
379 | |
380 | |
381 /* The following code to extract the family and the style is very */ | 378 /* The following code to extract the family and the style is very */ |
382 /* simplistic and might get some things wrong. For a full-featured */ | 379 /* simplistic and might get some things wrong. For a full-featured */ |
383 /* algorithm you might have a look at the whitepaper given at */ | 380 /* algorithm you might have a look at the whitepaper given at */ |
384 /* */ | 381 /* */ |
385 /* http://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-mode
l.aspx */ | 382 /* http://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-mode
l.aspx */ |
386 | 383 |
387 /* get style name -- be careful, some broken fonts only */ | 384 /* get style name -- be careful, some broken fonts only */ |
388 /* have a `/FontName' dictionary entry! */ | 385 /* have a `/FontName' dictionary entry! */ |
389 root->family_name = info->family_name; | 386 root->family_name = info->family_name; |
390 root->style_name = NULL; | 387 root->style_name = NULL; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 root->style_flags |= FT_STYLE_FLAG_ITALIC; | 447 root->style_flags |= FT_STYLE_FLAG_ITALIC; |
451 if ( info->weight ) | 448 if ( info->weight ) |
452 { | 449 { |
453 if ( !ft_strcmp( info->weight, "Bold" ) || | 450 if ( !ft_strcmp( info->weight, "Bold" ) || |
454 !ft_strcmp( info->weight, "Black" ) ) | 451 !ft_strcmp( info->weight, "Black" ) ) |
455 root->style_flags |= FT_STYLE_FLAG_BOLD; | 452 root->style_flags |= FT_STYLE_FLAG_BOLD; |
456 } | 453 } |
457 | 454 |
458 /* no embedded bitmap support */ | 455 /* no embedded bitmap support */ |
459 root->num_fixed_sizes = 0; | 456 root->num_fixed_sizes = 0; |
460 root->available_sizes = 0; | 457 root->available_sizes = NULL; |
461 | 458 |
462 root->bbox.xMin = type1->font_bbox.xMin >> 16; | 459 root->bbox.xMin = type1->font_bbox.xMin >> 16; |
463 root->bbox.yMin = type1->font_bbox.yMin >> 16; | 460 root->bbox.yMin = type1->font_bbox.yMin >> 16; |
464 /* no `U' suffix here to 0xFFFF! */ | 461 /* no `U' suffix here to 0xFFFF! */ |
465 root->bbox.xMax = ( type1->font_bbox.xMax + 0xFFFF ) >> 16; | 462 root->bbox.xMax = ( type1->font_bbox.xMax + 0xFFFF ) >> 16; |
466 root->bbox.yMax = ( type1->font_bbox.yMax + 0xFFFF ) >> 16; | 463 root->bbox.yMax = ( type1->font_bbox.yMax + 0xFFFF ) >> 16; |
467 | 464 |
468 /* Set units_per_EM if we didn't set it in t1_parse_font_matrix. */ | 465 /* Set units_per_EM if we didn't set it in t1_parse_font_matrix. */ |
469 if ( !root->units_per_EM ) | 466 if ( !root->units_per_EM ) |
470 root->units_per_EM = 1000; | 467 root->units_per_EM = 1000; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 /* driver :: A handle to the target Type 1 driver. */ | 604 /* driver :: A handle to the target Type 1 driver. */ |
608 /* */ | 605 /* */ |
609 FT_LOCAL_DEF( void ) | 606 FT_LOCAL_DEF( void ) |
610 T1_Driver_Done( FT_Module driver ) | 607 T1_Driver_Done( FT_Module driver ) |
611 { | 608 { |
612 FT_UNUSED( driver ); | 609 FT_UNUSED( driver ); |
613 } | 610 } |
614 | 611 |
615 | 612 |
616 /* END */ | 613 /* END */ |
OLD | NEW |