diff options
Diffstat (limited to 'freetype/src/type1')
-rw-r--r-- | freetype/src/type1/t1afm.c | 18 | ||||
-rw-r--r-- | freetype/src/type1/t1gload.c | 40 | ||||
-rw-r--r-- | freetype/src/type1/t1objs.c | 9 | ||||
-rw-r--r-- | freetype/src/type1/t1parse.c | 21 |
4 files changed, 56 insertions, 32 deletions
diff --git a/freetype/src/type1/t1afm.c b/freetype/src/type1/t1afm.c index 16dc471c5..ef343901a 100644 --- a/freetype/src/type1/t1afm.c +++ b/freetype/src/type1/t1afm.c @@ -4,7 +4,7 @@ /* */ /* AFM support for Type 1 fonts (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -58,7 +58,7 @@ /* PS string/name length must be < 16-bit */ - if ( ( len - 0xFFFFU ) > 0 ) + if ( len > 0xFFFFU ) return 0; for ( n = 0; n < type1->num_glyphs; n++ ) @@ -285,13 +285,15 @@ { t1_font->font_bbox = fi->FontBBox; - t1_face->bbox.xMin = fi->FontBBox.xMin >> 16; - t1_face->bbox.yMin = fi->FontBBox.yMin >> 16; - t1_face->bbox.xMax = ( fi->FontBBox.xMax + 0xFFFFU ) >> 16; - t1_face->bbox.yMax = ( fi->FontBBox.yMax + 0xFFFFU ) >> 16; + t1_face->bbox.xMin = fi->FontBBox.xMin >> 16; + t1_face->bbox.yMin = fi->FontBBox.yMin >> 16; + /* no `U' suffix here to 0xFFFF! */ + t1_face->bbox.xMax = ( fi->FontBBox.xMax + 0xFFFF ) >> 16; + t1_face->bbox.yMax = ( fi->FontBBox.yMax + 0xFFFF ) >> 16; - t1_face->ascender = (FT_Short)( ( fi->Ascender + 0x8000U ) >> 16 ); - t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000U ) >> 16 ); + /* no `U' suffix here to 0x8000! */ + t1_face->ascender = (FT_Short)( ( fi->Ascender + 0x8000 ) >> 16 ); + t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000 ) >> 16 ); if ( fi->NumKernPair ) { diff --git a/freetype/src/type1/t1gload.c b/freetype/src/type1/t1gload.c index 16586153f..f3fad4f5d 100644 --- a/freetype/src/type1/t1gload.c +++ b/freetype/src/type1/t1gload.c @@ -4,7 +4,7 @@ /* */ /* Type 1 Glyph Loader (body). */ /* */ -/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by */ +/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -103,16 +103,16 @@ metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x ); - metrics.bearing_y = FIXED_TO_INT( decoder->builder.left_bearing.y ); + metrics.bearing_y = 0; metrics.advance = FIXED_TO_INT( decoder->builder.advance.x ); + metrics.advance_v = FIXED_TO_INT( decoder->builder.advance.y ); error = inc->funcs->get_glyph_metrics( inc->object, glyph_index, FALSE, &metrics ); decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x ); - decoder->builder.left_bearing.y = INT_TO_FIXED( metrics.bearing_y ); decoder->builder.advance.x = INT_TO_FIXED( metrics.advance ); - decoder->builder.advance.y = 0; + decoder->builder.advance.y = INT_TO_FIXED( metrics.advance_v ); } #endif /* FT_CONFIG_OPTION_INCREMENTAL */ @@ -287,7 +287,12 @@ #endif +#ifdef FT_CONFIG_OPTION_INCREMENTAL + if ( glyph_index >= (FT_UInt)face->root.num_glyphs && + !face->root.internal->incremental_interface ) +#else if ( glyph_index >= (FT_UInt)face->root.num_glyphs ) +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ { error = T1_Err_Invalid_Argument; goto Exit; @@ -396,10 +401,20 @@ FIXED_TO_INT( decoder.builder.advance.x ); glyph->root.internal->glyph_transformed = 0; - /* make up vertical ones */ - metrics->vertAdvance = ( face->type1.font_bbox.yMax - - face->type1.font_bbox.yMin ) >> 16; - glyph->root.linearVertAdvance = metrics->vertAdvance; + if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) + { + /* make up vertical ones */ + metrics->vertAdvance = ( face->type1.font_bbox.yMax - + face->type1.font_bbox.yMin ) >> 16; + glyph->root.linearVertAdvance = metrics->vertAdvance; + } + else + { + metrics->vertAdvance = + FIXED_TO_INT( decoder.builder.advance.y ); + glyph->root.linearVertAdvance = + FIXED_TO_INT( decoder.builder.advance.y ); + } glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; @@ -459,9 +474,12 @@ metrics->horiBearingX = cbox.xMin; metrics->horiBearingY = cbox.yMax; - /* make up vertical ones */ - ft_synthesize_vertical_metrics( metrics, - metrics->vertAdvance ); + if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) + { + /* make up vertical ones */ + ft_synthesize_vertical_metrics( metrics, + metrics->vertAdvance ); + } } /* Set control data to the glyph charstrings. Note that this is */ diff --git a/freetype/src/type1/t1objs.c b/freetype/src/type1/t1objs.c index e9357e6c5..b1de68719 100644 --- a/freetype/src/type1/t1objs.c +++ b/freetype/src/type1/t1objs.c @@ -441,10 +441,11 @@ root->num_fixed_sizes = 0; root->available_sizes = 0; - root->bbox.xMin = type1->font_bbox.xMin >> 16; - root->bbox.yMin = type1->font_bbox.yMin >> 16; - root->bbox.xMax = ( type1->font_bbox.xMax + 0xFFFFU ) >> 16; - root->bbox.yMax = ( type1->font_bbox.yMax + 0xFFFFU ) >> 16; + root->bbox.xMin = type1->font_bbox.xMin >> 16; + root->bbox.yMin = type1->font_bbox.yMin >> 16; + /* no `U' suffix here to 0xFFFF! */ + root->bbox.xMax = ( type1->font_bbox.xMax + 0xFFFF ) >> 16; + root->bbox.yMax = ( type1->font_bbox.yMax + 0xFFFF ) >> 16; /* Set units_per_EM if we didn't set it in parse_font_matrix. */ if ( !root->units_per_EM ) diff --git a/freetype/src/type1/t1parse.c b/freetype/src/type1/t1parse.c index 1bef56bcf..2a762279f 100644 --- a/freetype/src/type1/t1parse.c +++ b/freetype/src/type1/t1parse.c @@ -397,15 +397,18 @@ T1_Skip_PS_Token( parser ); cur = parser->root.cursor; - if ( *cur == '\r' ) - { - cur++; - if ( *cur == '\n' ) - cur++; - } - else if ( *cur == '\n' ) - cur++; - else + + /* according to the Type1 spec, the first cipher byte must not be */ + /* an ASCII whitespace character code (blank, tab, carriage return */ + /* or line feed). We have seen Type 1 fonts with two line feed */ + /* characters... So skip now all whitespace character codes. */ + while ( cur < limit && + ( *cur == ' ' || + *cur == '\t' || + *cur == '\r' || + *cur == '\n' ) ) + ++cur; + if ( cur >= limit ) { FT_ERROR(( "T1_Get_Private_Dict:" " `eexec' not properly terminated\n" )); |