Problem with NSFontManager's traitsOfFont
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