efontWrapper for ESP32
๐ Overview
I have turned the efont library into a class library.
I derived efontWrapper from the Adafruit_GFX library or the TFT_eSPI library.
๐จ How to use
๐ Copy the efont library to the library folder
Arduino
Copy the efont library to the library folder
C:\Users\{{username}}\Documents\Arduino
PlatformIO
Edit the platformio.ini file.
lib_deps =
https://github.com/m5stack/M5StickC-Plus.git@0.0.2
https://github.com/tanakamasayuki/efont.git
๐ Modify efontWrapper.h
๐ Using TFT_eSPI Library
If you are using the M5Display
library with M5Stack or M5StickC to control any display unit, change TFT_eSPI
to the derivation source and use EfontWrapper
Class.
To make the change effective, modify the preprocessor in efontWrapper.h
as follows
# define TFT_ESPI
๐ Using Adafruit_GFX Library
If you are using the Adafruit_GFX library to control any display unit (LED matrix, TFT display, etc.) with the ESP32, you should change the derivation of Adafruit_GFX to use the EfontWrapper
class.
To make the change effective, modify the preprocessor in efontWrapper.h
as follows
# define ADAFRUIT_GFX
๐ Select a font
You can modify the following preprocessor to select the efont Unicode BDF Font Data
you want to use.
# define EFONTENABLEJAMINI
~
# if defined(EFONTENABLEALL)
# include <efontEnableAll.h>
# endif
# if defined(EFONTENABLEASCII)
# include <efontEnableAscii.h>
# endif
# if defined(EFONTENABLECJK)
# include <efontEnableCJK.h>
# endif
# if defined(EFONTENABLECN)
# include <efontEnableCn.h>
# endif
# if defined(EFONTENABLEJA)
# include "efontEnableJa.h"
# elif defined(EFONTENABLEJAMINI)
# include <efontEnableJaMini.h>
# endif
# if defined(EFONTENABLEKR)
# include <efontEnableKr.h>
# endif
# if defined(EFONTENABLETW)
# include <efontEnableTw.h>
# endif
๐ใApply a patch to the M5Display library
I have made modifications to the M5Display
class library in order to use efontWrapper.
The version of the M5StickCPlus library is 0.0.2.
Please apply the following patch to M5Display.cpp
and M5Display.h.
Execute the following command in the directory hierarchy where the two files are located.
git apply 0.0.2toDiff.patch
The M5Display
class is derived from the TFT_eSPI
class.
I have modified the class from which the M5Display
class is derived (TFT_eSPI
) to change it to the EfontWrapper
class at compile time.
๐ License
This software is released under the MIT License.
๐ค Author
If I can contribute something to you, I will be happy.
Serenity Prayer
God, grant me the serenity to accept the things I cannot change
courage to change the things I can,
and wisdom to know the difference.
Reinhold Niebuhr