Problem with getting new font to work

The Dot Matrix Display (DMD) is a 32x16 array of high-brightness LEDs for visually striking effects. [Product Page]
Post Reply
RadioDJ
Posts: 11
Joined: Fri Sep 27, 2013 5:56 pm

Problem with getting new font to work

Post by RadioDJ » Sat Oct 12, 2013 4:26 pm

I have create a new font with GLCDFontCreator2 based on Ariel with a size of 32*32, named the file Arial_Fet_32.h
When I looked in the new file and in the old Arial_black_16.h it looks simular.
But when I try to get it into Arduino by : #include "Arial_Fet_32.h" and later in the loop: dmd.selectFont(Arial_Fet_32); I get an error when I try to compile it. 'Arial_Fet_32' was not declared in this scope.

Can't I use my own font? or what have I done wrong??

TheRevva

Re: Problem with getting new font to work

Post by TheRevva » Sun Oct 13, 2013 3:06 am

I'd need quite a lot more detail to really help...
Perhaps you could post up your actual code (using the code tags in the forum so that it's a bit more 'readable')

Edit:
Just removed all my prior edits to this post... They were all BS anyway!

RadioDJ
Posts: 11
Joined: Fri Sep 27, 2013 5:56 pm

Re: Problem with getting new font to work

Post by RadioDJ » Sun Oct 13, 2013 6:31 am

Okej.
Here it was I have done.
I have use the original test example from cjdDMDb and just modified it with 2 lines.
I have put 1 more line just to include the new font and then I have modified 1 line in the loop.

I post the modified code here along with the new fontfile and hope that will help you to solve my problem.

Please rename the dmd_demo_2_panel_testing.txt to dmd_demo_2_panel_testing.pde.

I have tried with Arduino 1.0.4 and 1.0.5,
Attachments
Arial_Fet_32.h
(40.71 KiB) Downloaded 128 times
dmd_demo_2_panel_testing.txt
(6.04 KiB) Downloaded 116 times

TheRevva

Re: Problem with getting new font to work

Post by TheRevva » Sun Oct 13, 2013 8:41 am

RadioDJ wrote:Okej.
Here it was I have done.
I have use the original test example from cjdDMDb and just modified it with 2 lines.
I have put 1 more line just to include the new font and then I have modified 1 line in the loop.

I post the modified code here along with the new fontfile and hope that will help you to solve my problem.

Please rename the dmd_demo_2_panel_testing.txt to dmd_demo_2_panel_testing.pde.

I have tried with Arduino 1.0.4 and 1.0.5,
OK, the FIRST immediate issue I see is the the ACTUAL name of the font isn't Arial_Fet_32
Instead, it's named Arial_32
(
The actual 'name' of the font is NOT taken from the name of the Arial_Fet_32.h include file. Instead, the name is the variable name of the byte array INSIDE that include file.
Take a look at line #48 of Arial_Fet_32.h and you will see that the given name is Arial_32
)

Therefore, you either need to change the name of the font in the include file (on line 48 as above)
-or-
You can change the name of the font within your dmd_demo_2_panel_testing.c (on line # 89).
Currently, this line reads:

Code: Select all

   dmd.selectFont(Arial_Fet_32);
and you'd change it to read:

Code: Select all

   dmd.selectFont(Arial_32);
Go try that and, if you get some OTHER (new?) problem, just ask here!

RadioDJ
Posts: 11
Joined: Fri Sep 27, 2013 5:56 pm

Re: Problem with getting new font to work

Post by RadioDJ » Sun Oct 13, 2013 1:01 pm

It works.
Thanks a lot.

So I must look in the font-file (.h) to see what name it has got when I make a new one?

TheRevva

Re: Problem with getting new font to work

Post by TheRevva » Mon Oct 14, 2013 6:16 am

RadioDJ wrote:It works.
Thanks a lot.

So I must look in the font-file (.h) to see what name it has got when I make a new one?
Well, that would be ONE way to do it...
I am _assuming_ that you use the glcd_fontcreator2 (java version) to create fonts.
You might notice that when you select File / New Font, it ask you to give the font a name and THIS is the name it will use for the content when it generates the font file.
The confusing aspect is that when you finally decide to 'export' the font (using the export menu option), you can type in ANY name you want. Perhaps it would have been wiser for the program to supply a 'default' name being the given font name with a ".h" suffix appended.
i.e. If you had originally named the font "MyFont" when you started creating it, then when it comes time to 'export' the font, the system would provide a default filename of "MyFont.h" (which you could, of course, still override!)

plekotho
Posts: 1
Joined: Fri Jul 27, 2018 6:00 am

Re: Problem with getting new font to work

Post by plekotho » Fri Jul 27, 2018 6:26 am

It does not work for me. Im using yours Arial_32 fonts.
I've put the .h file inside the dmd2 library <Arduino\libraries\DMD2\fonts\Arial_Fet_32>

but when I compile the code :

#include <fonts/Arial_32.h>

it shows an error.

Error: No such file or directory

I have put the .h file outside the fonts folder, and change the code to
#include "Arial_32.h"
But keep getting the same error.

pls Help

Brissieboy
Posts: 131
Joined: Fri Sep 20, 2013 7:25 am

Re: Problem with getting new font to work

Post by Brissieboy » Fri Jul 27, 2018 11:36 pm

Supposedly the <brackets> tells the pre-compiler to look in the default include directory, "quotes" tells it to look in your working directory (where your .ino file is) but I think it will also look in the default include directory if it doesn't find the file.
When it is a newly added file, you do need to restart the Arduino application for it to be able to find the file.
Are the font file names exactly matching, including case? Are other #includes working for you?
Try placing the font file in the working directory and use "quotes" to see if that works - it should. That should give you some more clues.

Post Reply