def get_encoding(self): while 1: try: (cid,name) = self.nextobject() except PSEOF: break try: self._cid2unicode[cid] = name2unicode(name) except KeyError: pass return self._cid2unicode
def add_cid2unichr(self, cid, code): assert isinstance(cid, int) if isinstance(code, PSLiteral): # Interpret as an Adobe glyph name. self.cid2unichr[cid] = name2unicode(code.name) elif isinstance(code, str): # Interpret as UTF-16BE. self.cid2unichr[cid] = unicode(code, 'UTF-16BE', 'ignore') elif isinstance(code, int): self.cid2unichr[cid] = unichr(code) else: raise TypeError(code)
def add_cid2unichr(self, cid, code): assert isinstance(cid, int) if isinstance(code, PSLiteral): # Interpret as an Adobe glyph name. self.cid2unichr[cid] = name2unicode(code.name) elif isinstance(code, str): # Interpret as UTF-16BE. self.cid2unichr[cid] = unicode(code, 'UTF-16BE', 'ignore') elif isinstance(code, int): self.cid2unichr[cid] = unichr(code) else: raise TypeError(code) return