Fixes for non-mono (double width) variations (fixes #142)

* Apply the l/r/c alignment to both mono and non-mono
* Apply the valign centering to both mono and non-mono
* Apply the vertical stretching (good for powerline separators) to both mono and non-mono
This commit is contained in:
Ryan L McIntyre 2017-04-21 19:11:11 -04:00
parent a610ef8770
commit 0aa5fc4a2e

View file

@ -548,12 +548,14 @@ def copy_glyphs(sourceFont, sourceFontStart, sourceFontEnd, symbolFont, symbolFo
sourceFont[currentSourceFontGlyph].glyphname = sym_glyph.glyphname
scale_ratio_x = 1
scale_ratio_y = 1
# Now that we have copy/pasted the glyph, if we are creating a monospace
# font we need to scale and move the glyphs. It is possible to have
# empty glyphs, so we need to skip those.
if args.single and sym_dim['width'] and sym_dim['height']:
scale_ratio_x = 1
scale_ratio_y = 1
# If we want to preserve that aspect ratio of the glyphs we need to
# find the largest possible scaling factor that will allow the glyph
# to fit in both the x and y directions
@ -571,8 +573,17 @@ def copy_glyphs(sourceFont, sourceFontStart, sourceFontEnd, symbolFont, symbolFo
if 'x' in sym_attr['stretch']:
# Stretch the glyph horizontally to fit the entire available width
scale_ratio_x = font_dim['width'] / sym_dim['width']
# non-monospace (double width glyphs)
# elif sym_dim['width'] and sym_dim['height']:
# any special logic we want to apply for double-width variation
# would go here
# end if single width
if 'y' in sym_attr['stretch']:
# Stretch the glyph vertically to total line height (good for powerline separators)
# Currently stretching vertically for both monospace and double-width
scale_ratio_y = font_dim['height'] / sym_dim['height']
if scale_ratio_x != 1 or scale_ratio_y != 1: