Newlines don't work with Canvas rendering
See original GitHub issueJust want to point out that the code below works if your component has DOM, but not Canvas (and obviously not WebGL, which doesn’t seem to support text yet):
Crafty.e("Text").text("hi\nthere")
Renders in Canvas as hi there
and in DOM as:
hi
there
Tested with v0.9.0.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
HTML5 canvas ctx.fillText won't do line breaks? - Stack Overflow
I've made some upgrades I needed: render spaces, render leading/trailing newlines, render stroke and fill with one call (dont measure text twice) ...
Read more >fillText: \n (and \r\n) splits the text in different lines #1363
In browsers, newlines (and carriage return, new line) do not split the rendered text into two lines but render as a space instead,...
Read more >HTML5 canvas ctx.fillText won't do line breaks - Tutorialspoint
The fillText() method draws filled text on the canvas. If you want to break lines you can do this by splitting the text...
Read more >End of line or line break in HTML5 Canvas? - June Rockwell
It's tricky to do an end of line or line break in HTML5 Canvas because it's not built-in. I'm sure one day it...
Read more >Line break does not work in canvas - Sololearn
Line break does not work in canvas ... It should be backslash \ for escaping character Explicitly, line break is \n instead of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
ok hmmmm i dont think who created this framework is alive rn
@starwed Is Crafty abandoned?