cocoa - Ligatures not do not work in UILabel/NSAttributedString in iOS 6 -
i trying turn on ligatures (nsligatureattributename
) nsattributedstring
displayed uilabel
.
i targeting ios 6.1 , running in ipad simulator.
my set of test words are:
- aeciospore
- coeliac
- halfheaded
- cliffhanging
- aufkommender
- snuffkin
- domineesbriefjes
- offtrack
- dahinraffte
- coffins
my test code simple, loops through list of words , display 1 in uilabel
using text
property:
self.normallabel.text = words[i];
and other using attributedtext
property, after creating nsattributedstring
(see brandon campbell's answer more info on value of nsligatureattributename
):
nsdictionary *attrs = @{ nsfontattributename : [uifont systemfontofsize:74.0], nsligatureattributename : @1, //@2 not supported in ios nsbackgroundcolorattributename : [uicolor redcolor]}; self.attr.attributedtext = [[nsattributedstring alloc] initwithstring:words[i] attributes:attrs];
as can see i'm setting nsligatureattributename
2 (as nsnumber
). has no effect on words:
i'm using systemfont
(helvetica neue), here debugger output:
(lldb) po self.attr.attributedtext $0 = 0x0719bc90 aeciospore{ nsbackgroundcolor = "uidevicergbcolorspace 1 0 0 1"; nsfont = "<uicffont: 0x719cc80> font-family: \".helvetica neueui\"; font-weight: normal; font-style: normal; font-size: 74px"; nsligature = 1; } (lldb)
according docs nsligatureattributename 2 unsupported on ios.
nsligatureattributename value of attribute nsnumber object containing integer. ligatures cause specific character combinations rendered using single custom glyph corresponds characters. value 0 indicates no ligatures. value 1 indicates use of default ligatures. value 2 indicates use of ligatures. default value attribute 1. (note value 2 unsupported on ios.) available in ios 6.0 , later.
Comments
Post a Comment