Open therahedwig opened 2 years ago
The problem with using 'dx' and 'dy' in flowed text is that it moves characters (actually clusters) after they have been positioned by flowing into a shape. The ruby text could be moved with 'dx' and 'dy' above other characters but that would leave holes.
The problem with using 'dx' and 'dy' in flowed text is that it moves characters (actually clusters) after they have been positioned by flowing into a shape. The ruby text could be moved with 'dx' and 'dy' above other characters but that would leave holes.
Oh, wow, I hadn't even realized that... So we need a completely different solution?
Reading through the ruby css spec, it seems that there might be a solution in using specific values for display on a text-span.
For document languages (such as XML applications) that do not have pre-defined ruby elements, authors must map document language elements to ruby elements; this is done with the display property.
This could look like...
<text>
Here is some <tspan style="display:ruby"><tspan style="display:ruby-base">text</tspan><tspan style="display:ruby-text">annotation</tspan></tspan> with annotation.
</text>
The only thing I am missing here is a way to define <rp>
elements, that is, the fallback parentheses for ruby-annotations in html. So the above example "Here is some
There might be more issues with the spec. What I think might be a good next step is to try and make a script that tries to consume tspans with the ruby css values and outputs SVG 1.1 (or non-autowrapped) text, as a prototype.
Ok, I managed to get parsing of most of the typical cases done: ruby_in_svg_basic_parsing.zip
Some problems:
Other notes:
Anyway, please check out the samples and whether they're acceptable. I'll wait with providing feedback to the CSS issue tracker until people have had a chance to think about this here.
Hi, we (Krita project) have been looking at the SVG 2 text spec, and there was one thing we were wondering about: Ruby annotations.
So, as quick summary: Ruby annotations consist of small script positioned above CJK characters containing the pronunciation of said character. It should not be confused with the programming language. There's some support for it in HTML, and a w3c spec that explains it far better than I could.
In theory, we could use the dy and dx positioning of the non-autowrapped text to position text in any way we want. However, a note in the spec says that these are to be ignored for auto-wrapped/flowed text. Just positioning by itself is also not super-ideal, as it prevents outsiders from understanding that this positioning is happening because it is a Ruby annotation.
There is also an OpenType way of doing it. My problem with this is that it is per-font, and then if certain pronunciations are missing, you'd have to tell someone 'go edit the font', which, licensing issues aside, seems really mean. Like, this project seems to be adding Bopomofo Ruby to fonts with some programming (and they're literally annotating every character). And they're not even using the ruby feature tag, but rather stylistic sets and unicode variation selectors, meaning that the problem is a little bit more complicated than just hardcoding a given annotation for a given character.
So, I've been wondering if someone has an idea of how to approach this?
More links