Querying Aqua Font Variations
Using the methods of NSFont, you can query all of the Aqua font variations.
To request the default font size for the standard fonts,
you can either explicitly pass in default sizes (obtained from class
methods such as systemFontSize
and labelFontSize
),
or pass in 0 or a negative value.
For Objective-C, use the following method invocations:
Font |
Objective-C methods |
System font |
[NSFont systemFontOfSize:[NSFont
systemFontSize]]
|
Emphasized system font |
[NSFont boldSystemFontOfSize:[NSFont
systemFontSize]]
|
Small system font |
[NSFont systemFontOfSize:[NSFont
smallSystemFontSize]]
|
Emphasized small system font |
[NSFont boldSystemFontOfSize:[NSFont
smallSystemFontSize]]
|
Mini system font |
[NSFont systemFontSizeForControlSize: NSMiniControlSize]
|
Emphasized mini system font |
[NSFont boldSystemFontOfSize:[NSFont systemFontSizeForControlSize:
NSMiniControlSize]]
|
Application font |
[NSFont userFontOfSize:-1.0]
|
Application fixed-pitch font |
[NSFont userFixedPitchFontOfSize:-1.0]
|
Label Font |
[NSFont labelFontOfSize:[NSFont
labelFontSize]]
|
The equivalent Java invocations are as follows:
Font |
Java methods |
System font |
NSFont.systemFontOfSize(-1.0)
|
Emphasized system font |
NSFont.boldSystemFontOfSize(-1.0)
|
Small system font |
NSFont.systemFontOfSize(NSFont.smallSystemFontSize())
|
Emphasized small system font |
NSFont.boldSystemFontOfSize(NSFont.smallSystemFontSize())
|
Mini system font |
NSFont.systemFontSizeForControlSize(-1.0)
|
Emphasized mini system font |
NSFont.boldSystemFontOfSize(NSFont.systemFontSizeForControlSize(-1.0))
|
Application font |
NSFont.userFontOfSize(-1.0)
|
Application fixed-pitch font |
NSFont.userFixedPitchFontOfSize(-1.0)
|
Label font |
NSFont.labelFontOfSize(-1.0)
|
© 1997, 2008 Apple Inc. All Rights Reserved. (Last updated: 2008-02-08)
|
Did this document help you? |
Yes: Tell us what works for you.
|
|