pub struct Font { /* private fields */ }Expand description
Represents a CUF font file.
Contains font properties, glyph data, and optional kerning information. Glyphs are stored in a sparse map indexed by character code (0-65535).
Implementations§
Source§impl Font
impl Font
Sourcepub fn properties(&self) -> &CUFProperties
pub fn properties(&self) -> &CUFProperties
Font rendering properties and metrics.
Sourcepub fn glyphs(&self) -> &BTreeMap<u16, Glyph>
pub fn glyphs(&self) -> &BTreeMap<u16, Glyph>
Map of character codes to glyph data.
Only contains entries for characters actually defined in the font. Character codes map to Unicode-like values.
Sourcepub fn supports_kerning(&self) -> &bool
pub fn supports_kerning(&self) -> &bool
Whether this font file includes kerning data.
Sourcepub fn kerning_skip(&self) -> &u16
pub fn kerning_skip(&self) -> &u16
Character codes below this value do not have kerning data.
Sourcepub fn kerning_blocks(&self) -> &Vec<Vec<u8>>
pub fn kerning_blocks(&self) -> &Vec<Vec<u8>>
Kerning adjustment blocks (one per character code >= kerning_skip).
Source§impl Font
impl Font
Sourcepub fn properties_mut(&mut self) -> &mut CUFProperties
pub fn properties_mut(&mut self) -> &mut CUFProperties
Font rendering properties and metrics.
Sourcepub fn glyphs_mut(&mut self) -> &mut BTreeMap<u16, Glyph>
pub fn glyphs_mut(&mut self) -> &mut BTreeMap<u16, Glyph>
Map of character codes to glyph data.
Only contains entries for characters actually defined in the font. Character codes map to Unicode-like values.
Sourcepub fn supports_kerning_mut(&mut self) -> &mut bool
pub fn supports_kerning_mut(&mut self) -> &mut bool
Whether this font file includes kerning data.
Sourcepub fn kerning_skip_mut(&mut self) -> &mut u16
pub fn kerning_skip_mut(&mut self) -> &mut u16
Character codes below this value do not have kerning data.
Sourcepub fn kerning_blocks_mut(&mut self) -> &mut Vec<Vec<u8>>
pub fn kerning_blocks_mut(&mut self) -> &mut Vec<Vec<u8>>
Kerning adjustment blocks (one per character code >= kerning_skip).
Source§impl Font
impl Font
Sourcepub fn set_properties(&mut self, val: CUFProperties) -> &mut Self
pub fn set_properties(&mut self, val: CUFProperties) -> &mut Self
Font rendering properties and metrics.
Sourcepub fn set_glyphs(&mut self, val: BTreeMap<u16, Glyph>) -> &mut Self
pub fn set_glyphs(&mut self, val: BTreeMap<u16, Glyph>) -> &mut Self
Map of character codes to glyph data.
Only contains entries for characters actually defined in the font. Character codes map to Unicode-like values.
Sourcepub fn set_supports_kerning(&mut self, val: bool) -> &mut Self
pub fn set_supports_kerning(&mut self, val: bool) -> &mut Self
Whether this font file includes kerning data.
Sourcepub fn set_kerning_skip(&mut self, val: u16) -> &mut Self
pub fn set_kerning_skip(&mut self, val: u16) -> &mut Self
Character codes below this value do not have kerning data.
Sourcepub fn set_kerning_blocks(&mut self, val: Vec<Vec<u8>>) -> &mut Self
pub fn set_kerning_blocks(&mut self, val: Vec<Vec<u8>>) -> &mut Self
Kerning adjustment blocks (one per character code >= kerning_skip).
Trait Implementations§
Source§impl Decodeable for Font
impl Decodeable for Font
Source§impl<'de> Deserialize<'de> for Font
impl<'de> Deserialize<'de> for Font
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>,
Source§impl Encodeable for Font
impl Encodeable for Font
Source§fn encode<W: WriteBytes>(
&mut self,
buffer: &mut W,
_extra_data: &Option<EncodeableExtraData<'_>>,
) -> Result<()>
fn encode<W: WriteBytes>( &mut self, buffer: &mut W, _extra_data: &Option<EncodeableExtraData<'_>>, ) -> Result<()>
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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.