| OLD | NEW |
| 1 /***************************************************************************/ | 1 /***************************************************************************/ |
| 2 /* */ | 2 /* */ |
| 3 /* cidobjs.c */ | 3 /* cidobjs.c */ |
| 4 /* */ | 4 /* */ |
| 5 /* CID objects manager (body). */ | 5 /* CID objects manager (body). */ |
| 6 /* */ | 6 /* */ |
| 7 /* Copyright 1996-2006, 2008, 2010-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 24 matching lines...) Expand all Loading... |
| 42 | 42 |
| 43 /*************************************************************************/ | 43 /*************************************************************************/ |
| 44 /* */ | 44 /* */ |
| 45 /* SLOT FUNCTIONS */ | 45 /* SLOT FUNCTIONS */ |
| 46 /* */ | 46 /* */ |
| 47 /*************************************************************************/ | 47 /*************************************************************************/ |
| 48 | 48 |
| 49 FT_LOCAL_DEF( void ) | 49 FT_LOCAL_DEF( void ) |
| 50 cid_slot_done( FT_GlyphSlot slot ) | 50 cid_slot_done( FT_GlyphSlot slot ) |
| 51 { | 51 { |
| 52 slot->internal->glyph_hints = 0; | 52 slot->internal->glyph_hints = NULL; |
| 53 } | 53 } |
| 54 | 54 |
| 55 | 55 |
| 56 FT_LOCAL_DEF( FT_Error ) | 56 FT_LOCAL_DEF( FT_Error ) |
| 57 cid_slot_init( FT_GlyphSlot slot ) | 57 cid_slot_init( FT_GlyphSlot slot ) |
| 58 { | 58 { |
| 59 CID_Face face; | 59 CID_Face face; |
| 60 PSHinter_Service pshinter; | 60 PSHinter_Service pshinter; |
| 61 | 61 |
| 62 | 62 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 if ( cidsize->internal ) | 116 if ( cidsize->internal ) |
| 117 { | 117 { |
| 118 PSH_Globals_Funcs funcs; | 118 PSH_Globals_Funcs funcs; |
| 119 | 119 |
| 120 | 120 |
| 121 funcs = cid_size_get_globals_funcs( size ); | 121 funcs = cid_size_get_globals_funcs( size ); |
| 122 if ( funcs ) | 122 if ( funcs ) |
| 123 funcs->destroy( (PSH_Globals)cidsize->internal ); | 123 funcs->destroy( (PSH_Globals)cidsize->internal ); |
| 124 | 124 |
| 125 cidsize->internal = 0; | 125 cidsize->internal = NULL; |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 | 129 |
| 130 FT_LOCAL_DEF( FT_Error ) | 130 FT_LOCAL_DEF( FT_Error ) |
| 131 cid_size_init( FT_Size cidsize ) /* CID_Size */ | 131 cid_size_init( FT_Size cidsize ) /* CID_Size */ |
| 132 { | 132 { |
| 133 CID_Size size = (CID_Size)cidsize; | 133 CID_Size size = (CID_Size)cidsize; |
| 134 FT_Error error = FT_Err_Ok; | 134 FT_Error error = FT_Err_Ok; |
| 135 PSH_Globals_Funcs funcs = cid_size_get_globals_funcs( size ); | 135 PSH_Globals_Funcs funcs = cid_size_get_globals_funcs( size ); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 236 |
| 237 /* release font dictionaries */ | 237 /* release font dictionaries */ |
| 238 FT_FREE( cid->font_dicts ); | 238 FT_FREE( cid->font_dicts ); |
| 239 cid->num_dicts = 0; | 239 cid->num_dicts = 0; |
| 240 | 240 |
| 241 /* release other strings */ | 241 /* release other strings */ |
| 242 FT_FREE( cid->cid_font_name ); | 242 FT_FREE( cid->cid_font_name ); |
| 243 FT_FREE( cid->registry ); | 243 FT_FREE( cid->registry ); |
| 244 FT_FREE( cid->ordering ); | 244 FT_FREE( cid->ordering ); |
| 245 | 245 |
| 246 cidface->family_name = 0; | 246 cidface->family_name = NULL; |
| 247 cidface->style_name = 0; | 247 cidface->style_name = NULL; |
| 248 | 248 |
| 249 FT_FREE( face->binary_data ); | 249 FT_FREE( face->binary_data ); |
| 250 FT_FREE( face->cid_stream ); | 250 FT_FREE( face->cid_stream ); |
| 251 } | 251 } |
| 252 | 252 |
| 253 | 253 |
| 254 /*************************************************************************/ | 254 /*************************************************************************/ |
| 255 /* */ | 255 /* */ |
| 256 /* <Function> */ | 256 /* <Function> */ |
| 257 /* cid_face_init */ | 257 /* cid_face_init */ |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 error = cid_face_open( face, face_index ); | 327 error = cid_face_open( face, face_index ); |
| 328 if ( error ) | 328 if ( error ) |
| 329 goto Exit; | 329 goto Exit; |
| 330 | 330 |
| 331 /* if we just wanted to check the format, leave successfully now */ | 331 /* if we just wanted to check the format, leave successfully now */ |
| 332 if ( face_index < 0 ) | 332 if ( face_index < 0 ) |
| 333 goto Exit; | 333 goto Exit; |
| 334 | 334 |
| 335 /* check the face index */ | 335 /* check the face index */ |
| 336 /* XXX: handle CID fonts with more than a single face */ | 336 /* XXX: handle CID fonts with more than a single face */ |
| 337 if ( face_index != 0 ) | 337 if ( ( face_index & 0xFFFF ) != 0 ) |
| 338 { | 338 { |
| 339 FT_ERROR(( "cid_face_init: invalid face index\n" )); | 339 FT_ERROR(( "cid_face_init: invalid face index\n" )); |
| 340 error = FT_THROW( Invalid_Argument ); | 340 error = FT_THROW( Invalid_Argument ); |
| 341 goto Exit; | 341 goto Exit; |
| 342 } | 342 } |
| 343 | 343 |
| 344 /* now load the font program into the face object */ | 344 /* now load the font program into the face object */ |
| 345 | 345 |
| 346 /* initialize the face object fields */ | 346 /* initialize the face object fields */ |
| 347 | 347 |
| 348 /* set up root face fields */ | 348 /* set up root face fields */ |
| 349 { | 349 { |
| 350 CID_FaceInfo cid = &face->cid; | 350 CID_FaceInfo cid = &face->cid; |
| 351 PS_FontInfo info = &cid->font_info; | 351 PS_FontInfo info = &cid->font_info; |
| 352 | 352 |
| 353 | 353 |
| 354 cidface->num_glyphs = cid->cid_count; | 354 cidface->num_glyphs = (FT_Long)cid->cid_count; |
| 355 cidface->num_charmaps = 0; | 355 cidface->num_charmaps = 0; |
| 356 | 356 |
| 357 cidface->face_index = face_index; | 357 cidface->face_index = face_index & 0xFFFF; |
| 358 | 358 |
| 359 cidface->face_flags |= FT_FACE_FLAG_SCALABLE | /* scalable outlines */ | 359 cidface->face_flags |= FT_FACE_FLAG_SCALABLE | /* scalable outlines */ |
| 360 FT_FACE_FLAG_HORIZONTAL | /* horizontal data */ | 360 FT_FACE_FLAG_HORIZONTAL | /* horizontal data */ |
| 361 FT_FACE_FLAG_HINTER; /* has native hinter */ | 361 FT_FACE_FLAG_HINTER; /* has native hinter */ |
| 362 | 362 |
| 363 if ( info->is_fixed_pitch ) | 363 if ( info->is_fixed_pitch ) |
| 364 cidface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; | 364 cidface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; |
| 365 | 365 |
| 366 /* XXX: TODO: add kerning with .afm support */ | 366 /* XXX: TODO: add kerning with .afm support */ |
| 367 | 367 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 cidface->style_flags |= FT_STYLE_FLAG_ITALIC; | 414 cidface->style_flags |= FT_STYLE_FLAG_ITALIC; |
| 415 if ( info->weight ) | 415 if ( info->weight ) |
| 416 { | 416 { |
| 417 if ( !ft_strcmp( info->weight, "Bold" ) || | 417 if ( !ft_strcmp( info->weight, "Bold" ) || |
| 418 !ft_strcmp( info->weight, "Black" ) ) | 418 !ft_strcmp( info->weight, "Black" ) ) |
| 419 cidface->style_flags |= FT_STYLE_FLAG_BOLD; | 419 cidface->style_flags |= FT_STYLE_FLAG_BOLD; |
| 420 } | 420 } |
| 421 | 421 |
| 422 /* no embedded bitmap support */ | 422 /* no embedded bitmap support */ |
| 423 cidface->num_fixed_sizes = 0; | 423 cidface->num_fixed_sizes = 0; |
| 424 cidface->available_sizes = 0; | 424 cidface->available_sizes = NULL; |
| 425 | 425 |
| 426 cidface->bbox.xMin = cid->font_bbox.xMin >> 16; | 426 cidface->bbox.xMin = cid->font_bbox.xMin >> 16; |
| 427 cidface->bbox.yMin = cid->font_bbox.yMin >> 16; | 427 cidface->bbox.yMin = cid->font_bbox.yMin >> 16; |
| 428 /* no `U' suffix here to 0xFFFF! */ | 428 /* no `U' suffix here to 0xFFFF! */ |
| 429 cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFF ) >> 16; | 429 cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFF ) >> 16; |
| 430 cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFF ) >> 16; | 430 cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFF ) >> 16; |
| 431 | 431 |
| 432 if ( !cidface->units_per_EM ) | 432 if ( !cidface->units_per_EM ) |
| 433 cidface->units_per_EM = 1000; | 433 cidface->units_per_EM = 1000; |
| 434 | 434 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 /* driver :: A handle to the target CID driver. */ | 483 /* driver :: A handle to the target CID driver. */ |
| 484 /* */ | 484 /* */ |
| 485 FT_LOCAL_DEF( void ) | 485 FT_LOCAL_DEF( void ) |
| 486 cid_driver_done( FT_Module driver ) | 486 cid_driver_done( FT_Module driver ) |
| 487 { | 487 { |
| 488 FT_UNUSED( driver ); | 488 FT_UNUSED( driver ); |
| 489 } | 489 } |
| 490 | 490 |
| 491 | 491 |
| 492 /* END */ | 492 /* END */ |
| OLD | NEW |