Re: [svgwg] Baseline information for contextual layout (#739)

At risk of reiterating the suggestion I made in https://github.com/w3c/csswg-drafts/issues/4116, it seems unnecessarily complicated where the baseline you are aligning to is designed to match a text element within the SVG. That text element will already have font metrics.

Your proposal is more complete and covers every situation, including those where there's no text element to reference. For the use-cases you've mentioned elsewhere - svg's representing logos or symbols - the syntax is as good as any. I too prefer the CSS baseline names. And I presume the values are in viewBox units?

But for anything more complex, it's going to be an extremely arduous job to calculate those numbers.  Take something like, for example, http://web-platform-tests.live/svg/import/text-align-07-t-manual.svg. Calculating the alignment points manually in advance essentially requires the user to pre-calculate the linebox vertical alignment by hand, an algorithm which still surprises me with the results - and that's after I've implemented it. I'm sure an SVG editor could calculate them for inclusion, but you're then shifting the burden of development from just SVG renderers to both SVG renderers and SVG editors.

At the very least I would suggest at least an alternate syntax which allows you to retrieve those metrics from an embedded <text> or <tspan> by reference. I proposed one syntax in https://github.com/w3c/csswg-drafts/issues/4116 (`<svg baselineElement="textid">`) - the precise syntax could be changed to work with your proposal quite easily, eg `<svg horizontal-baselines="#textid">`.

Even for simple icons containing no text content, this would allow - for example - a stub <text> element with the right metrics but no text content to be included, just to copy the metrics from.

-- 
GitHub Notification of comment by faceless2
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/739#issuecomment-534021146 using your GitHub account

Received on Monday, 23 September 2019 09:19:37 UTC