mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
Fixed some TokenizedString tokens starting with a line break not being split correctly
This commit is contained in:
parent
0fe4c940d7
commit
023233a062
2 changed files with 4 additions and 9 deletions
|
@ -21,6 +21,7 @@ Improvements
|
||||||
|
|
||||||
Fixes
|
Fixes
|
||||||
- Fixed TokenizedString handling trailing spaces incorrectly in the last line of non-left aligned text
|
- Fixed TokenizedString handling trailing spaces incorrectly in the last line of non-left aligned text
|
||||||
|
- Fixed some TokenizedString tokens starting with a line break not being split correctly
|
||||||
|
|
||||||
### MLEM.Ui
|
### MLEM.Ui
|
||||||
Additions
|
Additions
|
||||||
|
|
|
@ -229,16 +229,10 @@ namespace MLEM.Formatting {
|
||||||
if (endsLater) {
|
if (endsLater) {
|
||||||
for (var i = tokenIndex + 1; i < this.Tokens.Length; i++) {
|
for (var i = tokenIndex + 1; i < this.Tokens.Length; i++) {
|
||||||
var other = this.Tokens[i];
|
var other = this.Tokens[i];
|
||||||
var otherFont = other.GetFont(defaultFont);
|
restOfLine += other.GetFont(defaultFont).MeasureString(other.SplitDisplayString[0], true).X;
|
||||||
if (other.SplitDisplayString.Length > 1) {
|
// if the token's split display string has multiple lines, then the line ends in it, which means we can stop
|
||||||
// the line ends in this token (so we also ignore trailing whitespaces)
|
if (other.SplitDisplayString.Length > 1)
|
||||||
restOfLine += otherFont.MeasureString(other.SplitDisplayString[0], true).X;
|
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
// the line doesn't end in this token (or it's the last token), so add it fully
|
|
||||||
var lastToken = i >= this.Tokens.Length - 1;
|
|
||||||
restOfLine += otherFont.MeasureString(other.DisplayString, lastToken).X;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (alignment == TextAlignment.Center)
|
if (alignment == TextAlignment.Center)
|
||||||
|
|
Loading…
Reference in a new issue