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

Added HANGING, IDEOGRAPHIC and TOP textBaseline to adjustments #2347

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

semohr
Copy link

@semohr semohr commented Feb 13, 2024

see #2343

  • Have you updated CHANGELOG.md?

@chearon
Copy link
Collaborator

chearon commented Jul 7, 2024

We do support textBaseline = "top". It's a no-op since the Pango layout is painted from the top-left.

The math for the existing alignments checks out. I can't explain why you got different results, as they look right when I try them (I used our own browser comparisons from npm run test-server to check). Does it still happen with different fonts? What OS did you try it on?

We can't do hanging or ideographic correctly because Pango doesn't expose that. I think it would be better to leave approximations up to the user for now.

@semohr
Copy link
Author

semohr commented Jul 8, 2024

As noted in the issue: #2343

I'm using
canvas@2.11.2 on Ubuntu 22.04.3 LTS (jammy)
node@v18.12.1
firefox@127.0.1
Arial font

Well as far as I can see the test might not be working correctly and the resolution is kinda low in these tests.
Please try the code snippet from the issue, the top alignment produces visible different results depending on if one uses the browser canvas implementation versus the node-canvas implementation.

@semohr
Copy link
Author

semohr commented Jul 8, 2024

Just to be sure I tried it again with the newest version (master branch f138b3a) as I submitted this quite some time ago. I picked another font and made sure to load exactly the same font files both in the browser and in the node implementation. The problem seems to persists.

image1101

I also tested it in chrome and on a different device. Same results.

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

Successfully merging this pull request may close these issues.

None yet

2 participants