Author |
Message |
27/06/2021 05:49:36
|
#1
|
k
Joined: Jun 17, 2021
Messages: 18
Offline
|
Hello,
Recently found this library, and so far it is really helpful.
I am trying to have arabic characters (e.g. ??????) and the designer does not accept the characters. I worked around this by changing the name in the arduino code. But then on the display i get cryptic text.
I am using an ESP32 and st7735 LCD
I am not sure how to go about solving this.
Any help is appreciated
Thank you
|
|
|
28/06/2021 19:38:14
|
#2
|
davetcc
Joined: Jan 19, 2019
Messages: 686
Offline
|
In terms of supported languages, I think you may be right and there could be a regex to only allow Latin characters in the name at the moment.
Our plan is to support multiple languages shortly, we just need to work out the best way to add this support without breaking anything existing, or adding complexity.
However, your immediate issue with incorrectly drawn characters is probably down to the graphics library you are using. Further, it's probably down to the fonts provided with the graphics library that you are using. For example, most fonts that are provided with Adafruit_GFX have a limited range of characters, as every added character adds to the memory overhead. You can easily generate another font and full instructions are provided with the Adafruit_GFX library.
|
|
|
30/06/2021 05:25:57
|
#3
|
k
Joined: Jun 17, 2021
Messages: 18
Offline
|
Thank you for the reply
I searched and found fork of the adafruit_gfx library that supports Unicode, but it seems incompatible with tcmenu code. And I am not sure what to change to make it work.
The library: https://github.com/joeycastillo/Adafruit-GFX-Library
I also tried the u8g2 for adafruit gfx: https://github.com/olikraus/U8g2_for_Adafruit_GFX but this also seems incompatible, and a gain I am not sure of what to do to make either work.
I have tried changing some of the line to solve the errors as they appear, but when I solve one I get another.
|
|
|
30/06/2021 07:59:30
|
#4
|
davetcc
Joined: Jan 19, 2019
Messages: 686
Offline
|
If you're on at least V2.1 of the library, you could just write your own Drawable using the custom drawable plugin. See the documentation with the plugin, although essentially you're just filling in the blanks of how to draw various elements with your graphics library. Although you'd need to provide more information about why it doesn't work for us to help you, as I would expect anything with AdafruitGfx compatibility to work out of the box, it is
by far the most used
a very common option and people have used many displays. As it's using UTF-8 there should be few issues as the character size is the same - 8 bits.
My recommendation is:
1. Check that the examples with those libraries work, if they do not then you need to solve any problems there first.
2. Create the most simple menu possible with that library, and provide a zip with the project EMF file and the compiler error output here as an attachement. Also the AdafruitGFX compatible library you used. We'll try and recreate.
|
|
|
03/07/2021 13:57:48
|
#5
|
k
Joined: Jun 17, 2021
Messages: 18
Offline
|
Hi sorry for the delayed reply,
I attached the project folder of a menu with only one text menuItem with some arabic text.
I used the foreign languages fork for adafruitGFX. Link: https://github.com/joeycastillo/Adafruit-GFX-Library
The first error that I got was that the library (gfxfont) was not available so i commented the line initializing the library.
Then I got the following:
Ar
duino: 1.8.15 (Mac OS X), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"
WARNING: library Adafruit_GFX_Library claims to run on samd architecture(s) and may be incompatible with your current board which runs on esp32 architecture(s).
In file included from /Users/kabsah/Documents/Arduino/ArabicTest/ArabicTest/ArabicTest_menu.h:16:0,
from /Users/kabsah/Documents/Arduino/ArabicTest/ArabicTest/ArabicTest_menu.cpp:12:
tcMenuAdaFruitGfx.h:53:41: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
typedef struct ColorGfxMenuConfig<const GFXfont*> AdaColorGfxMenuConfig;
^
tcMenuAdaFruitGfx.h:53:49: error: template argument 1 is invalid
typedef struct ColorGfxMenuConfig<const GFXfont*> AdaColorGfxMenuConfig;
^
In file included from /Users/kabsah/Documents/Arduino/ArabicTest/ArabicTest/tcMenuAdaFruitGfx.cpp:16:0:
tcMenuAdaFruitGfx.h:53:41: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
typedef struct ColorGfxMenuConfig<const GFXfont*> AdaColorGfxMenuConfig;
^
tcMenuAdaFruitGfx.h:53:49: error: template argument 1 is invalid
typedef struct ColorGfxMenuConfig<const GFXfont*> AdaColorGfxMenuConfig;
^
In file included from /Users/kabsah/Documents/Arduino/ArabicTest/ArabicTest/ArabicTest_menu.h:16:0,
from /Users/kabsah/Documents/Arduino/ArabicTest/ArabicTest/ArabicTest.ino:1:
tcMenuAdaFruitGfx.h:53:41: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
typedef struct ColorGfxMenuConfig<const GFXfont*> AdaColorGfxMenuConfig;
^
tcMenuAdaFruitGfx.h:53:49: error: template argument 1 is invalid
typedef struct ColorGfxMenuConfig<const GFXfont*> AdaColorGfxMenuConfig;
^
/Users/kabsah/Documents/Arduino/ArabicTest/ArabicTest/tcMenuAdaFruitGfx.cpp: In member function 'virtual tcgfx::Coord AdafruitDrawable::textExtents(const void*, int, const char*, int*)':
tcMenuAdaFruitGfx.cpp:90:15: error: 'class Adafruit_GFX' has no member named 'setFont'
graphics->setFont(static_cast<const GFXfont *>(f));
^
tcMenuAdaFruitGfx.cpp:90:41: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
graphics->setFont(static_cast<const GFXfont *>(f));
^
tcMenuAdaFruitGfx.cpp:90:41: error: expected '>' before 'GFXfont'
tcMenuAdaFruitGfx.cpp:90:41: error: expected '(' before 'GFXfont'
tcMenuAdaFruitGfx.cpp:90:41: error: 'GFXfont' was not declared in this scope
tcMenuAdaFruitGfx.cpp:90:50: error: expected primary-expression before '>' token
graphics->setFont(static_cast<const GFXfont *>(f));
^
tcMenuAdaFruitGfx.cpp:92:28: error: expected primary-expression before ')' token
auto* font = (GFXfont *) f;
^
exit status 1
ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Filename |
ArabicTest.zip |
Download
|
Description |
No description given |
Filesize |
10 Kbytes
|
Downloaded: |
50590 time(s) |
|
|
|
03/07/2021 14:33:37
|
#6
|
k
Joined: Jun 17, 2021
Messages: 18
Offline
|
I tried a different fork of adafruitgfx that supports utf:
https://github.com/agustisanchez/Adafruit-GFX-Library-UTF8
I merged the content of this library with the AdafruitGFX library installed from arduino ide. It compiles with no error, but I get a white screen only.
|
|
|
03/07/2021 17:17:55
|
#7
|
davetcc
Joined: Jan 19, 2019
Messages: 686
Offline
|
That sounds quite odd, if you just write to the screen after the setupMenu() call in setup, eg print statement or similar, does it work?
EG something similar to:
setupMenu();
gfx.print("test");
delay(10000);
|
|
|
03/07/2021 18:57:39
|
#8
|
k
Joined: Jun 17, 2021
Messages: 18
Offline
|
Still white screen.
|
|
|
04/07/2021 07:08:38
|
#9
|
davetcc
Joined: Jan 19, 2019
Messages: 686
Offline
|
At this point, I would confirm the ada graphics fork library you are using is working properly by using one of the examples that shipped with the library.
Does one of the simple adafruit gfx examples work with that library?
No: there's probably something wrong with the graphics library you're using, you'll need to fix this first.
Yes, the example works: Please create a minimal menu structure using designer with the same settings, and zip it up for us to take a look at. It can be attached here, or by private message to me.
|
|
|
07/07/2021 15:01:11
|
#10
|
k
Joined: Jun 17, 2021
Messages: 18
Offline
|
Hi, sorry for the late reply.
I again tried to run different adafruit example and found that the fork was the problem (some code it runs, some it doesn't). Sorry for my mistake.
I have also tried another approach which was to use the U8g2_for_Adafruit_GFX library. And found that it does work.
Library: https://github.com/olikraus/u8g2
But my problem is that I dont know how to adapt the tcmenu to accomodate. I made a simple library and verified that arabic works by including code to write a string in the setup part (not through tcmenu functions). But I was not able (or not knowledgable enough) to make the tcmenu use it.
I have included a simple menu as an attachment.
Filename |
ArabicTest.zip |
Download
|
Description |
No description given |
Filesize |
19 Kbytes
|
Downloaded: |
49901 time(s) |
|
|
|
08/07/2021 11:07:44
|
#11
|
davetcc
Joined: Jan 19, 2019
Messages: 686
Offline
|
Thanks, I'll take a look at the example provided, but if it's adafruit graphics compatible, it should work with the TcMenu drawable. If not I'll try and fix it up.
However, this is with the caveat mentioned before, at the moment TcMenu has not been tested with Unicode / UTF8.
|
|
|
15/08/2021 19:59:55
|
#12
|
k
Joined: Jun 17, 2021
Messages: 18
Offline
|
If foreign characters are proving to be a hassle, is there a way to make the menu an image instead of text?
or symbols? Because I am thinking of drawing the arabic text and having the image appear as the menu.
Is this possible?
|
|
|
16/08/2021 07:51:13
|
#13
|
davetcc
Joined: Jan 19, 2019
Messages: 686
Offline
|
I completely agree that the tcMenu Designer and library parts need improvement in this regard, We'd like to put some focus on getting this working once 2.2 is released. Can you think of any low-hanging fruit we could pick off that would make life easier during the design phase? We can't do much about the Unicode support in various graphics libraries.
The thing is that TcMenu is just the middle man, between the graphics library that you're using and the C compiler. Essentially, you can store any menu text you wish in UTF8 but it comes down to 1. if the compiler can fully support UTF8 and 2. if the graphics library can render with such fonts.
But in terms of using images, yes you can use images for an item, if you take a look at either the Esp8266 WiFi, or the EspAmplifier example, they show you how to associate an icon with a menu item.
|
|
|
16/08/2021 08:07:44
|
#14
|
k
Joined: Jun 17, 2021
Messages: 18
Offline
|
Yeah, I understand the limitation in the rendering libraries.
Still thank you, the library is one hell of a middle man.
for the icons, I only found the page on how to do it for title widgets. Not sure if the same method applies to regular menu items? Or at least a text menu item?
|
|
|
16/08/2021 10:47:29
|
#15
|
davetcc
Joined: Jan 19, 2019
Messages: 686
Offline
|
|
|
|
|