Re: CGContextShowTextAtPoint

2015-10-14 Thread Raglan T. Tiger
> On Oct 13, 2015, at 4:56 PM, Graham Cox wrote: > > Converting this to use string drawing is easy enough: > > NSDictionary* attributes = @{NSFontAttributedName:sysFont}; > NSString* myText = [NSString stringWithUTF8String:txt]; // > check encoding if

Re: CGContextShowTextAtPoint

2015-10-14 Thread Jens Alfke
> On Oct 14, 2015, at 8:54 AM, Raglan T. Tiger wrote: > > I did all the above ... now my text prints upside down andI cannot get it to > size up regardless of the font size. The view is probably using flipped coordinates. Look up flipped coordinates in the Cocoa view

Re: CGContextShowTextAtPoint

2015-10-14 Thread Conrad Shultz
t; in the Cocoa view documentation to understand what they are and how to work >> around the problem. >> >> As for the size, have you set the size of the NSFont in ‘sysFont’? >> > > I am using -graphicsContextWithBitmapImageRep and then adding text > annotations.

Re: CGContextShowTextAtPoint

2015-10-14 Thread David Duncan
>> >> >> On Oct 13, 2015, at 3:02 PM, Raglan T. Tiger <r...@crusaderrabbit.net> wrote: >>> CGContextShowTextAtPoint (ctx, pt.x,pt.y,(const char*)txt, len ); >>> >>> This has printed my text UNTIL 10.11. >>> >>> I see that CGCon

Re: CGContextShowTextAtPoint

2015-10-14 Thread Raglan T. Tiger
> On Oct 13, 2015, at 4:42 PM, Wim Lewis <w...@omnigroup.com> wrote: > > > On Oct 13, 2015, at 3:02 PM, Raglan T. Tiger <r...@crusaderrabbit.net> wrote: >> CGContextShowTextAtPoint (ctx, pt.x,pt.y,(const char*)txt, len ); >> >> This has

Re: CGContextShowTextAtPoint

2015-10-14 Thread Raglan T. Tiger
-rags > On Oct 14, 2015, at 2:37 PM, David Duncan wrote: > > Ensure that the text matrix is sane I have been doing this: CGAffineTransform t = CGAffineTransformMakeScale (1.0, -1.0); CGContextSetTextMatrix (ctx, t); changing the

Re: CGContextShowTextAtPoint

2015-10-14 Thread Raglan T. Tiger
for the size, have you set the size of the NSFont in ‘sysFont’? > I am using -graphicsContextWithBitmapImageRep and then adding text annotations. The reason for using CGContextShowTextAtPoint in the first place was to solve this problem when drawing NSStrings. I guess the real question is "H

CGContextShowTextAtPoint

2015-10-13 Thread Raglan T. Tiger
); CGContextSetTextDrawingMode(ctx, kCGTextFill); Then: 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? -rags

Re: CGContextShowTextAtPoint

2015-10-13 Thread Wim Lewis
On Oct 13, 2015, at 3:02 PM, Raglan T. Tiger <r...@crusaderrabbit.net> 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

Re: CGContextShowTextAtPoint

