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

litherum has just created a new issue for https://github.com/w3c/svgwg:

== Baseline information for contextual layout ==
Forked from https://github.com/w3c/csswg-drafts/issues/4116. That issue describes motivation to be able to annotate images with information which can participate in layout in surrounding context (like CSS). At TPAC this year in Tokyo, I brought up this topic in the SVG CG, and received encouragement to make a proposal which would add this kind of information in SVG.

The most straightforward way of doing this modeling this layout information is as an additional baseline. Indeed, this is how UIKit [models](https://developer.apple.com/documentation/uikit/uiimage/3375727-baselineoffsetfrombottom) this information.

There are three general approaches to baseline information: [OpenType](https://docs.microsoft.com/en-us/typography/opentype/spec/baselinetags), [TrueType](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bsln.html), and [CSS](https://drafts.csswg.org/css-inline-3/#dominant-baseline-property). These describe how there can be a collection of different baselines: Roman, Mathematical, Hanging, etc. Also, OpenType includes facilities for vertical baselines, which are helpful for aligning things horizontally.

So, gathering inspiration from `viewBox`, I was thinking of a microsyntax approach. Perhaps something like two new attributes on the `<svg>` element: `horizontal-baselines` and vertical-baselines`, which would look something similar to:

```
<svg horizontal-baselines=“‘hang’ 1014 ‘romn’ 14 ‘ideo’ 589” vertical-baselines=“‘icfb’ -142 ‘idtp’ 820 ‘romn’ -3”> ... </svg>
```

I got those 4 character codes from the [OpenType spec](https://docs.microsoft.com/en-us/typography/opentype/spec/baselinetags)  but we may want to prefer the CSS spec instead, in which case it would be something like:


```
<svg horizontal-baselines=“hanging 1014 alphabetic 14 ideographic 589” vertical-baselines=“middle -142 mathematical 820 alphabetic -3”> ... </svg>
```

Please view or discuss this issue at https://github.com/w3c/svgwg/issues/739 using your GitHub account

Received on Sunday, 22 September 2019 16:02:12 UTC