Search code examples
objective-ciphonegeometrydrawtext

How do I make a triangle space with text written for the iPhone?


I want to draw a triangle and elide text in the shape. I can restrict the triangle to an equilateral triangle and a fixed orientation ('upside down' or 'upside up'). Then I want to insert arbitrary text in the triangle such that the eliding is on word boundaries and not clipped.

Any simple algorithms? What methods are available in Objective-C?

I am thinking of calculating lines of rectangles of 'font height' and width bounded by the top-side as it intersects the triangle's sides. Then draw-text of the remaining text into each rectangle until done.


Solution

  • Wait for the 3.2 SDK...