- From: Allen Razdow <arazdow@mathsoft.com>
- Date: Wed, 20 Nov 2002 18:16:11 -0500
- To: "'Tobias Reif'" <tobiasreif@pinkjuice.com>, "'www-svg@w3.org'" <www-svg@w3.org>
- Cc: "'Kanaskie, Kurt A (Kurt)'" <kkanaskie@lucent.com>
Thanks Tobi, In general, many applications (like math typesetting, building data graphs and charts, etc) require "runtime" metrics of things as the graphics are constructed. Does SVG aim to allow this? The workarounds thus far suggested may work, but seem indirect for such a basic requirement. A general (extensible) set of functions to return measured values of things like strings and substrings would make this easier. Example: centering a column of dotted names aligned on the dots as in: foo.bar foobar.blatz x.y (using variable-spaced fonts). One suggestion was to add such functions to the "transform" syntax, since that's where they'd often be needed. For example, the strings above would be "translated" an amount based on the width of the substring upt to the first dot. transform="translate(SubstWidth('.','x.y'),0)" Do you agree that this should be addressed somehow in SVG? When I first asked our developers to look at using SVG in Mathcad they came back and said "it's too hard to measure things". -Allen -----Original Message----- From: Tobias Reif [mailto:tobiasreif@pinkjuice.com] Sent: Wednesday, November 20, 2002 5:59 PM To: 'www-svg@w3.org' Cc: Kanaskie, Kurt A (Kurt) Subject: 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 18:16:18 UTC