Helvetica Neue is the default font in iOS 7/8. When building hybrid apps, how do you include Helvetica Neue as the font?
It does not seem to be a free font. Or are most hybrid app developers pulling an open source version of Helvetica Neue from a CDN?
Helvetica Neue is not a free font sadly, and isn't licensed by standard on Android. It gets pretty expensive if you want to embed it within your app outside of iOS (see Linotype)
I guess you have a few options:
"Roboto" was first included in Ice Cream Sandwich, and looks very similar - comparison here. So you could include this in your CSS stack.
Use a similar open source font like Open Sans (Google Fonts) and embed the TTF file into your app.
Use a CSS stack that starts with Helvetica Neue, and works its way backwards to less nice fonts, depending on what platform the hybrid app is running on - i.e. this stack. You could add Roboto earlier in the stack if you like it...
Related
I want a monospace font for my UILabel in my iOS application.
Unfortunately, I could not find one. Even "American Typewriter" was not actually monospaced. What is a monospace font available in XCode?
iOS mono-spaced fonts
Courier
Courier-Bold
Courier-BoldOblique
Courier-Oblique
CourierNewPS-BoldItalicMT
CourierNewPS-BoldMT
CourierNewPS-ItalicMT
CourierNewPSMT
Menlo-Bold
Menlo-BoldItalic
Menlo-Italic
Menlo-Regular
iosfonts.com maintain a list of all iOS fonts.
This webpage detects your installed system fonts and returns a fairly comprehensive list.
Looking at an old listing of fonts shipped with iOS I see several one monospace fonts.
(eg. Andale Mono, Monaco, Courier New)
For 2018 it's only Menlo and Courier.
If your intent is to display numbers and you don't care about the specific font used, you can do this:
UIFont.monospacedDigitSystemFontOfSize(
UIFont.systemFontSize(),
weight: UIFontWeightRegular)
Adobe just released a nice monospaced font Source Code Pro in both TTF and OTF formats.
It's licensed with the Open Font License so it is available for free use within applications, including commercial applications.
You will need to add the font file as a resource in Xcode, by setting the UIAppFonts key in the info.plist to point to the SourceCodeProRegular.ttf file.
Now in your code you can set, for example:
self.textView.font = [UIFont fontWithName:#"Source Code Pro" size:14];
Expanding upon #reggie-pinkham's answer, I built this JS Bin for folks to use as a live test page; to save future reader's some time, here's a few screen shots using iOS Simulator on Mavericks:
iPad Air, iOS 8.1
iPhone 6 plus, iOS 8.1
As of iOS 13, San Francisco (SF) Mono is available. Couldn't find a way to set this in interface builder, but by code it's:
let font = UIFont.monospacedSystemFont(ofSize: 17.0, weight: .regular)
If you're looking for a monospace font for numbers, then try "Helvetica Neue".
A list of built-in fonts available on iOS: http://iosfonts.com. Courier and Menlo seem to be the only monospace fonts in there.
SwiftUI
You can use Font's instance method monospacedDigit
Text("0123456789")
.foregroundColor(.white)
.font(Font.custom("San Francisco", size: 20).monospacedDigit())
You can access system fonts in monospaced with the following Font factory method:
static func system(Font.TextStyle, design: Font.Design) -> Font
Example:
let monospacedBody = Font.system(.body, .monospaced)
Other usage:
let serifTitle = Font.system(.title, .serif)
In the meantime there is a good Monospace font available from Apple, that can be downloaded here: Apple SFUI
Here is how to add the fonts to Xcode: Add fonts to xcode
I am using different fonts in my Codename One app. If I include and use Roboto-Bold.ttf or Oswald font from Google fonts or Keep Calm Medium from dafont.com the text is displayed on Android and Codename One Simulator (as reported on this SO question) but NOT on iOS (neither on the device nor on XCode device) although the fonts are packaged in the .ipa generated by Codename One.
I tried with style = PLAIN or BOLD with the same results.
I used font = Font.createTrueTypeFont(fontName, fontFilename ).derive(fontSize, style);
Why are some fonts working while other aren't? Is there any way to know before compilation which fonts are more likely to work on iOS?
iOS and Android use very different approaches to dealing with fonts which we try to simplify with a simple method.
If you define the font in the designer with a UIID we can hide most of that complexity for you but when you load the font dynamically you are exposed to some of that.
Android just loads font files so the file is used and this should work easily like the simulator. iOS needs the fonts to be installed and then loaded by font name (which isn't the file name and isn't very intuitive). This stack overflow question discusses the method of getting the font name on a Mac: How do I get the font name from an otf or ttf file?
I would like to generate a button or label with the same visual plus sign or icons as used in the UIButtonBar system items. Is there a way to determine what font and characters are being used to generate these items?
Breaking this into two answers:
The system fonts: Helvetica Neue Ultralight is used by iOS 7, while iOS 6 uses Helvetica (or more specifically, the nearly-identical Helvetica Neue).
If you are trying to make icons that look like iOS defaults, I have used http://www.glyphish.com/ successfully.
The font called from [UIFont boldSystemFontWithSize xx] is not fixed-width, I don't know the exact name of this system font (iOS 6).
I'm wondering if there is a built-in fixed-width font? Otherwise I have to embed a new font to my app.
PS: maybe iOS 7 system font is fixed-width, LOL
Thanks guys.
Here's the list of built-in fonts available on iOS: http://iosfonts.com.
Courier looks like the only monospace font in there.
I want a monospace font for my UILabel in my iOS application.
Unfortunately, I could not find one. Even "American Typewriter" was not actually monospaced. What is a monospace font available in XCode?
iOS mono-spaced fonts
Courier
Courier-Bold
Courier-BoldOblique
Courier-Oblique
CourierNewPS-BoldItalicMT
CourierNewPS-BoldMT
CourierNewPS-ItalicMT
CourierNewPSMT
Menlo-Bold
Menlo-BoldItalic
Menlo-Italic
Menlo-Regular
iosfonts.com maintain a list of all iOS fonts.
This webpage detects your installed system fonts and returns a fairly comprehensive list.
Looking at an old listing of fonts shipped with iOS I see several one monospace fonts.
(eg. Andale Mono, Monaco, Courier New)
For 2018 it's only Menlo and Courier.
If your intent is to display numbers and you don't care about the specific font used, you can do this:
UIFont.monospacedDigitSystemFontOfSize(
UIFont.systemFontSize(),
weight: UIFontWeightRegular)
Adobe just released a nice monospaced font Source Code Pro in both TTF and OTF formats.
It's licensed with the Open Font License so it is available for free use within applications, including commercial applications.
You will need to add the font file as a resource in Xcode, by setting the UIAppFonts key in the info.plist to point to the SourceCodeProRegular.ttf file.
Now in your code you can set, for example:
self.textView.font = [UIFont fontWithName:#"Source Code Pro" size:14];
Expanding upon #reggie-pinkham's answer, I built this JS Bin for folks to use as a live test page; to save future reader's some time, here's a few screen shots using iOS Simulator on Mavericks:
iPad Air, iOS 8.1
iPhone 6 plus, iOS 8.1
As of iOS 13, San Francisco (SF) Mono is available. Couldn't find a way to set this in interface builder, but by code it's:
let font = UIFont.monospacedSystemFont(ofSize: 17.0, weight: .regular)
If you're looking for a monospace font for numbers, then try "Helvetica Neue".
A list of built-in fonts available on iOS: http://iosfonts.com. Courier and Menlo seem to be the only monospace fonts in there.
SwiftUI
You can use Font's instance method monospacedDigit
Text("0123456789")
.foregroundColor(.white)
.font(Font.custom("San Francisco", size: 20).monospacedDigit())
You can access system fonts in monospaced with the following Font factory method:
static func system(Font.TextStyle, design: Font.Design) -> Font
Example:
let monospacedBody = Font.system(.body, .monospaced)
Other usage:
let serifTitle = Font.system(.title, .serif)
In the meantime there is a good Monospace font available from Apple, that can be downloaded here: Apple SFUI
Here is how to add the fonts to Xcode: Add fonts to xcode