font rendering: reimplement tab-as-spaces support.

This commit is contained in:
Sasha Szpakowski
2022-12-28 19:46:48 -04:00
parent 7a0f6621e7
commit 9502942b7b
7 changed files with 136 additions and 78 deletions
+3 -3
View File
@@ -167,7 +167,7 @@ int GenericShaper::computeWordWrapIndex(const ColoredCodepoints& codepoints, Ran
float newwidth = w + getKerning(prevglyph, g) + getGlyphAdvance(g);
// Only wrap when there's a non-space character.
if (newwidth > wraplimit && g != ' ')
if (newwidth > wraplimit && !isWhitespace(g))
{
// Rewind to the last seen space when wrapping.
if (lastspaceindex != -1)
@@ -179,10 +179,10 @@ int GenericShaper::computeWordWrapIndex(const ColoredCodepoints& codepoints, Ran
}
// Don't count trailing spaces in the output width.
if (g == ' ')
if (isWhitespace(g))
{
lastspaceindex = i;
if (prevglyph != ' ')
if (!isWhitespace(prevglyph))
widthbeforelastspace = w;
}
else