MCPcopy Create free account
hub / github.com/scanny/python-pptx / _decode_name

Method _decode_name

src/pptx/text/fonts.py:302–315  ·  view source on GitHub ↗

Return the unicode name decoded from *raw_name* using the encoding implied by the combination of *platform_id* and *encoding_id*.

(raw_name, platform_id, encoding_id)

Source from the content-addressed store, hash-verified

300
301 @staticmethod
302 def _decode_name(raw_name, platform_id, encoding_id):
303 """
304 Return the unicode name decoded from *raw_name* using the encoding
305 implied by the combination of *platform_id* and *encoding_id*.
306 """
307 if platform_id == 1:
308 # reject non-Roman Mac font names
309 if encoding_id != 0:
310 return None
311 return raw_name.decode("mac-roman")
312 elif platform_id in (0, 3):
313 return raw_name.decode("utf-16-be")
314 else:
315 return None
316
317 def _iter_names(self):
318 """Generate a key/value pair for each name in this table.

Callers 2

_read_name_textMethod · 0.95

Calls

no outgoing calls