[TIMOB-23367] Expose/support hyphenationFactor & hyphenationFrequency for Attributed Strings
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2018-05-02T08:56:15.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | TiAPI |
Labels | attributedstring, hyphenation, label, text |
Reporter | Gertjan Smits |
Assignee | Vijay Singh |
Created | 2016-05-11T10:56:27.000+0000 |
Updated | 2018-08-06T17:41:08.000+0000 |
Description
iOS and Android both support hyphenation in native land. There is no option to use this in a Titanium app. (afaik)
It would be very convenient to have this functionality in Ti.UI.Label. Especially in our case for German apps.
Implementing this in Swift is extremely easy:
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.hyphenationFactor = 1.0
let attributedString = NSAttributedString(string: text, attributes: [NSParagraphStyleAttributeName:paragraphStyle])
label.attributedText = attributedString
*iOS*, hyphenationFactor: https://developer.apple.com/library/ios/documentation/Cocoa/Reference/ApplicationKit/Classes/NSMutableParagraphStyle_Class/#//apple_ref/occ/instp/NSMutableParagraphStyle/hyphenationFactor
*Android*, hyphenationFrequency:
http://developer.android.com/reference/android/widget/TextView.html#attr_android:hyphenationFrequency
*Extra info:*
https://en.wikipedia.org/wiki/Hyphen
For Android it probably needs to be implemented in combination with *android:breakStrategy*.
Hello, Thanks for creating the ticket. Our engineering team will look into it. This need to be cleared by our selection committee. Please understand that the processes is time-consuming and lots of variables in play. We will let you know if and when we will be including this feature in our platform. Regards
Any updates on this? Client now really wants it...
PR: https://github.com/appcelerator/titanium_mobile/pull/9100
Solved as part of TIMOB-24080.
Closing as a duplicate. If this is in error, please reopen.