Keep on improving fonts.

This commit is contained in:
2023-01-24 14:49:31 -08:00
parent 6f75e8b7a4
commit dd83f2cefa
9 changed files with 133 additions and 8 deletions

View File

@ -37,17 +37,17 @@ float_t TrueTypeFont::getScale(float_t scale) {
float_t TrueTypeFont::getSpaceSize(float_t fontSize) {
assertTrue(fontSize > 0);
return mathRound<float_t>(this->getScale(fontSize) * 18);
return this->getScale(fontSize) * 18;
}
float_t TrueTypeFont::getInitialLineHeight(float_t fontSize) {
assertTrue(fontSize > 0);
return mathRound<float_t>(42.0f * this->getScale(fontSize));
return 42.0f * this->getScale(fontSize);
}
float_t TrueTypeFont::getLineHeight(float_t fontSize) {
assertTrue(fontSize > 0);
return mathRound<float_t>(58.0f * this->getScale(fontSize));
return 96.0f * this->getScale(fontSize);
}
void TrueTypeFont::buffer(
@ -105,7 +105,14 @@ void TrueTypeFont::buffer(
// Setup the initial loop state, and X/Y coords for the quad.
int32_t i = 0;
float_t x = 0;
float_t y = this->getInitialLineHeight(fontSize) / scale;
float_t y = 0;
// Bake the first quad.
this->bakeQuad(quads, &x, &y, 'D');
y = -(quads->y0);
x = 0;
// y = this->getInitialLineHeight(fontSize) / scale;
float_t wordX = 0;
char c;
while(c = text[i++]) {