pub struct Tile {
pub(crate) glyph: char,
pub(crate) style: Style,
pub(crate) dx: i16,
pub(crate) dy: i16,
pub(crate) flags: TileFlags,
pub(crate) extra: Option<Arc<String>>,
}Expand description
A single drawable tile in the terminal grid.
Each tile occupies one cell on a single layer (see ADR 008 for the layer
model). Sub-cell pixel offsets (dx, dy) are visual only — they do not
affect grid logic or hit-testing. Backends that cannot represent pixel
offsets (e.g. CrosstermBackend) ignore them.
Fields§
§glyph: charPrimary codepoint. For ASCII and most Unicode this is the whole story.
style: StyleStyle applied to this tile.
dx: i16Pixel offset from the cell’s left edge. Negative shifts left.
Only meaningful for graphical backends (e.g. SoftwareBackend).
dy: i16Pixel offset from the cell’s top edge. Negative shifts up.
Only meaningful for graphical backends (e.g. SoftwareBackend).
flags: TileFlagsWide-character role flags (e.g. TileFlags::WIDE_CHAR).
Only present when the egc feature is enabled.
extra: Option<Arc<String>>Allocated only when the grapheme cluster has more than one codepoint (combining marks, ZWJ emoji sequences, etc.).
When Some, the full EGC string is stored here. The glyph field
still holds the first codepoint for fast single-char paths.
Only present when the egc feature is enabled.
Implementations§
Source§impl Tile
impl Tile
Sourcepub const fn new(glyph: char, style: Style) -> Self
pub const fn new(glyph: char, style: Style) -> Self
Creates a new tile with the given glyph and style.
dx and dy default to 0 (no sub-cell offset).
Sourcepub const fn flags(&self) -> TileFlags
pub const fn flags(&self) -> TileFlags
Returns the wide-character flags for this tile.
Only present when the egc feature is enabled.
Sourcepub fn extra(&self) -> Option<&str>
pub fn extra(&self) -> Option<&str>
Returns the extra EGC data for this tile, if any.
Some only for multi-codepoint grapheme clusters (combining marks,
ZWJ sequences, etc.). None for the common single-codepoint case.
Only present when the egc feature is enabled.
Sourcepub fn grapheme(&self) -> Option<&str>
pub fn grapheme(&self) -> Option<&str>
Returns the full grapheme cluster for this tile.
When the tile contains a multi-codepoint EGC (combining marks, ZWJ
sequences, etc.) this returns the stored string. For the common
single-codepoint case it returns None; use glyph
and encode_utf8 to reconstruct the string.
Only present when the egc feature is enabled.
Sourcepub const fn with_glyph(self, glyph: char) -> Self
pub const fn with_glyph(self, glyph: char) -> Self
Sets the glyph for this tile (builder style).
Sourcepub const fn with_style(self, style: Style) -> Self
pub const fn with_style(self, style: Style) -> Self
Sets the style for this tile (builder style).
Sourcepub const fn with_offset(self, dx: i16, dy: i16) -> Self
pub const fn with_offset(self, dx: i16, dy: i16) -> Self
Sets the sub-cell pixel offset for this tile (builder style).