Text measurement and SVG

Thursday, January 24th, 2008

In my spare time I’m working on long-needed program for engraving Gregorian chant. (“Engraving” is to music what “typesetting” is for text.) Below are the requirements I’ve been designing around:

  • Produces print-quality output from a text input format
  • in a format that can be embedded into common desktop publishing solutions like Adobe InDesign
  • Multi-platform (either web-based or runs on Win/Mac/Linux)

My current plan is to write the app in JS, provide output in SVG, and deploy over the web. I have a mockup/prototype of the SVG I’d like to produce:

Gregorian chant in SVG. Your browser doesn’t support SVG; please Get Firefox!

There is one major hurdle I haven’t figured out yet: I don’t know how to position the text. The positioning of Gregorian chant is very precise: the first neume (note) of each syllable is placed over the center of the vowel of the syllable. In addition, the spacing of neumes is arranged so that there are precise amounts of whitespace between each element and syllable, and hyphens between syllables are lengthened or shortened as necessary to fit. What is the best way to give a web application precise text measurement of individual letters within a syllable (including any kerning and ligatures)?

Ideally I’d like a way to do this with the user’s own fonts, but if I need to preprocess a font file to get metrics out of it, I guess that’s ok too.

Dear lazyweb, can somebody verify that Adobe InDesign/Quark/your favorite DTP program imports my sample SVG file correctly and usably? I don’t have a copy at the moment, and it’s rather expensive just for an import test…