Optionally increase subpixel resolution

Add CAIRO_SUBPIXEL_POSITIONS_FINE, for a 64x64 subpixel grid.

This helps in GTK, where we found that a shift by 0.25 can be
large enough to make the rasterized glyph touch new pixels,
and that breaks our invalidation.
This commit is contained in:
Matthias Clasen 2025-03-22 10:24:11 -04:00
parent 3625b20901
commit a5ca8899e4
2 changed files with 3 additions and 0 deletions

View file

@ -1443,6 +1443,7 @@ typedef enum _cairo_color_mode {
* the default manner for the font backend and target device, since 1.20
* @CAIRO_SUBPIXEL_POSITIONS_OFF: Do not use subpixel positions, since 1.20
* @CAIRO_SUBPIXEL_POSITIONS_ON: Use subpixel positions, since 1.20
* @CAIRO_SUBPIXEL_POSITIONS_FINE: Use fine subpixel positions, since 1.20
*
* Specifies whether to use subpixel positions when rendering glyphs.
* Without subpixel positions, glyph positions will be rounded to pixels.
@ -1454,6 +1455,7 @@ typedef enum _cairo_subpixel_positions {
CAIRO_SUBPIXEL_POSITIONS_DEFAULT,
CAIRO_SUBPIXEL_POSITIONS_OFF,
CAIRO_SUBPIXEL_POSITIONS_ON,
CAIRO_SUBPIXEL_POSITIONS_FINE
} cairo_subpixel_positions_t;
/**

View file

@ -408,6 +408,7 @@ static inline int _cairo_subpixel_bits (cairo_subpixel_positions_t subpixel_posi
[CAIRO_SUBPIXEL_POSITIONS_DEFAULT] = 2,
[CAIRO_SUBPIXEL_POSITIONS_OFF] = 0,
[CAIRO_SUBPIXEL_POSITIONS_ON] = 2,
[CAIRO_SUBPIXEL_POSITIONS_FINE] = 4,
};
return bits[subpixel_positions];