- some method name changes
- check for 3,0 platform/encoding wide strings git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@92 4cde692c-a291-49d1-8350-778aa11640f8
This commit is contained in:
parent
7f34d735e0
commit
d29f289911
@ -24,7 +24,7 @@ class table__n_a_m_e(DefaultTable.DefaultTable):
|
|||||||
self.names = []
|
self.names = []
|
||||||
for i in range(n):
|
for i in range(n):
|
||||||
name, data = sstruct.unpack2(nameRecordFormat, data, NameRecord())
|
name, data = sstruct.unpack2(nameRecordFormat, data, NameRecord())
|
||||||
name.fixlongs()
|
name.fixLongs()
|
||||||
name.string = stringData[name.offset:name.offset+name.length]
|
name.string = stringData[name.offset:name.offset+name.length]
|
||||||
assert len(name.string) == name.length
|
assert len(name.string) == name.length
|
||||||
#if (name.platEncID, name.platformID) in ((0, 0), (1, 3)):
|
#if (name.platEncID, name.platformID) in ((0, 0), (1, 3)):
|
||||||
@ -65,7 +65,7 @@ class table__n_a_m_e(DefaultTable.DefaultTable):
|
|||||||
self.names.append(name)
|
self.names.append(name)
|
||||||
name.fromXML((name, attrs, content), ttFont)
|
name.fromXML((name, attrs, content), ttFont)
|
||||||
|
|
||||||
def getname(self, nameID, platformID, platEncID, langID=None):
|
def getName(self, nameID, platformID, platEncID, langID=None):
|
||||||
for namerecord in self.names:
|
for namerecord in self.names:
|
||||||
if ( namerecord.nameID == nameID and
|
if ( namerecord.nameID == nameID and
|
||||||
namerecord.platformID == platformID and
|
namerecord.platformID == platformID and
|
||||||
@ -88,7 +88,7 @@ class NameRecord:
|
|||||||
("langID", hex(self.langID)),
|
("langID", hex(self.langID)),
|
||||||
])
|
])
|
||||||
writer.newline()
|
writer.newline()
|
||||||
if self.platformID == 0 or (self.platformID == 3 and self.platEncID == 1):
|
if self.platformID == 0 or (self.platformID == 3 and self.platEncID in (0, 1)):
|
||||||
writer.write16bit(self.string)
|
writer.write16bit(self.string)
|
||||||
else:
|
else:
|
||||||
writer.write8bit(self.string)
|
writer.write8bit(self.string)
|
||||||
@ -129,7 +129,7 @@ class NameRecord:
|
|||||||
return "<NameRecord NameID=%d; PlatformID=%d; LanguageID=%d>" % (
|
return "<NameRecord NameID=%d; PlatformID=%d; LanguageID=%d>" % (
|
||||||
self.nameID, self.platformID, self.langID)
|
self.nameID, self.platformID, self.langID)
|
||||||
|
|
||||||
def fixlongs(self):
|
def fixLongs(self):
|
||||||
"""correct effects from bug in Python 1.5.1, where "H"
|
"""correct effects from bug in Python 1.5.1, where "H"
|
||||||
returns a Python Long int.
|
returns a Python Long int.
|
||||||
This has been fixed in Python 1.5.2.
|
This has been fixed in Python 1.5.2.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user