Yes, that works, too!
Here's a sample font library:
~/Arduino/libraries/ugfx-arduino-font-had-logos-98/
.
├── bdf
│ └── had-logos-98.bdf
├── fontdata
│ └── had-logos-98.c
├── readme.md
└── ugfx-arduino-font-had-logos.h
The font is just the hackaday prize logo (wrenched skull with helmet) from 2014 with 98 pixels height, converted from svg (I don't remember where that came from) to bmp to bdf and then to uGFX's font format using their online converter. I might add more later.
You can use just about any font you like, as long as
- you are allowed to
- you have it as a TTF or BDF file
- there's enough space left in program memory
#include "fontdata/had-logos-98.c"
The font source must not be in the root directory or in src/, because arduino would try to compile it out of context and spit out errors. That's why it's in fontdata/.In the uGFX config file (gfxconf.h) you'd have
#define GDISP_NEED_TEXT TRUE
#define GDISP_INCLUDE_USER_FONTS TRUE
and in userfonts.h:#include "ugfx-arduino-font-had-logos.h"
More can be added here, and arduino will look up the library with that header and include it. Font collections can be created by having the font header include multiple font source files.github: ugfx-arduino-font-had-logos
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.