# cairo mathtext

Thanks for the references. I decided to go for the second approach (it
seems maybe more sane, and it doesn't seem like their are any major
benefits to using the glyphs made..) The SVG code outputs a tuple of:
basename, fontsize, unicode, ox, oy, metrics

I go through the list, and output that. I'm not sure if I'm doing
everything correctly. For example, I have no clue what 'metrics'
contains (e.g. what advance, width, etc. will do, and if I need it or
not). I'm also not sure if things like hinting work using this method
either (esp. since I render each character seperately -- I'm not sure

I

see any other method of doing it, however).

Any of this look sane?

ctx = cairo.Context()
file = open('test.ps', 'wb')
ctx.set_target_ps(file, 4.3, 4.3, 300, 300)

width, height, fonts = math_parse_s_ft2font_svg(r'$x^y * \pi$', 96, 50)

for f in fonts:
basename, fontsize, num, ox, oy, metrics = f
ctx.select_font(basename)
ctx.scale_font(fontsize)
ctx.move_to(ox, 100 - oy)
ctx.show_text(unichr(num).encode('utf8'))

ctx.stroke()

ctx.show_page()

Looks OK as far as I can tell, did you run it and check the image?

The PS output produced by cairo is currently an image but eventually
the cairo PS backend will be updated to produce native PS.

Cairo itself has changed a lot since the last 0.4.0 snapshot, mostly
function name changes rather than new features. A new release should
happen in a few weeks.

Steve