| OLD | NEW |
| 1 /***************************************************************************/ | 1 /***************************************************************************/ |
| 2 /* */ | 2 /* */ |
| 3 /* cffgload.c */ | 3 /* cffgload.c */ |
| 4 /* */ | 4 /* */ |
| 5 /* OpenType Glyph Loader (body). */ | 5 /* OpenType Glyph Loader (body). */ |
| 6 /* */ | 6 /* */ |
| 7 /* Copyright 1996-2011 by */ | 7 /* Copyright 1996-2012 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 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 { | 1506 { |
| 1507 FT_Int nargs; | 1507 FT_Int nargs; |
| 1508 | 1508 |
| 1509 | 1509 |
| 1510 FT_TRACE4(( " vvcurveto\n" )); | 1510 FT_TRACE4(( " vvcurveto\n" )); |
| 1511 | 1511 |
| 1512 if ( num_args < 4 ) | 1512 if ( num_args < 4 ) |
| 1513 goto Stack_Underflow; | 1513 goto Stack_Underflow; |
| 1514 | 1514 |
| 1515 /* if num_args isn't of the form 4n or 4n+1, */ | 1515 /* if num_args isn't of the form 4n or 4n+1, */ |
| 1516 /* we reduce it to 4n+1 */ | 1516 /* we enforce it by clearing the second bit */ |
| 1517 | 1517 |
| 1518 nargs = num_args - num_args % 4; | 1518 nargs = num_args & ~2; |
| 1519 if ( num_args - nargs > 0 ) | |
| 1520 nargs += 1; | |
| 1521 | 1519 |
| 1522 if ( cff_builder_start_point( builder, x, y ) ) | 1520 if ( cff_builder_start_point( builder, x, y ) ) |
| 1523 goto Fail; | 1521 goto Fail; |
| 1524 | 1522 |
| 1525 args -= nargs; | 1523 args -= nargs; |
| 1526 | 1524 |
| 1527 if ( nargs & 1 ) | 1525 if ( nargs & 1 ) |
| 1528 { | 1526 { |
| 1529 x += args[0]; | 1527 x += args[0]; |
| 1530 args++; | 1528 args++; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1553 { | 1551 { |
| 1554 FT_Int nargs; | 1552 FT_Int nargs; |
| 1555 | 1553 |
| 1556 | 1554 |
| 1557 FT_TRACE4(( " hhcurveto\n" )); | 1555 FT_TRACE4(( " hhcurveto\n" )); |
| 1558 | 1556 |
| 1559 if ( num_args < 4 ) | 1557 if ( num_args < 4 ) |
| 1560 goto Stack_Underflow; | 1558 goto Stack_Underflow; |
| 1561 | 1559 |
| 1562 /* if num_args isn't of the form 4n or 4n+1, */ | 1560 /* if num_args isn't of the form 4n or 4n+1, */ |
| 1563 /* we reduce it to 4n+1 */ | 1561 /* we enforce it by clearing the second bit */ |
| 1564 | 1562 |
| 1565 nargs = num_args - num_args % 4; | 1563 nargs = num_args & ~2; |
| 1566 if ( num_args - nargs > 0 ) | |
| 1567 nargs += 1; | |
| 1568 | 1564 |
| 1569 if ( cff_builder_start_point( builder, x, y ) ) | 1565 if ( cff_builder_start_point( builder, x, y ) ) |
| 1570 goto Fail; | 1566 goto Fail; |
| 1571 | 1567 |
| 1572 args -= nargs; | 1568 args -= nargs; |
| 1573 if ( nargs & 1 ) | 1569 if ( nargs & 1 ) |
| 1574 { | 1570 { |
| 1575 y += args[0]; | 1571 y += args[0]; |
| 1576 args++; | 1572 args++; |
| 1577 nargs--; | 1573 nargs--; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1605 FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n" | 1601 FT_TRACE4(( op == cff_op_vhcurveto ? " vhcurveto\n" |
| 1606 : " hvcurveto\n" )); | 1602 : " hvcurveto\n" )); |
| 1607 | 1603 |
| 1608 if ( cff_builder_start_point( builder, x, y ) ) | 1604 if ( cff_builder_start_point( builder, x, y ) ) |
| 1609 goto Fail; | 1605 goto Fail; |
| 1610 | 1606 |
| 1611 if ( num_args < 4 ) | 1607 if ( num_args < 4 ) |
| 1612 goto Stack_Underflow; | 1608 goto Stack_Underflow; |
| 1613 | 1609 |
| 1614 /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */ | 1610 /* if num_args isn't of the form 8n, 8n+1, 8n+4, or 8n+5, */ |
| 1615 /* we reduce it to the largest one which fits */ | 1611 /* we enforce it by clearing the second bit */ |
| 1616 | 1612 |
| 1617 nargs = num_args - num_args % 4; | 1613 nargs = num_args & ~2; |
| 1618 if ( num_args - nargs > 0 ) | |
| 1619 nargs += 1; | |
| 1620 | 1614 |
| 1621 args -= nargs; | 1615 args -= nargs; |
| 1622 if ( check_points( builder, ( nargs / 4 ) * 3 ) ) | 1616 if ( check_points( builder, ( nargs / 4 ) * 3 ) ) |
| 1623 goto Stack_Underflow; | 1617 goto Stack_Underflow; |
| 1624 | 1618 |
| 1625 phase = ( op == cff_op_hvcurveto ); | 1619 phase = ( op == cff_op_hvcurveto ); |
| 1626 | 1620 |
| 1627 while ( nargs >= 4 ) | 1621 while ( nargs >= 4 ) |
| 1628 { | 1622 { |
| 1629 nargs -= 4; | 1623 nargs -= 4; |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1956 | 1950 |
| 1957 case cff_op_endchar: | 1951 case cff_op_endchar: |
| 1958 FT_TRACE4(( " endchar\n" )); | 1952 FT_TRACE4(( " endchar\n" )); |
| 1959 | 1953 |
| 1960 /* We are going to emulate the seac operator. */ | 1954 /* We are going to emulate the seac operator. */ |
| 1961 if ( num_args >= 4 ) | 1955 if ( num_args >= 4 ) |
| 1962 { | 1956 { |
| 1963 /* Save glyph width so that the subglyphs don't overwrite it. */ | 1957 /* Save glyph width so that the subglyphs don't overwrite it. */ |
| 1964 FT_Pos glyph_width = decoder->glyph_width; | 1958 FT_Pos glyph_width = decoder->glyph_width; |
| 1965 | 1959 |
| 1960 |
| 1966 error = cff_operator_seac( decoder, | 1961 error = cff_operator_seac( decoder, |
| 1967 0L, args[-4], args[-3], | 1962 0L, args[-4], args[-3], |
| 1968 (FT_Int)( args[-2] >> 16 ), | 1963 (FT_Int)( args[-2] >> 16 ), |
| 1969 (FT_Int)( args[-1] >> 16 ) ); | 1964 (FT_Int)( args[-1] >> 16 ) ); |
| 1970 | 1965 |
| 1971 decoder->glyph_width = glyph_width; | 1966 decoder->glyph_width = glyph_width; |
| 1972 } | 1967 } |
| 1973 else | 1968 else |
| 1974 { | 1969 { |
| 1975 if ( !error ) | 1970 if ( !error ) |
| (...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2698 /* if we have a CID subfont, use its matrix (which has already */ | 2693 /* if we have a CID subfont, use its matrix (which has already */ |
| 2699 /* been multiplied with the root matrix) */ | 2694 /* been multiplied with the root matrix) */ |
| 2700 | 2695 |
| 2701 /* this scaling is only relevant if the PS hinter isn't active */ | 2696 /* this scaling is only relevant if the PS hinter isn't active */ |
| 2702 if ( cff->num_subfonts ) | 2697 if ( cff->num_subfonts ) |
| 2703 { | 2698 { |
| 2704 FT_ULong top_upm, sub_upm; | 2699 FT_ULong top_upm, sub_upm; |
| 2705 FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, | 2700 FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, |
| 2706 glyph_index ); | 2701 glyph_index ); |
| 2707 | 2702 |
| 2708 if ( fd_index >= cff->num_subfonts ) | 2703 if ( fd_index >= cff->num_subfonts ) |
| 2709 fd_index = (FT_Byte)( cff->num_subfonts - 1 ); | 2704 fd_index = (FT_Byte)( cff->num_subfonts - 1 ); |
| 2710 | 2705 |
| 2711 top_upm = cff->top_font.font_dict.units_per_em; | 2706 top_upm = cff->top_font.font_dict.units_per_em; |
| 2712 sub_upm = cff->subfonts[fd_index]->font_dict.units_per_em; | 2707 sub_upm = cff->subfonts[fd_index]->font_dict.units_per_em; |
| 2713 | 2708 |
| 2714 | 2709 |
| 2715 font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix; | 2710 font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix; |
| 2716 font_offset = cff->subfonts[fd_index]->font_dict.font_offset; | 2711 font_offset = cff->subfonts[fd_index]->font_dict.font_offset; |
| 2717 | 2712 |
| 2718 if ( top_upm != sub_upm ) | 2713 if ( top_upm != sub_upm ) |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2954 | 2949 |
| 2955 metrics->width = cbox.xMax - cbox.xMin; | 2950 metrics->width = cbox.xMax - cbox.xMin; |
| 2956 metrics->height = cbox.yMax - cbox.yMin; | 2951 metrics->height = cbox.yMax - cbox.yMin; |
| 2957 | 2952 |
| 2958 metrics->horiBearingX = cbox.xMin; | 2953 metrics->horiBearingX = cbox.xMin; |
| 2959 metrics->horiBearingY = cbox.yMax; | 2954 metrics->horiBearingY = cbox.yMax; |
| 2960 | 2955 |
| 2961 if ( has_vertical_info ) | 2956 if ( has_vertical_info ) |
| 2962 metrics->vertBearingX = metrics->horiBearingX - | 2957 metrics->vertBearingX = metrics->horiBearingX - |
| 2963 metrics->horiAdvance / 2; | 2958 metrics->horiAdvance / 2; |
| 2964 else | 2959 else |
| 2965 { | 2960 { |
| 2966 if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) | 2961 if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) |
| 2967 ft_synthesize_vertical_metrics( metrics, | 2962 ft_synthesize_vertical_metrics( metrics, |
| 2968 metrics->vertAdvance ); | 2963 metrics->vertAdvance ); |
| 2969 } | 2964 } |
| 2970 } | 2965 } |
| 2971 } | 2966 } |
| 2972 | 2967 |
| 2973 return error; | 2968 return error; |
| 2974 } | 2969 } |
| 2975 | 2970 |
| 2976 | 2971 |
| 2977 /* END */ | 2972 /* END */ |
| OLD | NEW |