From 32b85e67cbfd1fe2824af80be296a0c263d42455 Mon Sep 17 00:00:00 2001 From: David Turner Date: Thu, 29 Jun 2000 21:48:58 +0000 Subject: [PATCH] various bug fixes in the postscript font drivers (mainly they added one un-necessary point to each contour..) --- src/cff/t2gload.c | 47 +++++++++++++++++++++++++------------------- src/cid/cidgload.c | 17 ++++++++++++++++ src/sfnt/sfobjs.c | 2 +- src/type1/t1gload.c | 27 +++++++++++++++++-------- src/type1z/z1gload.c | 18 +++++++++++++++++ 5 files changed, 82 insertions(+), 29 deletions(-) diff --git a/src/cff/t2gload.c b/src/cff/t2gload.c index 75c8eba2d..ee4f25489 100644 --- a/src/cff/t2gload.c +++ b/src/cff/t2gload.c @@ -485,6 +485,23 @@ { FT_Outline* outline = builder->current; + /* XXXX : we must not include the last point in the path if it */ + /* is located on the first point.. */ + if (outline->n_points > 1) + { + FT_Int first = 0; + FT_Vector* p1 = outline->points + first; + FT_Vector* p2 = outline->points + outline->n_points-1; + + if (outline->n_contours > 1) + { + first = outline->contours[outline->n_contours-2]+1; + p1 = outline->points + first; + } + + if ( p1->x == p2->x && p1->y == p2->y ) + outline->n_points--; + } if ( outline->n_contours > 0 ) outline->contours[outline->n_contours - 1] = outline->n_points - 1; @@ -1676,8 +1693,13 @@ if ( load_flags & FT_LOAD_NO_RECURSE ) load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; - glyph->x_scale = size->metrics.x_scale; - glyph->y_scale = size->metrics.y_scale; + glyph->x_scale = 0x10000; + glyph->y_scale = 0x10000; + if (size) + { + glyph->x_scale = size->metrics.x_scale; + glyph->y_scale = size->metrics.y_scale; + } glyph->root.outline.n_points = 0; glyph->root.outline.n_contours = 0; @@ -1685,7 +1707,7 @@ hinting = ( load_flags & FT_LOAD_NO_SCALE ) == 0 && ( load_flags & FT_LOAD_NO_HINTING ) == 0; - glyph->root.format = ft_glyph_format_none; + glyph->root.format = ft_glyph_format_outline; /* by default */ { FT_Byte* charstring; @@ -1719,15 +1741,10 @@ { /* for composite glyphs, return only the left side bearing and the */ /* advance width.. */ - if ( load_flags & FT_LOAD_NO_RECURSE ) + if ( glyph->root.format == ft_glyph_format_composite ) { -#if 0 - glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x; - glyph->root.metrics.horiAdvance = decoder.builder.advance.x; -#else glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x; glyph->root.metrics.horiAdvance = decoder.glyph_width; -#endif /* 0 */ } else { @@ -1736,11 +1753,7 @@ /* copy the _unscaled_ advance width */ -#if 0 - metrics->horiAdvance = decoder.builder.advance.x; -#else metrics->horiAdvance = decoder.glyph_width; -#endif /* 0 */ /* make up vertical metrics */ metrics->vertBearingX = 0; @@ -1749,18 +1762,12 @@ glyph->root.format = ft_glyph_format_outline; - glyph->root.outline.flags &= ft_outline_owner; + glyph->root.outline.flags = 0; if ( size && size->metrics.y_ppem < 24 ) glyph->root.outline.flags |= ft_outline_high_precision; glyph->root.outline.flags |= ft_outline_reverse_fill; -#if 0 - glyph->root.outline.second_pass = TRUE; - glyph->root.outline.high_precision = size->root.metrics.y_ppem < 24; - glyph->root.outline.dropout_mode = 2; -#endif - if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 ) { /* scale the outline and the metrics */ diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index 152758330..3501990d8 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -335,6 +335,23 @@ { FT_Outline* outline = builder->current; + /* XXXX : we must not include the last point in the path if it */ + /* is located on the first point.. */ + if (outline->n_points > 1) + { + FT_Int first = 0; + FT_Vector* p1 = outline->points + first; + FT_Vector* p2 = outline->points + outline->n_points-1; + + if (outline->n_contours > 1) + { + first = outline->contours[outline->n_contours-2]+1; + p1 = outline->points + first; + } + + if ( p1->x == p2->x && p1->y == p2->y ) + outline->n_points--; + } if ( outline->n_contours > 0 ) outline->contours[outline->n_contours - 1] = outline->n_points - 1; diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 906d0e079..5087f1277 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -276,7 +276,7 @@ if ( LOAD_( hdmx ) || LOAD_( gasp ) || LOAD_( kerning ) || - LOAD_( pclt ) ) + LOAD_( pclt ) ) goto Exit; #ifdef TT_CONFIG_OPTION_EXTEND_ENGINE diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index e8388792c..bef4a4a6e 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -1235,6 +1235,23 @@ { FT_Outline* cur = builder->current; + /* XXXX : we must not include the last point in the path if it */ + /* is located on the first point.. */ + if (cur->n_points > 1) + { + FT_Int first = 0; + FT_Vector* p1 = cur->points + first; + FT_Vector* p2 = cur->points + cur->n_points-1; + + if (cur->n_contours > 1) + { + first = cur->contours[cur->n_contours-2]+1; + p1 = cur->points + first; + } + + if ( p1->x == p2->x && p1->y == p2->y ) + cur->n_points--; + } /* save current contour, if any */ if ( cur->n_contours > 0 ) @@ -1686,7 +1703,7 @@ { /* for composite glyphs, return only the left side bearing and the */ /* advance width */ - if ( load_flags & FT_LOAD_NO_RECURSE ) + if ( glyph->root.format == ft_glyph_format_composite ) { glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x; glyph->root.metrics.horiAdvance = decoder.builder.advance.x; @@ -1728,19 +1745,13 @@ glyph->root.format = ft_glyph_format_outline; - glyph->root.outline.flags &= ft_outline_owner; + glyph->root.outline.flags = 0; if ( size->root.metrics.y_ppem < 24 ) glyph->root.outline.flags |= ft_outline_high_precision; glyph->root.outline.flags |= ft_outline_reverse_fill; -#if 0 - glyph->root.outline.second_pass = TRUE; - glyph->root.outline.high_precision = size->root.metrics.y_ppem < 24; - glyph->root.outline.dropout_mode = 2; -#endif - if ( hinting ) { /* adjust the advance width */ diff --git a/src/type1z/z1gload.c b/src/type1z/z1gload.c index 6868339b9..ababad15d 100644 --- a/src/type1z/z1gload.c +++ b/src/type1z/z1gload.c @@ -308,6 +308,24 @@ { FT_Outline* outline = builder->current; + /* XXXX : we must not include the last point in the path if it */ + /* is located on the first point.. */ + if (outline->n_points > 1) + { + FT_Int first = 0; + FT_Vector* p1 = outline->points + first; + FT_Vector* p2 = outline->points + outline->n_points-1; + + if (outline->n_contours > 1) + { + first = outline->contours[outline->n_contours-2]+1; + p1 = outline->points + first; + } + + if ( p1->x == p2->x && p1->y == p2->y ) + outline->n_points--; + } + if ( outline->n_contours > 0 ) outline->contours[outline->n_contours-1] = outline->n_points-1; }