From 827679dd9f7c68befc4bf816c7fe7da6ccb9d2db Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Fri, 10 Feb 2023 23:57:30 +0000 Subject: freetype 2.13.0 git-svn-id: svn://tug.org/texlive/trunk@65782 c570f23f-e606-0410-a88d-b1316a301751 --- .../libs/freetype2/freetype-src/src/type1/t1afm.c | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'Build/source/libs/freetype2/freetype-src/src/type1/t1afm.c') diff --git a/Build/source/libs/freetype2/freetype-src/src/type1/t1afm.c b/Build/source/libs/freetype2/freetype-src/src/type1/t1afm.c index 6009e9ee2ee..787aa92c98a 100644 --- a/Build/source/libs/freetype2/freetype-src/src/type1/t1afm.c +++ b/Build/source/libs/freetype2/freetype-src/src/type1/t1afm.c @@ -4,7 +4,7 @@ * * AFM support for Type 1 fonts (body). * - * Copyright (C) 1996-2022 by + * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, @@ -178,7 +178,6 @@ /* temporarily. If we find no PostScript charmap, then just use */ /* the default and hope it is the right one. */ oldcharmap = t1_face->charmap; - charmap = NULL; for ( n = 0; n < t1_face->num_charmaps; n++ ) { @@ -186,9 +185,7 @@ /* check against PostScript pseudo platform */ if ( charmap->platform_id == 7 ) { - error = FT_Set_Charmap( t1_face, charmap ); - if ( error ) - goto Exit; + t1_face->charmap = charmap; break; } } @@ -209,10 +206,7 @@ kp++; } - if ( oldcharmap ) - error = FT_Set_Charmap( t1_face, oldcharmap ); - if ( error ) - goto Exit; + t1_face->charmap = oldcharmap; /* now, sort the kern pairs according to their glyph indices */ ft_qsort( fi->KernPairs, fi->NumKernPair, sizeof ( AFM_KernPairRec ), @@ -302,9 +296,14 @@ t1_face->bbox.xMax = ( fi->FontBBox.xMax + 0xFFFF ) >> 16; t1_face->bbox.yMax = ( fi->FontBBox.yMax + 0xFFFF ) >> 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 ); + /* ascender and descender are optional and could both be zero */ + /* check if values are meaningful before overriding defaults */ + if ( fi->Ascender > fi->Descender ) + { + /* 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 ) { -- cgit v1.2.3