mongoose-os-libs / ili9341-spi

ILI9341 TFT Driver for Mongoose OS
Apache License 2.0
17 stars 11 forks source link

setFont via JS API #21

Open amizer12 opened 3 years ago

amizer12 commented 3 years ago

Hi, Can you let me know how to properly send to the ffi function the font name when using this library via JS API ? When i simply use ILI9341.setFont(&FreeMonoBold9pt7b); It doesnt work and throws a parse error, when i try to pass it as string or anything else it also fails. Any pointers ?

pimvanpelt commented 3 years ago

I only use C on Mongoose OS. I'm sorry to say, because the javascript portion of this library was contributed, I do not use or maintain it directly. I cannot answer questions on its functionality - please take a look at the Mongoose OS gitter channel, perhaps you'll find the author or an active userbase there.

On Wed, Jun 2, 2021 at 6:16 PM amizer12 @.***> wrote:

Hi, Can you let me know how to properly send to the ffi function the font name when using this library via JS API ? When i simply use ILI9341.setFont(&FreeMonoBold9pt7b); It doesnt work and throws a parse error, when i try to pass it as string or anything else it also fails. Any pointers ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mongoose-os-libs/ili9341-spi/issues/21, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACDRSPIEO3KSZEAUWF7V2HLTQZKONANCNFSM457B74MA .

-- Pim van Pelt @.***> PBVP1-RIPE - http://www.ipng.nl/

amizer12 commented 3 years ago

Thanks for your reply - i found the way to do it looking through some other issues in here - will post and update to README.md file to cover this as i`m sure a lot of people will have issues with it as well.

rojer commented 3 years ago

@amizer12 see here for how to work with fonts from js - https://github.com/mongoose-os-apps/example-m5stack-js/blob/master/fs/init.js#L72

rojer commented 3 years ago

this uses a function in C - https://github.com/mongoose-os-apps/example-m5stack-js/blob/master/src/main.c#L26

i guess we could upstream it here for reuse

rojer commented 3 years ago

Thanks for your reply - i found the way to do it looking through some other issues in here - will post and update to README.md file to cover this as i`m sure a lot of people will have issues with it as well.

yes, please!

amizer12 commented 3 years ago

@rojer that was exactly what ive found and is working - ill add this to the readme tomorrow, will also do some more tests on how to add even more cusotm fonts in there