Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why Y position + fontsize? #51

Closed
PoeHaH opened this issue May 17, 2021 · 5 comments
Closed

Why Y position + fontsize? #51

PoeHaH opened this issue May 17, 2021 · 5 comments

Comments

@PoeHaH
Copy link

PoeHaH commented May 17, 2021

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:

image

Is there a reason I'm not aware about for adding the fontSize to the Y position? Can it be removed?

@geongeorge
Copy link
Owner

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:
New Project (2)

@PoeHaH
Copy link
Author

PoeHaH commented Jun 4, 2021

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.

@geongeorge
Copy link
Owner

geongeorge commented Jun 4, 2021

@PoeHaH Weird! I'll take a look into this soon.

Thanks for pointing this out

@PoeHaH
Copy link
Author

PoeHaH commented Jun 4, 2021

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 :).

@geongeorge
Copy link
Owner

Fixes this here: #76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants