-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[Impeller] libImpeller: Implement APIs for fetching glyph and line metrics. #165701
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…trics. This patch adds support in the typography subsystem of the public Impeller API such that users can implement text editing functionality. * Line metrics for a fully laid out paragraph can be retrieved. The metrics contain information about offsets into the original code unit buffer used to create the paragraph. These offsets can be used to implement functionality that edits whole lines. * Glyph information for a specific code unit offset, as well as a coordinate offset relative to the paragraph origin, can be obtained. This information can be used place decorations (like carets), select words surrounding the caret (a hit-test), and edit the source buffer to re-layout the paragraph. * Word boundaries (as specified in Unicode Standard Annex 29) can be retrieved to select and modify paragraph subsets by character, word, and line at caret. Like in Flutter, the code unit buffers are assumed to be arrays of UTF-16 bytes. I'd have preferred this to be UTF-8 because the initial paragraph construction is using UTF-8 bytes. Also, Skia internally seems to work with UTF-8 too but the interfaces are exposed using UTF-16 (presumably for users like Flutter that work with Dart strings that are UTF-16). Exposing additional APIs in txt::Paragraph to back this out seemed onerous. Instead, a UTF-16 assumption for all APIs that retrieve metrics is made (and documented). It stands to reason that paragraphs should be constructable using UTF-16 buffers in the public API too. I'll add that in a subsequent patch as that has little to do with metrics. Fixes flutter#165509
jason-simmons
approved these changes
Mar 24, 2025
autosubmit label was removed for flutter/flutter/165701, because - The status or check suite Linux linux_unopt has failed. Please fix the issues identified (or deflake) before re-applying this label. |
autosubmit label was removed for flutter/flutter/165701, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 26, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 27, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 27, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 27, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 27, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 27, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 28, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 28, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 28, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 28, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 29, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 29, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 30, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 30, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 31, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 31, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 31, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 31, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 31, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 31, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Mar 31, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 1, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 1, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 1, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 1, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
May 20, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
May 20, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
May 21, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
e: impeller
Impeller rendering backend issues and features requests
engine
flutter/engine repository. See also e: labels.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch adds support in the typography subsystem of the public Impeller API such that users can implement text editing functionality.
Like in Flutter, the code unit buffers are assumed to be arrays of UTF-16 bytes. I'd have preferred this to be UTF-8 because the initial paragraph construction is using UTF-8 bytes. Also, Skia internally seems to work with UTF-8 too but the interfaces are exposed using UTF-16 (presumably for users like Flutter that work with Dart strings that are UTF-16). Exposing additional APIs in txt::Paragraph to back this out seemed onerous. Instead, a UTF-16 assumption for all APIs that retrieve metrics is made (and documented). It stands to reason that paragraphs should be constructable using UTF-16 buffers in the public API too. I'll add that in a subsequent patch as that has little to do with metrics.
Fixes #165509