font: remove 'fextents' sub-struct
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Daniel Eklöf · committed by Daniel Eklöf · parent 168e931 · Browse files · 4 files·+18 added−20 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+18 added−20 removed
- other:+18 added−20 removed
Provenance
- Commit
efc3f6d- Tree
1c6b9b6- Author
Daniel Eklöf <daniel@ekloef.se>- Committer
Daniel Eklöf <daniel@ekloef.se>- Parent
168e931
4 files changed+18 added−20 removed
modified:font.c+5 added-5 removed
272 unmodified lines273 font->fc_idx = font_idx;274 font->is_fallback = is_fallback;275 font->ref_counter = 1;276 277- font->fextents.height = height * font->pixel_size_fixup;278- font->fextents.descent = -descent * font->pixel_size_fixup;279- font->fextents.ascent = ascent * font->pixel_size_fixup;280- font->fextents.max_x_advance = max_x_advance * font->pixel_size_fixup;277+ font->height = height * font->pixel_size_fixup;278+ font->descent = -descent * font->pixel_size_fixup;279+ font->ascent = ascent * font->pixel_size_fixup;280+ font->max_x_advance = max_x_advance * font->pixel_size_fixup;281 282 LOG_DBG("metrics: height: %d, descent: %d, ascent: %d, x-advance: %d",283- height, descent, ascent, max_x_advance);283+ font->height, font->descent, font->ascent, font->max_x_advance);284 285 if (!is_fallback) {286 font->fc_pattern = pattern;287 font->fc_fonts = fonts;310 unmodified linesmodified:font.h+4 added-6 removed
39 unmodified lines40 FT_LcdFilter lcd_filter;41 double pixel_size_fixup; /* Scale factor - should only be used with ARGB32 glyphs */42 bool bgr; /* True for FC_RGBA_BGR and FC_RGBA_VBGR */43 44- struct {45- int height;46- int descent;47- int ascent;48- int max_x_advance;44+ int height;45+ int descent;46+ int ascent;47+ int max_x_advance;49- } fextents;48 49 struct {50 int position;51 int thickness;17 unmodified linesmodified:main.c+2 added-2 removed
353 unmodified lines354 355 /* Calculate number of entries we can show, based on the total356 * height and the fonts line height */357 const double line_height358- = 2 * render_options.y_margin + font->fextents.height;358+ = 2 * render_options.y_margin + font->height;359 const size_t max_matches =360 (render_options.height - 2 * render_options.border_size - line_height)361 / line_height;362 4 unmodified lines367 goto out;368 if (dmenu_mode)369 dmenu_load_entries(apps);370 else371- xdg_find_programs(icon_theme, font->fextents.height, apps);371+ xdg_find_programs(icon_theme, font->height, apps);372 read_cache(apps);373 374 if ((render = render_init(font, &render_options)) == NULL)375 goto out;41 unmodified linesmodified:render.c+7 added-7 removed
110 unmodified lines111 const wchar_t *ptext = prompt_text(prompt);112 const size_t text_len = wcslen(ptext);113 114 int x = render->options.border_size + render->options.x_margin;115- int y = render->options.border_size + render->options.y_margin + font->fextents.ascent;115+ int y = render->options.border_size + render->options.y_margin + font->ascent;116 117 for (size_t i = 0; i < prompt_len + text_len; i++) {118 wchar_t wc = i < prompt_len ? pprompt[i] : ptext[i - prompt_len];119 const struct glyph *glyph = font_glyph_for_wc(font, wc);7 unmodified lines127 if (prompt_cursor(prompt) + prompt_len - 1 == i) {128 pixman_image_fill_rectangles(129 PIXMAN_OP_SRC, buf->pix, &render->options.pix_text_color,130 1, &(pixman_rectangle16_t){131- x, y - font->fextents.ascent,132- font->underline.thickness, font->fextents.ascent + font->fextents.descent});131+ x, y - font->ascent,132+ font->underline.thickness, font->ascent + font->descent});133 }134 }135 }136 31 unmodified lines168 const size_t selected = matches_get_match_index(matches);169 170 assert(match_count == 0 || selected < match_count);171 172- const double row_height = 2 * y_margin + font->fextents.height;172+ const double row_height = 2 * y_margin + font->height;173 const double first_row = 1 * border_size + row_height;174 const double sel_margin = x_margin / 3;175 176 /*177 * LOG_DBG("height=%f, ascent=%f, descent=%f", fextents.height, fextents.ascent,178 * fextents.descent);179 */180- double y = first_row + (row_height + font->fextents.height) / 2 - font->fextents.descent;180+ double y = first_row + (row_height + font->height) / 2 - font->descent;181 182 for (size_t i = 0; i < match_count; i++) {183 const struct match *match = matches_get(matches, i);//&matches[i];184 22 unmodified lines207 double height = cairo_image_surface_get_height(surf);208 double scale = 1.0;209 210 if (height > row_height) {211- scale = font->fextents.height / height;211+ scale = font->height / height;212 LOG_DBG("%s: scaling: %f (row-height: %f, size=%fx%f)",213 match->application->title, scale, row_height, width, height);214 215 width *= scale;20 unmodified lines236 237 RsvgDimensionData dim;238 rsvg_handle_get_dimensions(svg, &dim);239 240- double height = font->fextents.height;240+ double height = font->height;241 double scale = height / dim.height;242 243 cairo_save(buf->cairo);244 cairo_set_operator(buf->cairo, CAIRO_OPERATOR_OVER);51 unmodified lines