pub struct CharItem {
pub code: CharCode,
pub cid: Option<Cid>,
pub gid: Option<Gid>,
pub unicode: SmallVec<[char; 2]>,
pub width: f32,
pub vertical_glyph: bool,
}Expand description
One decoded character: everything the layers above need about one character code, computed once.
The fields answer the three separate questions a font is asked. gid is
glyph selection, unicode is what the character means, and width is
how far the pen moves — and none of the three is derivable from the others.
Fields§
§code: CharCodeThe character code as the font’s encoding delimited it: one byte for a simple font, whatever the CMap’s codespace says for a Type0 font.
cid: Option<Cid>The CID this code maps to, for a Type0 font only.
gid: Option<Gid>The glyph to draw, or None when the ladder found no glyph at all.
None is PDFium’s -1, which is distinct from glyph 0 (.notdef):
.notdef draws a box, None draws nothing. The two were a Gid and
a bool beside it until the pair could express a state that has no
meaning – “no glyph” carrying an index.
unicode: SmallVec<[char; 2]>The characters this code stands for, usually one and occasionally none — a ligature glyph maps to several, an unmapped code to zero.
width: f32The advance width in 1000/em text space.
vertical_glyph: boolSet when the GSUB vert/vrt2 feature substituted a vertical form.
Not derivable downstream, and load-bearing: it suppresses the Japan1 CID transform, which would otherwise rotate an already-rotated glyph.