(self, descriptor, widths, spec)
| 502 | class PDFSimpleFont(PDFFont): |
| 503 | |
| 504 | def __init__(self, descriptor, widths, spec): |
| 505 | # Font encoding is specified either by a name of |
| 506 | # built-in encoding or a dictionary that describes |
| 507 | # the differences. |
| 508 | if 'Encoding' in spec: |
| 509 | encoding = resolve1(spec['Encoding']) |
| 510 | else: |
| 511 | encoding = LITERAL_STANDARD_ENCODING |
| 512 | if isinstance(encoding, dict): |
| 513 | name = literal_name(encoding.get('BaseEncoding', LITERAL_STANDARD_ENCODING)) |
| 514 | diff = list_value(encoding.get('Differences', None)) |
| 515 | self.cid2unicode = EncodingDB.get_encoding(name, diff) |
| 516 | else: |
| 517 | self.cid2unicode = EncodingDB.get_encoding(literal_name(encoding)) |
| 518 | self.unicode_map = None |
| 519 | if 'ToUnicode' in spec: |
| 520 | strm = stream_value(spec['ToUnicode']) |
| 521 | self.unicode_map = FileUnicodeMap() |
| 522 | CMapParser(self.unicode_map, StringIO(strm.get_data())).run() |
| 523 | PDFFont.__init__(self, descriptor, widths) |
| 524 | return |
| 525 | |
| 526 | def to_unichr(self, cid): |
| 527 | if self.unicode_map: |
nothing calls this directly
no test coverage detected