From 56ad4064e8eeff6c320952daef8767188ae7fa63 Mon Sep 17 00:00:00 2001 From: James Godfrey-Kittle Date: Wed, 8 Apr 2015 16:14:56 -0700 Subject: Update scripts based on 03/31 delivery. --- scripts/lib/fontbuild/anchors.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'scripts/lib/fontbuild/anchors.py') diff --git a/scripts/lib/fontbuild/anchors.py b/scripts/lib/fontbuild/anchors.py index d82ffa7..fe3e280 100644 --- a/scripts/lib/fontbuild/anchors.py +++ b/scripts/lib/fontbuild/anchors.py @@ -13,6 +13,37 @@ def getAnchorByName(g,anchorName): return a +def moveMarkAnchors(f, g, anchorName, accentName, dx, dy): + if "top"==anchorName: + 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) + + 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] + 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) + for anc in anchors: + if "top" == anc.name: + anchor2.x = anc.x + int(dx) + g.anchors.append(anchor2) + + def alignComponentToAnchor(f,glyphName,baseName,accentName,anchorName): g = getGlyph(glyphName,f) base = getGlyph(baseName,f) @@ -26,6 +57,8 @@ 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) + def alignComponentsToAnchors(f,glyphName,baseName,accentNames): for a in accentNames: -- cgit v1.2.3