• 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
Problem with NSFontManager's traitsOfFont
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with NSFontManager's traitsOfFont


  • Subject: Problem with NSFontManager's traitsOfFont
  • From: Gideon King <email@hidden>
  • Date: Sun, 16 Dec 2001 17:49:28 +0800

I am trying to work with the attributes of fonts directly, and having the problem that with every font I have tried, NSFontManager tells me that the font traits are 16777228.

I have tried creating a font specifically by using things like:
aFont = [fm fontWithFamily:@"Helvetica" traits:NSBoldFontMask weight:5 size:18];
and have also tried creating the initial font then using things like:
aFont = [fm convertFont:aFont toHaveTrait:NSBoldFontMask];

But whenever I call traitsOfFont, I still get 16777228, whether it is plain, bold or italic.

In the debugger I have also tried the standard user font:
print (unsigned int)[fm traitsOfFont:(NSFont *)[NSFont userFontOfSize:18]]
with the result:
$8 = 16777228

I would expect the traits value to be 0 for normal, 1 for italic, 2 for bold, 3 for italic bold etc.

Can anyone shed any light on how to get the real traits mask from the font?

Thanks

Gideon


  • Prev by Date: Re: Cocoa Documentation on NSFormatter
  • Next by Date: Re: NSImage from Web: Resolution
  • Previous by thread: Archiving: placeholders
  • Next by thread: NSBeginAlertSheet()
  • Index(es):
    • Date
    • Thread