FROM : Dave Dribin
DATE : Thu Jan 02 19:13:17 2003
On Thursday, January 2, 2003, at 05:37 PM, Hubert Figuiere wrote:
> According to Dave Dribin <<email_removed>>:
>> Hmm... all I get are rectangles as if it does not know the correct
>> character. I even tried CGContextSelectFont(), but that didn't help
>> either.
>
> I'd use the NSAttributedString extension to NSString to draw text. It
> uses ATSUI and CG to draw text, but perform remapping to draw glyphs
> that are not in the selected font by using another. Since NSString are
> inherently Unicode oriented, this allow drawing Cyrillic, Chinese and
> Japanese all along mixed with Western chars.
>
> <http://www.abisource.com/~hub/new_cocoa.jpg> show the result. Here
> text is stored as Unicode UCS-2 and I simply use [-NSString
> drawAtPoint:withAttributes:] to draw my text. All the layout in
> handled by the cross platform engine and I simply needed to draw
> Unicode a specified location.
Wow, interesting! I downloaded the AbiWord source just to take a look
at what was going on. I've got a couple questions for ya. How do you
layout characters with this method? Do you draw characters one at a
time to make sure they go where you laid them out? How do you track
the mouse over characters, for example, when you select some text?
> And I have been told that performance was pretty much the best you
> could get. :-) (I haven't checked yet)
Well, drawAtPoint: is certainly the easiest method. I think I'll try
this again, and see what the performance is like before I try and
optimize taking one of the more complicated methods.
-Dave
DATE : Thu Jan 02 19:13:17 2003
On Thursday, January 2, 2003, at 05:37 PM, Hubert Figuiere wrote:
> According to Dave Dribin <<email_removed>>:
>> Hmm... all I get are rectangles as if it does not know the correct
>> character. I even tried CGContextSelectFont(), but that didn't help
>> either.
>
> I'd use the NSAttributedString extension to NSString to draw text. It
> uses ATSUI and CG to draw text, but perform remapping to draw glyphs
> that are not in the selected font by using another. Since NSString are
> inherently Unicode oriented, this allow drawing Cyrillic, Chinese and
> Japanese all along mixed with Western chars.
>
> <http://www.abisource.com/~hub/new_cocoa.jpg> show the result. Here
> text is stored as Unicode UCS-2 and I simply use [-NSString
> drawAtPoint:withAttributes:] to draw my text. All the layout in
> handled by the cross platform engine and I simply needed to draw
> Unicode a specified location.
Wow, interesting! I downloaded the AbiWord source just to take a look
at what was going on. I've got a couple questions for ya. How do you
layout characters with this method? Do you draw characters one at a
time to make sure they go where you laid them out? How do you track
the mouse over characters, for example, when you select some text?
> And I have been told that performance was pretty much the best you
> could get. :-) (I haven't checked yet)
Well, drawAtPoint: is certainly the easiest method. I think I'll try
this again, and see what the performance is like before I try and
optimize taking one of the more complicated methods.
-Dave






Cocoa mail archive

