Improve font selection on MS-Windows

The Arial Unicode MS font claims in its USB (Unicode Subset
Bitfields) values support for several scripts for which it
doesn't actually have glyphs.  This sometimes caused Emacs to
decide to use Arial Unicode MS for some script, only to
discover later that there are no glyphs for that script's
characters.  This change fixes the USB values according to
actual font coverage, as determined by BabelMap.
* src/w32font.c (add_font_entity_to_list): Fix USB values of Arial
Unicode MS font according to its actual coverage of scripts.
This commit is contained in:
Eli Zaretskii 2022-05-27 15:07:33 +03:00
parent a83e75b207
commit 8399c6a821

View file

@ -1540,6 +1540,19 @@ add_font_entity_to_list (ENUMLOGFONTEX *logical_font,
|| physical_font->ntmFontSig.fsUsb[1]
|| physical_font->ntmFontSig.fsUsb[0] & 0x3fffffff;
/* Kludgey fix for Arial Unicode MS font that claims support for
scripts it doesn't actually cover. */
if (strncmp (logical_font->elfLogFont.lfFaceName,
"Arial Unicode MS", 16) == 0)
{
/* Reset bits 4 (Phonetic), 12 (Vai), 14 (Nko), 27 (Balinese). */
physical_font->ntmFontSig.fsUsb[0] &= 0xf7ffafef;
/* Reset bits 53 (Phags-pa) and 58 (Phoenician). */
physical_font->ntmFontSig.fsUsb[1] &= 0xfbdfffff;
/* Set bit 70 (Tibetan). */
physical_font->ntmFontSig.fsUsb[2] |= 0x00000040;
}
/* Skip non matching fonts. */
/* For uniscribe backend, consider only truetype or opentype fonts