uifont

-fontWithSize returning different font object

99封情书 提交于 2020-01-01 05:26:20
问题 Update 1 I found a work-around: // instead of font = [font fontWithSize:pointSize]; // i can do this and get the correct font back font = [UIFont fontWithName:font.fontName size:pointSize] I'm using Nick Lockwood's HTMLLabel class to turn HTML into an NSAttributedString that respects the styling within the HTML. For the most part, it works great. However, I'm using a custom font in my app, and for some reason, my font is always getting rendered in bold. I don't have this problem using the

iOS: finding correct font size to fit in a UILabel depending on its size

会有一股神秘感。 提交于 2019-12-31 05:45:09
问题 I have a UILabel whose property text I would like to set paragraphs of text to using NSString . I have an array in which I store a sequence of characters that represent a text paragraph. The paragraph doesn't have to fit/included perfectly within this UILabel . If the paragraph doesn't end, I would move on to the next label. Let say if I had rect size of this UILabel 160 X 240, how could I be able to determine the correct font size in order to fill this string of the UILabel within nicely? Is

Get meta-info from UIFont or CGFont - iOS, Swift

你。 提交于 2019-12-31 05:23:08
问题 I want to get meta info from fonts. For example: supported languages, version, license etc. How can I do this? It works fine on Mac Fonts app. I need to implement this on iOS. 回答1: You can get much of that information using CTFontCopyName . For example, you can print the font's copyright and license like this: print(CTFontCopyName(font, kCTFontCopyrightNameKey)) print(CTFontCopyName(font, kCTFontLicenseNameKey)) The key constants are of the format kCTFont***NameKey and are declared in CTFont

More time is taken to display NSAttributed string with custom fonts

三世轮回 提交于 2019-12-25 15:56:43
问题 I am displaying NSAttributed string column wise using Core Text. It is working fine. When using system font, it is displayed without any delay both in simulator and device. But when using custom font, more time is taken to display the content in device. But in the simulator, the result is quick. - (void)updateAttributedString { // Existing Code if (self.text != nil) { self.attributedString = [[NSMutableAttributedString alloc] initWithString:self.text]; NSRange range = NSMakeRange(0, [self

How to increase the font size of a NSAttributedsString in iOS

醉酒当歌 提交于 2019-12-25 04:23:05
问题 I am trying to change the font size of an NSAttributedString dynamically. The problem is the string contains different font sizes and properties. so when i change the font size all the content size change to tat value. Not changing accordingly . .. . . 回答1: If I understood you correctly this approach should help you: you can enumerate all NSFontAttributeName attributes for your AttributedString and increase the font size by for instance 1. This would give you the following result: If that's

Can't load custom font on iOS

百般思念 提交于 2019-12-24 23:26:55
问题 I'm having trouble loading a custom font. .m file: - (void)viewDidLoad { [label setFont:[UIFont fontWithName:@"BIO.TTF" size:32]]; [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } I did type in the font name "BIO.TTF" in the .plist file. The font is provided by the application. 回答1: Use file name in plist, and font name in your code. 回答2: The accepted answer is incorrect. Custom font names under iOS do not always correspond to what finder reports

Question mark when tapping or holding font icons

╄→гoц情女王★ 提交于 2019-12-24 23:09:49
问题 So I recently started some tinkering with my app to get it iOS 11 compatible. Thankfully most of it seems to be. However I did notice, that in my toolbar if I tap or tap and hold an icon, which is supplied by a ttf file from fontello, I get a question mark box. Example of icon: menu = [[UIBarButtonItem alloc] initWithTitle:@"\ue811" style:UIBarButtonItemStylePlain target:self action:@selector(openMenu:)]; [menu setTitleTextAttributes:@{NSFontAttributeName: [UIFont fontWithName:@"fontello"

iPhone Character Spacing

落花浮王杯 提交于 2019-12-24 10:07:19
问题 Is there a way to add character spacing in UILabel? I found some examples like: How to change an UILabel/UIFont's letter spacing? But it's hard to believe that there isn't a easier way. 回答1: There is no other to achieve what you want than doing custom Quartz drawing, UILabel is not flexible enough. However, other people have taken on the challenge, there is for example OHAttributedLabel which allows you to set an NSAttributedString as the label's text. Try the NSKernAttributeName , it

Check if certain character is supported by UIFont

北城余情 提交于 2019-12-24 05:27:13
问题 I know how to get the array of all fonts in iOS. Now I need to check if certain font support Cyrillic characters (Ukrainian alphabet). 回答1: I think you can check font for Cyrillic characters using this function: CTFontGetGlyphsForCharacters If it returns False the font is improper. 来源: https://stackoverflow.com/questions/19622219/check-if-certain-character-is-supported-by-uifont

iOS - Entry in Info.plist for only iOS 6 and above?

◇◆丶佛笑我妖孽 提交于 2019-12-24 00:58:43
问题 I have an entry in my app's Info.plist (a Dictionary), and I only want it to be used in iOS 6 and above. It involves font replacement, using FontReplacer, and I don't want to replace fonts for a device running iOS 5. You can see the example on GitHub for a better explanation. Basically, is there a way for me to only use that Info.plist entry if the user's device is running iOS 6 or later? Thanks. 回答1: No. There isn't a way to tell the system to only have a specific entry available if >iOS 6.