diff options
| author | Po Lu | 2023-08-24 09:08:11 +0800 |
|---|---|---|
| committer | Po Lu | 2023-08-24 09:08:11 +0800 |
| commit | 1986484d4d0b77e5c9f00217cdf2da28b6b6cf11 (patch) | |
| tree | 673d29ef8b198e4f9cf76a4dd2281c376d75cef1 /src | |
| parent | a261b17e3066fc5e5323a17a51c8180e82711b7f (diff) | |
| download | emacs-1986484d4d0b77e5c9f00217cdf2da28b6b6cf11.tar.gz emacs-1986484d4d0b77e5c9f00217cdf2da28b6b6cf11.zip | |
Properly detect medium fonts
* src/sfntfont.c (sfnt_decode_family_style): Refer to the
preferred family and subfamily if present.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sfntfont.c | 23 |
1 files 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, | |||
| 322 | struct sfnt_name_record family_rec, style_rec; | 322 | struct sfnt_name_record family_rec, style_rec; |
| 323 | unsigned char *family_data, *style_data; | 323 | unsigned char *family_data, *style_data; |
| 324 | 324 | ||
| 325 | family_data = sfnt_find_name (name, SFNT_NAME_FONT_FAMILY, | 325 | /* Because MS-Windows is incapable of treating font families |
| 326 | comprising more than four styles correctly, the TrueType | ||
| 327 | specification incorporates additional PREFERRED_FAMILY and | ||
| 328 | PREFERRED_SUBFAMILY name resources that are meant to be consulted | ||
| 329 | over the traditional family and subfamily resources. When | ||
| 330 | present within fonts supplying unusual styles, these names hold | ||
| 331 | the ``actual'' typographic family and style of the font, in lieu | ||
| 332 | of the font family with the style affixed to the front and | ||
| 333 | Regular. */ | ||
| 334 | |||
| 335 | family_data = sfnt_find_name (name, SFNT_NAME_PREFERRED_FAMILY, | ||
| 326 | &family_rec); | 336 | &family_rec); |
| 327 | style_data = sfnt_find_name (name, SFNT_NAME_FONT_SUBFAMILY, | 337 | |
| 338 | if (!family_data) | ||
| 339 | family_data = sfnt_find_name (name, SFNT_NAME_FONT_FAMILY, | ||
| 340 | &family_rec); | ||
| 341 | |||
| 342 | style_data = sfnt_find_name (name, SFNT_NAME_PREFERRED_SUBFAMILY, | ||
| 328 | &style_rec); | 343 | &style_rec); |
| 329 | 344 | ||
| 345 | if (!style_data) | ||
| 346 | style_data = sfnt_find_name (name, SFNT_NAME_FONT_SUBFAMILY, | ||
| 347 | &style_rec); | ||
| 348 | |||
| 330 | if (!family_data || !style_data) | 349 | if (!family_data || !style_data) |
| 331 | return 1; | 350 | return 1; |
| 332 | 351 | ||