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

Add Two.Text.direction property #719

Merged
merged 9 commits into from
Feb 22, 2024
Merged

Add Two.Text.direction property #719

merged 9 commits into from
Feb 22, 2024

Conversation

jonobr1
Copy link
Owner

@jonobr1 jonobr1 commented Feb 22, 2024

This PR introduces text direction to the Two.Text class. Now, you can specify if text is rendered from left to right or right to left. This is helpful for working with more languages, such as:

  • Arabic
  • Aramaic
  • Azeri
  • Dhivehi/Maldivian
  • Hebrew
  • Kurdish (Sorani)
  • Persian/Farsi
  • Urdu

Example usage:

const str = "تا زمانی که متوقف نشوید، مهم نیست که چقدر آهسته حرکت می کنید.";
const text = new Two.Text(str, two.width - 10, 50);
text.direction = 'rtl'; // Default is 'ltr'

@jonobr1 jonobr1 self-assigned this Feb 22, 2024
@jonobr1 jonobr1 added this to the v0.8.x milestone Feb 22, 2024
@jonobr1 jonobr1 merged commit 910f1f1 into dev Feb 22, 2024
2 checks passed
@jonobr1 jonobr1 deleted the text-direction branch February 22, 2024 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant