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

Picographics: wordwrap ignored for vector fonts #521

Open
anomaly256 opened this issue Sep 27, 2022 · 5 comments
Open

Picographics: wordwrap ignored for vector fonts #521

anomaly256 opened this issue Sep 27, 2022 · 5 comments
Labels
[- pico graphics library -] documentation Improvements or additions to documentation question Further information is requested

Comments

@anomaly256
Copy link

Hi, I've noticed today that passing a wordwrap value though .text() is ignored when using a vector font. Is this expected behaviour? Documentation doesn't mention that it is.

Thanks

@ZodiusInfuser ZodiusInfuser added documentation Improvements or additions to documentation question Further information is requested [- pico graphics library -] labels Jan 20, 2023
@netsmith
Copy link

Same issue - did it get resolved?

@anomaly256
Copy link
Author

@netsmith unsure, a whole bunch of life got in the way and distracted me since I posted this and I haven’t revisited the project I was working on at the time. If you’re still seeing it with the current release then I guess it hasn’t been addressed yet.

To be fair it can be a complex problem to solve with non-raster fonts as their width is hard to predict when you account for kerning and the variability of individual glyphs so I’m not surprised if it’s been left in the ‘too hard’ bucket for the time being 😛

With raster fonts you can just multiply the fixed width by the number of characters to know when you’ll hit the edge of the drawing area and will need to wrap. With vector fonts you have to query each glyph’s individual width at the given scale, and calculate the kerning that the font defines (if any, these ones might not) and apply that to the tally.

@Gadgetoid
Copy link
Member

Pretty much exactly what @anomaly256 said. It's a big effort for little return.

I'm actually someday hoping to replace all of our vector fonts with a polygon renderer and "Alright Fonts" - https://github.com/lowfatcode/alright-fonts

Made the first step for that here, but there's a way to go - #783

@fighterguard
Copy link

I've noticed something else: Line breaks don't work with vector fonts either. They only work with bitmap fonts.
I looked up and down in the docs, and there is no mention of anything related to that. So, even if you know where exactly you want a new line, it won't work. I guess vector fonts are completely useless, and should never be used.

@GreenBattery
Copy link

@anomaly256 Measurement of text width appears to work correctly when it comes to centralizing text, so it seems like that aspect is already solved perhaps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[- pico graphics library -] documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants