achimdoebler / UGUI

µGUI - Open Source GUI module for embedded systems
Other
1.23k stars 421 forks source link

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

Open deividAlfa opened 3 years ago

deividAlfa commented 3 years ago

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

0x3333 commented 3 years ago

Nice, UTF-8 support is great!

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

deividAlfa commented 3 years ago

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

deividAlfa commented 3 years ago

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...

0x3333 commented 3 years ago

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

deividAlfa commented 3 years ago

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 commented 3 years ago

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.

0x3333 commented 3 years ago

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

deividAlfa commented 3 years ago

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

0x3333 commented 3 years ago

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).

deividAlfa commented 3 years ago

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

agugu2000 commented 5 months ago

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 commented 5 months ago

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

deividAlfa commented 5 months ago

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).

agugu2000 commented 5 months ago

Dude,many many thanks