pub struct TableWriter { /* private fields */ }
Expand description
An object that manages a collection of serialized tables.
This handles deduplicating objects and tracking offsets.
Implementations§
Source§impl TableWriter
impl TableWriter
Sourcepub fn write_slice(&mut self, bytes: &[u8])
pub fn write_slice(&mut self, bytes: &[u8])
Write raw bytes into this table.
The caller is responsible for ensuring bytes are in big-endian order.
Sourcepub fn write_offset(&mut self, obj: &dyn FontWrite, width: usize)
pub fn write_offset(&mut self, obj: &dyn FontWrite, width: usize)
Create an offset to another table.
The width
argument is the size in bytes of the offset, e.g. 2 for
an Offset16
, and 4 for an Offset32
.
The provided table will be serialized immediately, and the position of the offset within the current table will be recorded. Offsets are resolved when the root table object is serialized, at which point we overwrite each recorded offset position with the final offset of the appropriate table.
Sourcepub fn pad_to_2byte_aligned(&mut self)
pub fn pad_to_2byte_aligned(&mut self)
Add a padding byte of necessary to ensure the table length is an even number.
This is necessary for things like the glyph table, which require offsets to be aligned on 2-byte boundaries.
Trait Implementations§
Source§impl Debug for TableWriter
impl Debug for TableWriter
Auto Trait Implementations§
impl Freeze for TableWriter
impl RefUnwindSafe for TableWriter
impl Send for TableWriter
impl Sync for TableWriter
impl Unpin for TableWriter
impl UnwindSafe for TableWriter
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<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.