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

Request: The ability to layout arbitrary boxes in line with text #80

Open
nicoburns opened this issue Feb 23, 2023 · 0 comments
Open

Request: The ability to layout arbitrary boxes in line with text #80

nicoburns opened this issue Feb 23, 2023 · 0 comments

Comments

@nicoburns
Copy link
Contributor

It's often the case that UIs want to intersperse non-textual content in line with text. Examples of this would include inline images and form fields. But in theory this extends to arbitrary content. It seems to me that:

  • A UI framework wanting to implement such functionality would not be able to build it on top of the text-only functionality that cosmic-text currently offers.
  • It would be relatively easy for cosmic-text to offer support for laying out boxes (rectangles) in line with text.

I don't really care what the API looks like, but I would suggest something like:

  • Cosmic text takes a Vec<InlineBox> as input in addition to it's existing inputs
  • Each InlineBox consists of:
    • a unique identifier
    • a width
    • a height
    • an index into the text string specifying the position at which the box should be laid out
    • Possibly some kind of baseline/alignment specifying for vertical alignment
  • Cosmic text output a Vec of box positions for each line consisting of:
    • the unique identifier
    • an x position
    • a y position
@nicoburns nicoburns changed the title Request: The ability to layout arbitrary boxes inline with text Request: The ability to layout arbitrary boxes in line with text Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant