[TIMOB-4467] Platform inconsistencies around custom fonts
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Done |
Resolution Date | 2019-11-20T23:08:53.000+0000 |
Affected Version/s | Release 1.7.0 |
Fix Version/s | n/a |
Components | Tooling |
Labels | parity, stage |
Reporter | Kevin Whinnery |
Assignee | Unknown |
Created | 2011-06-21T07:48:32.000+0000 |
Updated | 2019-11-20T23:08:53.000+0000 |
Description
The handling of custom fonts is inconsistent across platforms. For iOS it requires a custom Info.plist setting - also, to my knowledge, fonts have to be placed at the top level Resource directory to be usable. For Android, fonts must be placed in Resources/fonts. There's not clear guidance on either platform on how to use these fonts in JavaScript.
Consistent handling and documentation on proper use is needed for custom fonts.
Just follow-up, because it concerns something I'm working on. iOS requires custom fonts to be declared upfront, so I believe Android should too for parity's sake. Stephen says that currently it's a plist (as Kevin points out) but that they need to move it to tiapp.xml. The two teams should do this in concert, i.e., we should try to make it so that we need only one
Other custom font discrepancies, from my observation: - I believe iOS supports both .otf and .ttf, but Android only supports .ttf. I could be wrong about this, but I couldn't seem to get .otf fonts to work on Android. - iOS loads based on the font name (embedded in the file), but Android loads based on the file name. So to use the same Chantelli Antiqua font referenced here on iOS, I'd need to specify the fontFamily as 'chantelli antiqua' instead of 'chantelli_antiqua'. Unrelated to parity, I also noted that the Mac stores its fonts in font "suitcases" which as far as I can tell neither platform can use. So users with Mac format fonts will need to extract the TrueType font data using a third-party tool.
I have tested fonts using 1.8.0.1 on iOS and Android: * Both platforms can use OTF and TTF files * You can put the font files into the Resources/fonts directory as long as you include a path in the value string in Info.plist A sample app with fonts is included with https://wiki.appcelerator.org/display/guides/Custom+Fonts
Closing. This has been addressed in previous releases of the SDK. http://docs.appcelerator.com/platform/latest/#!/api/Font