Skip to content

Add support for leading parameter in TextStyle #24637

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

Closed
wants to merge 3 commits into from

Conversation

GaryQian
Copy link
Contributor

@GaryQian GaryQian commented Nov 22, 2018

This enables leading as a TextStyle parameter to non-breaking-ly allow users to adjust the line spacing without changing the overall height of the text span and the metrics surrounding it.

Requires an engine roll with the LibTxt changes.

See #23875.

@GaryQian GaryQian added work in progress; do not review a: typography Text rendering, possibly libtxt labels Nov 22, 2018
@zoechi zoechi added the framework flutter/packages/flutter repository. See also f: labels. label Nov 28, 2018
@@ -313,13 +314,20 @@ class TextStyle extends Diagnosticable {
/// parent text span, or, for the root text spans, with the line box.
final TextBaseline textBaseline;

/// The height of this text span, as a multiple of the font size.
/// The height of this text span, as a multiple of the sum of font size and leading.
///
/// If applied to the root [TextSpan], this value sets the line height, which
/// is the minimum distance between subsequent text baselines, as multiple of
/// the font size.
Copy link
Contributor

Choose a reason for hiding this comment

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

either font size and leading or font size (the root [TextSpan] ignores the [leading])

Copy link
Contributor

Choose a reason for hiding this comment

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

looks like the latter

///
/// When null, default font leading will be used. Leading is the additional
/// spacing between lines.
final double leading;
Copy link
Contributor

Choose a reason for hiding this comment

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

this should mention that it's ignored at the paragraph level

@GaryQian
Copy link
Contributor Author

GaryQian commented Dec 12, 2018

This is now waiting for the engine-side to land and roll. Will require a manual roll.

@GaryQian
Copy link
Contributor Author

GaryQian commented Jan 3, 2019

Holding off on this change, as we will be implementing the 'Strut' system that will allow finer control of line spacing.

@GaryQian
Copy link
Contributor Author

GaryQian commented Jan 9, 2019

This will be superseded by the changes in flutter/engine#7414 and #26085. It is possible that this feature can be landed alongside it, but that will be attempted later after strut is landed and stable as it provides much but not all of the functionality of this.

@GaryQian GaryQian closed this Jan 9, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: typography Text rendering, possibly libtxt framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants