* src/type1/t1afm.c (T1_Read_Metrics): Validate ascender and descender.

The ascender and descender are optional in the AFM specifications.
They could be omitted or even set to zero, e.g., in the current release
of URW++ base 35 fonts.
This commit is contained in:
Alexei Podtelezhnikov 2023-02-04 03:20:25 +00:00
parent 646cc8ef8d
commit 82c131accb

View File

@ -296,9 +296,13 @@
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 */
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 )
{