On 24 Aug 2014, at 02:00, Holmberg Bertil <bertilholmb...@telia.com> wrote:

> The first part of this method shows how to get the glyph from any character
> Works fine with non-Latin characters such as Japanese too

Does it also work with aChar starting with the Japanese HIRAGANA LETTER ARCHAIC 
YE (U+1B001) ?
Hint: chars[0] will contain part of a surrogate pair.

> - (UIBezierPath *)bezierPathFromChar:(NSString *)aChar 
> inFont:(CTFontRef)aFont {
>    // Buffers
>    unichar chars[1];
>    CGGlyph glyphs[1];
> 
>    // Copy the character into the buffer
>    chars[0] = [aChar characterAtIndex:0];
> 
>    // Encode the glyph for the single character into another buffer
>    CTFontGetGlyphsForCharacters(aFont, chars, glyphs, 1);
> 
>    // Get the single glyph
>    CGGlyph aGlyph = glyphs[0];
> 
>    // Find a reference to the Core Graphics path for the glyph
>    CGPathRef glyphPath = CTFontCreatePathForGlyph(aFont, aGlyph, NULL);
> 
>    // Create a bezier path from the CG path
>    UIBezierPath *glyphBezierPath = [UIBezierPath bezierPath];
>    [glyphBezierPath moveToPoint:CGPointZero];
>    [glyphBezierPath appendPath:[UIBezierPath bezierPathWithCGPath:glyphPath]];
> 
>    CGPathRelease(glyphPath);
> 
>    return glyphBezierPath;
> }
> 

Gerriet.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to