Max Did It
Coding
,Wed
Post the First Comment
Tagged

Polygon Outlines With Uniform Inset

I want users of my hardware text rendering library firetype to be able to render characters with outlines.

Sounds simple enough, right? Adding an outline to text is a matter of setting a simple value in all major graphic softwares. Since firetype is able to retrieve the shapes of characters from font files, it should not be a problem to add an offset to these and render the result.

Turns out that adding an outline to a simple polygon is not as straightforward as you might think. In fact, to have a robust method of creating polygon outlines means to implement a relatively complex algorithm that encompasses several steps.

Even seemingly minor details like how far each vertex has to be moved to create the outline can create problems. The solution, however, is pleasently elegant, as you will see below. I will cover the other aspects of the outline algorithm in the next posts.

Read more...