uifont

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

隐身守侯 提交于 2019-12-01 09:08:22
问题 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 回答1: 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

How to set custom font in UIWebView?

非 Y 不嫁゛ 提交于 2019-12-01 09:06:14
I have a font in the resources and I loaded it into a UIFont I want to know how to use this UIFont as the default font for my UIWebView Thanks in advance... kthorat If you are using webpage to display in the WebView Here is what I would do : Create a string with the header of the HTML page add css file or embedded CSS in header Create the body of HTML. Create ending elements of HTML Append all the strings and load WebView from string NSString *bundlepath = [[NSBundle mainBundle] bundlePath]; NSURL *baseURL = [NSURL fileURLWithPath:bundlepath]; [webView loadHTMLString:html baseURL:baseURL];

UITextView attributed text not working when using custom font

↘锁芯ラ 提交于 2019-12-01 07:28:07
问题 I'm using UITextView and I'm setting its font and attributed text by code. Case 1: Custom-font - YES , attribtued text - NO The textView text is displayed in custom font. I want the attribtued text with custom font i.e Message : in this case shold be bolded. Case 2: Custom-font - YES , attribtued text - YES Only the attribtued text(Bold text) is displayed in custom font. The code I have is: - (void)loadTextView { _textView.text=NSLocalizedString(@"more_info_text",nil); _textView.font=[UIFont

How to set custom font in UIWebView?

不打扰是莪最后的温柔 提交于 2019-12-01 05:59:43
问题 I have a font in the resources and I loaded it into a UIFont I want to know how to use this UIFont as the default font for my UIWebView Thanks in advance... 回答1: If you are using webpage to display in the WebView Here is what I would do : Create a string with the header of the HTML page add css file or embedded CSS in header Create the body of HTML. Create ending elements of HTML Append all the strings and load WebView from string NSString *bundlepath = [[NSBundle mainBundle] bundlePath];

Not able to set custom fonts in WatchKit

三世轮回 提交于 2019-12-01 01:20:19
I am trying to set Roboto font and have added as target for watch kit extension, but it is still coming as nil. Can we set custom fonts in watch kit. Yes, you can use custom fonts in WatchKit https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/WatchKitProgrammingGuide/TextandLabels.html Yano Ratheez Its worked for me.. Using following Codes. Add the custom Font to both WatchKit Extension and WatchKit App target Info.plist Now you write the code following way, NSMutableAttributedString *attString =[[NSMutableAttributedString alloc] initWithString: @"Yano rocks!

How to Display different Custom arabic fonts in iPhone application?

霸气de小男生 提交于 2019-11-30 22:44:04
In my application i need to display arabic text with different custom fonts. I follow the scenario adding ttf files to info.plist . As per above scenario i am successfully getting display text in different font style for ENGLISH text only. I am doing same thing for arabic font styles but here i am not getting. Why is going like that? Please any one can help me Thanks in Advance. @Kareem , I took hint from Stackoverflow itself to load the fonts but could not get it working in first go. May be following steps can help you . Add the font files to your project. Make their entries in info.plist

Download font .ttf file from web and store on iPhone

半世苍凉 提交于 2019-11-30 18:38:29
问题 Is it possible to download .ttf file from web and store it on iPhone. Then use that for for labels and all other stuff ? Because my client want to control fonts from database and don't want to just drop fonts to xcode project right away. So in future if he wants to change font, he will add new font to database, app will recognize new font on web (thats already done with images, not a problem), download it and use as font. Thanks. 回答1: The fonts have to be set in the plist of your app, and

How to Display different Custom arabic fonts in iPhone application?

折月煮酒 提交于 2019-11-30 17:29:24
问题 In my application i need to display arabic text with different custom fonts. I follow the scenario adding ttf files to info.plist . As per above scenario i am successfully getting display text in different font style for ENGLISH text only. I am doing same thing for arabic font styles but here i am not getting. Why is going like that? Please any one can help me Thanks in Advance. 回答1: @Kareem , I took hint from Stackoverflow itself to load the fonts but could not get it working in first go.

Can't use custom font in iOS app

倾然丶 夕夏残阳落幕 提交于 2019-11-30 16:20:13
I'm trying to use custom font for my iOS app. Here is what I do I added my custom font (m.tff) to Xcode Supporting files directory. Also I create entry called Fonts provided by application with value name of the font (m.tff) in myApp.plist In my view I have a label UILabel *label = [[UILabel alloc]initWithFrame:CGRect(10, 20, 230, 30)]; label.font = [UIFont fontWithName:@"My custom font" size:15]; etc... The problem is that when I launch the app the text in label is with default font instead of using the specific one. What I miss here ? EDITED Well it seem works now, but the font applies only

Giving Framesetter the correct line spacing adjustment

こ雲淡風輕ζ 提交于 2019-11-30 16:06:41
问题 Several posts have noted difficulties with getting an exact height out of CTFramesetterSuggestFrameSizeWithConstraints, and here, (framesetter post), @Chris DeSalvo gives what looks like the definitive fix: add a paragraph style setting with the correct line spacing adjustment. DeSalvo gets his “leading” by removing UIFont’s ascender and descender from its lineHeight. I wondered how that would compare to CTFontGetLeading . I worked with fonts created like this: CTFontRef fontr =