2015-10-13 Thread Graham Cox
ont(ctx, [sysFontName > cStringUsingEncoding:NSASCIIStringEncoding], 90, kCGEncodingMacRoman); > CGContextSetTextDrawingMode(ctx, kCGTextFill); > CGContextShowTextAtPoint (ctx, pt.x,pt.y,(const char*)txt, len ); Converting this to use string drawing is easy enough: NSDictionary* attributes = @{NSFontAtt

Re: CGContextShowTextAtPoint

2015-10-13 Thread Quincey Morris
On Oct 13, 2015, at 15:02 , Raglan T. Tiger <r...@crusaderrabbit.net> wrote: > > I see that CGContextShowTextAtPoint is deprecated in 10.9 ... is it gone in > 10.11? Apparently. There’s this: https://developer.apple.com/library/prerelease/mac/documentation/GraphicsIma

Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-04-06 Thread Rhythmic Fistman
(@This is an up arrow character \u2B06); I have not found a way to use CGContextShowTextAtPoint to easily display such a character and the examples I have found using CGContextShowGlyphsAtPoint() seem to require me to use a font containing the upwards arrow glyph. Is there a generic all inclusive

Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-03-30 Thread Jeff Schriebman
CGContextShowTextAtPoint to easily display such a character and the examples I have found using CGContextShowGlyphsAtPoint() seem to require me to use a font containing the upwards arrow glyph. Is there a generic all inclusive unicode font? What is the right approach to this issue? Suggestions are appreciated

Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-03-30 Thread Jens Alfke
On Mar 30, 2012, at 9:18 AM, Jeff Schriebman wrote: I have not found a way to use CGContextShowTextAtPoint to easily display such a character and the examples I have found using CGContextShowGlyphsAtPoint() seem to require me to use a font containing the upwards arrow glyph. I'm

Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-03-30 Thread David Duncan
character \u2B06); I have not found a way to use CGContextShowTextAtPoint to easily display such a character and the examples I have found using CGContextShowGlyphsAtPoint() seem to require me to use a font containing the upwards arrow glyph. Is there a generic all inclusive unicode font? What

Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-03-30 Thread Douglas Davidson
On Mar 30, 2012, at 9:31 AM, Jens Alfke wrote: On Mar 30, 2012, at 9:18 AM, Jeff Schriebman wrote: I have not found a way to use CGContextShowTextAtPoint to easily display such a character and the examples I have found using CGContextShowGlyphsAtPoint() seem to require me to use a font

Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-03-30 Thread Jeff Schriebman
This is what I have figured out so far: According to the Quartz 2D programming guide Quartz 2D provides a limited, low-level interface for drawing text encoded in the MacRoman text encoding and for drawing glyphs which probably explains my problem with using CGContextShowTextAtPoint(). I

Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-03-30 Thread David Duncan
On Mar 30, 2012, at 11:45 AM, Jeff Schriebman wrote: I'm not sure how to use the string drawing APIs to directly put a unicode UTF8 character onto a specific X,Y location given a CGContextRef. Both AppKit and UIKit have methods for making a CGContextRef current. Lookup the NSGraphicsContext

Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-03-30 Thread Jeff Schriebman
Thanks David. My CGContextRef is the current context. I'm just unfamiliar with how to draw a unicode character into it when I don't know the font containing a specific unicode glyph. I'm doing this for OS X 10.7 which is all I need to support. Thanks. On Mar 30, 2012, at 11:56 AM, David

Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-03-30 Thread David Duncan
On Mar 30, 2012, at 12:19 PM, Jeff Schriebman wrote: Thanks David. My CGContextRef is the current context. I'm just unfamiliar with how to draw a unicode character into it when I don't know the font containing a specific unicode glyph. I'm doing this for OS X 10.7 which is all I need to

Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-03-30 Thread Jeff Schriebman
Still having problems. I've unsuccessfully tried drawAtPoint:withAttributes: but I'm not sure what the best way to accomplish what I need to do. I'm not too familiar with the NSString methods so any advice is appreciated. On Mar 30, 2012, at 12:47 PM, David Duncan wrote: On Mar 30, 2012, at

Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-03-30 Thread Kyle Sluder
On Mar 30, 2012, at 1:21 PM, Jeff Schriebman wrote: Still having problems. I've unsuccessfully tried drawAtPoint:withAttributes: but I'm not sure what the best way to accomplish what I need to do. I'm not too familiar with the NSString methods so any advice is appreciated. What aspects of

Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-03-30 Thread Jeff Schriebman
The following code fragment properly displays an up arrow on my view. Thanks for everyone's patience and help. NSDictionary* fontAttrs = [NSDictionary dictionaryWithObjectsAndKeys: [NSColor redColor], NSForegroundColorAttributeName, [NSFont

Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-03-30 Thread Jens Alfke
On Mar 30, 2012, at 1:21 PM, Jeff Schriebman wrote: I've unsuccessfully tried drawAtPoint:withAttributes: but I'm not sure what the best way to accomplish what I need to do. I'm not too familiar with the NSString methods so any advice is appreciated. What was unsuccessful? Did you try it

Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-03-30 Thread Kevin Bracey
did i miss something, I thought is - (void)drawAtPoint:(NSPoint)point not NSAttributedString not NSString. Cheers kevin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list.

Re: Displaying an arbitrary unicode character using CGContextShowTextAtPoint or CGContextShowGlyphsAtPoint

2012-03-30 Thread Jeff Schriebman
The final code ended up looking like this NSDictionary* fontAttrs = [NSDictionary dictionaryWithObjectsAndKeys: [NSColor redColor], NSForegroundColorAttributeName, [NSFont systemFontOfSize:12], NSFontAttributeName, nil];

CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread Gabriel Zachmann
, 0.0, 1.0, 1.0 ); CGContextSetShadowWithColor( ctxt, CGSizeMake(0,0), 10, blue ); CGContextShowTextAtPoint( ctxt, theLayer.bounds.origin.x + 7.0, theLayer.bounds.origin.y + 7.0, str, strlen(str) ); CFRelease( blue ); } } I have checked that 'str' does actually hold

Re: CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread Graham Cox
On 09/08/2011, at 10:43 PM, Gabriel Zachmann wrote: I have checked that 'str' does actually hold a valid string at the user's instance. (I logged it and had him send me the log file.) I have also tried different font sizes. I have also googled around. All to no avail. Does anybody

Re: CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread Graham Cox
On 09/08/2011, at 10:43 PM, Gabriel Zachmann wrote: I have checked that 'str' does actually hold a valid string at the user's instance. (I logged it and had him send me the log file.) CGContextSelectFont( ctxt, AndaleMono, 14, kCGEncodingMacRoman ); // Andale Mono doesn't work

Re: CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread Gabriel Zachmann
Thanks a lot for your response ... I've found the Core Graphics text handling methods to be gnarly and awkward the few times I've attempted to use them, and always ended up going some other route to render text. Could you please point me to a few of them? In your case, the choice seems

Re: CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread Graham Cox
On 10/08/2011, at 12:48 AM, Gabriel Zachmann wrote: Could you please point me to a few of them? NSString, NSAttributedString, Core Text Can CATextLayer render text with a shadow? Like this: CGContextSetShadowWithColor( ctxt, CGSizeMake(0,0), 10, blue ); I really need the shadow to be

Re: CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread glenn andreas
On Aug 9, 2011, at 9:48 AM, Gabriel Zachmann wrote: Thanks a lot for your response ... I've found the Core Graphics text handling methods to be gnarly and awkward the few times I've attempted to use them, and always ended up going some other route to render text. Could you please

Re: CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread Gabriel Zachmann
CGContextSelectFont( ctxt, AndaleMono, 14, kCGEncodingMacRoman ); // Andale Mono doesn't work either Perhaps he doesn't have Andale Mono on his machine? I'm not sure what CG does with text if the font isn't there, does it fall back to something else or just silently fail? I think

Re: CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread Graham Cox
On 10/08/2011, at 2:06 AM, Gabriel Zachmann wrote: Just checked the doc of CATextLayer but couldn't find a hint on how it helps me determine whether or not a font is installed ... can you tell me? I doesn't. But it falls back gracefully, AFAIK. If you need a specific non-standard font, you