Skip to content

Commit

Permalink
[scale-upem] Implement kern table
Browse files Browse the repository at this point in the history
  • Loading branch information
behdad committed Aug 15, 2022
1 parent d9338ea commit 61d651e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Snippets/scale-upem.py
Expand Up @@ -6,7 +6,6 @@


class ScalerVisitor(TTVisitor):

def __init__(self, scaleFactor):
self.scaleFactor = scaleFactor

Expand Down Expand Up @@ -85,6 +84,14 @@ def visit(visitor, obj, attr, glyphs):
coordinates[i] = visitor.scale(x), visitor.scale(y)


@ScalerVisitor.register_attr(ttLib.getTableClass("kern"), "kernTables")
def visit(visitor, obj, attr, kernTables):
for table in kernTables:
kernTable = table.kernTable
for k in kernTable.keys():
kernTable[k] = visitor.scale(kernTable[k])


# GPOS


Expand Down Expand Up @@ -112,5 +119,5 @@ def visit(visitor, obj):

font = TTFont(sys.argv[1])

visitor = ScalerVisitor(.5)
visitor = ScalerVisitor(0.5)
visitor.visit(font)

0 comments on commit 61d651e

Please sign in to comment.