mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-04 21:08:10 +02:00
Force non-AA text when using a bitmap strike with only scaling transform.
When the current font size matches one of the available fixed sizes, and the overall transform has only scaling components, FreeType will use the fixed size bitmaps by default. For glyphs which do not have bitmaps, force them to be rendered in monochrome instead of anti-aliased so that they all match nicely.
This commit is contained in:
parent
f09f02a6e8
commit
06af5c2891
1 changed files with 24 additions and 0 deletions
|
|
@ -1506,6 +1506,30 @@ _cairo_ft_scaled_font_create (cairo_ft_unscaled_font_t *unscaled,
|
|||
goto FAIL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Force non-AA drawing when using a bitmap strike that
|
||||
* won't be resampled due to non-scaling transform
|
||||
*/
|
||||
if (!unscaled->have_shape &&
|
||||
(scaled_font->ft_options.load_flags & FT_LOAD_NO_BITMAP) == 0 &&
|
||||
scaled_font->ft_options.base.antialias != CAIRO_ANTIALIAS_NONE &&
|
||||
(face->face_flags & FT_FACE_FLAG_FIXED_SIZES))
|
||||
{
|
||||
int i;
|
||||
FT_Size_Metrics *size_metrics = &face->size->metrics;
|
||||
|
||||
for (i = 0; i < face->num_fixed_sizes; i++)
|
||||
{
|
||||
FT_Bitmap_Size *bitmap_size = &face->available_sizes[i];
|
||||
|
||||
if (bitmap_size->x_ppem == size_metrics->x_ppem * 64 &&
|
||||
bitmap_size->y_ppem == size_metrics->y_ppem * 64)
|
||||
{
|
||||
scaled_font->ft_options.base.antialias = CAIRO_ANTIALIAS_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
metrics = &face->size->metrics;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue