conflict between Core Graphics and NSView graphics

2010-04-26 Thread Bill Appleton
hi all i converted a bunch of quickdraw code to core graphics successfully -- it worked now i am converting a bunch of carbon UI code to cocoa but when I draw text, my fonts are wrong and my font sizes are much too big i am getting the CGContextRef from the NSWindow in the drawRect handler,

Re: conflict between Core Graphics and NSView graphics

2010-04-26 Thread David Duncan
On Apr 26, 2010, at 12:24 PM, Bill Appleton wrote: but when I draw text, my fonts are wrong and my font sizes are much too big i am getting the CGContextRef from the NSWindow in the drawRect handler, and then setting the CG font and size, etc. like before Try checking the text matrix.

Re: conflict between Core Graphics and NSView graphics

2010-04-26 Thread Aki Inoue
Bill, How are you rendering the text ? We recommend sticking to Cocoa text rendering API in order to support proper Unicode rendering. Thanks, Aki On Apr 26, 2010, at 12:24 PM, Bill Appleton wrote: hi all i converted a bunch of quickdraw code to core graphics successfully -- it worked

Re: conflict between Core Graphics and NSView graphics

2010-04-26 Thread Bill Appleton
hi Aki, i am using CGContextShowGlyphsWithAdvances i have a very large amount of core graphics code, i thought it was compatible with cocoa i see the text in the right spot but the size is gigantic thanks, bill On Mon, Apr 26, 2010 at 12:34 PM, Aki Inoue a...@apple.com wrote: Bill,

Re: conflict between Core Graphics and NSView graphics

2010-04-26 Thread Aki Inoue
OK, sounds like you're being affected by the text matrix. In CG, there are 3 font properties that determine the font rendering: font name, font size, and text matrix. You need to manage all 3. The easiest approach is to use -[NSFont setInContext:] to let the Cocoa object set all 3 properties

Re: conflict between Core Graphics and NSView graphics

2010-04-26 Thread Bill Appleton
thanks all! On Mon, Apr 26, 2010 at 12:50 PM, Aki Inoue a...@apple.com wrote: OK, sounds like you're being affected by the text matrix. In CG, there are 3 font properties that determine the font rendering: font name, font size, and text matrix. You need to manage all 3. The easiest

Re: conflict between Core Graphics and NSView graphics

2010-04-26 Thread Jens Alfke
On Apr 26, 2010, at 12:50 PM, Aki Inoue wrote: In CG, there are 3 font properties that determine the font rendering: font name, font size, and text matrix. You need to manage all 3. Is the text matrix just used for special effects like obliquing? Using it to scale the text could produce

Re: conflict between Core Graphics and NSView graphics

2010-04-26 Thread Aki Inoue
We always us the text matrix instead of font size. While it is true that the advancements and glyph outline could be affected by the font point size down in the font system, the CG graphics model doesn't work that way. What we recommend is to stick to the Cocoa Text System that tries very hard

Re: conflict between Core Graphics and NSView graphics

2010-04-26 Thread Mike Abdullah
On 26 Apr 2010, at 20:24, Bill Appleton wrote: hi all i converted a bunch of quickdraw code to core graphics successfully -- it worked now i am converting a bunch of carbon UI code to cocoa but when I draw text, my fonts are wrong and my font sizes are much too big i am getting

Re: conflict between Core Graphics and NSView graphics

2010-04-26 Thread Bill Appleton
that CGContextRef is the same as [[thewind graphicsContext] graphicsPort] in the scope if the drawRect routine (i am away from that machine, the code is probably wrong, but you can see what i mean) so the two methods return the same context On Mon, Apr 26, 2010 at 3:58 PM, Mike Abdullah