Calculate w/h of font measure properly.
This commit is contained in:
@ -74,6 +74,7 @@ fontmeasure_t * fontTextMeasure(font_t *font, char *text, fonttextinfo_t *info,
|
||||
|
||||
scale *= FONT_SCALE_ADJUST;
|
||||
measure = malloc(sizeof(fontmeasure_t));
|
||||
measure->width = 0, measure->height = 0;
|
||||
measure->scale = scale;
|
||||
measure->quads = malloc(sizeof(stbtt_aligned_quad) * info->realChars);
|
||||
|
||||
@ -101,6 +102,8 @@ fontmeasure_t * fontTextMeasure(font_t *font, char *text, fonttextinfo_t *info,
|
||||
);
|
||||
quad->x0 *= scale, quad->x1 *= scale;
|
||||
quad->y0 *= scale, quad->y1 *= scale;
|
||||
measure->width = mathMax(measure->width, quad->x1);
|
||||
measure->height = mathMax(measure->height, quad->y1);
|
||||
j++;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user