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

text::Shaping strategy selection #1822

Merged
merged 3 commits into from
May 2, 2023
Merged

text::Shaping strategy selection #1822

merged 3 commits into from
May 2, 2023

Conversation

hecrj
Copy link
Member

@hecrj hecrj commented May 1, 2023

This PR introduces a new Shaping enum in the text module that allows users to control the shaping strategy used to lay out text.

The Basic strategy is considerably more efficient (specially in debug builds!) and works well for simple scripts (the use cases the library currently satisfies).

Because of this, Basic is the default strategy used in text-based widgets (except the TextInput). In other words, Advanced shaping must be explicitly enabled when necessary.

@hecrj hecrj added feature New feature or request text performance labels May 1, 2023
@hecrj hecrj added this to the 0.10.0 milestone May 1, 2023
@hecrj hecrj changed the title Shaping strategy selection text::Shaping strategy selection May 1, 2023
@AustinMReppert
Copy link
Contributor

As some one who knows nothing about fonts, I feel like this could result in some problems:

  • Looks fine in dev/test, but user enters text requiring advanced shaping and app re-displays said text incorrectly
  • App dev localizes their app's text and ships something that appears fine to them.

I wonder if there is any room for warnings in debug mode to detect text that requires advanced shaping.

@hecrj
Copy link
Member Author

hecrj commented May 2, 2023

We will get there eventually.

Developers need to know what they are doing for now.

@hecrj hecrj merged commit 2d7d9a1 into advanced-text May 2, 2023
@hecrj hecrj deleted the basic-shaping branch May 2, 2023 01:30
@hecrj hecrj mentioned this pull request May 5, 2023
@MoSal
Copy link
Contributor

MoSal commented May 6, 2023

Would making the default cfg-able with a default_advanced_shaping feature be a bad idea?

Also, wouldn't it be better if the enum was marked as #[non_exhaustive], with the assumption that Auto or some other shaping impl/strategy may get implemented in the future?

@pomoke
Copy link

pomoke commented Jul 11, 2024

Simply make advanced shaping default, and this is how a lot of GUI frameworks work. i18n will heavily depend on fallback and shaping.

@hecrj
Copy link
Member Author

hecrj commented Jul 11, 2024

Eventually, maybe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request performance text
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants