pub struct FontModifier { /* private fields */ }Expand description
Font modifier for updating font properties.
Provides a builder-style API for modifying font metadata, metrics,
and other properties. Changes are tracked internally and applied
when commit() is called.
§Note
Full round-trip serialization with proper offset recalculation is currently in development. Some modifications may not persist correctly when saving and reloading the font.
Implementations§
Source§impl FontModifier
impl FontModifier
pub fn new(font: Font) -> Self
Sourcepub fn set_font_name(&mut self, name: &str) -> Result<&mut Self>
pub fn set_font_name(&mut self, name: &str) -> Result<&mut Self>
Sourcepub fn set_full_font_name(&mut self, name: &str) -> Result<&mut Self>
pub fn set_full_font_name(&mut self, name: &str) -> Result<&mut Self>
Set full font name (name ID 4).
Updates the full font name (family + style) in the name table.
§Arguments
name- The new full font name
Sourcepub fn set_version(&mut self, major: u16, minor: u16) -> Result<&mut Self>
pub fn set_version(&mut self, major: u16, minor: u16) -> Result<&mut Self>
Sourcepub fn set_copyright(&mut self, copyright: &str) -> Result<&mut Self>
pub fn set_copyright(&mut self, copyright: &str) -> Result<&mut Self>
Set copyright notice (name ID 0).
Updates the copyright notice in the name table.
§Arguments
copyright- The copyright notice text
Sourcepub fn set_trademark(&mut self, trademark: &str) -> Result<&mut Self>
pub fn set_trademark(&mut self, trademark: &str) -> Result<&mut Self>
Set trademark notice (name ID 7).
Updates the trademark notice in the name table.
§Arguments
trademark- The trademark notice text
Sourcepub fn set_font_revision(&mut self, major: u16, minor: u16) -> Result<&mut Self>
pub fn set_font_revision(&mut self, major: u16, minor: u16) -> Result<&mut Self>
Update font version and revision in head table.
Sets the font revision number in the head table.
§Arguments
major- Major version numberminor- Minor version number (0-99)
Sourcepub fn set_embedding_type(&mut self, embedding_type: u16) -> Result<&mut Self>
pub fn set_embedding_type(&mut self, embedding_type: u16) -> Result<&mut Self>
Modify embedding permissions in OS/2 table
Sourcepub fn set_localized_font_name(
&mut self,
name: &str,
language_id: u16,
) -> Result<&mut Self>
pub fn set_localized_font_name( &mut self, name: &str, language_id: u16, ) -> Result<&mut Self>
Set font name in multiple languages
Sourcepub fn set_font_metrics(
&mut self,
units_per_em: u16,
ascender: i16,
descender: i16,
line_gap: i16,
) -> Result<&mut Self>
pub fn set_font_metrics( &mut self, units_per_em: u16, ascender: i16, descender: i16, line_gap: i16, ) -> Result<&mut Self>
Update font metrics in head and hhea tables
Sourcepub fn set_glyph_advance(
&mut self,
glyph_index: usize,
advance_width: u16,
) -> Result<&mut Self>
pub fn set_glyph_advance( &mut self, glyph_index: usize, advance_width: u16, ) -> Result<&mut Self>
Modify glyph advance widths