emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8399c6a821: Improve font selection on MS-Windows


From: Eli Zaretskii
Subject: master 8399c6a821: Improve font selection on MS-Windows
Date: Fri, 27 May 2022 08:12:32 -0400 (EDT)

branch: master
commit 8399c6a82127f3c6a2e5f781122567d27ae799f8
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    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.
---
 src/w32font.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/w32font.c b/src/w32font.c
index 4e60b818ce..611a0c8965 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]