Including a new font

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
Post Reply
plito
Posts: 19
Joined: Sat Sep 23, 2017 8:24 pm

Including a new font

Post by plito » Tue Jan 09, 2018 4:32 pm

I create a new font to use it with DMD2 but on compilation says " Arial15 was not declared in this scope " . I use #include <fonts/Arial15.h> at the begin as the others fonts but it doesn´t let me compilate it. Am I missing something ? The font is in the same directory that the others. Plase somebody explain me. Thanks

User avatar
stryker
Posts: 268
Joined: Sat Jan 14, 2012 2:44 pm

Re: Including a new font

Post by stryker » Wed Jan 10, 2018 8:09 am

Hi @plito
I've always used the alternative #include syntax

Code: Select all

#include "Arial_black_16.h"
so perhaps try

Code: Select all

#include "fonts/Arial15.h"
I just checked now, and even in our newer projects where I use the quoted syntax and DMD2, our custom fonts contained within the older DMD library directory are found and used okay by the IDE. Reading the C++ reference here I can't think of any satisfactory reason why one way would work over the other, just that the quoted syntax is the way I've always followed.

If that doesn't fix it, as I suspect, can you include your custom font file here to make sure it's not something fractured in there that's stopping it?

Geoff

plito
Posts: 19
Joined: Sat Sep 23, 2017 8:24 pm

Re: Including a new font

Post by plito » Sun Jan 21, 2018 3:50 pm

Thank you Geoff. I´ll try it and then I´ll tell you.

plito
Posts: 19
Joined: Sat Sep 23, 2017 8:24 pm

Re: Including a new font

Post by plito » Sun Jan 21, 2018 4:16 pm

Geoff. It doesn´t work putting "" . Now the compilation allow the header #include "fonts/Arial15.h" but give error when I put dmd.selectFont(Arial15) into the setup() , says " Arial15 was not declared in this scope " . I don´t understand why. Sorry for my english. Thanks

User avatar
stryker
Posts: 268
Joined: Sat Jan 14, 2012 2:44 pm

Re: Including a new font

Post by stryker » Mon Jan 22, 2018 6:06 am

Please upload your font file and I'll give it a try

plito
Posts: 19
Joined: Sat Sep 23, 2017 8:24 pm

Re: Including a new font

Post by plito » Tue Jan 23, 2018 12:52 pm

Arial_Black_15.h
(12.05 KiB) Downloaded 66 times
This is the font I´d modified. If I name it Arial_Black_16.h ( as the original ) it works, but if I call it with another name , doesn´t let me compile it.
Thank you Geoff

User avatar
stryker
Posts: 268
Joined: Sat Jan 14, 2012 2:44 pm

Re: Including a new font

Post by stryker » Wed Jan 24, 2018 2:32 am

Did you see that all the font references in this file are called that still? When you #include this font, the file name is not relevant to the compiler but the content is...these lines will mean you're defining a font called Arial_Black_16 regardless what your filename is therefore.

Code: Select all

#ifndef ARIAL_BLACK_15_H
#define ARIAL_BLACK_16_H

#define ARIAL_BLACK_16_WIDTH 10
#define ARIAL_BLACK_16_HEIGHT 16

static const uint8_t Arial_Black_16[] PROGMEM = {
Change those, and you should be good to go :D
Geoff

plito
Posts: 19
Joined: Sat Sep 23, 2017 8:24 pm

Re: Including a new font

Post by plito » Wed Jan 24, 2018 9:50 pm

Thank you Geoff. I´d changed the character bytes but I didn´t know what you explain me. Thank you again.

Post Reply