NEW Adafruit_mfGFX multifont library


Hi! RWB,
Did you ever get this running on the teensy 3.1? I am struggling. I am now going line by line through the standard GFX library and this one, to try and find differences that are broken. But I’m not much of a coder, so I dont know if I’ll get far.

I have the weirdest errors, for example, that “Adafruit_mfGFX” doesn’t exist as a file, when I’m included in the sketch folder and elsewhere. Seems to be some conflicts but I removed the _robots conflicts, plus mfGFX shouldn’t have the conflict problems that the default GFX has.

I apologize if I should just be doing a PM, but I thought I’d keep the conversation about this running on a teensy 3.1 open. I am new here, just found the post in a vain attempt to try and do a proper large font implementation (as opposed to crudely drawing all my fonts as bitmaps that I try to corral together and parse strings for.)


I do have it working on the Teensy 3.1.

I did have to remove the robot library to get it working.

What type of LCD screen are you using?

You may just have to copy the contents of the Adafruit_mfGFX over to the regular Adafruit_GFX folder. I think that is what I did but I’m not really sure since I don’t remember. I’m on vacation now but reply back and I’ll try to help you out and look at exactly what I did and post it up. I was planning on doing a tutorial on this anyways.


That’s pretty cool to hear! I’m encouraged to hear that it is possible; I must have just been doing something wrong.

So far the first thing I noticed on the new stab at it is that I needed to comment “applications” out. If I was more thorough I would have noticed this mentioned on this page. I had a bunch of other compiling errors but those were my mistakes and sequentially got all of mfGFX copied to standard GFX while also going line by line so I have a better idea whats going on.

I was working through a number of compile errors, I’m sure I’m probably making the mistakes. But, for now, my as-of-yet-unsolved error is the fonts.ccp file. The compiler is really unhappy with “'const FontDescriptor” and goes to say for each of them " error: too many initializers for ‘const FontDescriptor’"

Anyway I’m at a bit of a loss and will take another stab later today, but I appreciate just that you got it working and that encouraged me to try a few more things. I realize you’re on vacation and I dont mean to bother you too much.

I am running a 5" TFT screen by the way, using the RA8875 board/chip. So I’m really looking forward to some higher resolution fonts :).


Here is a link to the Arduino Version of this GFX library which allows you to use custom fonts.

This library was created by @peekay123 and you can find the libarary here


(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)


(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)


(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)


1.) @Tomek this forum is more for Spark related discussion. It’s great to have you here and members to help you along but let’s keep this as minimal as possible. :smiley:

2.) @RWB, consolidate your threads all into one if you will? Or even post them in Gist and simply share the link.

3.) If we continue the discussion in this thread, people using Spark core and wanting to use this library is going to face an issue.



@Tomek and @RWB, I agree with @kennethlimcp. You need to start a topic on the Teensy forum! I would gladly create a github repo for the Arduino/Teensy specific library if you guys want. :slight_smile:


There is no solution on the teensy forum! That would be a waste of time.

A Github link to @Peekay123 's Arduino library version would be ideal. Then I could delete my post.

This topic is pulling people in to the Spark forum because it’s been indexed in Google so it’s coming up when people search for ways to use different fonts with the GFX library. This thread provides the only workable way to use custom fonts with the GFX library with Arduino or Spark devices.

I suspect these questions will continue to pop up but a link to the Arduino version should help a lot of people out upfront.


Hi @peekay123 Some of the LCD displays include a font rom. Have you looked into using the fonts on them? I wonder if they support copying directly from the font rom into the screen buffer? It may speed up the display.

Thanks for making this library available. I have ported the ILI9341 library. I can make that available if others want it.


Hi everyone. I took the liberty of making the thread on the adafruit forum.
I chose the adafruit forum because I saw it as a more general “using this library with other MCUs” thread than a teensy specific thread. I’ll hear back from the mods if that’s a correct use of their forums. The teensy forums are awesome and have helped me many times, but I think I could also understand RWBs note (which seemed to imply/reference) that useful information can sometimes get lost in the teensy forums.

For now I basically have a preamble on the thread, because I realized I should make sure everything is working 100% for me and I understand why not if not, before I upload RWB’s files there.

