feat(src/renderer): unify fontgroup baseline (#1560)

* feat(src/renderer): unify fontgroup baseline

* fix(src/renderer): use the first font's baseline for the text run
This commit is contained in:
Takase 2023-08-04 02:03:33 +08:00 committed by GitHub
parent 43c73ca298
commit a867beffdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -397,7 +397,7 @@ double ren_draw_text(RenSurface *rs, RenFont **fonts, const char *text, size_t l
if (set->surface && color.a > 0 && end_x >= clip.x && start_x < clip_end_x) { if (set->surface && color.a > 0 && end_x >= clip.x && start_x < clip_end_x) {
uint8_t* source_pixels = set->surface->pixels; uint8_t* source_pixels = set->surface->pixels;
for (int line = metric->y0; line < metric->y1; ++line) { for (int line = metric->y0; line < metric->y1; ++line) {
int target_y = line + y - metric->bitmap_top + font->baseline * surface_scale; int target_y = line + y - metric->bitmap_top + fonts[0]->baseline * surface_scale;
if (target_y < clip.y) if (target_y < clip.y)
continue; continue;
if (target_y >= clip_end_y) if (target_y >= clip_end_y)