Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14565] iOS: "font" property does not return to default when set to null or {}

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2017-07-13T21:36:47.000+0000
Affected Version/sRelease 3.1.1
Fix Version/sRelease 6.2.0
ComponentsiOS
Labelsparity
ReporterTony Lukasavage
AssigneeHans Knöchel
Created2013-07-16T20:18:52.000+0000
Updated2017-07-20T21:29:33.000+0000

Description

problem

When setting the *font* property of a Ti.UI.Label to *null* or *{}*, the font of the Label does not return to the default font which is used when no font property is defined. It instead is set to a font slightly smaller than the default font. This is best seen by running the test case below. This is an issue for Alloy as it relies on the ability to "reset" Titanium proxy properties in order to remove/reset style classes at runtime. In its current state, this could potentially create unexpected visual results on iOS.

expected

When I set the the *font* property of a Ti.UI.Label to *null* or *{}*, the font of the Label should return to its default state. This is what occurs on Android and Mobileweb.

test case

app.js

var win = Ti.UI.createWindow({
	backgroundColor: '#fff',
	modal: false,
	exitOnClose: true
});
var label = Ti.UI.createLabel({
	text: 'just a test label'
});

// Clicking the label will show that on iOS a slightly smaller font is used when
// the label is re-rendered with font=null. All other platforms use the same default
// font.
label.addEventListener('click', function(e) {
	label.font = null;
});

win.add(label);
win.open();

Comments

  1. Shameer Jan 2014-08-13

    Issue reproduces Titanium Command-Line Interface, CLI version 3.3.0, Titanium SDK version 3.3.0.GA iOS SDK: 7.1 iOS iPhone Simulator: 7.1
  2. Hans Knöchel 2017-06-30

    iOS uses the default font-size of 17 these days, we used 14/15 in many places. This PR will align the defaults to the native defaults, so when you click, the label should not decrease. This will also fix number of potential other font-tickets. PR: https://github.com/appcelerator/titanium_mobile/pull/9182
  3. Samir Mohammed 2017-07-20

    Verified fix in SDK version: 6.2.0.v20170719160617. Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/9182

JSON Source