Re: General Text Metrics Requirement

Kanaskie, Kurt A (Kurt) wrote:

 > Thanks Allen for the suggestions on fixed width font, that should
 > suffice for my application.
 >
 > The suggestion to use a buffered image reminds me of my X11
 > programming days, where the solution is to query the Graphics
 > Context for things like stringLength(). I started down that path
 > with XSLT, DOM, etc., but it seemed like a long hike with lots of
 > side trails.

There might be machines without any monospace fonts, so you could embed 
one, as in
http://www.pinkjuice.com/howto/RubySVG/examples.xhtml#examples_osource_news
I don't do line-wrapping there, but I can know exactly how many 
characters fit on one line, and put ... at the end if it's longer. 
Line-wrapping could be done quite easily, if monospace is OK (you also 
don't miss hinting which SVG Font doesn't have).

Another way, allowing for variable width fonts, might be to use

http://www.w3.org/TR/SVG/fonts.html#GlyphElementHorizAdvXAttribute

<glyph [...] horiz-adv-x="410"

eg for each character, get the horiz-adv-x of the glyph, etc.

Tobi

-- 
http://www.pinkjuice.com/

Received on Wednesday, 20 November 2002 17:59:04 UTC