TypeLayer: add boundingBox headroom so last glyph is not clipped

This commit is contained in:
AskaEth committed 2026-08-28 09:27:24 +08:00
1 parent 62da58f93d
commit 7ee5f6e6a8
1 file changed
+2 -2
+2 -2
View File
@@ -565,8 +565,8 @@ def build_type_layer_tysh(ly: dict, font_ps: str, text_w: Optional[float] = None
# text box (0,0,tw,th) so the edit box is small and sits at the text.
tysh.transform = [1.0, 0.0, 0.0, 1.0, float(l), float(t)]
tysh.left, tysh.top, tysh.right, tysh.bottom = int(l), int(t), int(rr), int(bb2)
tw = text_w if text_w else (rr - l)
th = size_px * 0.9 # ~glyph height
tw = (text_w if text_w else (rr - l)) * 1.1 + size_px * 0.3 # headroom so the last glyph is not clipped
th = size_px * 1.1
bbd = td[b"boundingBox"]
bbd[b"Left"].value = 0.0
bbd[b"Top "].value = 0.0