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

RE: General Text Metrics Requirement

From: Allen Razdow <arazdow@mathsoft.com>
Date: Wed, 20 Nov 2002 18:16:11 -0500
Message-ID: <8D1EA20CE6AB1043956A27D60E468F1C0115B837@distrib.mathsoft.com>
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:


(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
the strings above would be "translated" an amount based on the width of the
substring upt to the first dot.

Do you agree that this should be addressed somehow in SVG?  When I first
our developers to look at using SVG in Mathcad they came back and said "it's
too hard to measure things".


-----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
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


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

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


Received on Wednesday, 20 November 2002 18:16:18 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:46:54 UTC