nsfontmanager

How to install custom font in mac programmatically in macOS

风流意气都作罢 提交于 2020-03-24 21:26:56
问题 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 = [[NSFontManager sharedFontManager] availableFontFamilies]; if ([fonts containsObject:@"Square721 BT"]) { NSLog(@"Fonts Available"); } else { NSLog(@"No fonts"); } Now, if the font is not already installed, how can I install it programmatically? 回答1: Add

How to install custom font in mac programmatically in macOS

你离开我真会死。 提交于 2020-03-24 21:24:11
问题 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 = [[NSFontManager sharedFontManager] availableFontFamilies]; if ([fonts containsObject:@"Square721 BT"]) { NSLog(@"Fonts Available"); } else { NSLog(@"No fonts"); } Now, if the font is not already installed, how can I install it programmatically? 回答1: Add

How to install custom font in mac programmatically in macOS

隐身守侯 提交于 2020-03-24 21:23:11
问题 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 = [[NSFontManager sharedFontManager] availableFontFamilies]; if ([fonts containsObject:@"Square721 BT"]) { NSLog(@"Fonts Available"); } else { NSLog(@"No fonts"); } Now, if the font is not already installed, how can I install it programmatically? 回答1: Add

How to install custom font in mac programmatically in macOS

六眼飞鱼酱① 提交于 2020-03-24 21:23:03
问题 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 = [[NSFontManager sharedFontManager] availableFontFamilies]; if ([fonts containsObject:@"Square721 BT"]) { NSLog(@"Fonts Available"); } else { NSLog(@"No fonts"); } Now, if the font is not already installed, how can I install it programmatically? 回答1: Add

Name and size from NSFont

家住魔仙堡 提交于 2019-12-10 20:31:45
问题 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 like [NSFont fontWithName:@"Menlo" size:11]; only backwards, so I get the name "Menlo" and as size 11. Thanks for help! Xcoder from Germany 回答1: The name and size of NSFont are variables with setters and getters ( @property ) so you can easily get them