Skip to content

Commit e6426bb

Browse files
committed
font-patcher: Fix alignment of some glyphs
[why] The EE00 and EE03 glyphs are aligned too far to the left. [how] Affected are only right aligned glyphs with (negative) overlap, that have an advance width (i.e. are member of a scale group). Extract a new condition as variable as we need it in several places. Use that condition also for the right alignment applicability check. Related: #1733 Signed-off-by: Fini Jastrow <[email protected]>
1 parent dd6115b commit e6426bb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

font-patcher

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from __future__ import absolute_import, print_function, unicode_literals
77

88
# Change the script version when you edit this script:
9-
script_version = "4.16.0"
9+
script_version = "4.16.1"
1010

1111
version = "3.2.1"
1212
projectName = "Nerd Fonts"
@@ -1580,7 +1580,8 @@ class font_patcher:
15801580

15811581
# Handle glyph l/r/c alignment
15821582
x_align_distance = 0
1583-
if self.args.nonmono and sym_dim['advance'] is None:
1583+
simple_nonmono = self.args.nonmono and sym_dim['advance'] is None
1584+
if simple_nonmono:
15841585
# Remove left side bearing
15851586
# (i.e. do not remove left side bearing when combined BB is in use)
15861587
x_align_distance = -self.sourceFont[currentSourceFontGlyph].left_side_bearing
@@ -1603,9 +1604,9 @@ class font_patcher:
16031604
x_align_distance -= overlap_width
16041605
elif sym_attr['align'] == 'c':
16051606
# center aligned keeps being center aligned even with overlap
1606-
if overlap_width < 0 and self.args.nonmono and sym_dim['advance'] is None: # Keep positive bearing due to negative overlap (propo)
1607+
if overlap_width < 0 and simple_nonmono: # Keep positive bearing due to negative overlap (propo)
16071608
x_align_distance -= overlap_width / 2
1608-
elif sym_attr['align'] == 'r' and not self.args.nonmono:
1609+
elif sym_attr['align'] == 'r' and not simple_nonmono:
16091610
# Check and correct overlap; it can go wrong if we have a xy-ratio limit
16101611
target_xmax = (self.font_dim['xmin'] + self.font_dim['width']) * self.get_target_width(stretch)
16111612
target_xmax += overlap_width

0 commit comments

Comments
 (0)