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

Need to erase some data values #47

Open
arunyava opened this issue Nov 7, 2024 · 9 comments
Open

Need to erase some data values #47

arunyava opened this issue Nov 7, 2024 · 9 comments

Comments

@arunyava
Copy link

arunyava commented Nov 7, 2024

Hi,
This post was not and issue.
I need some help for clearing the data. I will write some string value to display. for example i wrote WELCOME' string on display. I want to erase E and M on the display. How can i achieve this. Thanks in advance!

@nopnop2002
Copy link
Owner

nopnop2002 commented Nov 7, 2024

If you draw the same character in the same position with the same color as the background color, it will disappear.

// get font width & height
uint8_t buffer[FontxGlyphBufSize];
uint8_t fontWidth;
uint8_t fontHeight;
GetFontx(fx16G, 0, buffer, &fontWidth, &fontHeight);

lcdFillScreen(&dev, BLACK);
strcpy((char *)ascii, "WELCOME");
lcdDrawString(&dev, fx16G, xpos, ypos, ascii, WHITE);
vTaskDelay(1000);
strcpy((char *)ascii, "E");
lcdDrawString(&dev, fx16G, xpos+(fontWidth*1), ypos, ascii, BLACK);
lcdDrawString(&dev, fx16G, xpos+(fontWidth*6), ypos, ascii, BLACK);
strcpy((char *)ascii, "M");
lcdDrawString(&dev, fx16G, xpos+(fontWidth*5), ypos, ascii, BLACK);

@arunyava
Copy link
Author

Thank you sir for reply. One more help. How to draw a symbol means bluetooth symbol , battery symbols like that? Is it possible to help me to do that?

@nopnop2002
Copy link
Owner

nopnop2002 commented Nov 20, 2024

A font file is required that contains symbols such as the Bluetooth symbol and battery symbol.

I think that such font files are available on the Internet.

This is a 24x24 font converted from u8g2 library emoticons21.bdf.
bdf-font-1

This is a 16x16 font converted from u8g2 library Scroll-o-Sprites.bdf.
bdf-font-2

Font File Editor(FONTX Editor)

There is a font file editor.
This can be done on Windows 10.
You can create your own font files.
Developer page is here.

This is a battery symbol font included in the u8g2 library.
Battery-5
Battery-6
Battery-1
Battery-2
Battery-3
Battery-4

@arunyava
Copy link
Author

arunyava commented Nov 25, 2024 via email

@arunyava
Copy link
Author

Unable to download FONTX editor

@nopnop2002
Copy link
Owner

nopnop2002 commented Nov 25, 2024

Perhaps your browser is blocking the download zip file.
Please review your browser settings.

You can download fontx editor from here.
http://elm-chan.org/fsw_e.html

@nopnop2002
Copy link
Owner

nopnop2002 commented Nov 26, 2024

I added IconTest example.
st7789-11

I created a PNG file with this.
https://github.com/nopnop2002/esp-idf-st7789/tree/master/battery-image

@arunyava
Copy link
Author

Can you explain "This is a 16x16 font converted from u8g2 library Scroll-o-Sprites.bdf." this one?

@nopnop2002
Copy link
Owner

nopnop2002 commented Nov 29, 2024

Import Scroll-o-Sprites.bdf included in the u8g2 library into fontx editor and save it as an FNT file.

Scroll-o-Sprites.bdf is here.

https://github.com/olikraus/u8g2/blob/master/tools/font/pbm/Scroll-o-Sprites.bdf

  • download u8g2 library
  • start fontx editor
  • import Scroll-o-Sprites.bdf
  • save as Scroll-o-Sprites.fnt
  • copy Scroll-o-Sprites.fnt to fonts directory
    FontxFile fx32S[2];
    InitFontx(fx32S,"/fonts/Scroll-o-Sprites.fnt",""); // 16x16Dot Emoji
    CodeTest(&dev, fx32S, CONFIG_WIDTH, CONFIG_HEIGHT, 0x00, 0xFF);

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

2 participants