W3C home > Mailing lists > Public > www-svg@w3.org > November 2002

Re: General Text Metrics Requirement

From: Tobias Reif <tobiasreif@pinkjuice.com>
Date: Wed, 20 Nov 2002 23:59:05 +0100
Message-ID: <3DDC13B9.7070106@pinkjuice.com>
To: "'www-svg@w3.org'" <www-svg@w3.org>
CC: "Kanaskie, Kurt A (Kurt)" <kkanaskie@lucent.com>

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 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:23 GMT