[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master b00be9f: [cff] Fix family name logic of pure CFF font
From: |
Werner LEMBERG |
Subject: |
[freetype2] master b00be9f: [cff] Fix family name logic of pure CFF fontdata (#52056). |
Date: |
Tue, 19 Sep 2017 01:12:40 -0400 (EDT) |
branch: master
commit b00be9f609d8b4e8e45c1d53c1be303779a13d44
Author: John Tytgat <address@hidden>
Commit: Werner Lemberg <address@hidden>
[cff] Fix family name logic of pure CFF fontdata (#52056).
1. If `FamilyName' is present in the CFF font, use this for
FT_Face's `family_name'.
2. Otherwise, use the face name and chop off any subset prefix.
3. If at this point FT_Face's `family_name' is set, use this
together with the full name to determine the style.
4. Otherwise, use `CIDFontName' as FT_Face's `family_name'.
5. If we don't have a valid style, use "Regular".
Previously, FT_Face's `family_name' entry for pure CFF fontdata
nearly always was the fontname itself, instead of the `FamilyName'
entry in the CFF font (assuming there is one).
* src/cff/cffobjs.c (cff_face_init) [pure_cff]: Implement it.
---
ChangeLog | 18 ++++++++++++++++++
src/cff/cffobjs.c | 36 +++++++++++++++++++++---------------
2 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a4e8e67..64c39dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2017-09-19 John Tytgat <address@hidden>
+
+ [cff] Fix family name logic of pure CFF fontdata (#52056).
+
+ 1. If `FamilyName' is present in the CFF font, use this for
+ FT_Face's `family_name'.
+ 2. Otherwise, use the face name and chop off any subset prefix.
+ 3. If at this point FT_Face's `family_name' is set, use this
+ together with the full name to determine the style.
+ 4. Otherwise, use `CIDFontName' as FT_Face's `family_name'.
+ 5. If we don't have a valid style, use "Regular".
+
+ Previously, FT_Face's `family_name' entry for pure CFF fontdata
+ nearly always was the fontname itself, instead of the `FamilyName'
+ entry in the CFF font (assuming there is one).
+
+ * src/cff/cffobjs.c (cff_face_init) [pure_cff]: Implement it.
+
2017-09-18 Alexei Podtelezhnikov <address@hidden>
[build] Declutter Visual C++ 2010-2017 project.
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 6161393..2899a4c 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -876,7 +876,8 @@
cffface->height = (FT_Short)( ( cffface->units_per_EM * 12 ) / 10 );
if ( cffface->height < cffface->ascender - cffface->descender )
- cffface->height = (FT_Short)( cffface->ascender - cffface->descender
);
+ cffface->height = (FT_Short)( cffface->ascender -
+ cffface->descender );
cffface->underline_position =
(FT_Short)( dict->underline_position >> 16 );
@@ -884,27 +885,32 @@
(FT_Short)( dict->underline_thickness >> 16 );
/* retrieve font family & style name */
- cffface->family_name = cff_index_get_name(
- cff,
- (FT_UInt)( face_index & 0xFFFF ) );
+ if ( dict->family_name )
+ {
+ char* family_name;
+
+
+ family_name = cff_index_get_sid_string( cff, dict->family_name );
+ if ( family_name )
+ cffface->family_name = cff_strcpy( memory, family_name );
+ }
+
+ if ( !cffface->family_name )
+ {
+ cffface->family_name = cff_index_get_name(
+ cff,
+ (FT_UInt)( face_index & 0xFFFF ) );
+ if ( cffface->family_name )
+ remove_subset_prefix( cffface->family_name );
+ }
+
if ( cffface->family_name )
{
char* full = cff_index_get_sid_string( cff,
dict->full_name );
char* fullp = full;
char* family = cffface->family_name;
- char* family_name = NULL;
-
- remove_subset_prefix( cffface->family_name );
-
- if ( dict->family_name )
- {
- family_name = cff_index_get_sid_string( cff,
- dict->family_name );
- if ( family_name )
- family = family_name;
- }
/* We try to extract the style name from the full name. */
/* We need to ignore spaces and dashes during the search. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master b00be9f: [cff] Fix family name logic of pure CFF fontdata (#52056).,
Werner LEMBERG <=