Struct native_windows_gui::Font [−][src]
pub struct Font { pub handle: HFONT, }
Expand description
Represent a system font.
Can be used with any controls that draws text. Due to the very limited way win32 can draw text, only family, size and weight can be configured.
Example:
use native_windows_gui as nwg; fn build_font() -> nwg::Font { let mut font = nwg::Font::default(); nwg::Font::builder() .size(16) .family("Arial") .weight(1000) .build(&mut font); font }
Fields
handle: HFONT
Implementations
Set the default (application global!) font that will be used when creating controls and return the old one
Set the default (application global!) font that will be used when creating controls
This is a shortcut over Font::set_global_default
Return the default font that was previously set using Font::set_default
Add a font to the system font table. Don’t forget to call Font::remove_font(path)
once your done.
Returns false
if the font could not be added. Windows won’t tell you why though.
Other info:
- The value of
path
can be attf
or aotf
font. - Adding the same font multiple time increase the internal refcount
- Use
Font::families()
to return the available system font families
Remove a font that was previously added by Font::add_font
Add a font resource from a binary source. Returns a memory font handle if the font was loaded succesfully.
Send the handle to remove_memory_font
at the end of your program to free the font from memory.
Remove a font that was previously added by Font::add_memory_font