I'm trying to horizontally align text bits with different size and fonts.
Here is the result I'd like (made with scribus):
You can see that text is horizontally align perfectly (to the pixel).
I tried implementing this with a basic UITextView, and justifying the text. Here is what I got:
You can see that the text is not horizontally aligned to the pixel. I tried centering and it's still not good enough:
If things were not hard enough, the first and third line are dynamic text... so their size changes.
I had a look at textkit but didn't find anything conclusive...
My leads are:
- find best font size for text given the width.
- space glyphs evenly so that the text bounding box is equal to the desired width.
but I have no clue how to do that. Any leads ? thanks !