[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 1986484d4d0: Properly detect medium fonts
From: |
Po Lu |
Subject: |
master 1986484d4d0: Properly detect medium fonts |
Date: |
Wed, 23 Aug 2023 21:08:43 -0400 (EDT) |
branch: master
commit 1986484d4d0b77e5c9f00217cdf2da28b6b6cf11
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Properly detect medium fonts
* src/sfntfont.c (sfnt_decode_family_style): Refer to the
preferred family and subfamily if present.
---
src/sfntfont.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/sfntfont.c b/src/sfntfont.c
index e2dfdaff3b6..f2dc05c886e 100644
--- a/src/sfntfont.c
+++ b/src/sfntfont.c
@@ -322,11 +322,30 @@ sfnt_decode_family_style (struct sfnt_name_table *name,
struct sfnt_name_record family_rec, style_rec;
unsigned char *family_data, *style_data;
- family_data = sfnt_find_name (name, SFNT_NAME_FONT_FAMILY,
+ /* Because MS-Windows is incapable of treating font families
+ comprising more than four styles correctly, the TrueType
+ specification incorporates additional PREFERRED_FAMILY and
+ PREFERRED_SUBFAMILY name resources that are meant to be consulted
+ over the traditional family and subfamily resources. When
+ present within fonts supplying unusual styles, these names hold
+ the ``actual'' typographic family and style of the font, in lieu
+ of the font family with the style affixed to the front and
+ Regular. */
+
+ family_data = sfnt_find_name (name, SFNT_NAME_PREFERRED_FAMILY,
&family_rec);
- style_data = sfnt_find_name (name, SFNT_NAME_FONT_SUBFAMILY,
+
+ if (!family_data)
+ family_data = sfnt_find_name (name, SFNT_NAME_FONT_FAMILY,
+ &family_rec);
+
+ style_data = sfnt_find_name (name, SFNT_NAME_PREFERRED_SUBFAMILY,
&style_rec);
+ if (!style_data)
+ style_data = sfnt_find_name (name, SFNT_NAME_FONT_SUBFAMILY,
+ &style_rec);
+
if (!family_data || !style_data)
return 1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 1986484d4d0: Properly detect medium fonts,
Po Lu <=