Skip to content

Commit

Permalink
font-patcher: Fix GlyphToScale for 'xy' scales
Browse files Browse the repository at this point in the history
[why]
The scale-glyph-data is used only for 'pa' scales, but thereafter used
for all shifts, even if the scaling has been 'x' or 'y' or both.

As we do not use GlyphToScale for anything but 'pa' scaled glyphs that
should not make any difference right now. But it will be an obscure bug
if we ever want to handle the Powerline symbols with a scale group.

I do not know if that will ever happen, but I tried it whilst
experimenting spending hours on finding this bug.

[how]
Access the GlyphToScale data and use it even for 'x' and 'y' scaling, if
we have it for the particular glyph.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
  • Loading branch information
Finii committed Jan 2, 2023
1 parent 9a5c2ab commit 5ead818
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,11 @@ class font_patcher:
else:
if 'x' in sym_attr['stretch']:
# Stretch the glyph horizontally to fit the entire available width
scale_ratio_x = self.font_dim['width'] / sym_dim['width']
scale_ratio_x = False
if scale_glyph_data:
scale_ratio_x = self.font_dim['width'] / scale_glyph_data[1]['width']
if scale_ratio_x is False:
scale_ratio_x = self.font_dim['width'] / sym_dim['width']
# end if single width

# non-monospace (double width glyphs)
Expand All @@ -1045,7 +1049,11 @@ class font_patcher:
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 = self.font_dim['height'] / sym_dim['height']
scale_ratio_y = False
if scale_glyph_data:
scale_ratio_y = self.font_dim['height'] / scale_glyph_data[1]['height']
if scale_ratio_y is False:
scale_ratio_y = self.font_dim['height'] / sym_dim['height']

overlap = sym_attr['params'].get('overlap')

Expand Down

0 comments on commit 5ead818

Please sign in to comment.