From 6d925f5b9a6e1b58765ee09fe8552b75f75241c3 Mon Sep 17 00:00:00 2001 From: Just Date: Mon, 23 Oct 2000 14:36:20 +0000 Subject: [PATCH] workaround for odd-length unicode strings (!) git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@126 4cde692c-a291-49d1-8350-778aa11640f8 --- Lib/fontTools/ttLib/tables/_n_a_m_e.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Lib/fontTools/ttLib/tables/_n_a_m_e.py b/Lib/fontTools/ttLib/tables/_n_a_m_e.py index 62bd14601..8bcf69cf4 100644 --- a/Lib/fontTools/ttLib/tables/_n_a_m_e.py +++ b/Lib/fontTools/ttLib/tables/_n_a_m_e.py @@ -89,7 +89,12 @@ class NameRecord: ]) writer.newline() if self.platformID == 0 or (self.platformID == 3 and self.platEncID in (0, 1)): - writer.write16bit(self.string) + if len(self.string) % 2: + # no, shouldn't happen, but some of the Apple + # tools cause this anyway :-( + writer.write16bit(self.string + "\0") + else: + writer.write16bit(self.string) else: writer.write8bit(self.string) writer.newline()