Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14351] Android: TTC files not supported for custom fonts

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterDavide Cassenti
AssigneeUnknown
Created2013-06-24T09:49:01.000+0000
Updated2018-02-28T20:04:11.000+0000

Description

Problem description

When using a TTC (TrueType Collection) file on Android, only the regular font seems to be taken in account. Applying a 'bold' effect on the font does not use the 'bold' variant inside the file. The same works fine on iOS.

Steps to reproduce

1. Need a TTC font that contains both regular and bold 2. create an Alloy app and configure it to support the custom font added 3. Create the following index.xml
<Alloy>
	<Window class="container">
		<Label id="label" top='10dp' left='20dp' onClick="doClick">Custom bold font</Label>
		<Label id="regularLabel" top='30dp' left='20dp' onClick="doClick">Custom regular font</Label>

	</Window>
</Alloy>
4. Use the following index.tss:
".container": {
	backgroundColor: "white"
},
"#label[platform=ios]": {
	width: Ti.UI.SIZE,
	height: Ti.UI.SIZE,
	color: "#000",
	font:{
		fontFamily: "Gill Sans",
		fontSize: "30dp",
		fontWeight: "bold"
	}
},
"#label[platform=android]": {
	width: Ti.UI.SIZE,
	height: Ti.UI.SIZE,
	color: "#000",
	font:{
		fontFamily: "GillSans_1",
		fontSize: '30dp'
	}
},
"#regularLabel[platform=ios]": {
	width: Ti.UI.SIZE,
	height: Ti.UI.SIZE,
	color: "#000",
	font:{
		fontFamily: "Gill Sans",
		fontSize: "30dp"
	}
},
"#regularLabel[platform=android]": {
	width: Ti.UI.SIZE,
	height: Ti.UI.SIZE,
	color: "#000",
	font:{
		fontFamily: "GillSans_0",
		fontSize: '30dp'
	}
}
5. Run the app on both platforms

Attachments

FileDateSize
device-2014-02-18-125026.png2014-02-18T07:07:13.000+000017548
iOS Simulator Screen shot Feb 18, 2014 12.50.13 PM.png2014-02-18T07:07:13.000+000021932

Comments

No comments

JSON Source