Scrolling text support / DrawText length > 14
Closed this issue · 7 comments
Continuation of alexeden/rpi-led-matrix#24
Re-implement DrawText using hzeller DrawGlyph method instead of DrawText. Should help to fix garbled/Unicode text being written to screen.
Need to extend alexeden's library to add DrawGlyph method from hzeller. Consider creating a PR into alexeden/rpi-led-matrix when changes are done if it's helpful.
I don't think the issue is with Unicode perse. The same issue happens if you use regular characters of length greater than 16. The reason you're seeing it with shorter strings that include Unicode is that those characters are more than a single byte. What I think happens is the underlying library statically allocates a buffer based on some maximum number of regular characters for the screen. When your string exceeds that, you get a buffer overflow, which corrupts the data.
I don't think the issue is with Unicode perse. The same issue happens if you use regular characters of length greater than 16. The reason you're seeing it with shorter strings that include Unicode is that those characters are more than a single byte. What I think happens is the underlying library statically allocates a buffer based on some maximum number of regular characters for the screen. When your string exceeds that, you get a buffer overflow, which corrupts the data.
I see what you mean, @konstk1. I think changing that in hzeller's code might be a bit beyond me. Changing it there would probably be the correct way of fixing the issue.
@samturner3, I tweaked my library without touching the alexeden's repo or my fork of it. Now it iterates through the characters in the string and writes them separately. It seems to be working! I double checked the spacing of characters and that should be the same as before as well.
Try cloning the latest version from wesleytabaka/rpi-led-matrix-painter-example and let me know what you think. That's commit 683f4b91057d9de412e917a0aaab807c75d59e6e
Thanks!
@wesleytabaka I'm now getting this error when installing
pi@rpiWallClock:~/rpi-led-matrix-painter-example $ npm i
> rpi-led-matrix-painter-test@1.1.4 postinstall /home/pi/rpi-led-matrix-painter-example
> npm run build
> rpi-led-matrix-painter-test@1.1.4 build /home/pi/rpi-led-matrix-painter-example
> cd ./src/ && tsc
index.ts:1:24 - error TS2307: Cannot find module 'rpi-led-matrix-painter' or its corresponding type declarations.
1 import * as Board from "rpi-led-matrix-painter";
~~~~~~~~~~~~~~~~~~~~~~~~
index.ts:2:37 - error TS2307: Cannot find module 'rpi-led-matrix-painter' or its corresponding type declarations.
2 import { PaintingInstruction } from "rpi-led-matrix-painter";
~~~~~~~~~~~~~~~~~~~~~~~~
Found 2 errors.
Package.json:
"dependencies": {
"rpi-led-matrix-painter": "^1.1.4"
},
PS want to communicate on this over some kind of chat app?
@samturner3 It looks like you might need to run npm install and then npm run build.
Sure we can chat if you'd like. What are you on? I can send a send a Zoom link and we can chat there.
@samturner3 It look like you might need to run npm install and then npm run build.
Sure we can chat if you'd like. What are you on? I can send a send a Zoom link and we can chat there.
Yep ran npm i and build. Sure send over the link
Here's my Zoom link: --OBFUSCATED--
@samturner3 , based on our discussion and the results yesterday I'm going to close this issue.
I'll also create a new one for the unhandledPromiseRejection warning and the error itself when trying to create a canvas outside the bounds of the LED board.
Thanks!