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

Method __init__

pattern/web/pdf/pdffont.py:504–524  ·  view source on GitHub ↗
(self, descriptor, widths, spec)

Source from the content-addressed store, hash-verified

502class 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:

Callers

nothing calls this directly

Calls 11

resolve1Function · 0.90
literal_nameFunction · 0.90
list_valueFunction · 0.90
stream_valueFunction · 0.90
FileUnicodeMapClass · 0.90
CMapParserClass · 0.90
get_dataMethod · 0.80
getMethod · 0.45
get_encodingMethod · 0.45
runMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected