Adjust xadvance computation to use rounding instead of truncate

This commit is contained in:
Francesco Abbate 2020-06-02 17:52:02 +02:00
parent 39d7d49586
commit d46cf80226
1 changed files with 1 additions and 9 deletions

View File

@ -146,17 +146,9 @@ retry:
/* adjust glyph's xadvance */ /* adjust glyph's xadvance */
for (int i = 0; i < 256; i++) { for (int i = 0; i < 256; i++) {
set->glyphs[i].xadvance = floor(set->glyphs[i].xadvance); set->glyphs[i].xadvance = floor(set->glyphs[i].xadvance + 0.5);
} }
#if 0
/* convert 8bit data to 32bit */
for (int i = width * height - 1; i >= 0; i--) {
uint8_t n = *((uint8_t*) set->image->pixels + i);
set->image->pixels[i] = (RenColor) { .r = 255, .g = 255, .b = 255, .a = n };
}
#endif
return set; return set;
} }