• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CoreText and a trailing space
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CoreText and a trailing space


  • Subject: CoreText and a trailing space
  • From: Roland King <email@hidden>
  • Date: Wed, 10 Apr 2013 10:04:32 +0800

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.

Is there any way to do this? I've looked for CoreText attribute which says, don't ignore trailing/leading space and not found one, nor an attribute which says 'lay this piece of the string out whatever' which can be applied to the space itself and have also looked for a character which is the size of an ideographic space, has an empty representation but is a character and not a space and also a zero-width, non-space character I could end the line with which would force the space(s) before it to lay out.  I've found none of the above.

I can detect when this happens using CTLineGetTrailingWhitespaceWidth() but it's too late by then, in the cases where the line lays out very close to the margin, I don't have space to put in the graphic.
_______________________________________________

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

  • Follow-Ups:
    • Re: CoreText and a trailing space
      • From: Wim Lewis <email@hidden>
  • Prev by Date: Re: Understanding NSTask
  • Next by Date: Re: CoreText and a trailing space
  • Previous by thread: Correct way to implement a "Share" toolbar item
  • Next by thread: Re: CoreText and a trailing space
  • Index(es):
    • Date
    • Thread