Re: CGContextShowTextAtPoint
Re: CGContextShowTextAtPoint
- Subject: Re: CGContextShowTextAtPoint
- From: David Duncan <email@hidden>
- Date: Wed, 14 Oct 2015 13:37:52 -0700
Ensure that the text matrix is sane (its separate from the current ctm and not stored with the graphics state).
> On Oct 14, 2015, at 1:36 PM, Raglan T. Tiger <email@hidden> wrote:
>
>
>> On Oct 13, 2015, at 4:42 PM, Wim Lewis <email@hidden> wrote:
>>
>>
>> On Oct 13, 2015, at 3:02 PM, Raglan T. Tiger <email@hidden> wrote:
>>> CGContextShowTextAtPoint (ctx, pt.x,pt.y,(const char*)txt, len );
>>>
>>> This has printed my text UNTIL 10.11.
>>>
>>> I see that CGContextShowTextAtPoint is deprecated in 10.9 ... is it gone in 10.11?
>>
>> As Quincey Morris says, Core Text
>
> I have text printing in the correct orientation now using
>
> CFAttributedStringRef attrString = CFAttributedStringCreate(kCFAllocatorDefault, cfstr, attributes);
>
> CTLineRef line = CTLineCreateWithAttributedString(attrString);
>
> // Set text position and draw the line into the graphics context
> CGContextSetTextPosition(ctx, pt.x, pt.y);
> CTLineDraw(line, ctx);
>
> Now, I cannot increase the font size. I set up attributes as:
>
> CFStringRef keys[] = { kCTFontAttributeName };
> CFTypeRef values[] = { [ NSFont systemFontOfSize:48 ] };
>
> CFDictionaryRef attributes =
> CFDictionaryCreate(kCFAllocatorDefault, (const void**)&keys,
> (const void**)&values, sizeof(keys) / sizeof(keys[0]),
> &kCFTypeDictionaryKeyCallBacks,
> &kCFTypeDictionaryValueCallBacks);
>
>
> and see my attributed string as:
>
> 667 x, 2.3 y{
> NSFont = "\".HelveticaNeueDeskInterface-Regular 48.00 pt. P [] (0x1128ca30) fobj=0x11d04390, spc=12.93\"";
> }
>
> but the result is like 8 pt not 48.
> _______________________________________________
>
> 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
--
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