fix: Fix text rendering issue where spaces are missing #3192
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.
Description
Fix text rendering issue where spaces end up missing.
What happens is that if a single paragraph is split into multiple spans, due to having different formatting, for example, the layouting engine will run into an edge case when trying to place the last span. It will:
That is not normally an issue because if it doesn't fit, it will go to the next line and the space becomes unnecessary in that case. But in case we are still trying to populate the same line, we need to make sure we don't "eat up" the space.
There could be other similar edge cases where a space could go missing, so I opted to make it explicit whether the initial space should be added or not by adding a parameter to determine if it is the start of a new line or not.
Examples
Before:
After:
Checklist
docs
and added dartdoc comments with///
.examples
ordocs
.Breaking Change?