mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-14 05:33:59 -04:00
font: set pixman filter when re-scaling glyph
This commit is contained in:
parent
5b6c941b0a
commit
c5602fde96
1 changed files with 5 additions and 14 deletions
19
font.c
19
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 ||
|
||||||
bitmap->pixel_mode == FT_PIXEL_MODE_LCD_V);
|
bitmap->pixel_mode == FT_PIXEL_MODE_LCD_V);
|
||||||
|
|
||||||
struct pixman_transform trans;
|
|
||||||
pixman_transform_init_identity(&trans);
|
|
||||||
|
|
||||||
if (font->pixel_size_fixup != 1.) {
|
if (font->pixel_size_fixup != 1.) {
|
||||||
|
struct pixman_transform scale;
|
||||||
|
pixman_transform_init_identity(&scale);
|
||||||
pixman_transform_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_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){
|
*glyph = (struct glyph){
|
||||||
.wc = wc,
|
.wc = wc,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue