Skip to content

Help with text height offset #6620

Answered by radarhere
avalonv asked this question in Q&A
Discussion options

You must be logged in to vote

Replace

v_offset += font.getbbox(line)[3]

with

v_offset += font.getbbox("A")[3] + 4

to better mirror

Pillow/src/PIL/ImageDraw.py

Lines 387 to 394 in ef7e1ee

return (
self.textsize(
"A",
font=font,
stroke_width=stroke_width,
)[1]
+ spacing
)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@avalonv
Comment options

Answer selected by avalonv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants