2
0

fix width i

This commit is contained in:
2026-04-03 13:29:06 +09:00
parent f85060265d
commit 41c87206f2
4 changed files with 19 additions and 3 deletions

View File

@@ -81,6 +81,22 @@ for g in ['a', 'i']:
xmin, ymin, xmax, ymax = bb
glyph_w = xmax - xmin
# For 'i': slight horizontal stretch to reduce side margins
if g == 'i' and glyph_w > 0:
stretch = (target_w * 0.3) / glyph_w
if stretch > 1.0:
cx = (xmin + xmax) / 2.0
glyph.transform(psMat.compose(
psMat.translate(-cx, 0),
psMat.compose(
psMat.scale(stretch, 1.0),
psMat.translate(cx, 0)
)
))
bb = glyph.boundingBox()
xmin, ymin, xmax, ymax = bb
glyph_w = xmax - xmin
# Center horizontally within the glyph width
x_offset = (target_w - glyph_w) / 2.0 - xmin
# Align baseline