From da0aa6d5448a10361e706429e75f87eef6a5af08 Mon Sep 17 00:00:00 2001 From: nopnop2002 Date: Wed, 11 Sep 2024 07:36:24 +0900 Subject: [PATCH] Update README.md --- BdfFontDemo/README.md | 81 ++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/BdfFontDemo/README.md b/BdfFontDemo/README.md index 179c279..b40d9fd 100644 --- a/BdfFontDemo/README.md +++ b/BdfFontDemo/README.md @@ -5,7 +5,7 @@ ![BdfFontDemo-3](https://github.com/user-attachments/assets/4dbb6f39-ae0f-4ca2-9e55-ba32476b018e) u8g2 is a great Library for monochrome displays. -This library contains a large number of BDF format fonts. +This library contains a lot of BDF format fonts. This project is a demo that displays BDF format fonts. # How to use BDF Font @@ -17,49 +17,50 @@ This project is a demo that displays BDF format fonts. - Convert BDF font files to header files. I used [this](https://github.com/pixelmatix/bdf2c) repository. - ``` - cc -o bdf2c bdf2c.c - - ./bdf2c -n ncenR12 -b < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/bdf/ncenR12.bdf > main/ncenR12.h - - ./bdf2c -n timR12 -b < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/bdf/timR12.bdf > main/timR12.h - - ./bdf2c -n battery -b < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/battery/battery19.bdf > main/battery.h - - ./bdf2c -n emoticons -b < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/emoticons/emoticons21.bdf > main/emoticons.h - - ./bdf2c -n Scroll_o_Sprites -b < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/pbm/Scroll-o-Sprites.bdf > main/Scroll-o-Sprites.h - ``` +``` +cc -o bdf2c bdf2c.c + +./bdf2c -n ncenR12 -b < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/bdf/ncenR12.bdf > main/ncenR12.h + +./bdf2c -n timR12 -b < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/bdf/timR12.bdf > main/timR12.h + +./bdf2c -n battery -b < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/battery/battery19.bdf > main/battery.h + +./bdf2c -n emoticons -b < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/emoticons/emoticons21.bdf > main/emoticons.h + +./bdf2c -n Scroll_o_Sprites -b < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/pbm/Scroll-o-Sprites.bdf > main/Scroll-o-Sprites.h +``` - BDF font files can be viewed with the following command. - ``` - ./bdf2c -B < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/bdf/ncenR12.bdf | more - - ./bdf2c -B < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/bdf/timR12.bdf | more - - ./bdf2c -B < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/battery/battery19.bdf | more - - ./bdf2c -B < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/emoticons/emoticons21.bdf | more - - ./bdf2c -B < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/pbm/Scroll-o-Sprites.bdf | more +``` +./bdf2c -B < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/bdf/ncenR12.bdf | more + +./bdf2c -B < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/bdf/timR12.bdf | more + +./bdf2c -B < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/battery/battery19.bdf | more + +./bdf2c -B < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/emoticons/emoticons21.bdf | more + +./bdf2c -B < $HOME/u8g2-hal-esp-idf/examples/i2c/components/u8g2/tools/font/pbm/Scroll-o-Sprites.bdf | more +``` - Add header files. - ``` - #include "ssd1306.h" - #include "ncenR12.h" - #include "timR12.h" - #include "battery.h" - #include "emoticons.h" - #include "Scroll-o-Sprites.h" - ``` +``` +#include "ssd1306.h" +#include "ncenR12.h" +#include "timR12.h" +#include "battery.h" +#include "emoticons.h" +#include "Scroll-o-Sprites.h" +``` - Show BDF Font - ``` - ssd1306_clear_screen(&dev, false); - ssd1306_contrast(&dev, 0xff); - show_bdf_font_text(&dev, __ncenR12_bitmap__, "Hello World", 0, 0); // You can change font file - show_bdf_font_code(&dev, __battery_bitmap__, 48, 100, 0); - show_bdf_font_code(&dev, __battery_bitmap__, 49, 110, 0); - show_bdf_font_code(&dev, __battery_bitmap__, 50, 120, 0); - ``` +``` +ssd1306_clear_screen(&dev, false); +ssd1306_contrast(&dev, 0xff); +show_bdf_font_text(&dev, __ncenR12_bitmap__, "Hello World", 0, 0); // You can change font file +show_bdf_font_code(&dev, __battery_bitmap__, 48, 100, 0); +show_bdf_font_code(&dev, __battery_bitmap__, 49, 110, 0); +show_bdf_font_code(&dev, __battery_bitmap__, 50, 120, 0); +```