Skip to content
Myr

render: don’t use the full line height for icons

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Subtract the font’s descent from the line height, and use that as the maximum height for icons.

authored by Daniel Eklöf · committed by Daniel Eklöf · parent 43bf8bd · Browse files · 2 files+17 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+17 added−5 removed

  • other:+17 added−5 removed

2 files+17 added−5 removed

modified:CHANGELOG.md+6 added
modified:render.c+11 added-5 removed
23 unmodified lines
24 unsigned x_margin;25 unsigned y_margin;26 unsigned border_size;27 unsigned row_height;28 unsigned icon_height;29};3031static pixman_color_t32rgba2pixman(struct rgba rgba)
217 unmodified lines
250251 const int row_height = render->row_height;252 const int first_row = 1 * border_size + y_margin + row_height;253 const int sel_margin = x_margin / 3;254 const int icon_height = render->icon_height;255256 int y = first_row + (row_height + font->height) / 2 - font->descent;257258 for (size_t i = 0; i < match_count; i++) {
77 unmodified lines
336 pixman_format_code_t fmt = pixman_image_get_format(png);337 int height = pixman_image_get_height(png);338 int width = pixman_image_get_width(png);339338 if (height > min(row_height, font->height)) {339 double scale = (double)min(row_height, font->height) / height;340 if (height > icon_height) {341 double scale = (double)icon_height / height;342343 pixman_f_transform_t _scale_transform;344 pixman_f_transform_init_scale(345 &_scale_transform, 1. / scale, 1. / scale);
56 unmodified lines
402#if defined(FUZZEL_ENABLE_SVG)403 RsvgDimensionData dim;404 rsvg_handle_get_dimensions(icon->svg, &dim);405404 double height = min(row_height, font->height);406 double height = icon_height;407 double scale = height / dim.height;408409 double img_x = cur_x;410 double img_y = first_row + i * row_height + (row_height - height) / 2;
82 unmodified lines
493 const unsigned row_height = render->options.line_height.px >= 0494 ? pt_or_px_as_pixels(&render->options.line_height, dpi)495 : font->height;496497 const unsigned icon_height = max(0, (row_height - font->descent) * scale);498499 const unsigned height =500 border_size + /* Top border */501 y_margin +502 row_height + /* The prompt */
10 unmodified lines
513 x_margin +514 border_size;515516 LOG_DBG("x-margin: %d, y-margin: %d, border: %d, row-height: %d, "513 "height: %d, width: %d, scale: %d",514 x_margin, y_margin, border_size, row_height, height, width, scale);517 "icon-height: %d, height: %d, width: %d, scale: %d",518 x_margin, y_margin, border_size, row_height, icon_height,519 height, width, scale);520521 render->y_margin = y_margin;522 render->x_margin = x_margin;523 render->border_size = border_size;524 render->row_height = row_height;525 render->icon_height = icon_height;526 render->dpi = dpi;527528 if (new_width != NULL)529 *new_width = width;
15 unmodified lines