CTLineGetTypographicBounds in iOS -- ascent and descent are always coming back as zero

704 views Asked by At

In an iOS category on NSAttributedString, I have the following:

CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef)self);
CGFloat ascent;
CGFloat descent;
double length = CTLineGetTypographicBounds(line, &ascent, &descent, NULL);
    // at this point, ascent and descent always come back as zero.

According to the docs, it appears that these should be the ascent and descent of the line. But they aren't.

The width is not returning zero.

That said, if I then draw the line, it draws just fine.

Am I missing something?

0

There are 0 answers