Re: -glyphWithName:
Re: -glyphWithName:
- Subject: Re: -glyphWithName:
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sun, 24 Aug 2014 17:30:44 +0700
On 24 Aug 2014, at 02:00, Holmberg Bertil <email@hidden> 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 (email@hidden)
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:
This email sent to email@hidden