Skip to main content

GLYPH_PADDING

Constant GLYPH_PADDING 

Source
pub const GLYPH_PADDING: u16 = 1;
Expand description

Padding in pixels added to each side of a glyph to prevent texture bleeding.

The hybrid (GPU) renderer samples atlas sub-images via Extend::Pad, which clamps out-of-bounds coordinates to the edge texel. Without at least 1px of transparent padding, strip-rasteriser overshoot at glyph boundaries would either duplicate the edge row/column or bleed in content from a neighbouring glyph allocation. 1px is sufficient: the overshoot is sub-pixel, and the transparent padding absorbs it. This padding also enables a future switch to native bilinear sampling in the hybrid renderer.