Skip to content

Conversation

@asturur
Copy link
Contributor

@asturur asturur commented Jun 6, 2021

Hi, this is a PR that will add failing tests to show that ctx.direction isn't handled properly when textAlign is either start or end.

I plan to open a PR where with some simple logic between direction and text align start/end we can achieve a basic support.

The test uses also some arab text ( translated from google for the word left,right,start and end) to show that there is additional complexity when handling rtl

I added on purpose the property ctx.direction = 'ltr' instead of the default inherit, since inherit requires the canvas to have an attribute to inspect that we don't have anyway.

https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/direction

This is how the test looks like now.
image

@asturur
Copy link
Contributor Author

asturur commented Jun 7, 2021

@zbjornson this PR won't add anything more than tests and is done on my side unless you have some issue with those tests or you want the tests and the fix (partial probably) in the same pr.

@asturur
Copy link
Contributor Author

asturur commented Jun 13, 2021

Any update on those tests? do you think are useful or you prefer something different?

Copy link
Collaborator

@zbjornson zbjornson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good with me! 🍻

@zbjornson zbjornson merged commit 8de64bd into Automattic:master Jun 14, 2021
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.

2 participants