Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use kCTSuperscriptAttributeName?

Looking through some other SO questions, it appears that other people are having problems getting kCTSuperscriptAttributeName to display superscripts and subscripts correctly. I've been unable to find any successful implementation of kCTSuperscriptAttributeName, even though Apple's docs claim that it works.

I tried this, but xCode shows an error, listing it as "undeclared identifier"

 NSDictionary * superscriptAttrs = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:1] forKey:kCTSuperscriptAttributeName];

Some people also claim it to be possible to make superscripts and subscripts through WebViews, but my subscripts/superscripts need to be dynamic so I'm afraid this method will complicate things.

Either the correct way to implement kSupersciptAttributeName or an alternative route I could take to make scripts would be appreciated. Thanks

like image 434
Mahir Avatar asked Dec 30 '11 09:12

Mahir


1 Answers

You need to #import <CoreText/CTStringAttributes.h>

like image 164
borrrden Avatar answered Nov 15 '22 06:11

borrrden