[Proposal] Add text-hint command
coastalwhite opened this issue · comments
One large problem with TinyVG as I see it now is accessibility. I am 100% in favor of not having to encode font dependent data in the format, instead replacing that with paths, but the problem is that then the text data is lost. It would be good for accessibility and GUIs text selection tools to allow the possibility to define the presence of text somehow. Possibly, this could be combined with #18, but maybe it should be its own command. To be extra clear, this should not render text. It should only generate metadata that text is somewhere and where the individual characters start and end.
Example implementation command:
command-name: "text-hint"
command-index: ...
layout:
y: Unit
rotation: Unit
height: Unit
text-length: varuint
text: [text-length]u8 (encoded as UTF-8)
codepoint-length: varuint
codepoint-x-offset [codepoint-length]Unit (x coordinates of where characters end)
This would be a complicated command, and therefore it might not suit your vision of this project. But since it is a hint, renderers could ignore the command, but it would allow larger tools that want to incorporate the standard to also have most of the metadata available.
This is something i can definitly see!
I'm not super happy with your chosen encoding, but the base idea is definitly good.
Let's see how we can get better:
command-name: "text-hint"
command-index: ...
layout:
center: Point # center of the text
rotation: Unit # rotation in degrees
height: Unit # height of the text
text-length: varuint # number of bytes
text: [text-length]u8 # encoded as UTF-8
# for each glyph (grapheme cluster), encodes start x and end x
glyph-length: varuint # number of glyphs
glyph-offset: [glyph-length][2]Unit
rotation
could also be made a byte using 2° steps
Consider this proposal accepted!