[TIMOB-25161] iOS: Expose "thin", "light", "ultra-light" and "semi-bold" font-weights in Titanium font-system
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | None |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2017-08-16T15:17:59.000+0000 |
| Affected Version/s | Release 6.1.2 |
| Fix Version/s | Release 6.2.0 |
| Components | iOS |
| Labels | n/a |
| Reporter | Neeraj Mishra |
| Assignee | Hans Knöchel |
| Created | 2017-08-12T00:12:47.000+0000 |
| Updated | 2017-08-16T18:58:47.000+0000 |
Description
Description:
In native iOS development, there is a way to apply a *thin font style* to a label, see attached image from Xcode. How can this be achieved in Appcelerator alloy project? As per the docs: https://docs.appcelerator.com/platform/latest/#!/api/Font The only style available is "italic" or "normal", though in native it seems there are many other styles are available like "thin", "ultra thin" or "light" which are not there in Titanium.Attachments
| File | Date | Size |
|---|---|---|
| Screen Shot 2017-08-11 at 5.13.35 PM.png | 2017-08-12T00:13:56.000+0000 | 492529 |
We just exposed
semiboldin TIMOB-23114 and could add any other font-weight as well now (note: it's font-weight, not font-style in this context). We can expose it for 6.3.0 / 7.0.0. [~emerriman] for the exact release. *EDIT*: Changed title toiOS: Expose "thin" font-weight in Titanium font-system.I really do not like the solution, but it's the only way we can do it right now without rewriting the font-system. We should definitely consider refactoring the whole system in 7.0.0 if possible. PR (master): https://github.com/appcelerator/titanium_mobile/pull/9308 PR (6_2_X): https://github.com/appcelerator/titanium_mobile/pull/9309 Test-Case:
var win = Ti.UI.createWindow({ backgroundColor : '#fff', layout: 'vertical' }); var label1a = Ti.UI.createLabel({ text : 'This is a bold font', top: 40, left: 50, font: { fontWeight: 'bold', fontSize: 25 } }); var label1b = Ti.UI.createLabel({ text : 'This is a semibold font', top: 10, left: 50, font: { fontWeight: 'semibold', fontSize: 25 } }); var label1c = Ti.UI.createLabel({ text : 'This is a normal font', top: 10, left: 50, font: { fontSize: 25 } }); var label2 = Ti.UI.createLabel({ text : 'This is a thin font', left: 50, font: { fontWeight: 'thin', fontSize: 25 }, top: 10, }); var label3 = Ti.UI.createLabel({ text : 'This is a light font', left: 50, font: { fontWeight: 'light', fontSize: 25 }, top: 10, }); var label4 = Ti.UI.createLabel({ text : 'This is a ultra-light font', left: 50, font: { fontWeight: 'ultralight', fontSize: 25 }, top: 10, }); win.add([label1a,label1b,label1c,label2,label3,label4]); win.open();FR Passed. New font weights are available and usable without issue.
Verified in builds SDK 6.2.0.v20170816090501 and 7.0.0.v20170816113226