FROM : Henry McGilton
DATE : Thu Apr 21 19:39:59 2005
On Apr 21, 2005, at 10:15 AM, Luc Vandal wrote:
> It seems that it's not possible to set a font as bold. Is there a way
> to do this or fonts handling is very different compared to Windows?
If you want a bold (or italic, or both) font, you ask for
a bold (or italic, or both) font:
[NSFont fontWithName: (NSString *)fontName size:(float)fontSize];
So in this case, you would write:
NSFont myFont = [NSFont fontWithName: @"Optima-Bold" size: 10];
to get a ten-point Optima-Bold font.
You can also add or remove 'traits' using NSFontManager. Read
the 'Constants' section of NSFontManager, and look at addFontTrait:,
removeFontTrait:, convertFont:toHaveTrait, convertFont:toNotHaveTrait:
methods.
Cheers,
........ Henry
===============================+============================
Henry McGilton, Boulevardier | Trilithon Software
Objective-C/Java Composer | Seroia Research
-------------------------------+----------------------------
mailto:<email_removed> | http://www.trilithon.com
|
===============================+============================
DATE : Thu Apr 21 19:39:59 2005
On Apr 21, 2005, at 10:15 AM, Luc Vandal wrote:
> It seems that it's not possible to set a font as bold. Is there a way
> to do this or fonts handling is very different compared to Windows?
If you want a bold (or italic, or both) font, you ask for
a bold (or italic, or both) font:
[NSFont fontWithName: (NSString *)fontName size:(float)fontSize];
So in this case, you would write:
NSFont myFont = [NSFont fontWithName: @"Optima-Bold" size: 10];
to get a ten-point Optima-Bold font.
You can also add or remove 'traits' using NSFontManager. Read
the 'Constants' section of NSFontManager, and look at addFontTrait:,
removeFontTrait:, convertFont:toHaveTrait, convertFont:toNotHaveTrait:
methods.
Cheers,
........ Henry
===============================+============================
Henry McGilton, Boulevardier | Trilithon Software
Objective-C/Java Composer | Seroia Research
-------------------------------+----------------------------
mailto:<email_removed> | http://www.trilithon.com
|
===============================+============================
| Related mails | Author | Date |
|---|---|---|
| Luc Vandal | Apr 21, 19:15 | |
| Henry McGilton | Apr 21, 19:39 | |
| Jeff Gilbert | Apr 21, 19:44 | |
| John Brownlow | Apr 21, 19:46 |






Cocoa mail archive

