NSFontManager is the center of activity for the font conversion system. It records the currently selected font, updates the Font panel and Font menu to reflect the selected font, initiates font changes, and converts fonts in response to requests from text-bearing objects. In a more prosaic role, NSFontManager can be queried for the fonts available to the application and for the particular attributes of a font, such as whether it’s condensed or extended.
Questions tagged [nsfontmanager]
30 questions
1
vote
2 answers
Issue with NSFontPanel
I have an application where I user need to modify style (font, size, bold, back and fore colors,...)
How can I load the initial style in the FontPanel and get the new attributes after user validation?
I tried a lot of different things but without…

AP.
- 5,205
- 7
- 50
- 94
1
vote
1 answer
Unable to use NSFontManager methods in swift
In Xcode 6 Beta 6,
I am unable to use any NSFontManager methods in Swift.
For example:
var fontManager = NSFontManager.sharedFontManager()
fontManager.setAction("changeFont:")
I always get the error: NSFontManager does not have a member named…

Fran
- 15
- 2
1
vote
1 answer
NSFontPanel: Shadow color -- where art thou?
Tinkering with the NSFontPanel here. It would appear that, if you resize the stock panel wide enough, you automagically get the ability to turn shadows on/off, the shadow opacity, blur, offset and direction. Even works in TextEdit.
Nice.
However,…

zzyzy
- 973
- 6
- 21
1
vote
2 answers
How do I generate a filtered set of available font family names? (like in Pages or TextEdit)
I want to make a popup button like the one in Pages.app (or in TextEdit.app) whose menu is a filtered list of font families.
I can get an array of available font family names from [NSFontManager availableFontFamilies], but this provides far more…

proxpero
- 2,206
- 1
- 16
- 16
1
vote
1 answer
Filtering Fonts from NSFontPanel?
According to the documentation, you should set an to the shared instance of NSFontManager. The delegate should implement a method
- (BOOL) fontManager:(id)sender willIncludeFont:(NSString *)fontName;
which will then be…

digory doo
- 1,978
- 2
- 23
- 37
1
vote
2 answers
How to get array of fonts contained in an NSFontCollection?
How can you get an NSArray of fonts or fontfamilies that are "contained" by an NSFontCollection?
All NSFont and NSFontManager methods seem to require a single NSFontDescriptor, while NSFontCollection returns an NSArray of NSFontDescriptor objects.…

uchuugaka
- 12,679
- 6
- 37
- 55
1
vote
2 answers
WebView as responder
I would like to receive the changeFont: and changeColor: messages in a WebView subclass.
According to the documentation, these methods are sent by NSFontManager and NSColorPanel respectively to responders.
Yet, they never get called in my WebView…

hpique
- 119,096
- 131
- 338
- 476
0
votes
2 answers
fontWithFamily returns nil?
We're trying to create a font by doing something like the following:
NSFont * font;
font = [[NSFontManager sharedFontManager]
fontWithFamily:@"Arial"
traits:(NSUnboldFontMask | NSUnitalicFontMask)
weight:5
…

Colen
- 13,428
- 21
- 78
- 107
0
votes
0 answers
SwiftUI - NSFontPanel and Color Picker
I am trying to get NSFontPanel/NSFontManager to work in a SwiftUI Document Template app. I have the following which is a customize version of one I found on GitHub. This lets me pick the size, face, style, etc.
Interestingly, a color picker is…

Frank Nichols
- 1
- 1
0
votes
1 answer
Get user selected NSFont using NSFontManager - Unable to override changefont function
I'm trying to allow the user to select a font of his/her choice using the NSFontManager. I could show the font picker using the following code
@IBAction func fontchangeclicked(_ sender: Any) {
…

techno
- 6,100
- 16
- 86
- 192
0
votes
1 answer
macOS: "SF Pro Text" not available on new computer
I want to use the "SF Pro Text" font in my app. It works fine when I build my app on my main computer (running macOS11 Big Sur), but I have a 2nd partition to run macOS Monterey, and it doesn't seem to be available there at all, whether through…

Z S
- 7,039
- 12
- 53
- 105
0
votes
1 answer
How do I set state of a Bold format button for a NSTextView?
I have a NSTextView that I want to add format buttons for (bold, italics, etc).
Right now, I have a button set to "toggle" type, with different images for on/off states.
The toggle method checks the state of the button and send the shared…

Steven Hovater
- 1,389
- 2
- 12
- 25
0
votes
2 answers
Like create a Font Menu as in Microsoft Word in my Mac OSX Cocoa Application
I am Trying to Create a NSComboBox like the image attached with the list of Fonts. Any body knows and custom special control is available.
I have kept the image in dropbox

user226372
- 165
- 1
- 9
0
votes
1 answer
How to change the spacing between letters in a NSFont?
I'm trying to change the letter spacing in a NSFont (such as Gill Sans). Is this possible or will I need to load my own custom font?

strange
- 9,654
- 6
- 33
- 47
-1
votes
1 answer
NSFont not working properly in macOS Catalina
NSFont *fontRef = [NSFont fontWithName:@".SFNS-Light" size:20];
Above line of code used to work just fine but now it is not working in Catalina. I am getting nil for fontRef. .SFNS-Light stills show as available Fonts. Interesting enough it is…