Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Simplistic size measurement of text causes overflow #36
Using the simplest way to render a string, sometimes some part of the beginning and end of it disappears. When using a string like
Didn't go over all the characters that work and don't work correctly.
If you need any more details, please tell me.
The package determines the size of the svg based on the size of the elements within, so the width is a little too small.
One possible solution would be to use a monospace font.
Another would be to use
I’m guessing this is a known issue, but I don’t think there’s a way to fix it
Yes, @danfishgold is completely right. In Elm 0.18, the library used a native call to the HTML canvas to measure the width of some text. In Elm 0.19 this is not allowed any more and I reverted to a very simplistic calculation using the font size and the string length. I'm open to any suggestions to make this work again.
Regrettably, I don't think ports are the way to go. If my understanding is correct, this would require every developer using this library to wire up to a port themselves. I think requiring every developer to do this is bad library design.
Nope, when using ports it will always be async I guess.
Wonderful! Keep me posted if any solution comes up. I see decoding font files could be an option, but it is also async.