Skip to content

Commit d6315c5

Browse files
committed
fix(font): failed to get bitmap when font_size > 18
1 parent 45444de commit d6315c5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/font/in-core/font_inconsolata.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -7609,21 +7609,21 @@ int FontInconsolata_GetBitmap(LCUI_FontBitmap *bmp, wchar_t ch, int size)
76097609
int i, j, *ptr;
76107610
const uchar_t *byte_ptr;
76117611

7612-
if (size < 12 || size > 18) {
7612+
if (size < 12) {
76137613
return -1;
76147614
}
76157615
/* 不在范围内的字符都用框框表示 */
7616-
if (ch < ' ' || ch > '~') {
7616+
if (ch < ' ' || ch > '~' || size > 18) {
76177617
bmp->advance.x = (int)(size / 2.0 + 0.5);
76187618
bmp->advance.y = size;
76197619
bmp->rows = size;
76207620
bmp->width = bmp->advance.x;
7621-
bmp->buffer = calloc(bmp->rows*bmp->width, 1);
7621+
bmp->buffer = calloc(bmp->rows * bmp->width, 1);
76227622
bmp->pitch = bmp->width;
76237623
bmp->pixel_mode = 0;
76247624
bmp->top = size * 4 / 5;
76257625
bmp->left = 0;
7626-
j = (bmp->rows - 1)*bmp->width;
7626+
j = (bmp->rows - 1) * bmp->width;
76277627
for (i = 0; i < bmp->width; ++i, ++j) {
76287628
bmp->buffer[i] = 255;
76297629
bmp->buffer[j] = 255;

0 commit comments

Comments
 (0)