mirror of https://github.com/bjornbytes/lovr.git
Handle tabs in fonts;
This commit is contained in:
parent
185bb8438e
commit
4188fd53ec
|
@ -106,6 +106,14 @@ void lovrFontRender(Font* font, const char* str, float wrap, HorizontalAlign hal
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tabs
|
||||||
|
if (codepoint == '\t') {
|
||||||
|
Glyph* space = lovrFontGetGlyph(font, ' ');
|
||||||
|
cx += space->advance * 4;
|
||||||
|
str += bytes;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Kerning
|
// Kerning
|
||||||
cx += lovrFontGetKerning(font, previous, codepoint);
|
cx += lovrFontGetKerning(font, previous, codepoint);
|
||||||
previous = codepoint;
|
previous = codepoint;
|
||||||
|
@ -180,6 +188,14 @@ float lovrFontGetWidth(Font* font, const char* str, float wrap) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tabs
|
||||||
|
if (codepoint == '\t') {
|
||||||
|
Glyph* space = lovrFontGetGlyph(font, ' ');
|
||||||
|
x += space->advance * 4;
|
||||||
|
str += bytes;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Glyph* glyph = lovrFontGetGlyph(font, codepoint);
|
Glyph* glyph = lovrFontGetGlyph(font, codepoint);
|
||||||
x += glyph->advance + lovrFontGetKerning(font, previous, codepoint);
|
x += glyph->advance + lovrFontGetKerning(font, previous, codepoint);
|
||||||
previous = codepoint;
|
previous = codepoint;
|
||||||
|
|
Loading…
Reference in New Issue