@@ -321,9 +321,13 @@ def ttfFontProperty(font):
321321 sfnt = font .get_sfnt ()
322322 # These tables are actually mac_roman-encoded, but mac_roman support may be
323323 # missing in some alternative Python implementations and we are only going
324- # to look for ASCII substrings, where any ASCII-compatible encoding works.
325- sfnt2 = sfnt .get ((1 , 0 , 0 , 2 ), b'' ).decode ('latin-1' ).lower ()
326- sfnt4 = sfnt .get ((1 , 0 , 0 , 4 ), b'' ).decode ('latin-1' ).lower ()
324+ # to look for ASCII substrings, where any ASCII-compatible encoding works
325+ # - or big-endian UTF-16, since important Microsoft fonts use that.
326+ sfnt2 = (sfnt .get ((1 , 0 , 0 , 2 ), b'' ).decode ('latin-1' ).lower () or
327+ sfnt .get ((3 , 1 , 0x0409 , 2 ), b'' ).decode ('utf_16_be' ).lower ())
328+ sfnt4 = (sfnt .get ((1 , 0 , 0 , 4 ), b'' ).decode ('latin-1' ).lower () or
329+ sfnt .get ((3 , 1 , 0x0409 , 4 ), b'' ).decode ('utf_16_be' ).lower ())
330+
327331 if sfnt4 .find ('oblique' ) >= 0 :
328332 style = 'oblique'
329333 elif sfnt4 .find ('italic' ) >= 0 :
0 commit comments