pub enum FontFace {
Classic,
Modern,
}Expand description
Bitmap typeface for TextStyle.
Variants§
Classic
The original 5×7 uppercase-only face (lowercase draws as uppercase).
Modern
Mixed-case proportional face with descenders and accents.
Implementations§
Source§impl FontFace
impl FontFace
Sourcepub const fn metrics(self) -> FaceMetrics
pub const fn metrics(self) -> FaceMetrics
Integer metrics in font pixels.
use ferravex_render::text::FontFace;
let m = FontFace::Modern.metrics();
assert_eq!((m.cap_height, m.x_height, m.descent, m.line_height), (8, 6, 2, 14));
assert_eq!(FontFace::Classic.metrics().line_height, 8);Sourcepub fn supports(self, c: char) -> bool
pub fn supports(self, c: char) -> bool
Whether the face has art for c (space included). Unsupported
characters draw as ? and are counted in TextMetrics::unsupported.
use ferravex_render::text::FontFace;
assert!(FontFace::Modern.supports('é') && FontFace::Modern.supports('★'));
assert!(!FontFace::Classic.supports('é'));
assert!(FontFace::Classic.supports('a')); // drawn as 'A'Sourcepub fn characters(self) -> impl Iterator<Item = char>
pub fn characters(self) -> impl Iterator<Item = char>
Every character the face draws, in authoring order.
use ferravex_render::text::FontFace;
assert!(FontFace::Modern.characters().count() > 180);Trait Implementations§
impl Copy for FontFace
impl Eq for FontFace
impl StructuralPartialEq for FontFace
Auto Trait Implementations§
impl Freeze for FontFace
impl RefUnwindSafe for FontFace
impl Send for FontFace
impl Sync for FontFace
impl Unpin for FontFace
impl UnwindSafe for FontFace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more