From b2fa537e7f734f1bdcef8da18aa71580dbfbede6 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Sat, 1 Jan 2022 11:46:37 +0100 Subject: [PATCH] font-patcher: Correct mono scaling of thin glyphs [why] Some glyphs that are tall and thin, are too big in the resulting patched font, i.e. are higher than our 'line'. At least for --mono fonts. The non-mono fonts do not rescale the inserted glyphs at all, so there is no definition of 'too tall/wide'. [how] We want all glyphs to fit into the box defined by *_dim['height'] and *_dim['widths'], as it also defines our powerline-glyph scaling and horizontal and vertical advance widths. So we need to take that value (instead of EM) for the scaling calculation. The history of the use of EM here is a bit obscure, more explanations in the PR. Signed-off-by: Fini Jastrow --- font-patcher | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/font-patcher b/font-patcher index 375964047..388cf3521 100755 --- a/font-patcher +++ b/font-patcher @@ -901,10 +901,7 @@ class font_patcher: # We want to preserve x/y aspect ratio, so find biggest scale factor that allows symbol to fit scale_ratio_x = self.font_dim['width'] / sym_dim['width'] - - # font_dim['height'] represents total line height, keep our symbols sized based upon font's em - # NOTE: is this comment correct? font_dim['height'] isn't used here - scale_ratio_y = self.sourceFont.em / sym_dim['height'] + scale_ratio_y = self.font_dim['height'] / sym_dim['height'] if scale_ratio_x > scale_ratio_y: scale_ratio = scale_ratio_y else: