summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Andersson <rasmus@notion.se>2018-01-14 00:57:57 +0300
committerRasmus Andersson <rasmus@notion.se>2018-01-14 00:57:57 +0300
commit310bbf85d8ebac08b467202b53f76a0f97567e82 (patch)
tree602fd12c9874da5e9d6a4f34bda5b54018227bd1
parentc026473d55667362f19373623d8c45e6c6afc3b7 (diff)
downloadinter-310bbf85d8ebac08b467202b53f76a0f97567e82.tar.xz
misc/rf-scripts/AdjustWidth.py
-rw-r--r--misc/rf-scripts/AdjustWidth.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/misc/rf-scripts/AdjustWidth.py b/misc/rf-scripts/AdjustWidth.py
index c3d381f68..d9dbc6d8b 100644
--- a/misc/rf-scripts/AdjustWidth.py
+++ b/misc/rf-scripts/AdjustWidth.py
@@ -10,15 +10,16 @@ if __name__ == "__main__":
print "Resizing glyph margins for %r" % font
# how much to add or remove from each glyph's margin
- A = -16
+ A = 32
if font is not None:
+ errors = 0 # if >0 then changes are discarded
for g in font:
# skip glyphs
- if g.name in ('c', 'e', 'o', 'r', 'j'):
- continue
+ #if g.name in ('c', 'e', 'o', 'r', 'j'):
+ # continue
- if g.width < 2:
+ if g.width < 4:
print '"%s": ["ignore", "zero-width"],' % (g.name)
continue
@@ -26,27 +27,31 @@ if __name__ == "__main__":
print '"%s": ["ignore", "empty"],' % (g.name)
continue
- if g.width % 16 != 0:
- print '"%s": ["ignore", "misaligned"],' % (g.name)
+ if g.width % 4 != 0:
+ print '"%s": ["error", "misaligned"],' % (g.name)
+ errors += 1
continue
- if g.leftMargin <= 0 or g.rightMargin <= 0:
- print '"%s": ["ignore", "zero-or-negative"],' % (g.name)
- continue
+ #if g.leftMargin <= 0 or g.rightMargin <= 0:
+ # print '"%s": ["ignore", "zero-or-negative"],' % (g.name)
+ # continue
leftMargin = int(max(0, g.leftMargin + A))
rightMargin = int(max(0, g.rightMargin + A))
#print '"%s": ["update", %g, %g],' % (g.name, leftMargin, rightMargin)
- if 'interface.spaceadjust' in g.lib:
- g.lib['interface.width-adjustments'].append(A)
+ if 'interui.spaceadjust' in g.lib:
+ g.lib['interui.width-adjustments'].append(A)
else:
- g.lib['interface.width-adjustments'] = [A]
+ g.lib['interui.width-adjustments'] = [A]
# order of assignment is probably important
g.rightMargin = int(rightMargin)
g.leftMargin = int(leftMargin)
- font.update()
+ if errors > 0:
+ print "Discarding changes because there were errors"
+ else:
+ font.update()
else:
print "No fonts open"