5x5 Font for NeoPixel Matrix

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jefe_de_estado
 
Posts: 6
Joined: Fri Oct 05, 2012 2:18 pm

5x5 Font for NeoPixel Matrix

Post by jefe_de_estado »

I'd really like to use my matrix in a horizontal orientation, but that means I need a font that is no taller than 5 pixels high. I've dug around hoping someone already had the code written so I can just copy/pasta, but I can't find it anywhere. Anyone know of where I can get the code? There are plenty of 5x5 fonts on dafont.com, but it would save me loads of time if I didn't have to do all the code.

Thanks for any help!

Pixellated
 
Posts: 25
Joined: Wed Jul 30, 2014 8:54 am

Re: 5x5 Font for NeoPixel Matrix

Post by Pixellated »

Hi, I'm looking for the same, really hoping someone can chime in. I found a font code that was formatted the same as the one in glcdhont.c, but it didn't work, just scrolled gibberish. I think it's more complex than just dropping a 5x5 format into the glcdfont.c file... but then again I'm not fluent in ASCII or hex code, whichever or whatever those are.. I wish the glcdfont.c file had notations so I could try dropping in individual letters into their respective spots, such as replace 5x7 "a" with 5x5 "a". I may have been replacing "!" with "a" ..or "f" with "<" if that makes any sense.

I just wanted to add, that if you are desperate, you can use a mix of upper and lower case letters, and also modify the matrix.setCursor(x, 0); line in the matrix test example to make the text mostly legible. Depending on my orientation I can change the 0 value to 1, 2, -1, or -2 and it helps tremendously. Rather than chopping off the bottom it chops off the tops of letters and depending on the letter you can try upper or lower case, and it works okay. Letters with long extenders are still horrible though, such as d, p, f, etc.

Since I only need to scroll a maximum of 2 or 3 phrases, I may just bang out code to force the words I want to appear, and just not use the Neomatrix library at all.

User avatar
jefe_de_estado
 
Posts: 6
Joined: Fri Oct 05, 2012 2:18 pm

Re: 5x5 Font for NeoPixel Matrix

Post by jefe_de_estado »

I came across this post on the Arduino forum:

http://forum.arduino.cc/index.php/topic,187563.0.html

It looks like he's got a map of the characters, but the gfx font file doesn't list out individual characters, just a long list of hex codes... They didn't have a solution in this post. Moving x and going with all lowercase may work for me. But for some reason I can only get it to display 7 characters. Any idea there?

Pixellated
 
Posts: 25
Joined: Wed Jul 30, 2014 8:54 am

Re: 5x5 Font for NeoPixel Matrix

Post by Pixellated »

Yes, I had this issue for some time and the program's notations do not make it clear.

I am at work right now and cannot view the code, but it's a very simple fix. You need to increase a value for a number in order to use more characters. I think it's something width, or something something width. It is almost directly under the "howdy", or the line I mentioned above...I cannot recall. I want to say the default value is aorund 35, and you need to increase that for longer strings. I will give a better reply late this morning.

Pixellated
 
Posts: 25
Joined: Wed Jul 30, 2014 8:54 am

Re: 5x5 Font for NeoPixel Matrix

Post by Pixellated »

You probably already figured it out, but for more than 7 characters change this line to a bigger number, too big and it'll have a delay after the word or phrase, too small and letters are cropped out.

if(--x < -36) {

it's directly below "Howdy".

User avatar
jefe_de_estado
 
Posts: 6
Joined: Fri Oct 05, 2012 2:18 pm

Re: 5x5 Font for NeoPixel Matrix

Post by jefe_de_estado »

I didn't get much time to work on it last week. Hopefully more this week. How does that number relate to the number of characters? Just guess until it's right?

User avatar
jefe_de_estado
 
Posts: 6
Joined: Fri Oct 05, 2012 2:18 pm

Re: 5x5 Font for NeoPixel Matrix

Post by jefe_de_estado »

Spent way too much time on this... Here's the font file that has been edited such that 0-9 and A-Z (caps only) will fit a 5x5 grid. It's based on a 5x5 font from dafont.com. If you care to change the entire fontset, here's how I did it. Download this: http://www.codehead.co.uk/cbfg/ and use it to create a bmp of whatever font you want (in my case, the 5x5 font from dafont). Have it spit out the bmp, I don't think it matters what size as long as you get all the symbols you are looking for. Make sure the background color is white and letters are black. Next download: http://en.radzio.dxp.pl/bitmap_converter/ this program. Use it to open the bmp you created. It will spit out a file that is really close to what you want. Now for the 'fun' part.... You have to figure out what each character is in the original glcdfont.c file, and what each character is in the new file you just made. Copy/pasta characters into the right places in the glcdfont.c file.... whammo! 5x5 font! I'm sure someone out there smarter than me has a better way to do it, but this worked.
Attachments
glcdfont.c
(9.59 KiB) Downloaded 698 times

User avatar
jefe_de_estado
 
Posts: 6
Joined: Fri Oct 05, 2012 2:18 pm

Re: 5x5 Font for NeoPixel Matrix

Post by jefe_de_estado »

It's too late... I forgot to say how I translated the glcdfont.c file..... import the file into excel as a csv file, edit all the data to get rid of all the 0x (seriously excel, you can't just ignore that?). Use =HEX2BIN() function for each value, 5 col high for each row of hex numbers. Hold your laptop sideways and stare really hard and try to figure out what each character is. yeah... no fun....

Pixellated
 
Posts: 25
Joined: Wed Jul 30, 2014 8:54 am

Re: 5x5 Font for NeoPixel Matrix

Post by Pixellated »

Dude, awesome! I would almost consider asking thew moderators to do something with this, it's not the first time I've seen someone ask for a 5x5 font! Love it! Thanks for sharing.

If you're open to suggestions I would ask for a "space" that is less than 5 pixels, if that makes sense, like if you could convert the " . " to nothing but a 2 pixel space. Not even display a "." just a shortened " " ...Sometimes I feel as if the space is too long when having phrases.

Again, thanks so much for sharing! Rock on!

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”