Simplified text y position update
@@ -485,7 +485,6 @@ defaultFontLookup(utf8_int32_t codepoint) {
internal void
ENGINE_print(ENGINE* engine, char* text, int64_t x, int64_t y, uint32_t c) {
- int newlines = 0;
int fontWidth = 8;
int fontHeight = 8;
int spacing = (fontHeight / 4);
@@ -495,8 +494,8 @@ ENGINE_print(ENGINE* engine, char* text, int64_t x, int64_t y, uint32_t c) {
size_t len = utf8len(text);
for (size_t pos = 0; pos < len; pos++) {
if (text[pos] == '\n') {
- newlines++;
cursor = 0;
+ y += fontHeight + spacing;
v = utf8codepoint(v, &codepoint);
continue;
}
@@ -506,7 +505,7 @@ ENGINE_print(ENGINE* engine, char* text, int64_t x, int64_t y, uint32_t c) {
for (int i = 0; i < fontWidth; i++) {
uint8_t v = (glyph[j] >> i) & 1;
if (v != 0) {
- ENGINE_pset(engine, x + cursor + i, y + (fontHeight * newlines) + j + (spacing * newlines), c);
+ ENGINE_pset(engine, x + cursor + i, y + j, c);
}
}
}
