Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-17340

TiAPI: Text - Add lineHeight property to Ti.UI.Label and Ti.Ui.TextArea

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 7.0.0
    • Component/s: Android
    • Labels:
    • Environment:

      Titanium SDK: 3.2.3.GA
      Platform & version: Any mobile
      Device Details: Any devise
      Host Operating System: Any OS

    • Story Points:
      5
    • Sprint:
      2017 Sprint 22 SDK, 2017 Sprint 23 SDK

      Description

      Conscious duplicate of poorly defined ticket TIMOB-6403.

      Problem

      Right now, Titanium doesn't have support for the line height property of text. Preferred behaviour would be to be able to have a property `lineHeight`, and the methods `setLineHeight` and `getLineHeight`, on `Titanium.UI.Label` and `Titanium.UI.TextArea`.

      LineHeight would be set to control the vertical spacing between lines in a multiline label or textarea.

      Available values should be `'normal'`, or any supported dimension measurement. `'normal' ` would indicate the default lineHeight for the set fontsize, any other would apply as the platform it's run on handles it.

      Test case

      Inserting the following code in some window to get three labels. Expected result would be to have

      app.js

      var label1, label2, label3, view;
       
      view = Ti.UI.createView({
        height: 1000,
        width: 100
      });
       
      label1 = Ti.UI.createLabel({
        height: Ti.UI.SIZE,
        left: 0,
        lineHeight: 'normal',
        right: 0,
        text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sed cursus nunc, id semper risus.',
        top: 0
      });
       
      label2 = Ti.UI.createLabel({
        height: Ti.UI.SIZE,
        left: 0,
        lineHeight: 20,
        right: 0,
        text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sed cursus nunc, id semper risus.',
        top: 200
      });
       
      label3 = Ti.UI.createLabel({
        height: Ti.UI.SIZE,
        left: 0,
        lineHeight: 40,
        right: 0,
        text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque sed cursus nunc, id semper risus.',
        top: 400
      });
       
      view.add(label1);
       
      view.add(label2);
       
      view.add(label3);
      

      Logs

      Don't apply here.

      Discussions

      Want for this feature has been long existent. Also, you should have seen the look on our designer's face when I told him we can't control line height with Titanium.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gmathews Gary Mathews
                Reporter:
                jasperkennis Jasper Kennis
                Reviewer:
                Joshua Quick
                Tester:
                Lokesh Choudhary
              • Watchers:
                29 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Source Code