# Trávník's smooth self-referential formula - Formula development

Go back to main page on Trávník's smooth self-referential formula.

Self-referential formulas have two components to them: part that can draw a glyph and a part that can use it to render itself and the big number.

February 2017 to August 2017 I have experimented with various formulas to plot Bézier curves along with creating a crude glyph editor for them. Most useful resource for learning the Bézier curves was https://pomax.github.io/bezierinfo/. I tried several approaches with different ways to render Bézier curves. At first I was using parametric curve for 4-control points where a shape was drawn along the curve (circular or rectangular, or even squircle). I could even use Bézier polynomial to continuously change from square to squircle to circle along the path. For non-circles, I could rotate the shape along the curve based on another Bézier polynomial defining rotation. This was reminiscent of how Knuth's Metafont defines glyphs. I could create a crude font like DIN Round that way, but the more I learned about typography and visual tricks it does to make font look right the less it was appealing to create a font that way.

Typography is all about outline based fonts. So in August 2017
I searched for other formulas that could be useful for glyph
rendering that would be using outlines. I developed one that
used even-odd collision counting (a common way to do polygon
fill in computer graphics) that was solving general cubic
equation (that came out of Bézier polygon). For point
P_{x}, P_{y} I would just cast a ray x ≥
P_{x}, y = P_{y} and count collisions with all
the outlines along the way. I could express it as quite long
formula that included solving cubic equations including all
the sub-cases. But that was not numerically stable where
control points meet. It was causing line artifacts extending
from control points and tangents. Then (still August) I tried
winding number based polygon fill methods. I did not expect
they would work well, but they really did. Most direct
inspiration for this was this
article https://tug.org/TUGboat/tb33-1/tb103jackowski.pdf
(Bogusław Jackowski, TUGboat, Volume 33 (2012), No. 1,
Pg. 98-101) about computing winding numbers / winding
angles. To compute winding angle for point P it computes angle
at point P closed by end points of a curve if the curve is far
enough to be sure it does not go around the point from other
direction or circling it. When it is too close it recursively
splits its into two curves, that may be far enough. I have
simplified its condition on what is far enough. In my variant
the curve is split if the point P is inside the bounding box
of Bézier curve control points.

By end of August 2017 I have had the part that renders glyph finished and I started designing letters and numbers while improving the glyph editor along the way to support editing operations I needed.

At this time I could try to convert existing font into my outline curve format, but that would be bad from legal point of view because fonts have licenses attached. I would not really want attach a license into the formula. Also I wanted to try designing a font myself a thing I never did myself before. Designing a font consumes a lot of time. To outsiders of typography the letters can just use regular geometric shapes that follow coarse grid of control points, but in fact the human vision is pleased most by shapes that are not fitting a coarse grid of control points. For example see here: https://frerejones.com/blog/typeface-mechanics-001/. Also a font is not a group of pretty characters, but rather a pretty group of characters. How the characters fit together when used to write words is important.

Close to end of 2017 I had most of the letters I needed. I started developing Composer. Part of program that could present several letter/glyphs composed together.

In February 2018, I did get some help on typography in this forum: http://typedrawers.com/discussion/2574/self-ref-a-special-purpose-serif-font. I have incorporated some of the advice into my font. But I decided that rather than perfecting the font, I needed to complete the project.

Since then till end of 2018 I was not really devoting that much free time to this and rather pursuing my photography hobby, but still along I was improving composer part of program a typesetting the final formula.

By 2nd Feburary 2019 I had the final version of typesetted formula and optimized tools to create a rendering of it. Rendering whole formula including the big number in higher resolution takes days of computing power even with the fast variant of the formula implementation.

I spent rest of time writing texts and preparing source distribution for public use.

Go back to main page on Trávník's smooth self-referential formula.

Back to index - Jakub Trávník's resources.