| OLD | NEW |
| 1 /***************************************************************************/ | 1 /***************************************************************************/ |
| 2 /* */ | 2 /* */ |
| 3 /* cffload.c */ | 3 /* cffload.c */ |
| 4 /* */ | 4 /* */ |
| 5 /* OpenType and CFF data/program tables loader (body). */ | 5 /* OpenType and CFF data/program tables loader (body). */ |
| 6 /* */ | 6 /* */ |
| 7 /* Copyright 1996-2014 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 poff[0] = p[0]; | 350 poff[0] = p[0]; |
| 351 break; | 351 break; |
| 352 | 352 |
| 353 case 2: | 353 case 2: |
| 354 for ( ; p < p_end; p += 2, poff++ ) | 354 for ( ; p < p_end; p += 2, poff++ ) |
| 355 poff[0] = FT_PEEK_USHORT( p ); | 355 poff[0] = FT_PEEK_USHORT( p ); |
| 356 break; | 356 break; |
| 357 | 357 |
| 358 case 3: | 358 case 3: |
| 359 for ( ; p < p_end; p += 3, poff++ ) | 359 for ( ; p < p_end; p += 3, poff++ ) |
| 360 poff[0] = FT_PEEK_OFF3( p ); | 360 poff[0] = FT_PEEK_UOFF3( p ); |
| 361 break; | 361 break; |
| 362 | 362 |
| 363 default: | 363 default: |
| 364 for ( ; p < p_end; p += 4, poff++ ) | 364 for ( ; p < p_end; p += 4, poff++ ) |
| 365 poff[0] = FT_PEEK_ULONG( p ); | 365 poff[0] = FT_PEEK_ULONG( p ); |
| 366 } | 366 } |
| 367 | 367 |
| 368 FT_FRAME_EXIT(); | 368 FT_FRAME_EXIT(); |
| 369 } | 369 } |
| 370 | 370 |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 if ( charset->sids[i] > max_cid ) | 802 if ( charset->sids[i] > max_cid ) |
| 803 max_cid = charset->sids[i]; | 803 max_cid = charset->sids[i]; |
| 804 } | 804 } |
| 805 | 805 |
| 806 if ( FT_NEW_ARRAY( charset->cids, (FT_ULong)max_cid + 1 ) ) | 806 if ( FT_NEW_ARRAY( charset->cids, (FT_ULong)max_cid + 1 ) ) |
| 807 goto Exit; | 807 goto Exit; |
| 808 | 808 |
| 809 /* When multiple GIDs map to the same CID, we choose the lowest */ | 809 /* When multiple GIDs map to the same CID, we choose the lowest */ |
| 810 /* GID. This is not described in any spec, but it matches the */ | 810 /* GID. This is not described in any spec, but it matches the */ |
| 811 /* behaviour of recent Acroread versions. */ | 811 /* behaviour of recent Acroread versions. */ |
| 812 for ( j = num_glyphs - 1; j >= 0 ; j-- ) | 812 for ( j = (FT_Long)num_glyphs - 1; j >= 0 ; j-- ) |
| 813 charset->cids[charset->sids[j]] = (FT_UShort)j; | 813 charset->cids[charset->sids[j]] = (FT_UShort)j; |
| 814 | 814 |
| 815 charset->max_cid = max_cid; | 815 charset->max_cid = max_cid; |
| 816 charset->num_glyphs = num_glyphs; | 816 charset->num_glyphs = num_glyphs; |
| 817 | 817 |
| 818 Exit: | 818 Exit: |
| 819 return error; | 819 return error; |
| 820 } | 820 } |
| 821 | 821 |
| 822 | 822 |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1440 FT_FRAME_BYTE( header_size ), | 1440 FT_FRAME_BYTE( header_size ), |
| 1441 FT_FRAME_BYTE( absolute_offsize ), | 1441 FT_FRAME_BYTE( absolute_offsize ), |
| 1442 FT_FRAME_END | 1442 FT_FRAME_END |
| 1443 }; | 1443 }; |
| 1444 | 1444 |
| 1445 FT_Error error; | 1445 FT_Error error; |
| 1446 FT_Memory memory = stream->memory; | 1446 FT_Memory memory = stream->memory; |
| 1447 FT_ULong base_offset; | 1447 FT_ULong base_offset; |
| 1448 CFF_FontRecDict dict; | 1448 CFF_FontRecDict dict; |
| 1449 CFF_IndexRec string_index; | 1449 CFF_IndexRec string_index; |
| 1450 FT_Int subfont_index; | 1450 FT_UInt subfont_index; |
| 1451 | 1451 |
| 1452 | 1452 |
| 1453 FT_ZERO( font ); | 1453 FT_ZERO( font ); |
| 1454 FT_ZERO( &string_index ); | 1454 FT_ZERO( &string_index ); |
| 1455 | 1455 |
| 1456 font->stream = stream; | 1456 font->stream = stream; |
| 1457 font->memory = memory; | 1457 font->memory = memory; |
| 1458 dict = &font->top_font.font_dict; | 1458 dict = &font->top_font.font_dict; |
| 1459 base_offset = FT_STREAM_POS(); | 1459 base_offset = FT_STREAM_POS(); |
| 1460 | 1460 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1488 FT_SET_ERROR( cff_index_get_pointers( &string_index, | 1488 FT_SET_ERROR( cff_index_get_pointers( &string_index, |
| 1489 &font->strings, | 1489 &font->strings, |
| 1490 &font->string_pool ) ) ) | 1490 &font->string_pool ) ) ) |
| 1491 goto Exit; | 1491 goto Exit; |
| 1492 | 1492 |
| 1493 font->num_strings = string_index.count; | 1493 font->num_strings = string_index.count; |
| 1494 | 1494 |
| 1495 if ( pure_cff ) | 1495 if ( pure_cff ) |
| 1496 { | 1496 { |
| 1497 /* well, we don't really forget the `disabled' fonts... */ | 1497 /* well, we don't really forget the `disabled' fonts... */ |
| 1498 subfont_index = face_index; | 1498 subfont_index = (FT_UInt)( face_index & 0xFFFF ); |
| 1499 | 1499 |
| 1500 if ( subfont_index >= (FT_Int)font->name_index.count ) | 1500 if ( face_index > 0 && subfont_index >= font->name_index.count ) |
| 1501 { | 1501 { |
| 1502 FT_ERROR(( "cff_font_load:" | 1502 FT_ERROR(( "cff_font_load:" |
| 1503 " invalid subfont index for pure CFF font (%d)\n", | 1503 " invalid subfont index for pure CFF font (%d)\n", |
| 1504 subfont_index )); | 1504 subfont_index )); |
| 1505 error = FT_THROW( Invalid_Argument ); | 1505 error = FT_THROW( Invalid_Argument ); |
| 1506 goto Exit; | 1506 goto Exit; |
| 1507 } | 1507 } |
| 1508 | 1508 |
| 1509 font->num_faces = font->name_index.count; | 1509 font->num_faces = font->name_index.count; |
| 1510 } | 1510 } |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 | 1694 |
| 1695 if ( font->cf2_instance.finalizer ) | 1695 if ( font->cf2_instance.finalizer ) |
| 1696 { | 1696 { |
| 1697 font->cf2_instance.finalizer( font->cf2_instance.data ); | 1697 font->cf2_instance.finalizer( font->cf2_instance.data ); |
| 1698 FT_FREE( font->cf2_instance.data ); | 1698 FT_FREE( font->cf2_instance.data ); |
| 1699 } | 1699 } |
| 1700 } | 1700 } |
| 1701 | 1701 |
| 1702 | 1702 |
| 1703 /* END */ | 1703 /* END */ |
| OLD | NEW |