Skip to content

drawText reference point and baseline #355

@syonfox

Description

@syonfox

I am playing around with drawing text in predefined boxes and having issues centering it.
I looked through some of the other issues on centering text but don't see a clear answer to this so sorry if I missed something :)
or if this is just me using the wrong numbers.

Either way I think it would be valuable to add this info to the page.drawText() documentation

what is the reference point for drawing text?
image

I thought it was the bottom of the descender(A in fig)
but my drawings are off and I was trying to find the information and cant :(

if you know please tell me if at the baseline(B) or even at the top (C)

also, I assume font. heightAtSize(size) is the height from the top of the ascender to the bottom of the descender. if the text is drawn from the baseline is it possible to measure either the height from the top of the text to the baseline or vis versa.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions