pub struct BitmapFont {
pub glyphs: HashMap<char, BitmapGlyph>,
pub kerning_table: Option<HashMap<(char, char), f32>>,
pub ascent: f32,
pub descent: f32,
pub line_gap: f32,
pub padding: u32,
}Expand description
Runtime representation of all metadata for a single bitmap font.
Does not own or even reference the bitmap itself.
Fields§
§glyphs: HashMap<char, BitmapGlyph>Map of unicode codepoints to glyphs in the font.
kerning_table: Option<HashMap<(char, char), f32>>Additional kerning to apply as well as that given by BitmapGlyph metrics to a pair of glyphs.
ascent: f32The highest point that any glyph in the font extends above the baseline. Typically positive.
descent: f32The lowest point that any glyph in the font extends below the baseline. Typically negative.
line_gap: f32The gap to leave between the descent of one line and the ascent of the next.
This is of course only a guideline given by the font’s designers.
padding: u32The distance from the true pixel bounding box of any given glyph to the bounding box given by BitmapGlyph.bitmap_source.
Trait Implementations§
Source§impl Archive for BitmapFont
impl Archive for BitmapFont
Source§type Archived = ArchivedBitmapFont
type Archived = ArchivedBitmapFont
The archived representation of this type. Read more
Source§type Resolver = BitmapFontResolver
type Resolver = BitmapFontResolver
The resolver for this type. It must contain all the additional information from serializing
needed to make the archived type from the normal type.
Source§impl<'de> Deserialize<'de> for BitmapFont
impl<'de> Deserialize<'de> for BitmapFont
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<__D: Fallible + ?Sized> Deserialize<BitmapFont, __D> for Archived<BitmapFont>where
HashMap<char, BitmapGlyph>: Archive,
Archived<HashMap<char, BitmapGlyph>>: Deserialize<HashMap<char, BitmapGlyph>, __D>,
Option<HashMap<(char, char), f32>>: Archive,
Archived<Option<HashMap<(char, char), f32>>>: Deserialize<Option<HashMap<(char, char), f32>>, __D>,
f32: Archive,
Archived<f32>: Deserialize<f32, __D>,
u32: Archive,
Archived<u32>: Deserialize<u32, __D>,
impl<__D: Fallible + ?Sized> Deserialize<BitmapFont, __D> for Archived<BitmapFont>where
HashMap<char, BitmapGlyph>: Archive,
Archived<HashMap<char, BitmapGlyph>>: Deserialize<HashMap<char, BitmapGlyph>, __D>,
Option<HashMap<(char, char), f32>>: Archive,
Archived<Option<HashMap<(char, char), f32>>>: Deserialize<Option<HashMap<(char, char), f32>>, __D>,
f32: Archive,
Archived<f32>: Deserialize<f32, __D>,
u32: Archive,
Archived<u32>: Deserialize<u32, __D>,
Source§fn deserialize(&self, deserializer: &mut __D) -> Result<BitmapFont, __D::Error>
fn deserialize(&self, deserializer: &mut __D) -> Result<BitmapFont, __D::Error>
Deserializes using the given deserializer
Auto Trait Implementations§
impl Freeze for BitmapFont
impl RefUnwindSafe for BitmapFont
impl Send for BitmapFont
impl Sync for BitmapFont
impl Unpin for BitmapFont
impl UnsafeUnpin for BitmapFont
impl UnwindSafe for BitmapFont
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
The archived counterpart of this type. Unlike
Archive, it may be unsized. Read moreSource§type MetadataResolver = ()
type MetadataResolver = ()
The resolver for the metadata of this type. Read more
Source§unsafe fn resolve_metadata(
&self,
_: usize,
_: <T as ArchiveUnsized>::MetadataResolver,
_: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata,
)
unsafe fn resolve_metadata( &self, _: usize, _: <T as ArchiveUnsized>::MetadataResolver, _: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata, )
Creates the archived version of the metadata for this value at the given position and writes
it to the given output. Read more
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