| OLD | NEW |
| 1 /***************************************************************************/ | 1 /***************************************************************************/ |
| 2 /* */ | 2 /* */ |
| 3 /* ttload.c */ | 3 /* ttload.c */ |
| 4 /* */ | 4 /* */ |
| 5 /* Load the basic TrueType tables, i.e., tables that can be either in */ | 5 /* Load the basic TrueType tables, i.e., tables that can be either in */ |
| 6 /* TTF or OTF fonts (body). */ | 6 /* TTF or OTF fonts (body). */ |
| 7 /* */ | 7 /* */ |
| 8 /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ | 8 /* Copyright 1996-2010, 2012, 2013 by */ |
| 9 /* 2010 by */ | |
| 10 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
| 11 /* */ | 10 /* */ |
| 12 /* This file is part of the FreeType project, and may only be used, */ | 11 /* This file is part of the FreeType project, and may only be used, */ |
| 13 /* modified, and distributed under the terms of the FreeType project */ | 12 /* modified, and distributed under the terms of the FreeType project */ |
| 14 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 13 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
| 15 /* this file you indicate that you have read the license and */ | 14 /* this file you indicate that you have read the license and */ |
| 16 /* understand and accept it fully. */ | 15 /* understand and accept it fully. */ |
| 17 /* */ | 16 /* */ |
| 18 /***************************************************************************/ | 17 /***************************************************************************/ |
| 19 | 18 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 table = tt_face_lookup_table( face, tag ); | 135 table = tt_face_lookup_table( face, tag ); |
| 137 if ( table ) | 136 if ( table ) |
| 138 { | 137 { |
| 139 if ( length ) | 138 if ( length ) |
| 140 *length = table->Length; | 139 *length = table->Length; |
| 141 | 140 |
| 142 if ( FT_STREAM_SEEK( table->Offset ) ) | 141 if ( FT_STREAM_SEEK( table->Offset ) ) |
| 143 goto Exit; | 142 goto Exit; |
| 144 } | 143 } |
| 145 else | 144 else |
| 146 error = SFNT_Err_Table_Missing; | 145 error = FT_THROW( Table_Missing ); |
| 147 | 146 |
| 148 Exit: | 147 Exit: |
| 149 return error; | 148 return error; |
| 150 } | 149 } |
| 151 | 150 |
| 152 | 151 |
| 153 /* Here, we */ | 152 /* Here, we */ |
| 154 /* */ | 153 /* */ |
| 155 /* - check that `num_tables' is valid (and adjust it if necessary) */ | 154 /* - check that `num_tables' is valid (and adjust it if necessary) */ |
| 156 /* */ | 155 /* */ |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 * 0x38, so we will just check that it is greater. | 230 * 0x38, so we will just check that it is greater. |
| 232 * | 231 * |
| 233 * Note that according to the specification, the table must be | 232 * Note that according to the specification, the table must be |
| 234 * padded to 32-bit lengths, but this doesn't apply to the value of | 233 * padded to 32-bit lengths, but this doesn't apply to the value of |
| 235 * its `Length' field! | 234 * its `Length' field! |
| 236 * | 235 * |
| 237 */ | 236 */ |
| 238 if ( table.Length < 0x36 ) | 237 if ( table.Length < 0x36 ) |
| 239 { | 238 { |
| 240 FT_TRACE2(( "check_table_dir: `head' table too small\n" )); | 239 FT_TRACE2(( "check_table_dir: `head' table too small\n" )); |
| 241 error = SFNT_Err_Table_Missing; | 240 error = FT_THROW( Table_Missing ); |
| 242 goto Exit; | 241 goto Exit; |
| 243 } | 242 } |
| 244 | 243 |
| 245 if ( FT_STREAM_SEEK( table.Offset + 12 ) || | 244 if ( FT_STREAM_SEEK( table.Offset + 12 ) || |
| 246 FT_READ_ULONG( magic ) ) | 245 FT_READ_ULONG( magic ) ) |
| 247 goto Exit; | 246 goto Exit; |
| 248 | 247 |
| 249 if ( magic != 0x5F0F3CF5UL ) | 248 if ( magic != 0x5F0F3CF5UL ) |
| 250 { | 249 { |
| 251 FT_TRACE2(( "check_table_dir:" | 250 FT_TRACE2(( "check_table_dir:" |
| 252 " no magic number found in `head' table\n")); | 251 " no magic number found in `head' table\n")); |
| 253 error = SFNT_Err_Table_Missing; | 252 error = FT_THROW( Table_Missing ); |
| 254 goto Exit; | 253 goto Exit; |
| 255 } | 254 } |
| 256 | 255 |
| 257 if ( FT_STREAM_SEEK( offset + ( nn + 1 ) * 16 ) ) | 256 if ( FT_STREAM_SEEK( offset + ( nn + 1 ) * 16 ) ) |
| 258 goto Exit; | 257 goto Exit; |
| 259 } | 258 } |
| 260 else if ( table.Tag == TTAG_SING ) | 259 else if ( table.Tag == TTAG_SING ) |
| 261 has_sing = 1; | 260 has_sing = 1; |
| 262 else if ( table.Tag == TTAG_META ) | 261 else if ( table.Tag == TTAG_META ) |
| 263 has_meta = 1; | 262 has_meta = 1; |
| 264 } | 263 } |
| 265 | 264 |
| 266 sfnt->num_tables = valid_entries; | 265 sfnt->num_tables = valid_entries; |
| 267 | 266 |
| 268 if ( sfnt->num_tables == 0 ) | 267 if ( sfnt->num_tables == 0 ) |
| 269 { | 268 { |
| 270 FT_TRACE2(( "check_table_dir: no tables found\n" )); | 269 FT_TRACE2(( "check_table_dir: no tables found\n" )); |
| 271 error = SFNT_Err_Unknown_File_Format; | 270 error = FT_THROW( Unknown_File_Format ); |
| 272 goto Exit; | 271 goto Exit; |
| 273 } | 272 } |
| 274 | 273 |
| 275 /* if `sing' and `meta' tables are present, there is no `head' table */ | 274 /* if `sing' and `meta' tables are present, there is no `head' table */ |
| 276 if ( has_head || ( has_sing && has_meta ) ) | 275 if ( has_head || ( has_sing && has_meta ) ) |
| 277 { | 276 { |
| 278 error = SFNT_Err_Ok; | 277 error = FT_Err_Ok; |
| 279 goto Exit; | 278 goto Exit; |
| 280 } | 279 } |
| 281 else | 280 else |
| 282 { | 281 { |
| 283 FT_TRACE2(( "check_table_dir:" )); | 282 FT_TRACE2(( "check_table_dir:" )); |
| 284 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS | 283 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS |
| 285 FT_TRACE2(( " neither `head', `bhed', nor `sing' table found\n" )); | 284 FT_TRACE2(( " neither `head', `bhed', nor `sing' table found\n" )); |
| 286 #else | 285 #else |
| 287 FT_TRACE2(( " neither `head' nor `sing' table found\n" )); | 286 FT_TRACE2(( " neither `head' nor `sing' table found\n" )); |
| 288 #endif | 287 #endif |
| 289 error = SFNT_Err_Table_Missing; | 288 error = FT_THROW( Table_Missing ); |
| 290 } | 289 } |
| 291 | 290 |
| 292 Exit: | 291 Exit: |
| 293 return error; | 292 return error; |
| 294 } | 293 } |
| 295 | 294 |
| 296 | 295 |
| 297 /*************************************************************************/ | 296 /*************************************************************************/ |
| 298 /* */ | 297 /* */ |
| 299 /* <Function> */ | 298 /* <Function> */ |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 sfnt.offset = FT_STREAM_POS(); | 346 sfnt.offset = FT_STREAM_POS(); |
| 348 | 347 |
| 349 if ( FT_READ_ULONG( sfnt.format_tag ) || | 348 if ( FT_READ_ULONG( sfnt.format_tag ) || |
| 350 FT_STREAM_READ_FIELDS( offset_table_fields, &sfnt ) ) | 349 FT_STREAM_READ_FIELDS( offset_table_fields, &sfnt ) ) |
| 351 goto Exit; | 350 goto Exit; |
| 352 | 351 |
| 353 /* many fonts don't have these fields set correctly */ | 352 /* many fonts don't have these fields set correctly */ |
| 354 #if 0 | 353 #if 0 |
| 355 if ( sfnt.search_range != 1 << ( sfnt.entry_selector + 4 ) || | 354 if ( sfnt.search_range != 1 << ( sfnt.entry_selector + 4 ) || |
| 356 sfnt.search_range + sfnt.range_shift != sfnt.num_tables << 4 ) | 355 sfnt.search_range + sfnt.range_shift != sfnt.num_tables << 4 ) |
| 357 return SFNT_Err_Unknown_File_Format; | 356 return FT_THROW( Unknown_File_Format ); |
| 358 #endif | 357 #endif |
| 359 | 358 |
| 360 /* load the table directory */ | 359 /* load the table directory */ |
| 361 | 360 |
| 362 FT_TRACE2(( "-- Number of tables: %10u\n", sfnt.num_tables )); | 361 FT_TRACE2(( "-- Number of tables: %10u\n", sfnt.num_tables )); |
| 363 FT_TRACE2(( "-- Format version: 0x%08lx\n", sfnt.format_tag )); | 362 FT_TRACE2(( "-- Format version: 0x%08lx\n", sfnt.format_tag )); |
| 364 | 363 |
| 365 /* check first */ | 364 if ( sfnt.format_tag != TTAG_OTTO ) |
| 366 error = check_table_dir( &sfnt, stream ); | |
| 367 if ( error ) | |
| 368 { | 365 { |
| 369 FT_TRACE2(( "tt_face_load_font_dir:" | 366 /* check first */ |
| 370 " invalid table directory for TrueType\n" )); | 367 error = check_table_dir( &sfnt, stream ); |
| 368 if ( error ) |
| 369 { |
| 370 FT_TRACE2(( "tt_face_load_font_dir:" |
| 371 " invalid table directory for TrueType\n" )); |
| 371 | 372 |
| 372 goto Exit; | 373 goto Exit; |
| 374 } |
| 373 } | 375 } |
| 374 | 376 |
| 375 face->num_tables = sfnt.num_tables; | 377 face->num_tables = sfnt.num_tables; |
| 376 face->format_tag = sfnt.format_tag; | 378 face->format_tag = sfnt.format_tag; |
| 377 | 379 |
| 378 if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) ) | 380 if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) ) |
| 379 goto Exit; | 381 goto Exit; |
| 380 | 382 |
| 381 if ( FT_STREAM_SEEK( sfnt.offset + 12 ) || | 383 if ( FT_STREAM_SEEK( sfnt.offset + 12 ) || |
| 382 FT_FRAME_ENTER( face->num_tables * 16L ) ) | 384 FT_FRAME_ENTER( face->num_tables * 16L ) ) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 TT_Table table; | 475 TT_Table table; |
| 474 FT_ULong size; | 476 FT_ULong size; |
| 475 | 477 |
| 476 | 478 |
| 477 if ( tag != 0 ) | 479 if ( tag != 0 ) |
| 478 { | 480 { |
| 479 /* look for tag in font directory */ | 481 /* look for tag in font directory */ |
| 480 table = tt_face_lookup_table( face, tag ); | 482 table = tt_face_lookup_table( face, tag ); |
| 481 if ( !table ) | 483 if ( !table ) |
| 482 { | 484 { |
| 483 error = SFNT_Err_Table_Missing; | 485 error = FT_THROW( Table_Missing ); |
| 484 goto Exit; | 486 goto Exit; |
| 485 } | 487 } |
| 486 | 488 |
| 487 offset += table->Offset; | 489 offset += table->Offset; |
| 488 size = table->Length; | 490 size = table->Length; |
| 489 } | 491 } |
| 490 else | 492 else |
| 491 /* tag == 0 -- the user wants to access the font file directly */ | 493 /* tag == 0 -- the user wants to access the font file directly */ |
| 492 size = face->root.stream->size; | 494 size = face->root.stream->size; |
| 493 | 495 |
| 494 if ( length && *length == 0 ) | 496 if ( length && *length == 0 ) |
| 495 { | 497 { |
| 496 *length = size; | 498 *length = size; |
| 497 | 499 |
| 498 return SFNT_Err_Ok; | 500 return FT_Err_Ok; |
| 499 } | 501 } |
| 500 | 502 |
| 501 if ( length ) | 503 if ( length ) |
| 502 size = *length; | 504 size = *length; |
| 503 | 505 |
| 504 stream = face->root.stream; | 506 stream = face->root.stream; |
| 505 /* the `if' is syntactic sugar for picky compilers */ | 507 /* the `if' is syntactic sugar for picky compilers */ |
| 506 if ( FT_STREAM_READ_AT( offset, buffer, size ) ) | 508 if ( FT_STREAM_READ_AT( offset, buffer, size ) ) |
| 507 goto Exit; | 509 goto Exit; |
| 508 | 510 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 /* <Return> */ | 619 /* <Return> */ |
| 618 /* FreeType error code. 0 means success. */ | 620 /* FreeType error code. 0 means success. */ |
| 619 /* */ | 621 /* */ |
| 620 FT_LOCAL_DEF( FT_Error ) | 622 FT_LOCAL_DEF( FT_Error ) |
| 621 tt_face_load_maxp( TT_Face face, | 623 tt_face_load_maxp( TT_Face face, |
| 622 FT_Stream stream ) | 624 FT_Stream stream ) |
| 623 { | 625 { |
| 624 FT_Error error; | 626 FT_Error error; |
| 625 TT_MaxProfile* maxProfile = &face->max_profile; | 627 TT_MaxProfile* maxProfile = &face->max_profile; |
| 626 | 628 |
| 627 const FT_Frame_Field maxp_fields[] = | 629 static const FT_Frame_Field maxp_fields[] = |
| 628 { | 630 { |
| 629 #undef FT_STRUCTURE | 631 #undef FT_STRUCTURE |
| 630 #define FT_STRUCTURE TT_MaxProfile | 632 #define FT_STRUCTURE TT_MaxProfile |
| 631 | 633 |
| 632 FT_FRAME_START( 6 ), | 634 FT_FRAME_START( 6 ), |
| 633 FT_FRAME_LONG ( version ), | 635 FT_FRAME_LONG ( version ), |
| 634 FT_FRAME_USHORT( numGlyphs ), | 636 FT_FRAME_USHORT( numGlyphs ), |
| 635 FT_FRAME_END | 637 FT_FRAME_END |
| 636 }; | 638 }; |
| 637 | 639 |
| 638 const FT_Frame_Field maxp_fields_extra[] = | 640 static const FT_Frame_Field maxp_fields_extra[] = |
| 639 { | 641 { |
| 640 FT_FRAME_START( 26 ), | 642 FT_FRAME_START( 26 ), |
| 641 FT_FRAME_USHORT( maxPoints ), | 643 FT_FRAME_USHORT( maxPoints ), |
| 642 FT_FRAME_USHORT( maxContours ), | 644 FT_FRAME_USHORT( maxContours ), |
| 643 FT_FRAME_USHORT( maxCompositePoints ), | 645 FT_FRAME_USHORT( maxCompositePoints ), |
| 644 FT_FRAME_USHORT( maxCompositeContours ), | 646 FT_FRAME_USHORT( maxCompositeContours ), |
| 645 FT_FRAME_USHORT( maxZones ), | 647 FT_FRAME_USHORT( maxZones ), |
| 646 FT_FRAME_USHORT( maxTwilightPoints ), | 648 FT_FRAME_USHORT( maxTwilightPoints ), |
| 647 FT_FRAME_USHORT( maxStorage ), | 649 FT_FRAME_USHORT( maxStorage ), |
| 648 FT_FRAME_USHORT( maxFunctionDefs ), | 650 FT_FRAME_USHORT( maxFunctionDefs ), |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 FT_TRACE3(( "numGlyphs: %u\n", maxProfile->numGlyphs )); | 716 FT_TRACE3(( "numGlyphs: %u\n", maxProfile->numGlyphs )); |
| 715 | 717 |
| 716 Exit: | 718 Exit: |
| 717 return error; | 719 return error; |
| 718 } | 720 } |
| 719 | 721 |
| 720 | 722 |
| 721 /*************************************************************************/ | 723 /*************************************************************************/ |
| 722 /* */ | 724 /* */ |
| 723 /* <Function> */ | 725 /* <Function> */ |
| 724 /* tt_face_load_names */ | 726 /* tt_face_load_name */ |
| 725 /* */ | 727 /* */ |
| 726 /* <Description> */ | 728 /* <Description> */ |
| 727 /* Loads the name records. */ | 729 /* Loads the name records. */ |
| 728 /* */ | 730 /* */ |
| 729 /* <Input> */ | 731 /* <Input> */ |
| 730 /* face :: A handle to the target face object. */ | 732 /* face :: A handle to the target face object. */ |
| 731 /* */ | 733 /* */ |
| 732 /* stream :: The input stream. */ | 734 /* stream :: The input stream. */ |
| 733 /* */ | 735 /* */ |
| 734 /* <Return> */ | 736 /* <Return> */ |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 /* valid pointers within the name table... */ | 794 /* valid pointers within the name table... */ |
| 793 /* */ | 795 /* */ |
| 794 /* We thus can't check `storageOffset' right now. */ | 796 /* We thus can't check `storageOffset' right now. */ |
| 795 /* */ | 797 /* */ |
| 796 storage_start = table_pos + 6 + 12*table->numNameRecords; | 798 storage_start = table_pos + 6 + 12*table->numNameRecords; |
| 797 storage_limit = table_pos + table_len; | 799 storage_limit = table_pos + table_len; |
| 798 | 800 |
| 799 if ( storage_start > storage_limit ) | 801 if ( storage_start > storage_limit ) |
| 800 { | 802 { |
| 801 FT_ERROR(( "tt_face_load_name: invalid `name' table\n" )); | 803 FT_ERROR(( "tt_face_load_name: invalid `name' table\n" )); |
| 802 error = SFNT_Err_Name_Table_Missing; | 804 error = FT_THROW( Name_Table_Missing ); |
| 803 goto Exit; | 805 goto Exit; |
| 804 } | 806 } |
| 805 | 807 |
| 806 /* Allocate the array of name records. */ | 808 /* Allocate the array of name records. */ |
| 807 count = table->numNameRecords; | 809 count = table->numNameRecords; |
| 808 table->numNameRecords = 0; | 810 table->numNameRecords = 0; |
| 809 | 811 |
| 810 if ( FT_NEW_ARRAY( table->names, count ) || | 812 if ( FT_NEW_ARRAY( table->names, count ) || |
| 811 FT_FRAME_ENTER( count * 12 ) ) | 813 FT_FRAME_ENTER( count * 12 ) ) |
| 812 goto Exit; | 814 goto Exit; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 /* <Return> */ | 947 /* <Return> */ |
| 946 /* FreeType error code. 0 means success. */ | 948 /* FreeType error code. 0 means success. */ |
| 947 /* */ | 949 /* */ |
| 948 FT_LOCAL_DEF( FT_Error ) | 950 FT_LOCAL_DEF( FT_Error ) |
| 949 tt_face_load_os2( TT_Face face, | 951 tt_face_load_os2( TT_Face face, |
| 950 FT_Stream stream ) | 952 FT_Stream stream ) |
| 951 { | 953 { |
| 952 FT_Error error; | 954 FT_Error error; |
| 953 TT_OS2* os2; | 955 TT_OS2* os2; |
| 954 | 956 |
| 955 const FT_Frame_Field os2_fields[] = | 957 static const FT_Frame_Field os2_fields[] = |
| 956 { | 958 { |
| 957 #undef FT_STRUCTURE | 959 #undef FT_STRUCTURE |
| 958 #define FT_STRUCTURE TT_OS2 | 960 #define FT_STRUCTURE TT_OS2 |
| 959 | 961 |
| 960 FT_FRAME_START( 78 ), | 962 FT_FRAME_START( 78 ), |
| 961 FT_FRAME_USHORT( version ), | 963 FT_FRAME_USHORT( version ), |
| 962 FT_FRAME_SHORT ( xAvgCharWidth ), | 964 FT_FRAME_SHORT ( xAvgCharWidth ), |
| 963 FT_FRAME_USHORT( usWeightClass ), | 965 FT_FRAME_USHORT( usWeightClass ), |
| 964 FT_FRAME_USHORT( usWidthClass ), | 966 FT_FRAME_USHORT( usWidthClass ), |
| 965 FT_FRAME_SHORT ( fsType ), | 967 FT_FRAME_SHORT ( fsType ), |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 FT_FRAME_USHORT( usFirstCharIndex ), | 999 FT_FRAME_USHORT( usFirstCharIndex ), |
| 998 FT_FRAME_USHORT( usLastCharIndex ), | 1000 FT_FRAME_USHORT( usLastCharIndex ), |
| 999 FT_FRAME_SHORT ( sTypoAscender ), | 1001 FT_FRAME_SHORT ( sTypoAscender ), |
| 1000 FT_FRAME_SHORT ( sTypoDescender ), | 1002 FT_FRAME_SHORT ( sTypoDescender ), |
| 1001 FT_FRAME_SHORT ( sTypoLineGap ), | 1003 FT_FRAME_SHORT ( sTypoLineGap ), |
| 1002 FT_FRAME_USHORT( usWinAscent ), | 1004 FT_FRAME_USHORT( usWinAscent ), |
| 1003 FT_FRAME_USHORT( usWinDescent ), | 1005 FT_FRAME_USHORT( usWinDescent ), |
| 1004 FT_FRAME_END | 1006 FT_FRAME_END |
| 1005 }; | 1007 }; |
| 1006 | 1008 |
| 1007 const FT_Frame_Field os2_fields_extra[] = | 1009 static const FT_Frame_Field os2_fields_extra[] = |
| 1008 { | 1010 { |
| 1009 FT_FRAME_START( 8 ), | 1011 FT_FRAME_START( 8 ), |
| 1010 FT_FRAME_ULONG( ulCodePageRange1 ), | 1012 FT_FRAME_ULONG( ulCodePageRange1 ), |
| 1011 FT_FRAME_ULONG( ulCodePageRange2 ), | 1013 FT_FRAME_ULONG( ulCodePageRange2 ), |
| 1012 FT_FRAME_END | 1014 FT_FRAME_END |
| 1013 }; | 1015 }; |
| 1014 | 1016 |
| 1015 const FT_Frame_Field os2_fields_extra2[] = | 1017 static const FT_Frame_Field os2_fields_extra2[] = |
| 1016 { | 1018 { |
| 1017 FT_FRAME_START( 10 ), | 1019 FT_FRAME_START( 10 ), |
| 1018 FT_FRAME_SHORT ( sxHeight ), | 1020 FT_FRAME_SHORT ( sxHeight ), |
| 1019 FT_FRAME_SHORT ( sCapHeight ), | 1021 FT_FRAME_SHORT ( sCapHeight ), |
| 1020 FT_FRAME_USHORT( usDefaultChar ), | 1022 FT_FRAME_USHORT( usDefaultChar ), |
| 1021 FT_FRAME_USHORT( usBreakChar ), | 1023 FT_FRAME_USHORT( usBreakChar ), |
| 1022 FT_FRAME_USHORT( usMaxContext ), | 1024 FT_FRAME_USHORT( usMaxContext ), |
| 1023 FT_FRAME_END | 1025 FT_FRAME_END |
| 1024 }; | 1026 }; |
| 1025 | 1027 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 if ( FT_STREAM_READ_FIELDS( post_fields, post ) ) | 1120 if ( FT_STREAM_READ_FIELDS( post_fields, post ) ) |
| 1119 return error; | 1121 return error; |
| 1120 | 1122 |
| 1121 /* we don't load the glyph names, we do that in another */ | 1123 /* we don't load the glyph names, we do that in another */ |
| 1122 /* module (ttpost). */ | 1124 /* module (ttpost). */ |
| 1123 | 1125 |
| 1124 FT_TRACE3(( "FormatType: 0x%x\n", post->FormatType )); | 1126 FT_TRACE3(( "FormatType: 0x%x\n", post->FormatType )); |
| 1125 FT_TRACE3(( "isFixedPitch: %s\n", post->isFixedPitch | 1127 FT_TRACE3(( "isFixedPitch: %s\n", post->isFixedPitch |
| 1126 ? " yes" : " no" )); | 1128 ? " yes" : " no" )); |
| 1127 | 1129 |
| 1128 return SFNT_Err_Ok; | 1130 return FT_Err_Ok; |
| 1129 } | 1131 } |
| 1130 | 1132 |
| 1131 | 1133 |
| 1132 /*************************************************************************/ | 1134 /*************************************************************************/ |
| 1133 /* */ | 1135 /* */ |
| 1134 /* <Function> */ | 1136 /* <Function> */ |
| 1135 /* tt_face_load_pclt */ | 1137 /* tt_face_load_pclt */ |
| 1136 /* */ | 1138 /* */ |
| 1137 /* <Description> */ | 1139 /* <Description> */ |
| 1138 /* Loads the PCL 5 Table. */ | 1140 /* Loads the PCL 5 Table. */ |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 | 1228 |
| 1227 face->gasp.version = FT_GET_USHORT(); | 1229 face->gasp.version = FT_GET_USHORT(); |
| 1228 face->gasp.numRanges = FT_GET_USHORT(); | 1230 face->gasp.numRanges = FT_GET_USHORT(); |
| 1229 | 1231 |
| 1230 FT_FRAME_EXIT(); | 1232 FT_FRAME_EXIT(); |
| 1231 | 1233 |
| 1232 /* only support versions 0 and 1 of the table */ | 1234 /* only support versions 0 and 1 of the table */ |
| 1233 if ( face->gasp.version >= 2 ) | 1235 if ( face->gasp.version >= 2 ) |
| 1234 { | 1236 { |
| 1235 face->gasp.numRanges = 0; | 1237 face->gasp.numRanges = 0; |
| 1236 error = SFNT_Err_Invalid_Table; | 1238 error = FT_THROW( Invalid_Table ); |
| 1237 goto Exit; | 1239 goto Exit; |
| 1238 } | 1240 } |
| 1239 | 1241 |
| 1240 num_ranges = face->gasp.numRanges; | 1242 num_ranges = face->gasp.numRanges; |
| 1241 FT_TRACE3(( "numRanges: %u\n", num_ranges )); | 1243 FT_TRACE3(( "numRanges: %u\n", num_ranges )); |
| 1242 | 1244 |
| 1243 if ( FT_QNEW_ARRAY( gaspranges, num_ranges ) || | 1245 if ( FT_QNEW_ARRAY( face->gasp.gaspRanges, num_ranges ) || |
| 1244 FT_FRAME_ENTER( num_ranges * 4L ) ) | 1246 FT_FRAME_ENTER( num_ranges * 4L ) ) |
| 1245 goto Exit; | 1247 goto Exit; |
| 1246 | 1248 |
| 1247 face->gasp.gaspRanges = gaspranges; | 1249 gaspranges = face->gasp.gaspRanges; |
| 1248 | 1250 |
| 1249 for ( j = 0; j < num_ranges; j++ ) | 1251 for ( j = 0; j < num_ranges; j++ ) |
| 1250 { | 1252 { |
| 1251 gaspranges[j].maxPPEM = FT_GET_USHORT(); | 1253 gaspranges[j].maxPPEM = FT_GET_USHORT(); |
| 1252 gaspranges[j].gaspFlag = FT_GET_USHORT(); | 1254 gaspranges[j].gaspFlag = FT_GET_USHORT(); |
| 1253 | 1255 |
| 1254 FT_TRACE3(( "gaspRange %d: rangeMaxPPEM %5d, rangeGaspBehavior 0x%x\n", | 1256 FT_TRACE3(( "gaspRange %d: rangeMaxPPEM %5d, rangeGaspBehavior 0x%x\n", |
| 1255 j, | 1257 j, |
| 1256 gaspranges[j].maxPPEM, | 1258 gaspranges[j].maxPPEM, |
| 1257 gaspranges[j].gaspFlag )); | 1259 gaspranges[j].gaspFlag )); |
| 1258 } | 1260 } |
| 1259 | 1261 |
| 1260 FT_FRAME_EXIT(); | 1262 FT_FRAME_EXIT(); |
| 1261 | 1263 |
| 1262 Exit: | 1264 Exit: |
| 1263 return error; | 1265 return error; |
| 1264 } | 1266 } |
| 1265 | 1267 |
| 1266 | 1268 |
| 1267 /* END */ | 1269 /* END */ |
| OLD | NEW |