Adds flag for adjusting line height (not by default)

This commit is contained in:
Ryan L McIntyre 2017-04-21 18:46:18 -04:00
parent a2345efbe4
commit a610ef8770

View file

@ -37,6 +37,7 @@ parser = argparse.ArgumentParser(description='Nerd Fonts Font Patcher: patches a
parser.add_argument('-v', '--version', action='version', version=projectName + ": %(prog)s ("+version+")")
parser.add_argument('font', help='The path to the font to patch (e.g., Inconsolata.otf)')
parser.add_argument('-s', '--mono', '--use-single-width-glyphs', dest='single', action='store_true', help='Whether to generate the glyphs as single-width not double-width (default is double-width)', default=False)
parser.add_argument('-l', '--adjust-line-height', dest='adjustLineHeight', action='store_true', help='Whether to adjust line heights (attempt to center powerline separators more evenly)', default=False)
parser.add_argument('-q', '--quiet', '--shutup', dest='quiet', action='store_true', help='Do not generate verbose output', default=False)
parser.add_argument('-w', '--windows', dest='windows', action='store_true', help='Limit the internal font name to 31 characters (for Windows compatibility)', default=False)
parser.add_argument('-c', '--complete', dest='complete', action='store_true', help='Add all available Glyphs', default=False)
@ -352,12 +353,13 @@ PATCH_SET = [
#
# Make the total line size even. This seems to make the powerline separators
# center more evenly.
if (sourceFont.os2_winascent + sourceFont.os2_windescent) % 2 != 0:
sourceFont.os2_winascent += 1
if args.adjustLineHeight:
if (sourceFont.os2_winascent + sourceFont.os2_windescent) % 2 != 0:
sourceFont.os2_winascent += 1
# Make the line size identical for windows and mac
sourceFont.hhea_ascent = sourceFont.os2_winascent
sourceFont.hhea_descent = -sourceFont.os2_windescent
# Make the line size identical for windows and mac
sourceFont.hhea_ascent = sourceFont.os2_winascent
sourceFont.hhea_descent = -sourceFont.os2_windescent
# Line gap add extra space on the bottom of the line which doesn't allow
# the powerline glyphs to fill the entire line.