开发者

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

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, 开发者_StackOverflowbut only baseline-alignment supported.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