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

php - Auto increment employee ID -

python - Evaluating the next line in a For Loop while in the current iteration -

php - Facebook share link is not showing image within the post?(get parameter in url) -