Skip to main content

warn_tint_needs_sprite

Function warn_tint_needs_sprite 

Source
pub fn warn_tint_needs_sprite(
    seen: &mut BTreeSet<char>,
    glyph: char,
    tint: Tint,
) -> bool
Expand description

Warns, at most once per glyph, that glyph carries a tint but resolved to a bitmap font glyph rather than a sprite, so the tint was silently dropped.

This is #537’s exact trap: a font glyph is fg-coloured, so a cell that falls back to one still visibly changes colour when a tint is set, and it is easy to conclude the tint took effect when in fact nothing read it. Both pixel backends call this from the branch that already knows the sprite cache missed for this glyph, so the diagnostic and the fix it names are identical on each.

tint is the cell’s own tint; a tint whose is_identity is true (including Tint::None) has nothing to drop and is silent. seen is caller-owned state so a redraw loop reports each offending glyph once rather than every frame; entries are only ever added.

Returns whether a warning was emitted, which is always false in a build that compiles diagnostics out: the identity check, the seen bookkeeping, and the message all sit inside dev_only!, so a release build does none of them. See BuildMode.