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

Running love.graphics.newText on a string with a single space and getting its width returns 0 #65

Open
oatmealine opened this issue Aug 9, 2022 · 2 comments

Comments

@oatmealine
Copy link

See title:

local text = love.graphics.newText(love.graphics.getFont(), ' ')
print(text:getWidth()) --> 0

This does not replicate the behavior when using Font:getWidth in love.js or Text:getWidth natively, both of which return 8 (or whatever the size of a space in the font is).

@kristinalustig
Copy link

Possibly related - a game I'm working on has text input, and the text input constantly strips out any spaces in the web version (not other versions). Could it be that the problem isn't with getWidth but instead with how spaces are treated in general?

@alexjgriffith
Copy link

Which version of love.js are you running? On the 11.4 version compiled with the compatibility flag I get the same width for a space both on the web version and the native version.

SCROT-Apr17::213901

@kristinalustig Concerning spaces captured using the textinput handler, love.js overwrites the browsers default use of spaces and arrow keys (in index.html). Note that space is still captured in the keypressed handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants