question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Newlines don't work with Canvas rendering

See original GitHub issue

Just 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:open
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
Nep-Toodlescommented, Nov 23, 2020

ok hmmmm i dont think who created this framework is alive rn

1reaction
nekromoffcommented, Nov 18, 2021

@starwed Is Crafty abandoned?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found