Bigger font for ST7565 LCD

by Scott216 on Sun Apr 15, 2012 8:55 am

I just got a ST7565 (it's my first LCD). I using it with an Arduino Mega and I want a much bigger font, maybe 48 pixels high. I really only need digits 0-9. Can anyone tell me how to get started with this? I did some searching and found some programs like bmp2glcd and FontCreater2. But I'm unfamiliar with these programs and don't know if either of them is the right way to go.
Scott216
 
Posts: 136
Joined: Sun Apr 12, 2009 10:08 am
Location: New Jersey

Re: Bigger font for ST7565 LCD

by piton86 on Tue May 01, 2012 12:14 pm

Well if you only need 0-9 maybe you can make your own bitmaps 0 to 9 and then convert the code for arduino.
piton86
 
Posts: 22
Joined: Tue Apr 10, 2012 10:06 am

Re: Bigger font for ST7565 LCD

by Scott216 on Tue May 01, 2012 12:27 pm

I think that's a good option. Do you think bmp2glcd or FontCreater2 would be good choices. Or is there a better way?
Scott216
 
Posts: 136
Joined: Sun Apr 12, 2009 10:08 am
Location: New Jersey

Re: Bigger font for ST7565 LCD

by pburgess on Tue May 01, 2012 12:36 pm

Easy: Processing!

Funny coincidence, I just had a project that required 48-pixel-tall bitmaps. This sketch prompts for a B&W image file and then outputs a PROGMEM array that can be copied-and-pasted into an Arduino sketch (just change the array name as needed). Note that this outputs the image 'sideways,' much like the 5x7 font in the Adafruit_GFX library, so your glyph-rendering code will need to work with that order.

Code: Select all | TOGGLE FULL SIZE
void setup() {
  String filename;
  PImage img;
  int    i, x, y, b, lastBit;
  color  c;

  filename = selectInput("Select image file to convert:");
  img      = loadImage(filename);
  lastBit  = img.width * img.height - 1;
  img.loadPixels();

  print("#define WIDTH00 ");
  println(img.width);
  print("PROGMEM uint8_t img00[] = {");
  for(i=x=0; x<img.width; x++) {
    println();
    for(y=0; y<img.height; y+=8) {
      print("  ");
      print('B');
      for(b=0; b<8; b++, i++) {
        c = img.pixels[(y+b)*img.width+x];
        if((c & 1) == 0) print('0');
        else             print('1');
      }
      if(i < lastBit) print(',');
    }
  }
  println(" };");
}

void loop() {
}
User avatar
pburgess
 
Posts: 2441
Joined: Sun Oct 26, 2008 1:29 am

Re: Bigger font for ST7565 LCD

by Scott216 on Tue May 01, 2012 1:30 pm

What program should I run your sketch in?

I could rotate the bitmap 90 degrees, so then the final output would come out right side up.
Scott216
 
Posts: 136
Joined: Sun Apr 12, 2009 10:08 am
Location: New Jersey

Re: Bigger font for ST7565 LCD

by pburgess on Tue May 01, 2012 1:44 pm

Processing (download free from processing.org). This looks VERY similar to the Arduino IDE, so it should be pretty familiar to use. Just watch out for those "haven't had my morning coffee" moments where you inadvertently paste Processing code into the Arduino window, or vice-versa. :D

The sketch, as written, is hardcoded for a 48-pixel-tall image, and outputs the data sideways (this made more sense because the images I'm working with vary in width, but are always that constant height, so it always works out to six bytes). So if your numbers are going to be proportionally-spaced, I'd suggest something similar, and do the 90-degree rotation inside the Arduino sketch rather than in the image conversion.
User avatar
pburgess
 
Posts: 2441
Joined: Sun Oct 26, 2008 1:29 am

Re: Bigger font for ST7565 LCD

by bikeboy929 on Fri May 18, 2012 9:54 am

here's some crappy code for some bigger numbers if you still need it, not 48 pixel though

Code: Select all | TOGGLE FULL SIZE
void writetolcdbig( int curxcords, int curycords, char thewordbig[])
{
int tempswitch = 0;
while (thewordbig[tempswitch] != 0){
 
switch (thewordbig[tempswitch]) {

case '0':
glcd.fillrect(0 + curxcords, 0 + curycords, 9, 15, BLACK);
glcd.fillrect(3 + curxcords, 3 + curycords, 3, 9, WHITE);
break;

case '1':
glcd.fillrect(0 + curxcords, 0 + curycords, 9, 15, BLACK);
glcd.fillrect(0 + curxcords, 3 + curycords, 3, 9, WHITE);
glcd.fillrect(6 + curxcords, 0 + curycords, 3, 12, WHITE);
break;

case '2':
glcd.fillrect(0 + curxcords, 0 + curycords, 9, 15, BLACK);
glcd.fillrect(0 + curxcords, 3 + curycords, 6, 3, WHITE);
glcd.fillrect(3 + curxcords, 9 + curycords, 6, 3, WHITE);
break;

case '3':
glcd.fillrect(0 + curxcords, 0 + curycords, 9, 15, BLACK);
glcd.fillrect(0 + curxcords, 3 + curycords, 6, 3, WHITE);
glcd.fillrect(0 + curxcords, 9 + curycords, 6, 3, WHITE);
break;

case '4':
glcd.fillrect(0 + curxcords, 0 + curycords, 9, 15, BLACK);
glcd.fillrect(3 + curxcords, 0 + curycords, 3, 6, WHITE);
glcd.fillrect(0 + curxcords, 9 + curycords, 6, 6, WHITE);
break;

case '5':
glcd.fillrect(0 + curxcords, 0 + curycords, 9, 15, BLACK);
glcd.fillrect(3 + curxcords, 3 + curycords, 6, 3, WHITE);
glcd.fillrect(0 + curxcords, 9 + curycords, 6, 3, WHITE);
break;

case '6':
glcd.fillrect(0 + curxcords, 0 + curycords, 9, 15, BLACK);
glcd.fillrect(3 + curxcords, 3 + curycords, 6, 3, WHITE);
glcd.fillrect(3 + curxcords, 9 + curycords, 3, 3, WHITE);
break;

case '7':
glcd.fillrect(0 + curxcords, 0 + curycords, 9, 15, BLACK);
glcd.fillrect(0 + curxcords, 3 + curycords, 6, 12, WHITE);
break;

case '8':
glcd.fillrect(0 + curxcords, 0 + curycords, 9, 15, BLACK);
glcd.fillrect(3 + curxcords, 3 + curycords, 3, 3, WHITE);
glcd.fillrect(3 + curxcords, 9 + curycords, 3, 3, WHITE);
break;

case '9':
glcd.fillrect(0 + curxcords, 0 + curycords, 9, 15, BLACK);
glcd.fillrect(3 + curxcords, 3 + curycords, 3, 3, WHITE);
glcd.fillrect(0 + curxcords, 9 + curycords, 6, 6, WHITE);
break;

case 'V':
glcd.fillrect(0 + curxcords, 0 + curycords, 9, 15, BLACK);
glcd.fillrect(3 + curxcords, 0 + curycords, 3, 12, WHITE);
glcd.fillrect(0 + curxcords, 12 + curycords, 2, 3, WHITE);
glcd.fillrect(7 + curxcords, 12 + curycords, 2, 3, WHITE);
break;

case 'F':
glcd.fillrect(0 + curxcords, 0 + curycords, 9, 15, BLACK);
glcd.fillrect(3 + curxcords, 3 + curycords, 6, 3, WHITE);
glcd.fillrect(3 + curxcords, 9 + curycords, 6, 6, WHITE);
break;

case '.':
glcd.fillrect(0 + curxcords, 12 + curycords, 3, 3, BLACK);
curxcords -= 6;
break;

case 'd':
glcd.fillrect(1 + curxcords, 0 + curycords, 6, 6, BLACK);
glcd.fillrect(3 + curxcords, 2 + curycords, 2, 2, WHITE);
curxcords -= 3;
break;

case ' ':
glcd.fillrect(0 + curxcords, 0 + curycords, 6, 15, WHITE);
curxcords -= 6;
break;
case ':':
glcd.fillrect(0 + curxcords, 10 + curycords, 3, 3, BLACK);
glcd.fillrect(0 + curxcords, 4 + curycords, 3, 3, BLACK);
curxcords -= 6;
break;
bikeboy929
 
Posts: 5
Joined: Wed Apr 18, 2012 11:55 am

Re: Bigger font for ST7565 LCD

by zxfr on Fri Feb 01, 2013 11:08 am

Our tool http://pd4ml.com/pixelmeister/ (apart of its main functions) makes possible to convert any TTF font into a raster one, which can be used with the display. Optionally the converted fonts may include extra info for an antialiased output. To support the converted fonts we provide uText library, easy portable to virtually any platform.
zxfr
 
Posts: 3
Joined: Fri Feb 01, 2013 10:30 am