Canvas-Txt
Canvas-Txt copied to clipboard
Why Y position + fontsize?
Hi @geongeorge
Thank you for creating this great helper. Feel free to send me a PayPal donate link 🙂.
I have a quick question: in your source code, I see you're adding the fontsize to the Y-position:
if (this.vAlign === 'top')
txtY = y + this.fontSize
Because of that, my output is not aligned to the top of the debug lines:
Is there a reason I'm not aware about for adding the fontSize to the Y
position? Can it be removed?
Hey @PoeHaH ,
Sorry for the delayed response. Are you sure that is causing the space you have?
y + this.fontSize
is there because otherwise it would render the text base line on the y line which will be above the rectangular box. Something like this:
Thanks for your reply!
Hmm odd! I changed it t to txtY = y
and that works but perhaps there's another issue going on like a line height or something. I'll have to dig further.
@PoeHaH Weird! I'll take a look into this soon.
Thanks for pointing this out
I appreciate that. I'm using your library in some of my software so I'd like to see it maintained. Reach out to me if you need anything that can help with that :).
Fixes this here: https://github.com/geongeorge/Canvas-Txt/pull/76