• 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
Re: Drawing text like Lion's Mail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing text like Lion's Mail


  • Subject: Re: Drawing text like Lion's Mail
  • From: Andre Masse <email@hidden>
  • Date: Mon, 08 Aug 2011 18:03:29 -0400

Seems like a lot of work for a simple effect. I may play again with this later on this project. I have save this thread in Mail which is telling me that there's "20 messages selected" using its fancy font effect :-)

Thanks for all infos guys,

Andre Masse



On 08/08/2011, at 13:29 , David Duncan wrote:

> On Aug 8, 2011, at 10:21 AM, Jean-Daniel Dupas wrote:
>
>> Le 8 août 2011 à 18:50, David Duncan a écrit :
>>
>>> On Aug 8, 2011, at 8:16 AM, Jean-Daniel Dupas wrote:
>>>
>>>>
>>>> I think you can create a CGPath from some text using CTFrameGetPath().
>>>> Once you get the path, you can do whatever you want (clipping, shadow, gradient, …).
>>>
>>>
>>> CTFrameGetPath() returns the path used to create the frame, typically a rectangle, not a path that describes the text therein.
>>
>> My bad.
>> So I guess the only way to get the path is to use CTFontCreatePathForGlyph() on each glyph and using other CT methods to get there positions.
>> Not as convenient, but possible, especially if this is for a single line of text as requested by the OP.
>
>
> If you just need the text outlines for clipping, then you should be able to use the Text Drawing mode of the context. By setting it to kCGText*Clip, the clipping region is set to that of the text after it is "drawn".
>
> Unfortunately there is no simple way to get the path this way if it is what you need (at least not that I can tell). CTFontCreatePathForGlyph() is one way to go about it, and I think a combination of NSLayoutManager and NSBezierPath can also do it, although I believe you have to subclass NSLayoutManager to do so (I haven't done this, but I recall Aki Inoue outlining it to me a long time ago). If you are already using NSLayoutManager this would probably be the way to go since your metrics won't change as much going this route.
> --
> David Duncan
>
> _______________________________________________
>
> 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

  • Follow-Ups:
    • Re: Drawing text like Lion's Mail
      • From: Chase Latta <email@hidden>
References: 
 >Drawing text like Lion's Mail (From: Andre Masse <email@hidden>)
 >Re: Drawing text like Lion's Mail (From: Jens Alfke <email@hidden>)
 >Re: Drawing text like Lion's Mail (From: Andre Masse <email@hidden>)
 >Re: Drawing text like Lion's Mail (From: Thomas Davie <email@hidden>)
 >Re: Drawing text like Lion's Mail (From: Andre Masse <email@hidden>)
 >Re: Drawing text like Lion's Mail (From: Durango <email@hidden>)
 >Re: Drawing text like Lion's Mail (From: Andre Masse <email@hidden>)
 >Re: Drawing text like Lion's Mail (From: Siegfried <email@hidden>)
 >Re: Drawing text like Lion's Mail (From: Andre Masse <email@hidden>)
 >Re: Drawing text like Lion's Mail (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Drawing text like Lion's Mail (From: David Duncan <email@hidden>)
 >Re: Drawing text like Lion's Mail (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Drawing text like Lion's Mail (From: David Duncan <email@hidden>)

  • Prev by Date: Re: [Lion] IBOutlets, strong or weak?
  • Next by Date: Re: CFURLWriteDataAndPropertiesToResource as root?
  • Previous by thread: Re: Drawing text like Lion's Mail
  • Next by thread: Re: Drawing text like Lion's Mail
  • Index(es):
    • Date
    • Thread