lynneyun
(Lynne Yun)
May 8, 2017, 7:17pm
1
Hi,
I’m trying to figure out if there’s an easy way to figure out which glyphs fall above or underneath a certain Y value. This would be useful for catching any accented characters that are too tall, for example. Is there an easy way to do this?
Thanks!
This should be easy enough to script.
Alternatively, Rainer has something that would get you that information in a round-about way (or that you could use as a guide for writing something):
#MenuTitle: Report Highest and Lowest Glyphs
# -*- coding: utf-8 -*-
__doc__="""
Reports highest and lowest glyphs for each master in the Macro Window.
"""
thisFont = Glyphs.font
exportingGlyphs = [g for g in thisFont.glyphs if g.export]
Glyphs.clearLog()
Glyphs.showMacroWindow()
print "Highest and lowest glyphs for %s\n" % thisFont.familyName
for thisMaster in thisFont.masters:
masterID = thisMaster.id
glyphsBottomsAndTops = [[g.name, g.layers[masterID].bounds.origin.y, g.layers[masterID].bounds.origin.y + g.layers[masterID].bounds.size.height] for g in exportingGlyphs]
lowest = sorted( glyphsBottomsAndTops, key=lambda x: x[1] )[0]
highest = sorted( glyphsBottomsAndTops, key=lambda x: -x[2] )[0]
print "Master: %s" % thisMaster.name
print " Highest: %s (top y: %.1f)" % ( highest[0], highest[2] )
This file has been truncated. show original