MCPcopy Index your code
hub / github.com/clips/pattern / FileUnicodeMap

Class FileUnicodeMap

pattern/web/pdf/cmapdb.py:165–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163## FileUnicodeMap
164##
165class FileUnicodeMap(UnicodeMap):
166
167 def __init__(self):
168 UnicodeMap.__init__(self)
169 self.attrs = {}
170 return
171
172 def __repr__(self):
173 return '<UnicodeMap: %s>' % self.attrs.get('CMapName')
174
175 def set_attr(self, k, v):
176 self.attrs[k] = v
177 return
178
179 def add_cid2unichr(self, cid, code):
180 assert isinstance(cid, int)
181 if isinstance(code, PSLiteral):
182 # Interpret as an Adobe glyph name.
183 self.cid2unichr[cid] = name2unicode(code.name)
184 elif isinstance(code, str):
185 # Interpret as UTF-16BE.
186 self.cid2unichr[cid] = unicode(code, 'UTF-16BE', 'ignore')
187 elif isinstance(code, int):
188 self.cid2unichr[cid] = unichr(code)
189 else:
190 raise TypeError(code)
191 return
192
193
194## PyCMap

Callers 4

create_unicode_mapMethod · 0.90
__init__Method · 0.90
__init__Method · 0.90
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…