Re: CoreText and a trailing space
Re: CoreText and a trailing space
- Subject: Re: CoreText and a trailing space
- From: Roland King <email@hidden>
- Date: Wed, 10 Apr 2013 06:39:43 +0400
That looks like a good thing to try, thanks. I'm quite fortunate in that the images I need to add are perfectly the size of an ideographic space (they are fragments of Chinese characters which don't have real Unicode points) so CT does a fine job with them. Sounds like I need one trailing character with the CTRunDelegate set to return 0 or 1px wide nothing and that will force what I need.
I'll try that today. Thanks.
On 10 Apr, 2013, at 6:22, Wim Lewis <email@hidden> wrote:
>
> On 9 Apr 2013, at 7:04 PM, Roland King wrote:
>> I have an attributed string I'm laying out with a CTFrame. The string can have a trailing space in it, possibly more than one, they are actually \u3000, IDEOGRAPHIC SPACE. I need them to be treated like a real character and laid out, even if that breaks onto a new line. Those 'spaces' are placeholders for small images which can't be embedded in the string (iOS doesn't allow images in attributed strings like it does on OSX) so I need them laid out so I can find where they went and overlay the graphics. A little messy, works better than I expected, apart from this.
>
> We do attachments using U+FFFC OBJECT REPLACEMENT CHARACTER (which Apple also names NSAttachmentCharacter on the desktop) and setting a custom CTRunDelegate to specify the metrics of the attachment image (width, ascent, descent). Then we run through the laid-out text to find the attachment runs and draw their images and so on. This is rather clumsy (why doesn't CTRunDelegate have a drawing callback?) but it gets the job done.
>
> I think you can actually use any character rather than U+FFFC there, and it probably affects the line breaking algorithm accordingly.
>
>
>
> _______________________________________________
>
> 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
_______________________________________________
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