pub enum FontSource<'a> {
DefaultFontData {
size_pixels: Option<f32>,
config: Option<FontConfig>,
},
TtfData {
data: &'a [u8],
size_pixels: Option<f32>,
config: Option<FontConfig>,
},
TtfFile {
path: &'a str,
size_pixels: Option<f32>,
config: Option<FontConfig>,
},
}Expand description
A source for font data with v1.92+ dynamic font support
Variants§
DefaultFontData
Default font included with the library (ProggyClean.ttf)
With v1.92+, size_pixels can be 0.0 for dynamic sizing
TtfData
Binary TTF/OTF font data
With v1.92+, size_pixels can be 0.0 for dynamic sizing
TtfFile
Font from file path
With v1.92+, size_pixels can be 0.0 for dynamic sizing
Implementations§
Source§impl<'a> FontSource<'a>
impl<'a> FontSource<'a>
Sourcepub fn default_font() -> Self
pub fn default_font() -> Self
Creates a default font source with dynamic sizing
Sourcepub fn default_font_with_size(size: f32) -> Self
pub fn default_font_with_size(size: f32) -> Self
Creates a default font source with specific size
Sourcepub fn ttf_data_with_size(data: &'a [u8], size: f32) -> Self
pub fn ttf_data_with_size(data: &'a [u8], size: f32) -> Self
Creates a TTF data source with specific size
Sourcepub fn ttf_file_with_size(path: &'a str, size: f32) -> Self
pub fn ttf_file_with_size(path: &'a str, size: f32) -> Self
Creates a TTF file source with specific size
Sourcepub fn with_config(self, config: FontConfig) -> Self
pub fn with_config(self, config: FontConfig) -> Self
Sets the font configuration for this source
Trait Implementations§
Source§impl<'a> Clone for FontSource<'a>
impl<'a> Clone for FontSource<'a>
Source§fn clone(&self) -> FontSource<'a>
fn clone(&self) -> FontSource<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'a> Freeze for FontSource<'a>
impl<'a> RefUnwindSafe for FontSource<'a>
impl<'a> !Send for FontSource<'a>
impl<'a> !Sync for FontSource<'a>
impl<'a> Unpin for FontSource<'a>
impl<'a> UnwindSafe for FontSource<'a>
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