uifont

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

放肆的年华 提交于 2019-12-02 10:58:04
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. 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.h. You can get the supported languages using CTFontCopySupportedLanguages , but you get a list of BCP-47

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

好久不见. 提交于 2019-12-02 10:33:15
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 there a mathematical way for the calculation of font size based upon the size of the rect on the

Tamil font in iOS

旧城冷巷雨未停 提交于 2019-12-01 14:46:14
I try to install Tamil font name Bamini.ttf in xcode 4.2 and I made the specific changes in info.plist . Yet its not showing in Interface builder? Can any one help me to sort out this issue? As far as I know new font that you've installed will never be listed in Interface builder.However you can use it in your project like this: Import yourfont.ttf into your project (check the "copy items into destination group's folder" and "add to targets"). Open appname-info.plist a. add a new row and name it Fonts provided by application (It's an array of strings) b. add an entry with the Bamini.ttf Then

Tamil font in iOS

时间秒杀一切 提交于 2019-12-01 12:54:35
问题 I try to install Tamil font name Bamini.ttf in xcode 4.2 and I made the specific changes in info.plist . Yet its not showing in Interface builder? Can any one help me to sort out this issue? 回答1: As far as I know new font that you've installed will never be listed in Interface builder.However you can use it in your project like this: Import yourfont.ttf into your project (check the "copy items into destination group's folder" and "add to targets"). Open appname-info.plist a. add a new row and

How to change font size for iPhone 4 and IPhone 5 in auto-layout?

自闭症网瘾萝莉.ら 提交于 2019-12-01 12:44:00
I am trying to change font size of uilabel for iphone 4 and iphone 5 using autolayout and size classes. IB is giving option only for ipad and greater phones like iphone 6 and 6P . If i change font for wR and hR then it changes fonts size for iphone 4 , 5 and 6 which is wrong in my case . Please help me in this regard. Unfortunately , Apple Provides minimum consideration for all iPhone's(4,5,6,6p version) Portrait Mode Compact Width - Compact Height or Compact Width - Regular Height . So You can't specify Font Size separately for different iPhones in Portrait Mode from Storyboard. 来源: https:/

Font Anti-Aliasing on iPad SDK

泪湿孤枕 提交于 2019-12-01 12:22:37
I'm using a custom pixel font on the iPad SDK, and I'm trying to find a way to disable font anti-aliasing for UIFont. Pixel fonts usually work best when they don't have Anti-aliasing. I disable it easily in Photoshop when I create static resources, but this time I need a dynamic output with the custom font. Any ideas if this is even possible? Thanks. Something like this might work if you are subclassing a UILabel or similar: -(void) drawRect:(CGRect)r { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState( context ); CGContextSetShouldSmoothFonts( context , false ); [super

Custom Font not working in iOS 5

拟墨画扇 提交于 2019-12-01 11:56:18
I have added Avenir-Next-LT-Pro-Demi-Condensed_5186.ttf font in my resources. Also added the same to Fonts provided by application in my info.plist. In my code I have set the font like this, titleLabel.font = [UIFont fontWithName:@"Avenir-Next-LT-Pro-Demi-Condensed_5186" size:10]; But this is not working in ios 5 simulators and devices. Try this , The font name is not the font file name Avenir-Next-LT-Pro-Demi-Condensed_5186.ttf is a file name. simply double click the Avenir-Next-LT-Pro-Demi-Condensed_5186.ttf file it will automatically open the font reader.Get the font name from top of the

Font Anti-Aliasing on iPad SDK

非 Y 不嫁゛ 提交于 2019-12-01 11:50:53
问题 I'm using a custom pixel font on the iPad SDK, and I'm trying to find a way to disable font anti-aliasing for UIFont. Pixel fonts usually work best when they don't have Anti-aliasing. I disable it easily in Photoshop when I create static resources, but this time I need a dynamic output with the custom font. Any ideas if this is even possible? Thanks. 回答1: Something like this might work if you are subclassing a UILabel or similar: -(void) drawRect:(CGRect)r { CGContextRef context =

Custom Font not working in iOS 5

末鹿安然 提交于 2019-12-01 11:06:05
问题 I have added Avenir-Next-LT-Pro-Demi-Condensed_5186.ttf font in my resources. Also added the same to Fonts provided by application in my info.plist. In my code I have set the font like this, titleLabel.font = [UIFont fontWithName:@"Avenir-Next-LT-Pro-Demi-Condensed_5186" size:10]; But this is not working in ios 5 simulators and devices. 回答1: Try this , The font name is not the font file name Avenir-Next-LT-Pro-Demi-Condensed_5186.ttf is a file name. simply double click the Avenir-Next-LT-Pro

In iOS, Is it possible to add a font to the app during runtime?

青春壹個敷衍的年華 提交于 2019-12-01 09:44:25
In my app I want to let the user download and use fonts, but I don't know how to do this dynamically. I know we have to specify the fonts we want to use in the app's Info.plist file, but we can't add anything to that plist file programmatically. There is zynga's library but it is a subclass of UILabel . Please help You could use CGFontCreateWithDataProvider() followed by CTFontCreateWithGraphicsFont() . Then you'd have a CTFont, which you can draw using Core Text. As far as I know there's no way to get a UIFont from a custom font without either having the font in your app bundle and using the