From c5602fde9604fc330bec58c806d70be261cb2bf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Wed, 27 Nov 2019 21:33:08 +0100 Subject: [PATCH] font: set pixman filter when re-scaling glyph --- font.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/font.c b/font.c index 685261d2..20d71fa5 100644 --- a/font.c +++ b/font.c @@ -639,27 +639,18 @@ glyph_for_wchar(const struct font *font, wchar_t wc, struct glyph *glyph) bitmap->pixel_mode == FT_PIXEL_MODE_LCD || bitmap->pixel_mode == FT_PIXEL_MODE_LCD_V); - struct pixman_transform trans; - pixman_transform_init_identity(&trans); if (font->pixel_size_fixup != 1.) { + struct pixman_transform scale; + pixman_transform_init_identity(&scale); pixman_transform_scale( - &trans, NULL, + &scale, NULL, pixman_double_to_fixed(1.0 / font->pixel_size_fixup), pixman_double_to_fixed(1.0 / font->pixel_size_fixup)); + pixman_image_set_transform(pix, &scale); + pixman_image_set_filter(pix, PIXMAN_FILTER_BEST, NULL, 0); } - /* Figure out if we can use a translate transform instead of setting x/y in glyph */ -#if 0 - LOG_DBG("**** %f", font->face->glyph->bitmap_top * fixup - baseline); - - pixman_transform_translate( - &trans, NULL, - pixman_double_to_fixed(font->face->glyph->bitmap_left), - pixman_double_to_fixed(-(baseline / fixup - font->face->glyph->bitmap_top))); -#endif - - pixman_image_set_transform(pix, &trans); *glyph = (struct glyph){ .wc = wc,