Skip to main content

cell_art_glyph

Function cell_art_glyph 

Source
pub const fn cell_art_glyph(tile: &Tile) -> Option<char>
Expand description

The glyph a Presenter should paint art (a bitmap-font glyph or a tileset sprite) for, or None when this cell draws none.

Both pixel backends (retroglyph-software, retroglyph-gl) ask this same question at several points in their draw path (sprite-vs-font dispatch, font fallback, whether a cell counts as “occupied” for compositing), and used to each answer it independently, which let them drift (retroglyph#762). This is the one place that decides it:

  • A TileFlags::SPAN_COVERED cell (see Tile::span_offset) draws no art of its own: the span’s anchor already drew one piece of artwork across the whole footprint, and this cell’s glyph is only that artwork’s text fallback for backends that can’t draw it.
  • An is_empty tile draws no art: nothing has been written to it, so it is transparent when compositing layers. This is the canonical blank rule, matching Grid::flatten_into and the cell backends; comparing the glyph itself against ' ' is both slower (it can’t be decided without the glyph) and wrong for a font whose space glyph isn’t blank.

Neither check depends on whether a sprite exists for the glyph: that dispatch (sprite vs. bitmap font) is a separate, backend-specific decision made after this one, once a caller knows a cell draws art at all.