Questions tagged [nsfontmanager]

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.

30 questions
7
votes
1 answer

How does NSFontManager addFontTrait change the actual font on the UI element

I want to achieve the same thing as [[NSFontManager sharedFontManager] addFontTrait:(nullable id)sender] only using my code The doc states This action method causes the receiver to send its action message up the responder chain. By default, the…
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
6
votes
1 answer

NSFontManager selectedFont returning null

Okay so I've checked all over S.O. and all over Google and I can't find what is wrong with my code: - (IBAction)selectFont:(id)sender { NSFontManager *fontManager = [NSFontManager sharedFontManager]; [fontManager setDelegate:self]; …
Liftoff
  • 24,717
  • 13
  • 66
  • 119
4
votes
2 answers

Change the font, font color and background color of an NSTableView at runtime using NSFontPanel?

I'd like to enable the user to change the font of an view-based NSTableView. I'm using Cocoa bindings and Core Data. In my test code, I do have a changeFont: method that does get called as soon as I press a font-related key combination, like cmd-I…
Mojo66
  • 1,109
  • 12
  • 21
3
votes
1 answer

validModesForFontPanel never called

I have an application where I use the NSFontPanel. I open the font panel like this: NSFontManager *fontManager = [NSFontManager sharedFontManager]; [fontManager orderFrontFontPanel:self]; [fontManager setDelegate:self]; [fontManager…
pajevic
  • 4,607
  • 4
  • 39
  • 73
3
votes
4 answers

Name and size from NSFont

i've tried to find something in the Internet, but right now I don't have an answer, so it would be great if you can help me! So far I have a NSFont object, but I would like the name (as NSString) and size of the font, so I can output that! It's…
qwertz
  • 14,614
  • 10
  • 34
  • 46
3
votes
1 answer

Is there a mapping between NSFont.Weight and the integer values?

The NSFont API has two different ways to specify a weight. First, there is a struct NSFont.Weight which contains a floating point rawValue property. It's used in functions like: NSFont.systemFont(ofSize fontSize: CGFloat, weight: NSFont.Weight) ->…
Rob N
  • 15,024
  • 17
  • 92
  • 165
3
votes
2 answers

Why is NSFontManager.availableMembers(ofFontFamily:) crashing in Xcode 8 GM?

I wrote this in Xcode 8 Beta 6 (8S201h): guard let faceMembers = NSFontManager.shared().availableMembers(ofFontFamily: familyName ?? fontName) else { return nil } And it worked just fine. Now that I've upgraded to Xcode 8 GM Seed (8A218a) Xcode 8…
Ky -
  • 30,724
  • 51
  • 192
  • 308
3
votes
2 answers

Cocoa: Font formatting popup buttons

I am looking at a sample app that involves some text editing. It has some font formatting buttons like this: I can't find where in the code these are being set up, which makes me think they come built in somehow. For example, the font popup button…
James Harpe
  • 4,315
  • 8
  • 47
  • 74
2
votes
1 answer

How can I get NSFontManager selected font?

I can't get selected font in NSFontManager. What I need: 1) I need to get selected font title, size, color? I am calling NSFontManager with button like this: [[NSFontManager sharedFontManager] orderFrontFontPanel:self]; It's opening but I don't…
user1150322
2
votes
1 answer

NSTextField eating NSFontPanel..?

I'm having a weird problem receiving any messages from an NSFontPanel when an NSTextField in my app is focussed. Even a subclass of NSTextField doesn't receive anything from the font panel.. it seems that everything sent by the panel e.g. when…
ATV
  • 4,116
  • 3
  • 23
  • 42
2
votes
0 answers

NSFonts that have ASCII characters

I'm making my own font dialogue, but it's embedded within WebKit. It's working pretty much how I want it to, except for one part. It's showing fonts that can not be written using standard ASCII characters. They appear in standard Latin characters,…
Oliver Cooper
  • 849
  • 7
  • 20
2
votes
1 answer

Subclassing NSFontManager doesn't work

I subclassed NSFontManager and overrode "modifyFont:(id)sender) Then I changed the NSFontManager class in my xib files to the new class. I can see, that the class is initialized, but the overwritten method is never called. Though the NSFontManager…
user808667
  • 333
  • 3
  • 11
1
vote
1 answer

how can i set attributes of NSFontPanel?

How can i set font attributes of NSFontPanel, like color, bold etc ?
Richa Vijayvargiya
  • 209
  • 1
  • 3
  • 6
1
vote
1 answer

NSTextView, NSFontManager, and changeAttributes()

So I have this app that I'm writing to get familiar with Swift and programming for OSX. It's a note-taking app. The note window consists of an NSTextView and a button that brings up an NSFontPanel. Changing the font works great. Selecting a size? No…
Chris
  • 1,013
  • 1
  • 15
  • 35
1
vote
1 answer

How to install custom font in mac programmatically in macOS

I am having a mac app in which I have custom font which is not there in my custom font book of application folder in my mac. So, when an app launches, I checked it that if a font is installed in mac or not with the below code. NSArray *fonts =…
Manthan
  • 3,856
  • 1
  • 27
  • 58
1
2