From 5ead818de80b17ec9decd12e918e7771538ad8dd Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Mon, 2 Jan 2023 18:00:13 +0100 Subject: [PATCH] font-patcher: Fix GlyphToScale for 'xy' scales [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 --- font-patcher | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/font-patcher b/font-patcher index 2f30885ca5..81271b7e01 100755 --- a/font-patcher +++ b/font-patcher @@ -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) @@ -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')