ImpulseAdventure / GUIslice-Builder

Cross-platform drag & drop GUI builder for GUIslice
Other
166 stars 35 forks source link

Generated source code invalid #116

Closed kinafu closed 3 years ago

kinafu commented 3 years ago

Bug description Creating a text button with disabled flash API and UTF-8 enabled results in an invalid source code.

To Reproduce Download my project.zip or follow the steps to reproduce the behavior:

  1. Create a project in GUISlice builder
  2. Add a text button
  3. Enable UTF8 and disable flash API
  4. Generate source code

Expected behavior Generated .h source file should contain a button with

  // create E_ELEM_BTN1 button with text label
  pElemRef = gslc_ElemCreateBtnTxt(&m_gui,E_ELEM_BTN1,E_PG_MAIN,
    (gslc_tsRect){30,150,80,40},(char*)"flash",0,E_TI_5X8PT7B,&CbBtnCommon);

  gslc_ElemSetTxtEnc(&m_gui,$<COM-019>,GSLC_TXT_ENC_UTF8);

The gslc_ElemSetTxtEnc() call contains invalid code.

Version

Pconti31 commented 3 years ago

@kinafu Well, this is a good news bad news type of situation. If you look at the readme on the release page for HOTFIX 0.15.b005 of the Builder's repository you might notice

Bug No. 186 selecting UTF8 enable causes code gen to output $<COM-019> instead of pElemRef

This is now fixed with the current release 0.15.b005.

Now the bad news. If your target is arduino the Adafruit GFX drivers and fonts do not support UTF8. Notice all of the fonts have names ending in "7b.h". This means 7 bit ascii and UTF8 requires 8 bit support. Currently, only Raspberry PI with ttf (truetype) fonts work out of the box.

Now, if you are using a ESP8266, or ESP32 with TFT_eSPI drivers instead of Adafruit, I believe it supports UTF8 font if one exists. You would need to look over its examples. Still even if you create a UTF8 font and get it to work with TFT_eSPI I'm not sure GUIslice API would support it without changes. You might have to ask Calvin in his GUIslice API repository issues section for support. But I wouldn't ask until you had something working with TFT_eSPI without GUIslice.

I don't actually support GUIslice API so I can't help you out any further. Paul--

kinafu commented 3 years ago

I'll install the updated version and will probably further experiment with the TFT_eSPI utf8 support and maybe later with GUISlice utf8.

Thanks a lot for your comprehensive response and your amazing work!