@@ -321,9 +321,13 @@ def ttfFontProperty(font):
321
321
sfnt = font .get_sfnt ()
322
322
# These tables are actually mac_roman-encoded, but mac_roman support may be
323
323
# 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
+
327
331
if sfnt4 .find ('oblique' ) >= 0 :
328
332
style = 'oblique'
329
333
elif sfnt4 .find ('italic' ) >= 0 :
0 commit comments