pub struct Font { /* private fields */ }Expand description
Defines fonts used by FLTK
Implementations§
Source§impl Font
impl Font
Sourcepub const HelveticaBold: Font
pub const HelveticaBold: Font
Helvetica Bold
Sourcepub const HelveticaItalic: Font
pub const HelveticaItalic: Font
Helvetica Italic
Sourcepub const HelveticaBoldItalic: Font
pub const HelveticaBoldItalic: Font
Helvetica Bold Italic
Sourcepub const CourierBold: Font
pub const CourierBold: Font
Courier Bold
Sourcepub const CourierItalic: Font
pub const CourierItalic: Font
Courier Italic
Sourcepub const CourierBoldItalic: Font
pub const CourierBoldItalic: Font
Courier Bold Italic
Sourcepub const TimesItalic: Font
pub const TimesItalic: Font
Times Italic
Sourcepub const TimesBoldItalic: Font
pub const TimesBoldItalic: Font
Times Bold Italic
Sourcepub const ScreenBold: Font
pub const ScreenBold: Font
Screen Bold
Sourcepub const Zapfdingbats: Font
pub const Zapfdingbats: Font
Zapfdingbats
Sourcepub fn by_index(idx: usize) -> Font
pub fn by_index(idx: usize) -> Font
Returns a font by index. This is the enum representation of the Font. If you change the default font for your app,
which by default is Helvetica, Font::by_index(0) will still show Helvetica!
Examples found in repository?
examples/system_fonts.rs (line 46)
28fn main() {
29 let app = app::App::default().load_system_fonts();
30 // To load a font by path, check the App::load_font() method
31 let fonts = app::fonts();
32 // println!("{:?}", fonts);
33 let mut wind = window::Window::default().with_size(400, 300);
34 let mut frame = frame::Frame::default().size_of(&wind);
35 frame.set_label_size(30);
36 wind.set_color(enums::Color::White);
37 wind.end();
38 wind.show();
39 println!("The system has {} fonts!\nStarting slideshow!", fonts.len());
40 let mut i = 0;
41 while app.wait() {
42 if i == fonts.len() {
43 i = 0;
44 }
45 frame.set_label(&format!("[{}]", fonts[i]));
46 frame.set_label_font(enums::Font::by_index(i));
47 app::sleep(0.5);
48 i += 1;
49 }
50}Sourcepub fn by_name(name: &str) -> Font
pub fn by_name(name: &str) -> Font
Gets the font by its name, can be queried via the app::get_font_names()
Sourcepub fn set_font(old: Font, new: &str)
pub fn set_font(old: Font, new: &str)
Replace a current font with a loaded font
use fltk::enums::Font;
let font = Font::load_font("font.ttf").unwrap();
Font::set_font(Font::Helvetica, &font);Trait Implementations§
Source§impl Ord for Font
impl Ord for Font
Source§impl PartialOrd for Font
impl PartialOrd for Font
impl Copy for Font
impl Eq for Font
impl StructuralPartialEq for Font
Auto Trait Implementations§
impl Freeze for Font
impl RefUnwindSafe for Font
impl Send for Font
impl Sync for Font
impl Unpin for Font
impl UnwindSafe for Font
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