From 20348e0b8f4fe9d73caadbf46b06985ec8548000 Mon Sep 17 00:00:00 2001 From: Sam Rijs Date: Sat, 9 Feb 2019 12:30:48 +1100 Subject: [PATCH] implement CTFont::get_glyph_with_name --- core-text/src/font.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core-text/src/font.rs b/core-text/src/font.rs index 891b59e..2eff538 100644 --- a/core-text/src/font.rs +++ b/core-text/src/font.rs @@ -297,6 +297,13 @@ impl CTFont { } } + pub fn get_glyph_with_name(&self, glyph_name: &str) -> CGGlyph { + let glyph_name = CFString::new(glyph_name); + unsafe { + CTFontGetGlyphWithName(self.0, glyph_name.as_concrete_TypeRef()) + } + } + pub unsafe fn get_glyphs_for_characters(&self, characters: *const UniChar, glyphs: *mut CGGlyph, @@ -558,7 +565,7 @@ extern { /* Getting Glyph Data */ fn CTFontCreatePathForGlyph(font: CTFontRef, glyph: CGGlyph, matrix: *const CGAffineTransform) -> CGPathRef; - //fn CTFontGetGlyphWithName + fn CTFontGetGlyphWithName(font: CTFontRef, glyphName: CFStringRef) -> CGGlyph; fn CTFontGetBoundingRectsForGlyphs(font: CTFontRef, orientation: CTFontOrientation, glyphs: *const CGGlyph,