• 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: Replacement for CGContextSelectFont ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replacement for CGContextSelectFont ?


  • Subject: Re: Replacement for CGContextSelectFont ?
  • From: email@hidden
  • Date: Thu, 15 Sep 2016 18:33:21 +0900

The point is supposed to be use Core Text for text not only the font choice.
CG won't give good layout like Core text.
If you are comfortable with CG programming style then Core Text is pretty easy.



> On 15 Sep 2016, at 15:53, Gabriel Zachmann <email@hidden> wrote:
>
> I am trying to "resurrect" some old code.
>
> There are several deprecated functions in it.
>
> One of them is CGContextSelectFont() . I looked at the documentation , where it just says I should use Core Text.
> I also googled, but it is not clear to me , how I can replace it.
>
> The snippet of code is this:
>
>    CGContextSetShouldAntialias( ctxt, TRUE );
>    CGContextSetTextDrawingMode (ctxt, kCGTextFill);
>    CGContextSetRGBFillColor( ctxt, 1.0, 1.0, 1.0, 1.0 );
>    CGContextSelectFont( ctxt, "Times", saver_.fontSize_, kCGEncodingMacRoman );
>    CGColorRef blue = CGColorCreateGenericRGB( 0.0, 0.0, 1.0, 1.0 );
>    CGContextSetShadowWithColor( ctxt, CGSizeMake(0,0), 10, blue );
>    float offset = 7.0f;
>    if ( theLayer.bounds.size.height > 900 )
>        offset = 15.0f;
>    CGContextShowTextAtPoint( ctxt, theLayer.bounds.origin.x + offset, theLayer.bounds.origin.y + offset, str, strlen(str) );
>    CFRelease( blue );
>
> I would appreciate any hints about how I can replace this function. Any pointers and insights will be highly appreciated.
>
> Best regards,
> Gabriel.
>
>
> _______________________________________________
>
> 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


References: 
 >Replacement for CGContextSelectFont ? (From: Gabriel Zachmann <email@hidden>)

  • Prev by Date: Replacement for CGContextSelectFont ?
  • Next by Date: Re: Replacement for CGContextSelectFont ?
  • Previous by thread: Replacement for CGContextSelectFont ?
  • Next by thread: Re: Replacement for CGContextSelectFont ?
  • Index(es):
    • Date
    • Thread