Expand description
A bitmap font, created in any tool that exports the BMFont format, such as the original BMFont editor, Hiero, or Glyph Designer.
Fields
name: String
The name that was used to load this font.
size: f32
The size of this font, in pixels.
line_height: f32
The vertical distance between each line of text in this font, in pixels.
Implementations
sourceimpl Font
impl Font
sourcepub fn new(pack: Rc<impl AssetPack + 'static>, name: String) -> Self
pub fn new(pack: Rc<impl AssetPack + 'static>, name: String) -> Self
Parses a font using files in an asset pack. @param name The path to the font within the asset pack, excluding the .fnt suffix.
sourcepub fn dispose_files(&mut self) -> &Self
pub fn dispose_files(&mut self) -> &Self
Disposes the source .fnt File used to create this Font. This can free up some memory, if you don’t intend to recreate this Font later from the same AssetPack.
@returns This instance, for chaining.
sourcepub fn split_lines(&self, text: String, max_width: f32) -> Vec<String>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn split_lines(&self, text: String, max_width: f32) -> Vec<String>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Splits text into multiple lines that fit into a given width when displayed using this font.
sourcepub fn glyphs(&self, text: String) -> Vec<Glyph>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn glyphs(&self, text: String) -> Vec<Glyph>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Get the list of Glyphs that make up a string. Characters without glyphs in this font will be missing from the list.
pub fn layout_text(
&self,
text: String,
align: TextAlign,
wrap_width: f32,
letter_spacing: f32,
line_spacing: f32
) -> TextLayout
pub fn check_reload(&mut self) -> usize
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Font
impl !Send for Font
impl !Sync for Font
impl Unpin for Font
impl !UnwindSafe for Font
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
sourcefn into_color(self) -> To
fn into_color(self) -> To
Convert into color
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.