Re: NSGlyphGenerator behavior
Re: NSGlyphGenerator behavior
- Subject: Re: NSGlyphGenerator behavior
- From: Aki Inoue <email@hidden>
- Date: Mon, 9 Aug 2010 11:59:27 -0700
On 2010/08/07, at 22:08, vincent habchi wrote:
> Aki,
>
>> No, it doesn't chunk based on word boundary.
>> It could callback in chunks in order to prevent allocating too large buffer, though.
>>
>> So, you should be prepare to insert whatever requested.
>
> In fact, you're (of course) right. What I see is that it does cut as long as I keep typing in the field. But, when the field looses and regains first responder status, all the text is sent at once.
This behavior is resulted by how the text system invalidates existing layout cache. While typing, the invalidated range is roughly limited to the paragraph being edited.
>
> Since I have to identify keywords in a flow of chars, I do the surgery (or butcher ;)) operation myself in my custom -(void)generateGlyphsForGlyphStorage:… method, generating multiple calls (one for each chunk) to the shared instance NSGlyphGenerator -(void)generateGlyphsForGlyphStorage:…, and I analyse the return product.
>
> Yet, I assume that – more or less in accordance to what the documentation says –, the shared instance glyph generator does a basic one to one translation between unicode and glyph, so that the length parameter in the callback -(void)insertGlyphs: length: is valid not only for the glyph buffer, but also for the original string. Is that hypothesis correct?
Yes, that's correct.
Aki
> Thanks a lot (and thanks also for the very informative talk you gave, without which I surely wouldn't have been able to figure out all this)!
>
> Vincent
_______________________________________________
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