I think it's stupid question but i reaaly need a prove. My question it's can we set the UIFont or CTFont properties like ascender, descender, cap height, and x-height? Wh开发者_StackOverflow中文版en I look at the Class reference (in UIFont) the properties is nonatomic and readonly and in CTFont there are no function to set the properties. Can we make the function in UIFont so we can set the properties or no? Anybody can help me. Thank you for your attention. :)
Both UIFont and CTFont just hold information about a particular font, and they are immutable. However, you can create an NSAttributedString or an NSMutableAttributedString and apply some properties to some sections of the underlying string.
I do not know if the properties you mention specifically in your question can be modified, though, but many can, like weight, appearance, size, kerning, spacing, etc. Check out the documentation on CTParagraphStyleRef for information about the properties that can be modified when displaying attributed strings.
You can modify the fonts themselves using Apple's Font Suite. http://developer.apple.com/fonts/
Install the tool, use this command to deconstruct the files properties into an XML file.
ftxdumperfuser -t hhea -A d font.ttfz
later on, make the necessary edits and re-construct using
ftxdumperfuser -t hhea -A f font.ttf
Now use the new fon.ttf in your app!
精彩评论