Re: CoreText and a trailing space
Re: CoreText and a trailing space
- Subject: Re: CoreText and a trailing space
- From: Wim Lewis <email@hidden>
- Date: Tue, 09 Apr 2013 19:22:29 -0700
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