Skip to content
This repository

Baseline adjustment Request #25

Closed
dhoerl18 opened this Issue · 4 comments

2 participants

David Hoerl AliSoftware
David Hoerl

It would be great if there was some way to set a baseline offset (+ or -) for a range of text.

AliSoftware
Owner

Hi dhoerl18

Everything that can be achieved using CoreText and the CoreText String Attributes is possible using OHAttributedLabel.

Is there a attribute in the Apple reference linked above that matches what you expect concerning the baseline offset?
If so, you can easily use the addAttribute:value:range: native method of Apple's NSAttributedString class to add a value for this attribute for any range of text.

If you think it is really useful and may be used a lot, you may add this call to addAttribute:value:range: in a wrapper method in my NSAttributedString+Attributes category to make it more easy to call, but even if you don't, there is no restriction in using Apple's native methods to add your attributes to your NSAttributedString.

AliSoftware
Owner

After reading the different possible attributes of the CoreText framework, the only possibility is to add subscripting or superscripting attribute to a range of text. Nothing is provided to change the baseline offset for a range of text in a given paragraph.

David Hoerl
AliSoftware
Owner

Just for posterity and info: I tried to add subscript/superscript support, but in practice it doesn't work as none of the fonts embed in iOS does support the subscript/superscript attribute.

More details in comments of commit 5dd7dba

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.