Struct write_fonts::FontBuilder
source · pub struct FontBuilder<'a> { /* private fields */ }Expand description
Build a font from some set of tables.
Implementations§
source§impl<'a> FontBuilder<'a>
impl<'a> FontBuilder<'a>
sourcepub fn add_table<T>(&mut self, table: &T) -> Result<&mut Self, BuilderError>
pub fn add_table<T>(&mut self, table: &T) -> Result<&mut Self, BuilderError>
Add a table to the builder.
The table can be any top-level table defined in this crate. This function will attempt to compile the table and then add it to the builder if successful, returning an error otherwise.
sourcepub fn add_raw(&mut self, tag: Tag, data: impl Into<Cow<'a, [u8]>>) -> &mut Self
pub fn add_raw(&mut self, tag: Tag, data: impl Into<Cow<'a, [u8]>>) -> &mut Self
A builder method to add raw data for the provided tag
sourcepub fn copy_missing_tables(&mut self, font: FontRef<'a>) -> &mut Self
pub fn copy_missing_tables(&mut self, font: FontRef<'a>) -> &mut Self
Copy each table from the source font if it does not already exist
sourcepub fn contains(&self, tag: Tag) -> bool
pub fn contains(&self, tag: Tag) -> bool
Returns true if the builder contains a table with this tag.
sourcepub fn build(&mut self) -> Vec<u8>
pub fn build(&mut self) -> Vec<u8>
Assemble all the tables into a binary font file with a Table Directory.
Trait Implementations§
source§impl<'a> Clone for FontBuilder<'a>
impl<'a> Clone for FontBuilder<'a>
source§fn clone(&self) -> FontBuilder<'a>
fn clone(&self) -> FontBuilder<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl<'a> Debug for FontBuilder<'a>
impl<'a> Debug for FontBuilder<'a>
source§impl<'a> Default for FontBuilder<'a>
impl<'a> Default for FontBuilder<'a>
source§fn default() -> FontBuilder<'a>
fn default() -> FontBuilder<'a>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<'a> Freeze for FontBuilder<'a>
impl<'a> RefUnwindSafe for FontBuilder<'a>
impl<'a> Send for FontBuilder<'a>
impl<'a> Sync for FontBuilder<'a>
impl<'a> Unpin for FontBuilder<'a>
impl<'a> UnwindSafe for FontBuilder<'a>
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
Mutably borrows from an owned value. Read more
source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.