Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Add text-hint command #32

Open
coastalwhite opened this issue Aug 2, 2023 · 1 comment
Open

[Proposal] Add text-hint command #32

coastalwhite opened this issue Aug 2, 2023 · 1 comment
Labels
accepted This proposal was accepted proposal New feature or request

Comments

@coastalwhite
Copy link
Contributor

coastalwhite commented Aug 2, 2023

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.

@coastalwhite coastalwhite changed the title [Proposal] Add text-content field [Proposal] Add text-hint command Aug 2, 2023
@ikskuh ikskuh added the proposal New feature or request label Aug 3, 2023
@ikskuh
Copy link
Contributor

ikskuh commented Aug 3, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted This proposal was accepted proposal New feature or request
Development

No branches or pull requests

2 participants