-
Notifications
You must be signed in to change notification settings - Fork 30.5k
Text widget should allow for other line-breaking algorithms #53549
Copy link
Copy link
Open
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: typographyText rendering, possibly libtxtText rendering, possibly libtxtc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Fluttercustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: typographyText rendering, possibly libtxtText rendering, possibly libtxtc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Fluttercustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
Type
Fields
Give feedbackNo fields configured for issues without a type.
Currently the Text widget uses a greedy algorithm to apply line-breaks. Words are laid out until they don't fit, and then it continues in the next line.
I suggest there should be an option to choose other, better, line-breaking algorithms:
The
LineBreakAlgorithm.minimumRaggednesscould implement one of the algorithms shown here:The
LineBreakAlgorithm.totalfitcould implement the total-fit line breaking algorithm, by Donald Knuth and Michael Plass, which is considered the best there is, and is used in TeX and Adobe InDesign:The
LineBreakAlgorithm.customwould accept a custom algorithm that would return a list of positions (indexes in the text string) where the line-breaks should be applied. This would allow us to do cool stuff like make text into circular or triangular shapes.