Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24080] iOS: Add paragraph styles to AttributedString

GitHub Issuen/a
TypeImprovement
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2018-09-19T19:00:24.000+0000
Affected Version/sRelease 6.3.0, Release 7.1.0
Fix Version/sRelease 7.5.0
ComponentsAndroid, iOS
LabelsattributedString
ReporterFlavio De Stefano
AssigneeVijay Singh
Created2016-10-27T14:58:39.000+0000
Updated2018-09-19T20:58:01.000+0000

Description

Add LineHeight property for AttributedString PR: https://github.com/appcelerator/titanium_mobile/pull/8558

Comments

  1. Hans Knöchel 2016-10-27

    Hey Flavio, thanks for the PR! Please add Android parity, docs, unit-tests and example-code for your PR, thx!
  2. Flavio De Stefano 2016-10-28

    I'll address today. But, there's no Android parity, cause AttributedString are missing on Android. Right?
  3. Hans Knöchel 2016-10-28

    Ti.UI.AttributedString is cross-platform.
  4. Flavio De Stefano 2016-10-28

    Oh, I didn't notices that, sorry :) I'll indagate on how to implement in Android. Thank you.
  5. Hans Knöchel 2016-11-01

    Demo:
       var win = Titanium.UI.createWindow({
           backgroundColor: '#ddd',
       });
       
       win.open();
       
       var text = 'Bacon ipsum dolor Appcelerator Titanium rocks! sit amet fatback leberkas salami sausage tongue strip steak.';
       
       var attr = Titanium.UI.createAttributedString({
           text: text,
           attributes: [
               // Sets the line height
               {
                   type: Titanium.UI.ATTRIBUTE_LINE_HEIGHT,
                   range: [0, text.length],
                   value: 20.0
               },
           ]
       });
       
       var label = Titanium.UI.createLabel({
           width: 200,
           height: Titanium.UI.SIZE,
           attributedString: attr
       });
       
       win.add(label);
       
  6. Hans Knöchel 2017-08-08

    Moving out of 6.2.0, since we are trying to finalize the version the upcoming weeks and the PR has outstanding code-review adjustments.
  7. Vijay Singh 2018-05-09

    PR - https://github.com/appcelerator/titanium_mobile/pull/10032 Test Case -
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
       var label = Ti.UI.createLabel();
       var str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent quis dolor consequat turpis pharetra laoreet vitae a sapien. Aliquam erat volutpat. Nulla sit amet tellus sapien, a pulvinar metus. Suspendisse risus elit, dictum id molestie ac, ullamcorper id dui. Vivamus dapibus, eros nec sodales semper, sem dui semper eros, id condimentum quam tellus at ligula. Ut justo magna, tempor et vestibulum id, tincidunt sit amet quam. Maecenas dictum metus vel diam blandit facilisis. Ut tincidunt nibh non ligula sagittis nec tincidunt augue vehicula. Suspendisse sem dui, ornare in condimentum ut, convallis ut quam. Proin pharetra augue sed tortor aliquam iaculis. Etiam non erat lectus. In ac metus massa, quis dictum metus. Quisque faucibus quam non leo fringilla sit amet mattis mauris dictum. Duis viverra ipsum blandit dolor congue sed adipiscing tortor porta. Nullam malesuada felis ut dolor dignissim faucibus.";
       
       label.attributedString = Ti.UI.createAttributedString({
           text: str,
           attributes: [{
               type: Ti.UI.ATTRIBUTE_PARAGRAPH_STYLE,
               value: {
                   alignment: Ti.UI.TEXT_ALIGNMENT_JUSTIFY,
                   minimumLineHeight: 3,
                   headIndent: 5,
                   lineSpacing: 5,
                   lineBreakMode: Ti.UI.ATTRIBUTE_LINE_BREAK_BY_WORD_WRAPPING,
               },
               range: [0,str.length]
           }]
       });
       
       win.add(label);
       win.open();
       
  8. Keerthi Mahalingam 2018-09-19

    FR passed.
  9. Keerthi Mahalingam 2018-09-19

    Verified the fix on SDK 7.5.0.v20180919120117. Works fine.Closing
       Operating System
         Name                        = Mac OS X
         Version                     = 10.13.6
         Architecture                = 64bit
         # CPUs                      = 8
         Memory                      = 17179869184
       Node.js
         Node.js Version             = 8.9.1
         npm Version                 = 5.5.1
       Titanium CLI
         CLI Version                 = 5.1.1
       SDK                              =7.5.0.v20180919120117
       iPhone 6s -IOS 12
       

JSON Source