diff options
author | Peng Wu <alexepico@gmail.com> | 2019-10-09 14:20:22 +0800 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2019-12-05 15:32:47 +1000 |
commit | d06059ef2a85df3c70f3c0b77364b4c49837f331 (patch) | |
tree | 5dd4a904fd4096b6e84e7070bf3fbee905fe821d /read.c | |
parent | cfb4d64e1b90a28693fd700f4abf0f55d969f4f6 (diff) |
Round font size to integer value when reading bitmap font
Some fonts have a ppem value like 11.9, this patch adds integer rounding to
convert those ppem value to 12 instead of 11.
Diffstat (limited to 'read.c')
-rw-r--r-- | read.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -255,20 +255,20 @@ readFile(char *filename, FontPtr font) if(verbose_flag) fprintf(stderr, "size %d: %dx%d\n", i, - (int)(face->available_sizes[i].x_ppem >> 6), - (int)(face->available_sizes[i].y_ppem >> 6)); + (int)((face->available_sizes[i].x_ppem + 32) >> 6), + (int)((face->available_sizes[i].y_ppem + 32) >> 6)); rc = FT_Set_Pixel_Sizes(face, - face->available_sizes[i].x_ppem >> 6, - face->available_sizes[i].y_ppem >> 6); + (face->available_sizes[i].x_ppem + 32) >> 6, + (face->available_sizes[i].y_ppem + 32) >> 6); if(rc != 0) { fprintf(stderr, "Couldn't set size.\n"); return -1; } strike = makeStrike(font, - face->available_sizes[i].x_ppem >> 6, - face->available_sizes[i].y_ppem >> 6); + (face->available_sizes[i].x_ppem + 32) >> 6, + (face->available_sizes[i].y_ppem + 32) >> 6); if(strike == NULL) { fprintf(stderr, "Couldn't allocate strike.\n"); return -1; |