Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25161] iOS: Expose "thin", "light", "ultra-light" and "semi-bold" font-weights in Titanium font-system

GitHub Issuen/a
TypeImprovement
PriorityNone
StatusClosed
ResolutionFixed
Resolution Date2017-08-16T15:17:59.000+0000
Affected Version/sRelease 6.1.2
Fix Version/sRelease 6.2.0
ComponentsiOS
Labelsn/a
ReporterNeeraj Mishra
AssigneeHans Knöchel
Created2017-08-12T00:12:47.000+0000
Updated2017-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

FileDateSize
Screen Shot 2017-08-11 at 5.13.35 PM.png2017-08-12T00:13:56.000+0000492529

Comments

  1. Hans Knöchel 2017-08-12

    We just exposed semibold in 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 to iOS: Expose "thin" font-weight in Titanium font-system.
  2. Hans Knöchel 2017-08-13

    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();
       
  3. Eric Wieber 2017-08-16

    FR Passed. New font weights are available and usable without issue.
  4. Eric Wieber 2017-08-16

    Verified in builds SDK 6.2.0.v20170816090501 and 7.0.0.v20170816113226

JSON Source