Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
deividAlfa opened this issue Oct 7, 2021 · 14 comments

Comments

@deividAlfa
Copy link

deividAlfa commented Oct 7, 2021

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
Copy link

0x3333 commented Oct 7, 2021

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.

@deividAlfa
Copy link
Author

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

@deividAlfa
Copy link
Author

deividAlfa commented Oct 8, 2021

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
Copy link

0x3333 commented Oct 8, 2021

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

@deividAlfa
Copy link
Author

deividAlfa commented Oct 8, 2021

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
Copy link
Author

deividAlfa commented Oct 8, 2021

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
Copy link

0x3333 commented Oct 8, 2021

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

@deividAlfa
Copy link
Author

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

@0x3333
Copy link

0x3333 commented Oct 8, 2021

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
Copy link
Author

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

@agugu2000
Copy link

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
Copy link

agugu2000 commented May 24, 2024

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
Copy link
Author

deividAlfa commented May 24, 2024

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
Copy link

Dude,many many thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants