W3C home > Mailing lists > Public > www-svg@w3.org > September 2015

Re: Possible to resize text to max size within a box?

From: Cameron McCormack <cam@mcc.id.au>
Date: Thu, 17 Sep 2015 17:45:09 +1000
To: David Dailey <ddailey@zoominternet.net>
Cc: 'Mats Blakstad' <mats.gbproject@gmail.com>, www-svg@w3.org
Message-ID: <20150917074509.GA22038@wok.mcc.id.au>
Hi David and Mats,

> http://srufaculty.sru.edu/david.dailey/svg/test/bubbles2.svg (works
> in Chrome but not in Firefox – there was some part of textLength,(
> maybe?) that either Firefox hadn’t done or I had done wrong –
> don’t really remember) and of course Chrome will want me to rewrite
> all these examples before SVG2 moves to recommended status in 2023
> (barring objections) and is implemented cross browser in 2033. (humor)

The stretching of text there seems to work for me in Firefox.  (Firefox
doesn’t support textLength="" on <tspan>s, but does on a top <text>
element.)

I agree with Mats that adjusting the font-size to fit text in a
particular space is a useful effect, and probably something that you’d
want not only in SVG but CSS in general, although I am sure it is a
difficult problem to solve once you have line breaks and floats and so
on.

lengthAdjust="spacingAndGlyphs" just applies a scale in one dimension.
It shouldn’t be hard to extend that with another value that scales in
both dimensions (although note that scaling the text as if it had a
transform on it will not always get you the same result as scaling the
font-size down, due to hinting at least).  (I feel like the group might
have discussed this before…)

-- 
Cameron McCormack ≝ http://mcc.id.au/
Received on Thursday, 17 September 2015 07:45:40 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:42 UTC