UGUI icon indicating copy to clipboard operation
UGUI copied to clipboard

https://github.com/deividAlfa/UGUI adds UTF-8 support, new font structure to allow font stripping, ranges...

Open deividAlfa opened this issue 3 years ago • 14 comments

Given this project seems no longer alive, I'm providing the fork for anyone who might be searching new enhancements... https://github.com/deividAlfa/UGUI

deividAlfa avatar Oct 07 '21 16:10 deividAlfa

Nice, UTF-8 support is great!

I also have a fork, https://github.com/0x3333/UGUI, with those features:

  • Fonts, Components, Colors have been externalized to a separated file
  • Pseudo Theme created(See ugui_theme.h)
  • Added flush function. In case the display driver uses Framebuffer, this function will be called after UG_Update is called
  • Prefixed all defines with UGUI_
  • Touch support is optional using UGUI_USE_TOUCH define
  • Added UGUI_USE_COLOR_BW for monochromatic displays, also added theme support
  • Added X11 Simulator. Based on the fork https://github.com/MarioIvancic/UGUI. Tested only on MacOS 10.14.
  • Added Simulation config
  • Added Simulation example
  • Added Function to convert from RGB565 to RGB888
  • Added a check to UG_DrawRoundFrame, draw a rect frame in case radius 0
  • Added ProgressBar object
  • Console support is optional using UGUI_USE_CONSOLE define.
  • Created a UG_DEVICE struct to hold device information.

0x3333 avatar Oct 07 '21 18:10 0x3333

Nice! Will have a look, shouldn't be too hard to add the code. This library deserves more attention!

deividAlfa avatar Oct 07 '21 19:10 deividAlfa

I've checking your code. The externalization actually complicates things. Instead of simply including ugui.h, you have to include:

#include "ugui.h" #include "ugui_button.h" #include "ugui_checkbox.h" #include "ugui_textbox.h" #include "ugui_image.h" #include "ugui_progress.h"

Which is a poor implementation. it should be simpler. Giving some issues due that...

deividAlfa avatar Oct 08 '21 11:10 deividAlfa

Sure, I had this in my backlog for a while. Thanks

0x3333 avatar Oct 08 '21 13:10 0x3333

I fixed it in a simple way: Adding the includes after the defines and typedefs ugui.h:455 #define UG_STATUS_WAIT_FOR_UPDATE (1<<0) #include "ugui_button.h" #include "ugui_checkbox.h" #include "ugui_fonts_data.h" #include "ugui_image.h" #include "ugui_progress.h" #include "ugui_textbox.h"

This works perfectly, no more messsing with includes. I'm almost done at merging my code.

deividAlfa avatar Oct 08 '21 13:10 deividAlfa

Finished! I have some simple demos using current uGUI version here: https://github.com/deividAlfa/ST7789-STM32-uGUI

Also check my ttf2ugui fork to generate fonts using the new structure. I ported the old fonts, adding a bit to disable UTF8 when these fonts are selected, as they use codepage 850 encoding.

deividAlfa avatar Oct 08 '21 20:10 deividAlfa

It is missing the simulator files, like ugui_sim_x11.c.

0x3333 avatar Oct 08 '21 20:10 0x3333

Yep, ugui_sim.c was left when uploading the files. Fixed

deividAlfa avatar Oct 08 '21 20:10 deividAlfa

Me again, missing the X11 sim, ugui_sim_x11.c. Super helpful to debug on Mac or Linux the output(I used it to print my screenshots, see README.md in my fork).

0x3333 avatar Oct 08 '21 21:10 0x3333

Yeah, I noticed that file too, I was going to update the comment but I was late

deividAlfa avatar Oct 08 '21 21:10 deividAlfa

hey,dude,you still there??I tried your enhancement.A very good job. I've noticed an issue with your program when handling CJK characters whose encoding falls above 0x8000; they fail to display. The problem doesn't seem to lie with the font array itself, but rather with the positioning logic in _UG_GetCharData, specifically the line curr_offset & 0x8000.

agugu2000 avatar May 24 '24 07:05 agugu2000

OK,let my adjust my words:when the font array contains the characters over 0x8000,device will display nothing including any asciis or latin or CJK. when regain the font array without 0x8000+,everything goes fine.

Hope there will be a fix

agugu2000 avatar May 24 '24 08:05 agugu2000

Yes, it only works with Unicode below 0x8000. I just enabled issues in the repo.

I might extend the range to full Unicode (0-65535).

deividAlfa avatar May 24 '24 08:05 deividAlfa

Dude,many many thanks

agugu2000 avatar May 24 '24 09:05 agugu2000