[cff,cid,type1,type42] Fix up PS_FontInfo.

The italic angle is commonly specified in fractional degrees in
Type 1 fonts and its derivatives.  This change clarifies and fixes
these values.  Note that CFF fonts has always reported them as such,
but truncated the underline position and thickness.  Fixes #1367.

* include/freetype/t1tables.h (PS_FontInfoRec):
Use FT_Fixed for italic_angle.
* src/cid/cidtoken.h, src/type1/t1tokens.h, src/type42/t42parse.c:
Modify the italic_angle token.
* src/cff/cffdrivr.c (cff_ps_get_font_info): Fix the underline
position and thickness.

* docs/CHANGES: Note this change.
This commit is contained in:
Alexei Podtelezhnikov 2025-11-04 19:21:49 -05:00
parent ae63cc0d13
commit 3532877461
6 changed files with 20 additions and 6 deletions

View file

@ -1,3 +1,15 @@
CHANGES BETWEEN 2.14.1 and 2.14.2 (2025-Mmm-DD)
I. IMPORTANT BUG FIXES
- The italic angle in `PS_FontInfo` is now stored as a fixed-point
value in degrees for all Type 1 fonts and their derivatives,
consistent with CFF fonts and common practices. The broken
underline position and thickness values are fixed for CFF fonts.
======================================================================
CHANGES BETWEEN 2.14.0 and 2.14.1 (2025-Sep-11)
I. IMPORTANT BUG FIXES

View file

@ -92,7 +92,7 @@ FT_BEGIN_HEADER
FT_String* full_name;
FT_String* family_name;
FT_String* weight;
FT_Long italic_angle;
FT_Fixed italic_angle;
FT_Bool is_fixed_pitch;
FT_Short underline_position;
FT_UShort underline_thickness;

View file

@ -456,8 +456,10 @@
dict->weight );
font_info->italic_angle = dict->italic_angle;
font_info->is_fixed_pitch = dict->is_fixed_pitch;
font_info->underline_position = (FT_Short)dict->underline_position;
font_info->underline_thickness = (FT_UShort)dict->underline_thickness;
font_info->underline_position =
(FT_Short)( dict->underline_position >> 16 );
font_info->underline_thickness =
(FT_UShort)( dict->underline_thickness >> 16 );
cff->font_info = font_info;
}

View file

@ -47,7 +47,7 @@
T1_FIELD_STRING( "FullName", full_name, 0 )
T1_FIELD_STRING( "FamilyName", family_name, 0 )
T1_FIELD_STRING( "Weight", weight, 0 )
T1_FIELD_NUM ( "ItalicAngle", italic_angle, 0 )
T1_FIELD_FIXED ( "ItalicAngle", italic_angle, 0 )
T1_FIELD_BOOL ( "isFixedPitch", is_fixed_pitch, 0 )
T1_FIELD_NUM ( "UnderlinePosition", underline_position, 0 )
T1_FIELD_NUM ( "UnderlineThickness", underline_thickness, 0 )

View file

@ -33,7 +33,7 @@
T1_FIELD_DICT_FONTDICT )
/* we use pointers to detect modifications made by synthetic fonts */
T1_FIELD_NUM ( "ItalicAngle", italic_angle,
T1_FIELD_FIXED ( "ItalicAngle", italic_angle,
T1_FIELD_DICT_FONTDICT )
T1_FIELD_BOOL ( "isFixedPitch", is_fixed_pitch,
T1_FIELD_DICT_FONTDICT )

View file

@ -65,7 +65,7 @@
T1_FIELD_STRING( "FullName", full_name, 0 )
T1_FIELD_STRING( "FamilyName", family_name, 0 )
T1_FIELD_STRING( "Weight", weight, 0 )
T1_FIELD_NUM ( "ItalicAngle", italic_angle, 0 )
T1_FIELD_FIXED ( "ItalicAngle", italic_angle, 0 )
T1_FIELD_BOOL ( "isFixedPitch", is_fixed_pitch, 0 )
T1_FIELD_NUM ( "UnderlinePosition", underline_position, 0 )
T1_FIELD_NUM ( "UnderlineThickness", underline_thickness, 0 )