Changing font tracking in Cocoa

I am doing text rendering in Cocoa using NSAttributedString and setting font and underline properties etc. However, I cannot figure out how I can change the text tracking. Any suggestions?

+1


source to share


2 answers


I don't think font tracking is a displayable property for a text layout with attributed strings.

Perhaps you can use the available extension attribute in space and manually insert whitespace characters with scaling factors to affect their width, but I expect this to be awkward to hack anything other than trivial cases.



The only other way I can think of is to use your own custom attributes along with the subclass NSLayoutManager

. The cocoa text system is extremely flexible, but with this flexibility a great deal of complexity is achieved.

+1


source


My solution so far has just used the kerning attribute, since tracking and kerning are similar. Is there a better solution?



-1


source







All Articles