Re: [svgwg] tspan and text shaping (#634)

Some thoughts:

- This isn't about “text chunks”, which is a specific term in SVG to describe the units for `text-anchor` alignment.  This is about text shaping within a chunk (or within an inline box, to use CSS terms).

- This isn't SVG specific at all; I would expect SVG text to show the same behavior as other CSS-styled text. The guidance quoted by Frederik above (https://github.com/w3c/svgwg/issues/634#issuecomment-457926065) applies

- I think it is standard _not_ to apply kerning between glyphs from different fonts. Kerning is font-face (and size) specific, you can't assume that the same adjustment is appropriate when the previous glyph size & position wasn't defined by the same font.

- But, within the same font, a color/fill change doesn't _need_ to disable kerning, or even contextual alternates.  That said, this is the type of situation considered by the [CSS Text rule](https://drafts.csswg.org/css-text-3/#boundary-shaping) "Text shaping _should not_ be broken… if it is reasonable and possible for that case given the limitations of the font technology."  I don't think we want to say that a user agent is outright wrong for turning off optional text-shaping features when style changes. But linguistically required alternates, like Arabic initial/medial/final letter forms, should still be preserved.

- Ligatures and color/fill change are another matter. I'm surprised to see what looks like Firefox painting half of a ligature glyph in one color and half in the other.  That doesn't _necessarily_ mean that the only alternative would be to disable ligatures, though. Another option would be to paint the entire glyph using the styles applied to the first character in the ligature. (Which is similar to how we handle ligatures and text chunks within a single element.)  That said, the Firefox approach (split the ligature glyph for coloring purposes) is probably closer to how you want `::selection` highlights to be painted.

- The current rule in [SVG](https://svgwg.org/svg2-draft/text.html#GlyphsMetrics) is to disable ligatures when there is _any_ element boundary separating the characters. The rule in CSS Text is that element boundaries must have no effect on text shaping if they do not change formatting in a way that affects glyph rendering.  So these rules are in conflict & given the lack of interop we probably want to reconsider the SVG rule on this point.

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

Received on Monday, 20 May 2019 00:31:44 UTC