But, to RWB, all I had to modify was the RA8875 library to include “mfGFX” instead of “GFX” and I was up and running, compiled at least. Thanks! I have a copy of my fonts library and yours, and I’ll eventually try to diagnose why it wasn’t compiling right yesterday. Yours does.

So this is me wrapping up my personal derailing of this thread. Spark core seems awesome though! Next time perhaps I won’t be derailing the thread for a different MCU but just joining in on the spark discussion :stuck_out_tongue:


Now, fun times, I’m back with a relevant general comment on this library.
I couldn’t find anyone discussing it before, so I’m just going to throw it out there:
I’ve noticed there’s a size limit on the font that people should be aware of.

Personally I went through a little game of testing font sizes after I found pt.144 size (0-9 set) wasn’t displaying properly. The digits seemed to immediately try to go vertically down, as if this problem related to scrolling perhaps [edit: just tried settextwrap(0) doesn’t help]. pretty quickly it just becomes a mash of pixels though for a moment while they’re loading the first few they seem sensible.

The problem starts somewhere between pt.120 and pt.127 size font, because pt.120 works and anything at or over pt.127 doesn’t work for me (pt.127,128,144, and I think one other were tried.) This is for digits 0-9 with Verdana font.

Fonts these size or larger take a stupid amount of space, but personally I found a couple giant digits useful for my project. I don’t consider this a major problem, but I’m throwing it out there because anyone who starts right away with a larger than pt.120 size font will not necessarily know the problem. So more of a “note” than a report of a problem.:slight_smile:


I’m getting an SOS error with 1 red blink when using the default mfGFX library when the default TEST font is used. Any ideas, whey the default TEST font would cause this?


@wesner0019, any chance you can post your code via github or as gist? I would have to see what your code is doing overall. :smile:


Below is the github link. The code executes until the setFont(TEST); is ran, then the core goes into SOS mode.


@wesner0019, from what I can see in your test font, you describe the start and end chars as 0x00 and 0xFF meaning you have 255 chars defined. However, I only see 96 entries in the bitmaps and descriptor tables. You need to correctly set your start and end char values. This may be the source of your problem.


@Tomek Hey Buddy can you post some pictures of what you have done with @peekay123 's genius custom font library? I know you can do some cool stuff with it so please do share what you have created.

Also thanks for posting your feedback about the larger font sizes. I have a 3.5 inch Adafruit LCD display sitting here that I plan on using in the near future so good to know there are possible issues with fonts that large.

@peekay123 I found your Github library link for the Arduino Version of this custom GFX Library. Here it is for anybody else who comes along in the future wanting the Arduino version:

@kennethlimcp & @peekay123 I’m going to delete my code from above and replace it with a link to the Github code.


Hi RWB, I’ll post some photos in a couple hours on the adafruit page I made ( Granted it could be as good to post them here, but I figured it’s slightly off-topic in a way, well, not really, since it would just be general photos for the mfGFX library.

The larger fonts I have setup are pretty limited, because at those sizes they really are killer in size. I have a full calibri 48pt font, digits in verdana 0-9, in sizes pt.88 and pt.120, as well as occasional custom characters I wanted that basically are acting just as bitmaps. For example, I have single “x” in calibri-36 font because it was possibly easier than custom drawing an X with a few line commands. Anyway, photos will be on the adafruit page after I made a test screen showing them off.

What is the difference between the two github pages now? RWB, you linked one without the sharp memory example, but it’s the same thing right? Just without the sharp memory IO? I’ll update the adafruit page with the 2nd link .


@Tomek, do you know roughly how much flash your fonts are taking? One possibility would be to use @kennethlimcp’s FRAM shield to store fonts. The mfGFX library would need changing like what if did with the Sharp display, but it is possible. The only catch with FRAM is it does work over SPI and has to live with other SPI devices which is not usually a problem. It also does slow down character display time since data needs to be pulled off the FRAM via SPI.

Another possibility is to use the flashee-eeprom library for storing fonts on the external flash. Not sure if anyone has attempted that yet. It could be a cool discussion with @mdma to have! :smile: