Skip to content

Commit

Permalink
Convenience function has_glyph
Browse files Browse the repository at this point in the history
  • Loading branch information
mooman219 committed Nov 26, 2023
1 parent ac42453 commit 91332ee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,12 @@ impl Font {
(metrics, canvas.get_bitmap())
}

/// Checks if the font has a glyph for the given character.
#[inline]
pub fn has_glyph(&self, character: char) -> bool {
self.lookup_glyph_index(character) != 0
}

/// Finds the internal glyph index for the given character. If the character is not present in
/// the font then 0 is returned.
#[inline]
Expand Down

0 comments on commit 91332ee

Please sign in to comment.