Open Sanic opened 10 years ago
I usually use a wrapper function. Take a look at this:
Thanks for the hint. That helped me alot in my current project. I think it would be nice to have such a function in info-beamer itself to avoid code duplication.
I'd love to have this too, for the same reason as @Sanic
I hacked something quickly for wrapping when using non-monospace fonts. It's pretty crude (doesn't understand hyphenation), but I think I can add newline support pretty easily.
Text rendering of any non-trivial text is kind of a weak point right now. I'm not sure what the best approach to improve this without adding a ton of complexity. For full unicode support, something like harfbuzz.org is probably the way to go. I'm not sure how one would solve hyphenation and other locale dependent problems.
I agree that some kind of text-shaping library would be a more universal solution. Would full Cairo be overkill? Making PNGs using Cairo/Pango, then loading them as image resources seems a little inefficient, but it might be good enough for some use cases.
Would full Cairo be overkill?
Good question. I guess that would require a complete overhaul of the existing font rendering code. Right now (in the Pi version) I'm rendering glyphs into a dynamically growing texture (Example), then render strings as vertex buffers. For performance I cache those, so they can get reused across frames.
If I understand the scope of pango correctly, you basically hand it a string and get layout information for each glyph based on various rules (Fascinating!). I'm not sure how all of that would work together. All while being completely backwards compatible with the existing text rendering output.
I 've got a "invalid utf8" at font:write when usin ' ãç ', how to preparer for full utf-8? thanks
If it's a variable you source from somewhere (like a JSON file), be sure that its content is UTF-8 encoded. If you're using a string literal, make sure your code editor actually saves the file in UTF-8.
thanks, I will try. let you know!
I'am trying to display the contents of multiple textfiles, where each of them contains newlines. Unfortunately, the newlines will not be rendered as expected with font:write. The newline will just be shown as a blank.
Is there any way to do this?