NEW Adafruit_mfGFX multifont library


Where can one get some for testing?


@frlobo I think the best way to go is to get this breakout board:

Then pick what size memory LCD you want to test and then buy them from Digikey or Mouser.

Adafruit sells one but its only 96x96 pixels and its the mirror reflective finish which in my opinion is not as easy to read as the black and white versions and that’s why I recommend buying the parts individually.


Hi peekay123,
Because of the slow speed of the arduino Mega I switched over to the Arduino Due (32 bit 84 MHz) and expected to get it working after compiling for this processor after deleting the EEProm lines I used. But this is not the case, The compiler complains about errors in fonts.cpp . Do you know of any way to solve this problem? These problems are not there when compiling for Arduino Mega.
Best regards,
Jan Mulder


@dalojan, this forum is for Particle devices, not Arduino. I posted an Arduino version of the mfGFX library in my github here:

If you are having problems, post an issue in the repo please :wink:


Hi @peekay123,

@amacasas and I are working on a project using your awesome mgGFX library. We are using several fonts all of them define in the firmware binary. Unfortunately, we are running our of space. Our binary is hitting 128kb.

Do you have any guidance (or an example :smile:) on how to load the fonts from a SD card into the Photon’s flash memory?



@sazp96, unfortunately, the mfGFX library uses flash based fonts. To put them on SD would require a rewrite and would be slower due to SPI speed. Using an external eeprom similar to the Core’s might be a better options speed-wise. You could use @mdma’s flashee-prom library to download font data and then adapt mfGFX to read it from there instead.

I would recommend looking at a “smart” display or HMI like a Digole unit or a Nextion one. There is also the more expensive 4D Systems units. These offload a lot of display processing to the display itself.


Thanks for the advice @peekay123!

I understand how reading the fonts from the SD card using SPI every time they will be use will be very slow. But would it be possible to read the font once during Setup() and store it on a variable? Then the font would be in the 1MB of Flash memory and would be accessible very fast, right?

Is that doable?


I don’t know if this would help in your situation, but I needed some large numbers (72 point) and a few special characters, and basically choked an application on the Core, But since I had no use for the rest of the font, I created a custom version that was only numbers and the characters I needed, this saved a lot of space and allowed me to continue. I can give some pointers on how to do this and even how to use some characters beyond the 7F boundary, if you think it would help.


Thanks for the tip. Unfortunately I do need all the letters and numbers. :frowning:


@sazp96, IF you flash the font info to external flash (eg. P1 1MB flash) either via a program or DFU (@mdma would need to confirm this one), AND you adapt the mfGFX library to fetch font data from the external flash then it should work. Note that with the newest SDFat library, getting 3MB/s+ data read throughput is possible since it uses DMA. The P1 external flash is also on SPI but doesn’t use DMA as far as I know. So speeds would be comparable IMO.


Apologies if this has already been addressed but I searched and couldn’t find it.

The drawBitmap function only seems to work for image widths in multiples of 8. Otherwise, it skews the following lines.

I’ve looked at the code and I can see the relevant code but I’m a little rusty on bitwise operators, I’m sure someone else will spot the issue in a second…

int16_t i, j, byteWidth = (w + 7) / 8;

  for(j=0; j<h; j++) {
    for(i=0; i<w; i++ ) {
      if(pgm_read_byte(bitmap + j * byteWidth + i / 8) & (128 >> (i & 7))) {
	drawPixel(x+i, y+j, color);


@Nemiah, that code is from the original Adafruit_GFX library. They may have addressed this in their latest library which also supports multiple fonts. However their font tools sucks big time and can only be used on linux and only if you know what your doing.


I got it from the mfGFX lib on Particle, it uses dot maker or something for fonts, I actually got that part working no problems, it just the display of bitmaps I’m struggling with, I didn’t think to check the adafruit lib though, I’ll see if there’s an updated version.


@Nemiah, what I was trying to say is I modified the (older) Adafruit_GFX code to add multi-font support. As such, I didn’t modify any of the standard functions so as to keep compatibility.


@Peekay123 Came across this and figured I would post it here since the new Adafruit library now supports custom fonts. I figure the more ways to do this the better.

Personally I just use 4DSystems LCD displays cause all this is built in.


@RWB, the new Adafruit library rocks except for the fact that the custom font creator runs on (some) linux OS and is really not intuitive or supported. Now I noticed that someone has put out a web-based font creator. I’ll be testing this on the Photon, especially now since port the library will be easier with Arduino compatibility!


@peekay123 I’m messing with the Memory LCD + Boron in low power sleep modes.

I’ve found a way to use Icon Font’s to easily load premade Bitmap images onto the LCD screen.

I’m trying to load fonts with only numbers 0-9 and nothing else to save on memory space.

Based on your post above do I need to change the start and end chars to the number of actual individual characters I’ve loaded into the font bitmap array?

So for 0-9 only I need to set the start and end char array to 0x00 - 0xA to get this to work right instead of the default 0x00 - 0x7F for a 127-byte alphanumeric array?


Yes if I recall correctly.


So the start and end char numbers need to match the numbers or letters of the range that has been exported by TheDotFactory software?

So for numbers 9-0 on the ASCII table I had to put 0x30, 0x39, // Start Character, End Character to get it to work right.

It all makes sense now after playing around with this for too many hours per day :smile:


@peekay123 @rickkas7 I have hit the limits of the Borons Memory as far as loading bitmap images and custom large fonts during testing.

Is there any other place I can store the bitmap images on the Gen3 devices that would allow more space for Bitmaps to be stored and allow full updates via a remote OTA Firmware flash?