pub(crate) struct GlyphStyleMap {
styles: Vec<GlyphStyle>,
metrics_map: [u8; 90],
metrics_count: u8,
}
Expand description
Maps glyph identifiers to glyph styles.
Also keeps track of the styles that are actually used so we can allocate an appropriately sized metrics array.
Fields§
§styles: Vec<GlyphStyle>
List of styles, indexed by glyph id.
metrics_map: [u8; 90]
Maps an actual style class index into a compacted index for the metrics table.
Uses 0xFF
to signify unused styles.
metrics_count: u8
Number of metrics styles in use.
Implementations§
Source§impl GlyphStyleMap
impl GlyphStyleMap
Sourcepub fn new(glyph_count: u32, shaper: &Shaper<'_>) -> Self
pub fn new(glyph_count: u32, shaper: &Shaper<'_>) -> Self
Computes a new glyph style map for the given glyph count and character map.
Roughly based on https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/autofit/afglobal.c#L126
fn new_inner( glyph_count: u32, shaper: &Shaper<'_>, visited_set: VisitedLookupSet<'_>, ) -> Self
pub fn style(&self, glyph_id: GlyphId) -> Option<GlyphStyle>
Sourcepub fn metrics_index(&self, style: GlyphStyle) -> Option<usize>
pub fn metrics_index(&self, style: GlyphStyle) -> Option<usize>
Returns a compacted metrics index for the given glyph style.
Sourcepub fn metrics_count(&self) -> usize
pub fn metrics_count(&self) -> usize
Returns the required size of the compacted metrics array.
Sourcepub fn metrics_styles(&self) -> impl Iterator<Item = &'static StyleClass> + '_
pub fn metrics_styles(&self) -> impl Iterator<Item = &'static StyleClass> + '_
Returns an ordered iterator yielding each style class referenced by this map.
fn use_style(&mut self, style_ix: usize)
Trait Implementations§
Source§impl Debug for GlyphStyleMap
impl Debug for GlyphStyleMap
Auto Trait Implementations§
impl Freeze for GlyphStyleMap
impl RefUnwindSafe for GlyphStyleMap
impl Send for GlyphStyleMap
impl Sync for GlyphStyleMap
impl Unpin for GlyphStyleMap
impl UnwindSafe for GlyphStyleMap
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
Mutably borrows from an owned value. Read more