From a610ef8770ddfd5a3961f6fba9b3b453aaf42dda Mon Sep 17 00:00:00 2001 From: Ryan L McIntyre Date: Fri, 21 Apr 2017 18:46:18 -0400 Subject: [PATCH] Adds flag for adjusting line height (not by default) --- font-patcher | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/font-patcher b/font-patcher index 7ace3012f..657ec68f0 100755 --- a/font-patcher +++ b/font-patcher @@ -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.