stimmer / DueVGA

Arduino Due VGA library
92 stars 30 forks source link

Font Size? #13

Open himijendrix24 opened 9 years ago

himijendrix24 commented 9 years ago

Hello,

Sinze the library doesn't seem to get developed any further, did someone change the Font size? If not I will have to use Image2Code and generate a bit array with the text I want to show. Not very efficient but, the Due should have enough RAM...

Greetings, Himi

pilotak commented 9 years ago

Hi, did you get the font size workaround sorted out?

himijendrix24 commented 9 years ago

No, I didn't do anything with it since march...

pilotak commented 9 years ago

In case somebody wants bigger font/custom character

For 32x32 pixel: convert image to 8-bit array ie. here and use following

#include <VGA.h>

uint8_t custom_char[] = {
 //your 8-bit array (encoded image) goes here
}

void setup() {
  VGA.begin(800,600);

  uint16_t x = 400;
  uint16_t y = 300;

  uint8_t position = 0;
  uint8_t line = 0;
  uint8_t column = 0;

  for(uint8_t r =0; r < 32; r++){ //row
    for(uint8_t l =0; l < 4; l++){ // 4 byte in row (8*4 = 32)
      for(uint8_t b =0; b < 8; b++){ // go through each bit
        if(custom_char[position]&(128>>b)) VGA.drawPixel(x+column,y+line,1);
        else VGA.drawPixel(x+column,y+line,0);
        column++;
      }
      position++;
    }
    line++;
    column = 0;
  }
}

void loop() {
}