leah blogs

February 2005

13feb2005 · TeX in Ruby, or: Raft

My last experiments porting the layout part of TeX into a Ruby library now officially have a name: Raft, Ruby’s Advanced Framework for Typesetting. Thanks to Gabriele Renzi for proposing qraft where I simply dropped the first letter. Also note that Raft is Craft without C. :-)

On the technical side, I today shipped the first hbox consisting of letters and glue. You can see it, packed at various sizes, here. Note that I don’t have vboxes yet, the PDF code of the different lines is still assembled “manually”.

Before I look into vboxes, I have to do a major refactoring on the PDF generation side, to make it actually usable by the packer directly. PDF generation for typesetting turned out not to be that difficult, alas, the pdfTeX code for actually shipping out (minus the utility functions) is mere 3 pages of code.

Also, it’s time to be more exact with units. I should drop all uses of floating point arithmetics and rather use BigDecimal. Furthermore, the inch will stay being 72.27 Raft points. All this still has to be written…

Proper font handling will get a very difficult job. I currently use a simple-minded .afm-parser to get the bounding boxes and use some ideas of ttf2afm to calculate proper values from them… Having to fiddle with accents to get proper heights for accented chars totally turns me off. I’d rather do Unicode all the way, but I couldn’t yet get much information about OpenType and other unicode supporting font formats yet.

Next week, I’ll be on a one-week intern and probably don’t have a lot of time to hack, we’ll see.

NP: Dan Bern—Chelsea Hotel

Copyright © 2004–2018