pub struct FontCollection { /* private fields */ }
Expand description
A collection of fonts
Implementations§
Source§impl FontCollection
impl FontCollection
Sourcepub fn new() -> FontCollection
pub fn new() -> FontCollection
Examples found in repository?
examples/render.rs (line 186)
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
fn make_collection() -> FontCollection {
let mut collection = FontCollection::new();
let source = SystemSource::new();
let font = source
.select_best_match(&[FamilyName::SansSerif], &Properties::new())
.unwrap()
.load()
.unwrap();
collection.add_family(FontFamily::new_from_font(font));
let font = source
.select_by_postscript_name(DEVANAGARI_FONT_POSTSCRIPT_NAME)
.expect("failed to select Devanagari font")
.load()
.unwrap();
collection.add_family(FontFamily::new_from_font(font));
collection
}
Sourcepub fn add_family(&mut self, family: FontFamily)
pub fn add_family(&mut self, family: FontFamily)
Examples found in repository?
examples/render.rs (line 193)
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
fn make_collection() -> FontCollection {
let mut collection = FontCollection::new();
let source = SystemSource::new();
let font = source
.select_best_match(&[FamilyName::SansSerif], &Properties::new())
.unwrap()
.load()
.unwrap();
collection.add_family(FontFamily::new_from_font(font));
let font = source
.select_by_postscript_name(DEVANAGARI_FONT_POSTSCRIPT_NAME)
.expect("failed to select Devanagari font")
.load()
.unwrap();
collection.add_family(FontFamily::new_from_font(font));
collection
}
pub fn itemize<'a>(&'a self, text: &'a str) -> Itemizer<'a>
Auto Trait Implementations§
impl Freeze for FontCollection
impl RefUnwindSafe for FontCollection
impl !Send for FontCollection
impl !Sync for FontCollection
impl Unpin for FontCollection
impl UnwindSafe for FontCollection
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