ttf-view 0.4.0

A TrueType/OpenType font parsing/viewing library and a CLI tool.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::tables::cmap::GlyphId;

#[repr(C)]
pub struct Format0 {
    pub glyph_id_array: [u8; 256],
}

impl super::CmapSubtableTrait for Format0 {
    const FORMAT: u16 = 0;
}

impl Format0 {
    pub const fn map(&self, codepoint: u8) -> GlyphId {
        self.glyph_id_array[codepoint as usize].into()
    }
}