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

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

From: David Dailey <ddailey@zoominternet.net>
Date: Wed, 16 Sep 2015 23:50:21 -0400
To: "'Mats Blakstad'" <mats.gbproject@gmail.com>, <www-svg@w3.org>
Message-ID: <001e01d0f0fb$fa368940$eea39bc0$@net>
Not sure about SVG 2 since it often  is a subset of SVG 1.1 which was, I think,  a strict subset of SVG1.2, but in SVG1.1, you could make text shrink and expand both horizontally and vertically by using textLength in conjunction with viewBox as in examples at

http://srufaculty.sru.edu/david.dailey/svg/text/decorative.svg (used to be cross-browser consistent in 2009, but now has problems with stroke-dasharray on text)

http://cs.sru.edu/~ddailey/svg/OnlyEllo1.svg  (some social networks actually allow SVG animate – CSS? Not so much)

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)


There were 1.2 zillion examples at http://cs.sru.edu/~ddailey/svg/GeometricAccessibility.html (and allied pages dating back a decade or so from there), but that was already years ago, and though they worked in all modern browsers (modulo bug reports at the time), most no longer work in the browsers that people now call “modern.”.  Many of the examples have been reworked in a way that was consistent with both Chrome, Firefox, Opera and (I’m told) Safari this spring (2015 – it seems like a lifetime ago, since I was still, at that time, very smitten with SVG), if you’d like to scroll down a  dozen or so posts from https://ello.co/ddailey/?start_timestamp=2015-04-25 to see examples, but that was before I heard that the SVG WG decided to do whatever it is that they decided to do with SMIL that made the old people so terribly grumpy. 


I agree that the use case is a good one, and the designers of SVG1.1 apparently agreed.  





From: Mats Blakstad [mailto:mats.gbproject@gmail.com] 
Sent: Wednesday, September 16, 2015 5:22 PM
To: www-svg@w3.org
Subject: Possible to resize text to max size within a box?



I've tried to read the documentation for SVG2 draft.

On ‘textLength’ it says "This attribute is not intended for use to obtain effects such as shrinking or expanding text."

Is it possible within SVG2 in another way to simply set the length/width of a text, and then make the text size shrink/expand to fit it as good as possible?

Like in the example here:


This could be great if the SVG-element is responsive, but also if you use different/dynamic texts inside SVG and you want to control that if fits within a certain area.

Is it possible to do something like that within the current framework?
Received on Thursday, 17 September 2015 03:51:03 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:55:02 UTC