Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to set font style in a CGContextRef??



what i'm doing now is calling setport on the underlying quickdraw port, 
doing the "olden days" type font setup
then DrawThemeTextBox with kThemeCurrentPortFont

now i want to do this on a background thread maybe, so need to remove all non-thread safe code
that meas no quickdraw at all.

or say i'm ONLY passing around a contextRef, i don't HAVE a port (maybe it's a vector context right?)

wow i've been researching for a long time on this and found nothing that seemed to do what i want to do simply.

olden days:

TextFont(foo);
TextSize(bar);
TextStyle(baz);
DrawText(yadda yadda)

modern days:

option 1:
CGContextSelectFont(myContext, foo, barkCGEncodingFontSpecific);
??? But where is the call for style  ??

option 2:

ATSFontRef atsFontRef = ATSFontFindFromName(CFSTR(foo), kATSOptionFlagsDefault);
???? again, how do i set the STYLE????
CGFontRef fontRef = CGFontCreateWithPlatformFont(&atsFontRef);

CGContextSetFont(myContext, fontRef);


like, from the font panel callbacks, i get this info:

  kEventParamATSUFontID         = 'auid', /* typeATSUFontID*/
  kEventParamATSUFontSize       = 'ausz', /* typeATSUSize*/
  kEventParamFMFontFamily       = 'fmfm', /* typeFMFontFamily*/
  kEventParamFMFontStyle        = 'fmst', /* typeFMFontStyle*/
  kEventParamFMFontSize         = 'fmsz', /* typeFMFontSize*/
  kEventParamFontColor          = 'fclr', /* typeFontColor*/

so how do i translate that into a font i can use in my contextRef????  WITH THE STYLE.

thanks and stuff :)

-dave
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.