Aligning multiple sized text vertical center instead of baseline with Core Text in iOS
Asked Answered
C

2

0

Is it possible to align multiple sized text by bounding center (of each size) instead of baseline?

I tried CTRunDelegate feature, but it doesn't work. It was possible with CTRunDelegateCallbacks.getAscent and CTRunDelegateCallbacks.getDescent, but the feature doesn't work. Only CTRunDelegateCallbacks.getWidth worked. I succeed to laying out multiple sized text, images, and any objects, but only baseline-alignment supported.

Caterinacatering answered 11/10, 2010 at 7:2 Comment(0)
C
0

It was impossible still now. I'm regarding this is not possible for current version of Core Text.

Caterinacatering answered 20/11, 2010 at 14:21 Comment(0)
C
2

The run delegate methods getAscent and getDescent are, in fact, called (it is working in my own code). Of course, it makes sense that this doesn't change the baseline (and thus change how the text is displayed relative to other text on the line), as the ascent and descent are relative to the baseline.

It would be handy to have maybe a getBaselineOffset but, unfortunately, that doesn't exist.

My suggestion is to use the run delegate callbacks to reserve space for your differently-baselined text and then in a second pass, draw the other text with the different baseline.

Cosentino answered 29/6, 2011 at 0:8 Comment(0)
C
0

It was impossible still now. I'm regarding this is not possible for current version of Core Text.

Caterinacatering answered 20/11, 2010 at 14:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.