pub struct CellWidths { /* private fields */ }Expand description
How many cells of the screen each character takes, in one language:
two for a character with a wide glyph in any set of the atlas
(FontAtlasDef::wide, FontAtlasDef::wide_sets), and for
WIDE_PUNCTUATION in a language whose pack has it wide; one for any
other. text_width measures text with it,
and a glyph buffer prints with it. It also names the language’s wide
set, which a renderer looks wide glyphs up in first
(wide_font). CellWidths::NARROW has nothing
wide. Cheap to clone: the set is shared.
Implementations§
Source§impl CellWidths
impl CellWidths
Sourcepub fn of(atlas: &FontAtlasDef) -> Self
pub fn of(atlas: &FontAtlasDef) -> Self
The widths of atlas’s glyphs where no language is named: a
character with a wide glyph in any set takes two cells, but one of
WIDE_PUNCTUATION the atlas also has narrow takes one
(in_lang makes it wide).
Sourcepub fn wide(wide: impl IntoIterator<Item = char>) -> Self
pub fn wide(wide: impl IntoIterator<Item = char>) -> Self
Widths where the characters of wide take two cells.
Sourcepub fn in_lang(self, wide_font: Option<&str>, wide_punctuation: bool) -> Self
pub fn in_lang(self, wide_font: Option<&str>, wide_punctuation: bool) -> Self
These widths in a language that draws from the wide set wide_font
(None: no set of its own) and has WIDE_PUNCTUATION wide or
not: what its pack’s lang.ron says
(LangInfo::widths).
Sourcepub fn wide_font(&self) -> Option<&str>
pub fn wide_font(&self) -> Option<&str>
The wide set the language draws from first, if it names one
(FontAtlasDef::wide_cell).
Sourcepub fn wide_punctuation(&self) -> bool
pub fn wide_punctuation(&self) -> bool
Whether WIDE_PUNCTUATION takes two cells in this language.
Trait Implementations§
Source§impl Clone for CellWidths
impl Clone for CellWidths
Source§fn clone(&self) -> CellWidths
fn clone(&self) -> CellWidths
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more