Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13074] iOS: Unable to reference multiple variations of same font

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsalloy, font, fontfamily, mobile, tss, ttf
ReporterShawn Berg
AssigneeUnknown
Created2013-03-14T22:24:05.000+0000
Updated2018-02-28T20:03:20.000+0000

Description

We're trying to use multiple variations of the same font in a Titanium Mobile iPad application. I've attached the fonts to this issue. Specifically, we're trying to use "Open Sans" and "Open Sans Light". We're able to successfully reference both fonts in our app, but both render as "Open Sans Light" and we're unable to get our app to use "Open Sans". Here's our XML code our Alloy view:
<Alloy>
	<Window class="activationWindow">
		<ImageView class="logo" image="Logo-White.png"></ImageView>
		<Label class="revolutionize" text="Revolutionize your kitchen.">

		<Label class="yourName" text="Your Name">
		<TextField class="yourNameText" hintText="Brad Jones">
	</Window>
</Alloy>
.. and here's our TSS code:
".logo": {
	top: 322,
	left: 74,
	width: 342,
	height: 65
},

".revolutionize": {
	top: 405,
	left: 73,
	font: {fontFamily: "Open Sans Light", fontSize: "26"},
	color: "#ffffff"
},

".yourName": {
	top: 251,
	left: 566,
	font: {fontFamily: "Open Sans", fontSize: "17"},
	color: "#a1a1a1"
},

".yourNameText": {
	top: 279,
	left: 566,
	width: 364,
	height: 45
}

Attachments

FileDateSize
OpenSans_TTF.zip2013-03-14T22:24:05.000+00001143744

Comments

  1. Shawn Berg 2013-03-15

    I never was able to solve this using the font as it was named initially, but following the answer to [this post](http://stackoverflow.com/questions/6738929/custom-fonts-not-displaying-correctly-on-ios) I was able to use Font Forge to rename the fonts and successfully use both variations in my Titanium iPad app. Hope this helps someone else! I'm not sure if this bug is an iOS issue or a Titanium issue, though.
  2. Tony Lukasavage 2013-03-15

    While the example is in alloy, this appears to be a platform-level issue as everything here worked fine when Shawn converted his OTF font to TTF. I'm guessing the focus should remain on the problem being with OTF fonts, not all fonts in general.
  3. Shawn Berg 2013-03-15

    Converting from OTF to TTF didn't solve the problem. I had the exact same issue with the TTF fonts. What solved the problem was using a font editing utility (Font Forge, in my case) to rename the Light and Regular versions of the font to trick Titanium/iOS to think they were different fonts in different font families. This allowed me to reference both fonts in my Titanium Mobile iPad app using the new names I assigned to them.

JSON Source