ios - How to create light system font with special font attributes -


i need create uifont is:

  1. san francisco
  2. light weight
  3. using case insensitive font attribute (to display '/' glyph vertically aligned numbers)

i using code go it:

uifontdescriptor *fontdescriptor = [uifontdescriptor preferredfontdescriptorwithtextstyle:uifonttextstylebody]; nsarray *additionalfontsettings = @[@{uifontfeaturetypeidentifierkey: @(kcasesensitivelayouttype), uifontfeatureselectoridentifierkey: @(kcasesensitivelayoutonselector)}]; fontdescriptor = [fontdescriptor fontdescriptorbyaddingattributes:@{uifontdescriptorfeaturesettingsattribute: additionalfontsettings, uifontdescriptortraitsattribute: @{uifontweighttrait : @(uifontweightlight)}}]; return [uifont fontwithdescriptor:fontdescriptor size:50]; 

i right font right feature enabled, can't font weight adhered to. need light weight of system font. how achieve this?

turns out matt right hint. had forgotten can derive uifontdescriptor existing uifont.

therefore, creating descriptor works:

uifont *lightfont = [uifont systemfontofsize:50 weight:uifontweightlight]; uifontdescriptor *fontdescriptor = lightfont.fontdescriptor; 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -