Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint
Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint
- Subject: Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint
- From: Jeff Schriebman <email@hidden>
- Date: Fri, 30 Mar 2012 11:45:43 -0700
This is what I have figured out so far:
According to the Quartz 2D programming guide "Quartz 2D provides a limited, low-level interface for drawing text encoded in the MacRoman text encoding and for drawing glyphs" which probably explains my problem with using CGContextShowTextAtPoint().
I don't need a layout engine because I only need to put a single glyph at a specific location.
I can successfully print a glyph on my view using CGContextShowGlyphs() but as of yet I haven't figured a way to actually find the glyph for the unicode character U+2B06 / E2 AC 86. If I could find a font that has the character I need then I could put it all together. I know the font is available I just don't know how to find it.
I'm not sure how to use the string drawing APIs to directly put a unicode UTF8 character onto a specific X,Y location given a CGContextRef.
Thanks
On Mar 30, 2012, at 9:44 AM, Douglas Davidson wrote:
> On Mar 30, 2012, at 9:31 AM, Jens Alfke wrote:
>
>> On Mar 30, 2012, at 9:18 AM, Jeff Schriebman wrote:
>>
>>> I have not found a way to use CGContextShowTextAtPoint to easily display such a character and the examples I have found using CGContextShowGlyphsAtPoint() seem to require me to use a font containing the upwards arrow glyph.
>>
>> I'm not familiar with the CG-level text APIs. But unless they're very low-level indeed, as long as they take Unicode strings you should be able to use arbitrary characters, and the renderer will substitute glyphs from appropriate fonts as needed.
>
> They are in fact very low-level indeed, so ignore them unless you're prepared to write your own Unicode layout engine on top of them. Use the string drawing APIs instead.
>
> Douglas Davidson
Jeff
_______________________________________________
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