Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16511] iOS: Text in label gets truncated (...) when changing fontWeight from normal to bold

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2018-08-24T17:19:33.000+0000
Affected Version/sRelease 3.2.1
Fix Version/sRelease 7.5.0
ComponentsiOS
Labelsios, merge-7.0.2
ReporterMichael Woode
AssigneeVijay Singh
Created2014-02-25T10:04:54.000+0000
Updated2018-08-24T17:19:38.000+0000

Description

If setting either the width or left and right values of a label the text will be truncated when you change the fontWeight of the label. If width or left and right are omitted it resizes the label correctly after changing the fontWeight. The label container is "showing" the right size, but text gets truncated anyway.
var testLbl = Ti.UI.createLabel({
	text: 'Some semi-long text',
	font: {
		fontWeight: 'normal',
		fontSize: 13
	},
	backgroundColor:'#f00',
	color: '#000',
	textAlign: 'center',
	top: 60,
	// left: 10,
	// right: 10,
	width:'90%'
});
setTimeout(function(e){
	testLbl.font = {
		fontWeight: 'bold',
		fontSize: 13
	};
	//text gets truncated
}, 1000);

Comments

  1. Ritu Agrawal 2014-02-26

    I believe it has more to do with changing the fontWeight dynamically from "normal" to "bold". If you set the fontWeight to Bold initially and then change it to Bold dynamically then also it works fine. So it appears that the size is being not calculated when the fontWeight changes.
  2. Ritu Agrawal 2014-02-26

    Moving this ticket to engineering as I can reproduce this issue with the following test case.
       var win = Ti.UI.createWindow({fullscreen:true});  
       
       var testLbl = Ti.UI.createLabel({
           text: 'Some semi-long text for testing',
           font: {
               fontWeight: 'normal',
               fontSize: 13
           },
           backgroundColor:'#f00',
           color: '#000',
           textAlign: 'center',
           top: 60,
           left: 10,
           right: 10,
           width:'90%'
       });
       
       win.add(testLbl);
       
       
       win.addEventListener('open',function(){
       	setTimeout(function(e){
       	    testLbl.font = {
       	        fontWeight: 'bold',
       	        fontSize: 13
       	    };
       	    //text gets truncated
       	}, 2000);
       });
       
       win.open();
       
  3. Shameer Jan 2014-08-26

    Issue reproduces on SDK Version 3.2.1 and 3.4.0 Titanium Command-Line Interface, CLI version 3.3.0, Titanium SDK version 3.2.1.GA Titanium SDK version 3.4.0.GA Appcelerator Studio, build: 3.3.0.201407111535 iOS SDK: 7 iOS iPhone Simulator: 7
  4. Guile 2017-11-29

    This bug is triggered event if I set de fontFamily by its current value : $.label.font.fontFamily = $.label.font.fontFamily
  5. Vijay Singh 2018-03-09

    PR - https://github.com/appcelerator/titanium_mobile/pull/9923
  6. Samir Mohammed 2018-07-18

    *Closing ticket*, Verified fix in SDK Version: 7.4.0.v20180717131401 *FR Passed (Test Steps):*

    Created a titanium application

    Added the following code above in the app.js

    Ran the application

    Application text no longer truncated when changing the 'fontWeight' to bold from normal

    *Test Environment*
       APPC Studio: 5.0.0.201712081732
       APPC CLI: 7.0.4
       iPhone 6 simulator (11.2)
       Operating System Name: Mac OS High Sierra
       Operating System Version: 10.13
       Node.js Version: 8.9.1
       Xcode 9.2
       

JSON Source