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

If there is no feature like this already in SVG/CSS I think that SVG2 would
be a great start to start implement it!

I just want to exemplify with my own use case why this is a frustrating
limitation:
I make a multilingual SVG and the text inside the SVG can be printed in
many different languages. Something can be written with some few Chinese
symbols but need several long words in other languages, like in the
language Passamaquoddy.

One thought about this could be to also implement something like a "maximum
font" and "minimum font". Then it could also be possible to limit/fine-tune
the font size range to avoid too extreme results.

2015-09-17 22:36 GMT+02:00 Smailus, Thomas O <Thomas.O.Smailus@boeing.com>:

> This has been a feature I've been advocating for in the group for over a
> year, but since I don't write a browser and don't have a works statement
> that lets me do so, I'm sort of stuck just poking this issue.
>
> At last years symposium in Santa Clara I pushed it again and there was
> some discussion about this issue.
>
> CGM has it and for technical diagrams it is absolutely a must have to
> properly communicate and represent meaning by having text
> expanded/compressed to fit a box.
>
> From an implementation algorithm I'd think you scale the font uniformly to
> achieve the height you need, then using the length_adjust parameter scale
> just the length to get the length required.  (as one option)
>
> IE and Firefox do things differently, and none of them do it correctly, as
> the settings on the text element should flow through and consider any tspan
> subelements and then solve for the unknowns.
>
> There was some talk  in Santa Clara on what to do with this - and I
> thought it was flowing up to CSS but I've not heard back.  It’s a critical
> and missing feature that we currently have ECMAscript workarounds trying to
> mitigate that are non-ideal because of the inconsistent ways browsers
> implement effects and what one can do in script.
>
> If CSS isn’t taking up this issue I suggest we take it up formally in SVG2.
>
> If textLength cannot be made precisely to specify the length text should
> be (what is it now, a request to hope it might be?), and provide a
> corresponding textHeight, then we need to come up with width/height like
> parameters on text.
>
> And all of this, as pointed out, needs to be reconciled with multiline
> text.  SVG1.1se isn't multi-line aware, though I'd be happy with getting it
> on single-line SVG1.1se type text just fine - as that provides a path to
> migrate our hundreds of thousands of engineering diagrams from CGM to SVG
> in a predicable manner.
>
> Thomas
> --
> Thomas Smailus, Ph.D.  P.E.
> Boeing Information Technology
> thomas.o.smailus@boeing.com
>
> > -----Original Message-----
> > From: Cameron McCormack [mailto:cam@mcc.id.au]
> > Sent: Thursday, September 17, 2015 0:45
> > To: David Dailey
> > Cc: 'Mats Blakstad'; www-svg@w3.org
> > Subject: Re: Possible to resize text to max size within a box?
> >
> > 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 21:29:27 UTC