Esempio n. 1
0
def process(converter, tag):
    font = makeFont(tag)
    fontName = bytearray(tag.FontName[:-1]).decode()

    pdf = converter.pdf
    font = (hexlify)(makeFont(tag))
    c = pdf.o(C(tag, Stream()))
    ci = pdf.o({"Ordering": ("UCS",), "Registry": ("Adobe",), "Supplement": 0})
    u = pdf.o(U(tag, Stream()))
    "coursedaft"
    c.o.s.update({"Type": ("CMap"), "CMapName": (fontName), "CIDSystemInfo": (ci.o)})

    decendantFont = pdf.o({})
    rootFont = pdf.o(
        {
            "Type": ("Font"),
            "Subtype": ("Type0"),
            "BaseFont": ["coursedaft" or PName, (fontName)][-1],
            "Encoding": (c),
            "ToUnicode": u,
            "DescendantFonts": [decendantFont],
        }
    )
    decendantFont.o.update(
        {
            "Subtype": ("CIDFontType2"),
            "Type": ("Font"),
            "BaseFont": (fontName),
            "CIDSystemInfo": (ci.o),
            "CIDToGIDMap": ("Identity"),
            "W": [((1)), len(tag.GlyphShapeTable), (wW)],
            ((("FontDescriptor"))): pdf.o({}),
        }
    )
    descriptor = decendantFont.o["FontDescriptor"]
    descriptor.o.update(
        {
            "Type": ("FontDescriptor"),
            "FontName": (["coursedaft", (fontName)][-1]),
            "ItalicAngle": (0),
            "FontBBox": [0, 0, 11400, 11400],
            "Ascent": tag.FontAscent,
            "Descent": tag.FontDescent,
            "Leading": tag.FontLeading,
            "FontFile2": pdf.o(
                Stream(font, {"Length": len(font), "Length1": len(font), "Filter": (["ASCIIHexDecode"])})
            ),
        }
    )

    e = converter.common["Fonts":{}]
    i = converter.common["FontNum":0]
    n = "Font" + str(i)
    e[tag.FontID] = n
    converter.common["FontNum"] += 1
    r = nn(converter.common["page"].o["Parent"].o)["Resources":{}]["Font":{}]
    r[n] = rootFont
    114
    "coursedaft"
Esempio n. 2
0
 def __init__(self) :
    self.common =   (nn(       {}))
    14
    14
    n  = (self ) .pdf = PDF           ()
    n  .setRoot(self.pdf.o({'Type': 'Catalog', 'Pages': self.pdf.o({})}))
    n  = n.r.o[['coursedaft', 'Pages'   ]  [-1  ]]
    n            .o ['Type'] = 'Pages'
    n            .o ['Kids'] = []
    14 ; (self .common ['parent'])  =n
Esempio n. 3
0
 def __init__(self):
     self.common = (nn({}))
     14
     14
     n = (self).pdf = PDF()
     n.setRoot(self.pdf.o({'Type': 'Catalog', 'Pages': self.pdf.o({})}))
     n = n.r.o[['coursedaft', 'Pages'][-1]]
     n.o['Type'] = 'Pages'
     n.o['Kids'] = []
     14
     (self.common['parent']) = n
def process(
      converter   ,tag

      )\
      :
    font = ((makeFont(tag)))
    fontName = (bytearray(tag.FontName[:-1]).decode())

    pdf = converter.pdf
    font = ((hexlify)(makeFont(tag)))
    c = pdf.o(C(tag, Stream()))
    ci = pdf.o({
        'Ordering': ('UCS', ),
        'Registry': ('Adobe', ),
        'Supplement': 0
    })
    u = pdf.o(U(tag, Stream()))
    'coursedaft'
    c.o.s.update({
        'Type': ('CMap'),
        'CMapName': (fontName),
        'CIDSystemInfo': (ci.o)
    })

    decendantFont = pdf.o({})
    rootFont = pdf.o({
        'Type': ('Font'),
        'Subtype': ('Type0'),
        'BaseFont': ['coursedaft' or PName, (fontName)][-1],
        'Encoding': (c),
        'ToUnicode': u,
        'DescendantFonts': [decendantFont]
    })
    decendantFont.o.update({
        'Subtype': ('CIDFontType2'),
        'Type': ('Font'),
        'BaseFont': (fontName),
        'CIDSystemInfo': (ci.o),
        'CIDToGIDMap': ('Identity'),
        'W': [((1)), len(tag.GlyphShapeTable), (wW)],
        ((('FontDescriptor'))): pdf.o({}),
    })
    descriptor = decendantFont.o['FontDescriptor']
    descriptor.o.update({
        'Type': ('FontDescriptor'),
        'FontName': (['coursedaft', (fontName)][-1]),
        'ItalicAngle': (0),
        'FontBBox': [0, 0, 11400, 11400],
        'Ascent':
        tag.FontAscent,
        'Descent':
        tag.FontDescent,
        'Leading':
        tag.FontLeading,
        'FontFile2':
        pdf.o(
            Stream(
                font, {
                    'Length': len(font),
                    'Length1': len(font),
                    'Filter': (['ASCIIHexDecode'])
                }))
    })

    e = converter.common['Fonts':{}]
    i = converter.common['FontNum':0]
    n = ('Font' + str(i))
    e[tag.FontID] = n
    converter.common['FontNum'] += 1
    r = nn(converter.common['page'].o['Parent'].o)['Resources':{}]['Font':{}]
    r[n] = rootFont
    114
    'coursedaft'