Describe the bug
Trailing white-spaces are not accounted for in Text::width(...) in ggez 0.5.1
To Reproduce
See gist
Expected behavior
Text::width(...) should account for trailing spaces in the calculation.
Screenshots or pasted code
Output from gist
$ cargo run --example singlespacewidth.rs
Note: Release mode will improve performance greatly.
e.g. use `cargo run --example text --release`
Empty Text Width: 0
Single-space Text Width: 0
Char: 9
Char with 3 trailing spaces: 9
Char with 3 leading spaces: 40
Spaces bounded: 51
Whew. Sorry for putting this off for so long. Not sure what the correct behavior should be, since I've seen this "don't count the size of spaces" behavior for other things... and in some cases, such as making justified text, it's obviously the Right Thing. So, hmm.
Hmm, why not add another method that will return a text's width with spaces?
That's a fine idea, actually. The main problem there is that a space might not have only one width in a variable-width font...
Per https://github.com/alexheretic/glyph-brush/issues/60 glyph_brush only really cares about glyphs that actually get drawn, which seems pretty reasonable. Dunno what else to do, so I've upstreamed asking for advice: https://github.com/alexheretic/glyph-brush/issues/75
Most helpful comment
That's a fine idea, actually. The main problem there is that a space might not have only one width in a variable-width font...
Per https://github.com/alexheretic/glyph-brush/issues/60
glyph_brushonly really cares about glyphs that actually get drawn, which seems pretty reasonable. Dunno what else to do, so I've upstreamed asking for advice: https://github.com/alexheretic/glyph-brush/issues/75