font: remove the fextents sub-struct

This commit is contained in:
Daniel Eklöf 2019-11-27 21:38:49 +01:00
parent 9fb3c58588
commit b48365aa86
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 11 additions and 13 deletions

10
font.c
View file

@ -285,13 +285,13 @@ from_font_set(FcPattern *pattern, FcFontSet *fonts, int start_idx,
font->is_fallback = is_fallback; font->is_fallback = is_fallback;
font->ref_counter = 1; font->ref_counter = 1;
font->fextents.height = height * font->pixel_size_fixup; font->height = height * font->pixel_size_fixup;
font->fextents.descent = -descent * font->pixel_size_fixup; font->descent = -descent * font->pixel_size_fixup;
font->fextents.ascent = ascent * font->pixel_size_fixup; font->ascent = ascent * font->pixel_size_fixup;
font->fextents.max_x_advance = max_x_advance * font->pixel_size_fixup; font->max_x_advance = max_x_advance * font->pixel_size_fixup;
LOG_DBG("metrics: height: %d, descent: %d, ascent: %d, x-advance: %d", LOG_DBG("metrics: height: %d, descent: %d, ascent: %d, x-advance: %d",
height, descent, ascent, max_x_advance); font->height, font->descent, font->ascent, font->max_x_advance);
if (!is_fallback) { if (!is_fallback) {
font->fc_pattern = pattern; font->fc_pattern = pattern;

2
font.h
View file

@ -41,12 +41,10 @@ struct font {
double pixel_size_fixup; /* Scale factor - should only be used with ARGB32 glyphs */ double pixel_size_fixup; /* Scale factor - should only be used with ARGB32 glyphs */
bool bgr; /* True for FC_RGBA_BGR and FC_RGBA_VBGR */ bool bgr; /* True for FC_RGBA_BGR and FC_RGBA_VBGR */
struct {
int height; int height;
int descent; int descent;
int ascent; int ascent;
int max_x_advance; int max_x_advance;
} fextents;
struct { struct {
int position; int position;

View file

@ -97,8 +97,8 @@ expose(const struct exposable *exposable, pixman_image_t *pix, int x, int y, int
* font family. * font family.
*/ */
const double baseline = (double)y + const double baseline = (double)y +
(double)(height + font->fextents.ascent + font->fextents.descent) / 2.0 - (double)(height + font->ascent + font->descent) / 2.0 -
(font->fextents.descent > 0 ? font->fextents.descent : 0); (font->descent > 0 ? font->descent : 0);
x += exposable->particle->left_margin; x += exposable->particle->left_margin;