Struct nanovg::Font
[−]
[src]
pub struct Font<'a>(_, _);
A handle to a font. Fonts are managed by the NanoVG context itself. View this type only as a 'reference' to a font.
Methods
impl<'a> Font<'a>
[src]
pub fn context(&self) -> &'a Context
[src]
Get the underlying context this font was created on.
pub fn from_file<S: AsRef<str>, P: AsRef<IoPath>>(
context: &'a Context,
name: S,
path: P
) -> CreateFontResult
[src]
context: &'a Context,
name: S,
path: P
) -> CreateFontResult
Attempt to load a font from the file at path
.
Fonts are always named (specified with name
).
pub fn from_memory<'b, S: AsRef<str>>(
context: &'a Context,
name: S,
memory: &'b [u8]
) -> CreateFontResult<'a>
[src]
context: &'a Context,
name: S,
memory: &'b [u8]
) -> CreateFontResult<'a>
Attempt to load a font from memory.
Fonts are always named (specified with name
).
pub fn find<S: AsRef<str>>(context: &'a Context, name: S) -> CreateFontResult
[src]
Try to find a already loaded font with the given name
.
pub fn add_fallback(&self, fallback: Font) -> bool
[src]
Add fallback
as a fallback for the current font.
If the font renderer fails to rasterize a glyph with the main font, it will automatically
attempt to rasterize the same glyph with the fallback font.
This process continues until no working font is found, then the glyph is skipped.
Trait Implementations
impl<'a> Clone for Font<'a>
[src]
fn clone(&self) -> Font<'a>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more