def makeCollectionHmtxTransform2():
    fonts = [getTTFont(sfntTTFSourcePath), getTTFont(sfntTTFSourcePath)]
    for i, font in enumerate(fonts):
        glyf = font["glyf"]
        hmtx = font["hmtx"]
        maxp = font["maxp"]
        for name in glyf.glyphs:
            glyph = glyf.glyphs[name]
            glyph.expand(glyf)
            if hasattr(glyph, "xMin"):
                metrics = hmtx.metrics[name]
                if i == 0:
                    # Move the glyph so that xMin is 0
                    pen = TTGlyphPen(None)
                    glyph.draw(pen, glyf, -glyph.xMin)
                    glyph = pen.glyph()
                    glyph.recalcBounds(glyf)
                    assert glyph.xMin == 0
                    glyf.glyphs[name] = glyph
                hmtx.metrics[name] = (metrics[0], 0)

        # Build a unique glyph for each font, but with the same advance and LSB
        name = "box"
        pen = TTGlyphPen(None)
        pen.moveTo([0, 0])
        pen.lineTo([0, 1000])
        if i > 0:
            pen.lineTo([0, 2000])
            pen.lineTo([1000, 2000])
        pen.lineTo([1000, 1000])
        pen.lineTo([1000, 0])
        pen.closePath()
        glyph = pen.glyph()
        glyph.recalcBounds(glyf)
        glyf.glyphs[name] = glyph
        hmtx.metrics[name] = (glyph.xMax, glyph.xMin)
        glyf.glyphOrder.append(name)
        maxp.recalc(font)
        data = hmtx.compile(font)
        hmtx.decompile(data, font)

    data = getSFNTCollectionData(fonts, shared=["hmtx"])

    return data
def makeFixCollection1():
    paths = [sfntTTFSourcePath, sfntTTFSourcePath, sfntTTFSourcePath]
    woffdata = getWOFFCollectionData(paths)
    sfntdata = getSFNTCollectionData(paths, DSIG=True)

    return woffdata, sfntdata
def makeCollectionOffsetTables1():
    paths = [sfntTTFSourcePath, sfntTTFSourcePath, sfntTTFSourcePath]
    woffdata = getWOFFCollectionData(paths)
    sfntdata = getSFNTCollectionData(paths)

    return woffdata, sfntdata
def makeCollectionOrder1():
    data = getSFNTCollectionData([sfntTTFSourcePath, sfntTTFSourcePath, sfntTTFSourcePath], reverseNames=True)

    return data
def makeCollectionTransform1():
    data = getSFNTCollectionData([sfntTTFSourcePath, sfntTTFCompositeSourcePath])

    return data
def makeCollectionSharing6():
    data = getSFNTCollectionData([sfntTTFSourcePath, sfntTTFSourcePath], shared=["cmap"])

    return data
def makeCollectionSharing1():
    data = getSFNTCollectionData([sfntTTFSourcePath, sfntTTFSourcePath], modifyNames=False)

    return data
Esempio n. 8
0
def makeFixCollection1():
    paths = [sfntTTFSourcePath, sfntTTFSourcePath, sfntTTFSourcePath]
    woffdata = getWOFFCollectionData(paths)
    sfntdata = getSFNTCollectionData(paths, DSIG=True)

    return woffdata, sfntdata
Esempio n. 9
0
def makeCollectionSharing1():
    data = getSFNTCollectionData([sfntTTFSourcePath, sfntTTFSourcePath],
                                 modifyNames=False)

    return data
Esempio n. 10
0
def makeCollectionSharing3():
    data = getSFNTCollectionData(
        [sfntTTFSourcePath, sfntTTFSourcePath, sfntTTFCompositeSourcePath])

    return data
Esempio n. 11
0
def makeCollectionOrder1():
    data = getSFNTCollectionData(
        [sfntTTFSourcePath, sfntTTFSourcePath, sfntTTFSourcePath],
        reverseNames=True)

    return data
Esempio n. 12
0
def makeCollectionTransform1():
    data = getSFNTCollectionData(
        [sfntTTFSourcePath, sfntTTFCompositeSourcePath])

    return data
Esempio n. 13
0
def makeCollectionSharing5():
    data = getSFNTCollectionData([sfntTTFSourcePath, sfntTTFSourcePath],
                                 duplicates=["glyf"])

    return data
def makeCollectionOrder1():
    paths = [sfntTTFSourcePath, sfntTTFSourcePath, sfntTTFSourcePath]
    woffdata = getWOFFCollectionData(paths, reverseNames=True)
    sfntdata = getSFNTCollectionData(paths, reverseNames=True)

    return woffdata, sfntdata
def makeCollectionSharing3():
    data = getSFNTCollectionData([sfntTTFSourcePath, sfntTTFSourcePath, sfntTTFCompositeSourcePath])

    return data
Esempio n. 16
0
def makeCollectionOffsetTables1():
    paths = [sfntTTFSourcePath, sfntTTFSourcePath, sfntTTFSourcePath]
    woffdata = getWOFFCollectionData(paths)
    sfntdata = getSFNTCollectionData(paths)

    return woffdata, sfntdata
def makeCollectionSharing5():
    data = getSFNTCollectionData([sfntTTFSourcePath, sfntTTFSourcePath], duplicates=["glyf"])

    return data
Esempio n. 18
0
def makeCollectionOrder1():
    paths = [sfntTTFSourcePath, sfntTTFSourcePath, sfntTTFSourcePath]
    woffdata = getWOFFCollectionData(paths, reverseNames=True)
    sfntdata = getSFNTCollectionData(paths, reverseNames=True)

    return woffdata, sfntdata
def makeCollectionSharing6():
    data = getSFNTCollectionData([sfntTTFSourcePath, sfntTTFSourcePath], shared=["cmap"])

    return data