Friday, September 22, 2006

Not Invented Here

I'm working on the page rendering engine.
There are two parts - the positioning logic and the rendering code.

This is about the diagram rendering code.
It's impractical to use the Go font I purchased, called "Tokyo".
Several reasons.

One is that the Report Generator can't handle the font - each Go stone is represented by up to four characters - breaking the rendering code that assumes the rendering string has as much characters as its length. I could augment this - I have the source - but there are more impediments to using a font-based diagram rendering solution.

Another one is that although the font prints OK from PDF, a PDF reader is not able to display it perfectly, due to the fact that the font uses a clever trick to build a glyph out of a handful of characters.

Last but not least, I am not allowed, or even physically unable to embed that font into HTML, RTF etc. And I hate having to support two rendering engines.

My only good option is to render a bitmap image of the diagrams. But that is easier said than done, because I do not accept jaggy edges of circles, or coarse stone numbers when using a tiny font.

Fortunately I have made some very fast anti-aliasing code (used some years ago in the Go board), so what I will do is draw the image twice as large as it should be and then antialias it.

A positive side effect of making an antialiasing full-featured diagram rendering engine is that I can improve upon the existing "match" diagram.