swift - Why are iOS Monospaced fonts not behaving like that? -
i using spritekit , have timer in ios app rendered through sklabelnode , updated in update function. didn't want digits moving left , right count increased, tried using courier new. worked better avenir, there still subtle fluctuations in width of of digits. (the 6 , 9 wider other digits.) saw these fluctuations in several different experiments tried:
- normal & bold styles
- large (65) & small (9) font sizes
- courier new & menlo fonts
- xcode simulator & ipod touch
i submitted queries "which font has uniform width digits", answers find "use monospaced font". (see https://graphicdesign.stackexchange.com/questions/13148/which-fonts-have-the-same-width-for-every-character or monospace font - not monospace?)
my code super simple. setup scorenode once this:
scorenode = sklabelnode(fontnamed: "courier new") scorenode.fontsize = 65 scorenode.fontcolor = uicolor.blackcolor() scorenode.text = "0" scorenode.position = cgpoint(x: patternpane.midx, y: patternpane.midy) patternpanenode.addchild(scorenode)
and update score this:
scorenode.text = "\(viewcontrollerdelegate!.getscore())"
here's image overlaying frame showing 28 part of frame showing 29. can see edges of movie lined , can see base of 2s not line up.
any explanations?
is possible ios applying kerning sklabelnode though i'm using monospace font?
since ios 9, fonts use proportional numbers default.
if you're using uilabel
, can opt monospaced digits, there isn't solution sklabelnode
, far can tell.
more info in wwdc2015 video (minute 26): https://developer.apple.com/videos/play/wwdc2015/804/
Comments
Post a Comment