This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
libtxt: add a BoxHeightStyle option based on the height of the strut #8927
Merged
jason-simmons
merged 1 commit into
flutter-team-archive:master
from
jason-simmons:bug_32332
May 16, 2019
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,7 +79,10 @@ class Paragraph { | |
| // The line spacing will be added to the top of the rect. | ||
| kIncludeLineSpacingTop, | ||
| // The line spacing will be added to the bottom of the rect. | ||
| kIncludeLineSpacingBottom | ||
| kIncludeLineSpacingBottom, | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra space? not consistent with rest of the code.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is intended to separate |
||
| // Calculate boxes based on the strut's metrics. | ||
| kStrut | ||
| }; | ||
|
|
||
| enum class RectWidthStyle { | ||
|
|
@@ -267,6 +270,18 @@ class Paragraph { | |
| std::vector<double> line_baselines_; | ||
| bool did_exceed_max_lines_; | ||
|
|
||
| // Strut metrics of zero will have no effect on the layout. | ||
| struct StrutMetrics { | ||
| double ascent = 0; // Positive value to keep signs clear. | ||
| double descent = 0; | ||
| double leading = 0; | ||
| double half_leading = 0; | ||
| double line_height = 0; | ||
| bool force_strut = false; | ||
| }; | ||
|
|
||
| StrutMetrics strut_; | ||
|
|
||
| // Metrics for use in GetRectsForRange(...); | ||
| // Per-line max metrics over all runs in a given line. | ||
| std::vector<SkScalar> line_max_spacings_; | ||
|
|
@@ -372,16 +387,6 @@ class Paragraph { | |
| : x_start(x_s), y_start(y_s), x_end(x_e), y_end(y_e) {} | ||
| }; | ||
|
|
||
| // Strut metrics of zero will have no effect on the layout. | ||
| struct StrutMetrics { | ||
| double ascent = 0; // Positive value to keep signs clear. | ||
| double descent = 0; | ||
| double leading = 0; | ||
| double half_leading = 0; | ||
| double line_height = 0; | ||
| bool force_strut = false; | ||
| }; | ||
|
|
||
| // Passes in the text and Styled Runs. text_ and runs_ will later be passed | ||
| // into breaker_ in InitBreaker(), which is called in Layout(). | ||
| void SetText(std::vector<uint16_t> text, StyledRuns runs); | ||
|
|
||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could use a bit more detail about the properties of this, such as each box will have the same height, and the top/bottoms of the boxes will line up with each other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done