From 63c97fc065960d79b544b13ed3801a008cc7c50c Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Thu, 9 Apr 2015 10:11:20 -0700 Subject: Revise updated scripts to run without FontLab. --- scripts/lib/fontbuild/anchors.py | 25 ++++++++----------------- scripts/lib/fontbuild/generateGlyph.py | 21 +++++---------------- 2 files changed, 13 insertions(+), 33 deletions(-) (limited to 'scripts/lib/fontbuild') diff --git a/scripts/lib/fontbuild/anchors.py b/scripts/lib/fontbuild/anchors.py index fe3e280..a9716ac 100644 --- a/scripts/lib/fontbuild/anchors.py +++ b/scripts/lib/fontbuild/anchors.py @@ -18,30 +18,21 @@ def moveMarkAnchors(f, g, anchorName, accentName, dx, dy): anchors = f[accentName].anchors for anchor in anchors: if "mkmktop_acc" == anchor.name: - anchor2 = Anchor() - #print anchor.x, dx, anchor.y, dy - anchor2.name = "top" - anchor2.x = anchor.x + int(dx) - anchor2.y = anchor.y + int(dy) - g.anchors.append(anchor2) + g.appendAnchor("top", (anchor.x + int(dx), anchor.y + int(dy))) elif "bottom"==anchorName: anchors = f[accentName].anchors for anchor in anchors: if "mkmkbottom_acc" == anchor.name: - for n in range(len(g.anchors)): - if g.anchors[n].name == "bottom": - del g.anchors[n] + for anchor in g.anchors: + if anchor.name == "bottom": + g.removeAnchor(anchor) break - anchor2 = Anchor() - #print anchor.x, dx, anchor.y, dy - anchor2.name = "bottom" - anchor2.x = anchor.x + int(dx) - anchor2.y = anchor.y + int(dy) + x = anchor.x + int(dx) for anc in anchors: if "top" == anc.name: - anchor2.x = anc.x + int(dx) - g.anchors.append(anchor2) + x = anc.x + int(dx) + g.appendAnchor("bottom", (x, anchor.y + int(dy))) def alignComponentToAnchor(f,glyphName,baseName,accentName,anchorName): @@ -57,7 +48,7 @@ def alignComponentToAnchor(f,glyphName,baseName,accentName,anchorName): offset = (a1.x - a2.x, a1.y - a2.y) c = getComponentByName(f, g, accentName) c.offset = offset - moveMarkAnchors(f, g, anchorName, accentName, offset.x, offset.y) + moveMarkAnchors(f, g, anchorName, accentName, offset[0], offset[1]) def alignComponentsToAnchors(f,glyphName,baseName,accentNames): diff --git a/scripts/lib/fontbuild/generateGlyph.py b/scripts/lib/fontbuild/generateGlyph.py index 4702631..d7663b9 100644 --- a/scripts/lib/fontbuild/generateGlyph.py +++ b/scripts/lib/fontbuild/generateGlyph.py @@ -20,17 +20,11 @@ def copyMarkAnchors(f, g, srcname, width): anchors = f[srcname].anchors for anchor in anchors: if "top_dd" == anchor.name: - anchor1 = Anchor(anchor) - anchor1.x += width - g.anchors.append(anchor1) + g.appendAnchor(anchor.name, (anchor.x + width, anchor.y)) if "bottom_dd" == anchor.name: - anchor1 = Anchor(anchor) - anchor1.x += width - g.anchors.append(anchor1) + g.appendAnchor(anchor.name, (anchor.x + width, anchor.y)) if "top0315" == anchor.name: - anchor1 = Anchor(anchor) - anchor1.x += width - g.anchors.append(anchor1) + g.appendAnchor(anchor.name, (anchor.x + width, anchor.y)) if "top" == anchor.name: if g.unicode == None: continue @@ -42,15 +36,10 @@ def copyMarkAnchors(f, g, srcname, width): parenttop_present = 1 if parenttop_present: continue - anchor1 = Anchor(anchor) - anchor1.name = "parent_top" -# anchor1.x += width - g.anchors.append(anchor1) + g.appendAnchor("parent_top", anchor.position) # if "rhotichook" == anchor.name: - # anchor1 = Anchor(anchor) - # anchor1.x += width - # g.anchors.append(anchor1) + # g.appendAnchor(anchor.name, (anchor.x + width, anchor.y)) def generateGlyph(f,gname,glyphList={}): -- cgit v1.2.3