Add NameRecord.isUnicode()
diff --git a/Lib/fontTools/ttLib/tables/_n_a_m_e.py b/Lib/fontTools/ttLib/tables/_n_a_m_e.py
index d78b838..53fde4d 100644
--- a/Lib/fontTools/ttLib/tables/_n_a_m_e.py
+++ b/Lib/fontTools/ttLib/tables/_n_a_m_e.py
@@ -90,6 +90,10 @@
class NameRecord(object):
+ def isUnicode(self):
+ return (self.platformID == 0 or
+ (self.platformID == 3 and self.platEncID in [0, 1, 10]))
+
def toXML(self, writer, ttFont):
writer.begintag("namerecord", [
("nameID", self.nameID),
@@ -98,7 +102,7 @@
("langID", hex(self.langID)),
])
writer.newline()
- if self.platformID == 0 or (self.platformID == 3 and self.platEncID in (0, 1)):
+ if self.isUnicode():
if len(self.string) % 2:
# no, shouldn't happen, but some of the Apple
# tools cause this anyway :-(
@@ -117,7 +121,7 @@
self.platEncID = safeEval(attrs["platEncID"])
self.langID = safeEval(attrs["langID"])
s = strjoin(content).strip()
- if self.platformID == 0 or (self.platformID == 3 and self.platEncID in (0, 1)):
+ if self.isUnicode():
self.string = s.encode("utf_16_be")
else:
# This is the inverse of write8bit...