-
Notifications
You must be signed in to change notification settings - Fork 85
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
Text wrap #126
Comments
Sorry, let me clarify a little. I understand that you can use the My use case is rendering a markdown document using libui. This requires me to have a vertical layout that combines paragraphs of text along with other elements like images. My ideal would be that an Area filled with text would automatically set it's height so that I could stack them on top of each other with other content in between. Does this seem possible with the library in it's current state? Right now I'm trying how to figure out how to build something that attempts to draw the text in an area and resizes the area to just fit the text. |
Oh dang, just noticed that UIImage isn't supported yet. 😅 I guess I'll focus on plain text rendering for now, then. |
Area controls are always stretchy (I think). You would be better off with using a single area and rendering everything inside. You should be able to get the actual width and height the DrawTextLayout takes up and do the layout yourself with this information. (This works fine in normal areas, but not so much in scrolling areas: andlabs/libui#401) |
Any ideas on how I should handle mixed content in the future? Or is that even realistic? I'm definately going to need to rely on scrolling since the markdown documents could be quite long. Maybe libui isn't the right approach for doing something like this. 😅 |
Also, this might not be the point of the issue, but how would I set multiple attributes at once? Can I use It doesn't look like it's possible, but I might be missing something. 😅 |
I think you should be able to pull this off. Do you want to create something like this?
Yet.... 😄 ? |
That is possible: you can pass as many attributes to Lines 48 to 50 in 8e3bc58
Also described (not as clear) here: https://github.com/parro-it/libui-node/blob/master/docs/attributedstring.md#appendattributed |
Yeah, sort of like that, but it'd look like similar to how Github renders markdown content with Images and stuff spaced between the sections of text. So far my biggest blockers are:
I think that combined this makes libui a bad target for rendering markdown content. I'll probably park that idea or concede with supporting a subset for now.
Dang! I totally missed that. Thank you for the help! I'll see what I can do with this. 😁 |
A webview might come in the near future (there an issue in andlabs/libui), so you could create a html file from markdown and show that. |
Yeah, part of why I'm going this route is to experiment with UIs that don't use the web. My long-term goal is to create something like Firefox's reader view where instead of using the DOM and CSS, I'll extract the semantic content from the page and use native UI elements to render it. I got this idea after being frusterated with browsers taking up hundreds of megabytes of ram to show just a little content. The goal is to use less system resources, though, I'm not sure how realistic that will be. 😅 The content I want to render in the end will look kind of like markdown, so that's why I'm starting with getting that to render with libui. |
Hyperlinks in attributed string: andlabs/libui#303 |
Thanks! I've subscribed to both of those so I can see when they're ready. :D |
@RangerMauve |
Hi, what's the appropriate way to handle wrapping text?
Preferably with text that's been created with the AttributedString API.
The text was updated successfully, but these errors were encountered: