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;
|
||||
}
|
||||
|
||||
// Tabs
|
||||
if (codepoint == '\t') {
|
||||
Glyph* space = lovrFontGetGlyph(font, ' ');
|
||||
cx += space->advance * 4;
|
||||
str += bytes;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Kerning
|
||||
cx += lovrFontGetKerning(font, previous, codepoint);
|
||||
previous = codepoint;
|
||||
|
@ -180,6 +188,14 @@ float lovrFontGetWidth(Font* font, const char* str, float wrap) {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Tabs
|
||||
if (codepoint == '\t') {
|
||||
Glyph* space = lovrFontGetGlyph(font, ' ');
|
||||
x += space->advance * 4;
|
||||
str += bytes;
|
||||
continue;
|
||||
}
|
||||
|
||||
Glyph* glyph = lovrFontGetGlyph(font, codepoint);
|
||||
x += glyph->advance + lovrFontGetKerning(font, previous, codepoint);
|
||||
previous = codepoint;
|
||||
|
|
Loading…
Reference in New Issue