Skip to main content

CmapSubtable

Struct CmapSubtable 

Source
pub struct CmapSubtable {
    pub kind: SubtableKind,
    pub format: u16,
    pub platform_id: u16,
    pub plat_enc_id: u16,
    pub language: Option<u32>,
    pub cmap: Arc<CharMap>,
    pub reserved: u16,
    pub length: u32,
    pub n_groups: u32,
    pub num_var_selector_records: u32,
    pub uvs_dict: Option<UvsDict>,
    pub data: Option<Vec<u8>>,
}
Expand description

A cmap subtable (CmapSubtable and its subclasses).

Fields§

§kind: SubtableKind

The subtable class.

§format: u16

The format number (format).

§platform_id: u16

The platform ID (platformID).

§plat_enc_id: u16

The encoding ID (platEncID).

§language: Option<u32>

The language (language); None where fontTools has none (a subtable not read from anywhere yet, or an unknown format read from TTX).

§cmap: Arc<CharMap>

The mapping (cmap). Subtables at the same offset in a decompiled table share it, as in fontTools, and are compiled only once; use Arc::make_mut to modify it.

§reserved: u16

The reserved field of formats 12 and 13 (reserved).

§length: u32

The subtable length, as read (length; written to TTX for formats 12 and 13).

§n_groups: u32

The number of groups, as read (nGroups; formats 12 and 13).

§num_var_selector_records: u32

The number of variation selector records, as read (numVarSelectorRecords; formats 14 and 15).

§uvs_dict: Option<UvsDict>

The variation sequences of formats 14 and 15 (uvsDict). None if not set, as for a subtable sharing its data with an earlier one.

§data: Option<Vec<u8>>

The raw subtable of an unknown format, header included (data).

Implementations§

Source§

impl CmapSubtable

Source

pub fn new(format: u16) -> Self

A new, empty subtable of the given format (CmapSubtable.newSubtable).

Source

pub fn is_unicode(&self) -> bool

Whether the characters are Unicode code points (isUnicode).

Source

pub fn encoding(&self) -> Option<&'static str>

The codec of the subtable’s encoding, None if unknown (getEncoding()).

Source

pub fn is_symbol(&self) -> bool

Whether the subtable is for the Symbol encoding (3, 0) (isSymbol).

Source

pub fn cmap_mut(&mut self) -> &mut CharMap

The mapping, for modification (Arc::make_mut on CmapSubtable::cmap).

Source

pub fn decompile(&mut self, data: &[u8]) -> Result<()>

Decompiles a subtable from its data, header included (decompile(data, ttFont)).

Source

pub fn compile(&self, font: &mut Font) -> Result<Vec<u8>>

Compiles the subtable (compile).

Source

pub fn to_xml(&self, writer: &mut XmlWriter, font: &mut Font) -> Result<()>

Writes the subtable’s TTX element (toXML).

Source

pub fn from_xml(&mut self, element: &Element, font: &mut Font) -> Result<()>

Reads the subtable’s TTX element (fromXML); the platform and encoding IDs are read by the caller.

Trait Implementations§

Source§

impl Clone for CmapSubtable

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CmapSubtable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for CmapSubtable

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CmapSubtable

Auto Trait Implementations§

§

impl Forget for CmapSubtable

§

impl Freeze for CmapSubtable
where *const ArcInner<BTreeMap<u32, u32>> is !null: Freeze, PhantomData<ArcInner<BTreeMap<u32, u32>>>: Freeze, *const LeafNode<u32, Vec<(u32, Option<u32>)>> is !null: Freeze, PhantomData<(Owned, LeafOrInternal)>: Freeze, PhantomData<Box<(u32, Vec<(u32, Option<u32>)>)>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze,

§

impl Move for CmapSubtable

§

impl RefUnwindSafe for CmapSubtable

§

impl Send for CmapSubtable
where Arc<BTreeMap<u32, u32>>: Send, NodeRef<Owned, u32, Vec<(u32, Option<u32>)>, LeafOrInternal>: Send, BoxRaw<(u32, Vec<(u32, Option<u32>)>)>: Send, RawVecInner: Send,

§

impl Sync for CmapSubtable
where Arc<BTreeMap<u32, u32>>: Sync, NodeRef<Owned, u32, Vec<(u32, Option<u32>)>, LeafOrInternal>: Sync, BoxRaw<(u32, Vec<(u32, Option<u32>)>)>: Sync, RawVecInner: Sync,

§

impl Unpin for CmapSubtable
where Arc<BTreeMap<u32, u32>>: Unpin, *const LeafNode<u32, Vec<(u32, Option<u32>)>> is !null: Unpin, Box<(u32, Vec<(u32, Option<u32>)>)>: Unpin, *const u8 is !null: Unpin,

§

impl UnsafeUnpin for CmapSubtable
where *const ArcInner<BTreeMap<u32, u32>> is !null: UnsafeUnpin, PhantomData<ArcInner<BTreeMap<u32, u32>>>: UnsafeUnpin, *const LeafNode<u32, Vec<(u32, Option<u32>)>> is !null: UnsafeUnpin, PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin, PhantomData<Box<(u32, Vec<(u32, Option<u32>)>)>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin,

§

impl UnwindSafe for CmapSubtable

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

self as &dyn Any.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

self as &mut dyn Any.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.