How to reorder color font as second letter behind the first one while overlapping?

Hello Typedrawers, 
I am working on a color font and kerning them as they are overlapping. By default, the second letter always sits above the first letter, the third letter on the second, and so on. Is there any way the second letter goes behind the first one, third behind the second one and so on? 

Comments

  • This is a limitation of the current color font specification (actual the current font rendering in general; The same happens with simple back fonts, too but there it is not a problem.)
    I brought this up in various meetings and discussions over the years.
  • John Hudson
    John Hudson Posts: 3,317
    edited February 21
    Glyphs are painted in sequence. There isn’t really any way around this, and unlikely to be, as it is so basic to text rendering. It would require a major change in how text is handled in systems and applications to reverse the order in which glyphs are painted for some fonts in some situations, so it is the sort of thing that wouldn’t get traction in those places. I think probably the most direct way to do it would be in a closed environment: something like a browser-based typesetter that took care of the glyph layering and output some static graphic formats.
  • Mark Simonson
    Mark Simonson Posts: 1,745
    I wonder if it would be possible (in any of the color font formats) for a glyph to act as a mask or cut-out for the next glyph to be rendered, similar to the way you can do shape math in vector graphics apps (including font editors), maybe with a special layer in the first glyph. That way, you wouldn't need to change the existing glyph-drawing order of text.
  • >I wonder if it would be possible (in any of the color font formats) for a glyph to act as a mask or cut-out for the next glyph to be rendered...

    Currently, not as such. The most that could be done currently is to provide context for a substitution of the following glyph.

    (Hmmm... One could imagine an extension to COLR that has a PaintSubstGlyph table that references a glyph but allows the glyph ID to be substituted based on context of preceding or following base glyph IDs.)
  • John Hudson
    John Hudson Posts: 3,317
    edited February 21
    One could imagine an extension to COLR that has a PaintSubstGlyph table that references a glyph but allows the glyph ID to be substituted based on context of preceding or following base glyph IDs.
    Can you elaborate on that idea, Peter? I don’t see how substituting GIDs gets around the glyph painting order problem, or are you suggesting that the new table would enable a preceding glyph to be (re)painted based on the following context without also (re)painting that context?