def scaleNums(): question = "Is your num height " + str( currentNumHeight) + "?" + " If not, please enter it:" customNumHeight = AskString(question, currentNumHeight, "Current Numeral Height") customNumHeight = int(float(customNumHeight.upper())) yesNoQuestion = "This will scale all your numerals to " + str( targetNumHeight) + ". " + "Continue?" confirmScale = AskYesNoCancel(yesNoQuestion, title='Just Checking...', default=0) print confirmScale numScale = targetNumHeight / customNumHeight if confirmScale == 1: for g in f: if customNumHeight != targetNumHeight: g.prepareUndo() if g.name in numerals: g.selected = True print "scaled ", g.name, " to ", targetNumHeight g.scale(numScale) g.width = g.width * numScale g.update() g.performUndo()
f = CurrentFont() uppercase = [] numerals = [ 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine' ] for letter in string.uppercase: uppercase += letter targetCapHeight = AskString("Enter your target height for caps and numerals:", "", "Target Cap Height") targetCapHeight = int(float(targetCapHeight.upper())) currentCapHeight = f.info.capHeight def getNumHeight(numeralToCheckHeight): for g in f: if g.name == numeralToCheckHeight: for counter in g: currentNumHeight = counter.points[0].y print "currentNumHeight is ", currentNumHeight return currentNumHeight targetNumHeight = targetCapHeight currentNumHeight = getNumHeight("seven")