fix width i
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user