Struct fontstash::FontStash [−][src]
Shared ownership of font stash
Hack for creation
Renderer
needs fixed memory position so that fontstash::sys
can call callback methods
of it.
- Create
Renderer
in aBox
withFontStash
beinguninitialized
- Call
FontStash::init_mut
to initializeFontStash
Implementations
impl FontStash
[src]
Hack for creation
pub fn uninitialized() -> Self
[src]
pub fn init_mut<R: Renderer>(&mut self, w: u32, h: u32, renderer: *mut R)
[src]
impl FontStash
[src]
impl FontStash
[src]
Font storage. Each font is keyed with name
string.
pub fn add_font_mem(&self, name: &str, data: &[u8]) -> Result<FontIx>
[src]
pub fn set_font(&self, font: FontIx)
[src]
pub fn font_ix_by_name(&self, name: &str) -> Option<FontIx>
[src]
impl FontStash
[src]
Atlas
pub fn atlas_size(&self) -> [u32; 2]
[src]
pub fn expand_atlas(&self, w: u32, h: u32) -> Result<()>
[src]
Creates fontstash atlas size copying the previous data
pub fn reset_atlas(&self, w: u32, h: u32) -> Result<()>
[src]
Creates new fontstash atlas with size without copying the previous data
impl FontStash
[src]
States
pub fn set_size(&self, size: f32)
[src]
NOTE: DPI scaling?
pub fn set_color(&self, color: u32)
[src]
pub fn set_spacing(&self, spacing: f32)
[src]
Horizontal space between characters?
pub fn set_blur(&self, blur: f32)
[src]
pub fn set_align(&self, align: Align)
[src]
Sets alignment of quadliterals returned with FontStash::text_iter
impl FontStash
[src]
Texture
pub fn with_pixels(&self, f: impl FnMut(&[u8], u32, u32))
[src]
NOTE: Pixel is in one byte (8 bits alpha channel only)
impl FontStash
[src]
State stack
impl FontStash
[src]
Draw
pub fn text_iter(&self, text: &str) -> Result<FonsTextIter>
[src]
Iterator of quadliterals aligned with Align
impl FontStash
[src]
Measure
pub fn text_bounds_oneline(&self, pos: [f32; 2], text: &str) -> [f32; 4]
[src]
Returns [left_x, top_y, right_x, bottom_y]
. Note that it doesn’t handle multiple lines
of text. You need custom layer for multi-line text!
pub fn text_size_oneline(&self, text: &str) -> [f32; 2]
[src]
Returns [width, height]
. Note that it doesn’t handle multiple lines of text.
You need custom layer for multi-line text!
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for FontStash
impl !Send for FontStash
impl !Sync for FontStash
impl Unpin for FontStash
impl UnwindSafe for FontStash
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,