Skip to content

Centering Text in a circle #1763

Answered by Albx68
xILTx asked this question in Q&A
Aug 5, 2023 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

I have a "hacky" way of doing this, position the text at x:(circleDiameter/2)-(textWidth/2) and for y:(circleDiameter/2)-(fontSize/2)

fontSize wouldn't give you the exact height but nudge the values a bit until you visually center your text

This is how I've done it in my projects for now but it'd be really nice if there's a textAnchor property

Replies: 3 comments 1 reply

Comment options

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

Answer selected by xILTx
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants