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.
Returns the builder’s table tags in the order recommended by the OpenType spec.
Table tags not in the recommended order are sorted lexicographically, and ‘DSIG’
is always sorted last.
The presence of the ‘CFF ’ table determines which of the two recommended orders is used.
This matches fontTools’ sortedTagList
function.
See: https://learn.microsoft.com/en-us/typography/opentype/spec/recom#optimized-table-ordering https://github.com/fonttools/fonttools/blob/8d6b2f8f87637fcad8dae498d32eae738cd951bf/Lib/fontTools/ttLib/ttFont.py#L1096-L1117
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>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
T
, using the provided data to resolve any offsets.