diff --git a/render/.gitignore b/render/.gitignore new file mode 100644 index 0000000..f9871b3 --- /dev/null +++ b/render/.gitignore @@ -0,0 +1,2 @@ +*.o +render diff --git a/render/Arduino.h b/render/Arduino.h new file mode 100644 index 0000000..8b3eed9 --- /dev/null +++ b/render/Arduino.h @@ -0,0 +1,25 @@ +#ifndef __ARDUINO_H__ +#define __ARDUINO_H__ + +// Minimal Arduino.h implementation +// to support compilation of Adafruit_GFX + +#include +#include +#include +#include // for strlen + +#define PROGMEM +typedef const char *__FlashStringHelper; + +// Empty String class +// Doesn't really work, but isn't used either +// Only defined to make Adafruit_GFX compile +class String { +public: + inline unsigned int length(void) const { return 0; } + + const char *c_str() const { return ""; } +}; + +#endif diff --git a/render/DefaultFont.png b/render/DefaultFont.png new file mode 100644 index 0000000..2162ec6 Binary files /dev/null and b/render/DefaultFont.png differ diff --git a/render/FreeMono12pt7b.png b/render/FreeMono12pt7b.png new file mode 100644 index 0000000..67b99d8 Binary files /dev/null and b/render/FreeMono12pt7b.png differ diff --git a/render/FreeMono18pt7b.png b/render/FreeMono18pt7b.png new file mode 100644 index 0000000..beb6d8c Binary files /dev/null and b/render/FreeMono18pt7b.png differ diff --git a/render/FreeMono24pt7b.png b/render/FreeMono24pt7b.png new file mode 100644 index 0000000..23b6327 Binary files /dev/null and b/render/FreeMono24pt7b.png differ diff --git a/render/FreeMono9pt7b.png b/render/FreeMono9pt7b.png new file mode 100644 index 0000000..173f820 Binary files /dev/null and b/render/FreeMono9pt7b.png differ diff --git a/render/FreeMonoBold12pt7b.png b/render/FreeMonoBold12pt7b.png new file mode 100644 index 0000000..ee4f6a2 Binary files /dev/null and b/render/FreeMonoBold12pt7b.png differ diff --git a/render/FreeMonoBold18pt7b.png b/render/FreeMonoBold18pt7b.png new file mode 100644 index 0000000..af1006c Binary files /dev/null and b/render/FreeMonoBold18pt7b.png differ diff --git a/render/FreeMonoBold24pt7b.png b/render/FreeMonoBold24pt7b.png new file mode 100644 index 0000000..04e16fc Binary files /dev/null and b/render/FreeMonoBold24pt7b.png differ diff --git a/render/FreeMonoBold9pt7b.png b/render/FreeMonoBold9pt7b.png new file mode 100644 index 0000000..91ed1e9 Binary files /dev/null and b/render/FreeMonoBold9pt7b.png differ diff --git a/render/FreeMonoBoldOblique12pt7b.png b/render/FreeMonoBoldOblique12pt7b.png new file mode 100644 index 0000000..8e6d9d1 Binary files /dev/null and b/render/FreeMonoBoldOblique12pt7b.png differ diff --git a/render/FreeMonoBoldOblique18pt7b.png b/render/FreeMonoBoldOblique18pt7b.png new file mode 100644 index 0000000..373904f Binary files /dev/null and b/render/FreeMonoBoldOblique18pt7b.png differ diff --git a/render/FreeMonoBoldOblique24pt7b.png b/render/FreeMonoBoldOblique24pt7b.png new file mode 100644 index 0000000..e90672f Binary files /dev/null and b/render/FreeMonoBoldOblique24pt7b.png differ diff --git a/render/FreeMonoBoldOblique9pt7b.png b/render/FreeMonoBoldOblique9pt7b.png new file mode 100644 index 0000000..72c2e10 Binary files /dev/null and b/render/FreeMonoBoldOblique9pt7b.png differ diff --git a/render/FreeMonoOblique12pt7b.png b/render/FreeMonoOblique12pt7b.png new file mode 100644 index 0000000..c3a732c Binary files /dev/null and b/render/FreeMonoOblique12pt7b.png differ diff --git a/render/FreeMonoOblique18pt7b.png b/render/FreeMonoOblique18pt7b.png new file mode 100644 index 0000000..b85c60f Binary files /dev/null and b/render/FreeMonoOblique18pt7b.png differ diff --git a/render/FreeMonoOblique24pt7b.png b/render/FreeMonoOblique24pt7b.png new file mode 100644 index 0000000..a75fddf Binary files /dev/null and b/render/FreeMonoOblique24pt7b.png differ diff --git a/render/FreeMonoOblique9pt7b.png b/render/FreeMonoOblique9pt7b.png new file mode 100644 index 0000000..0a5c9f3 Binary files /dev/null and b/render/FreeMonoOblique9pt7b.png differ diff --git a/render/FreeSans12pt7b.png b/render/FreeSans12pt7b.png new file mode 100644 index 0000000..9cd4295 Binary files /dev/null and b/render/FreeSans12pt7b.png differ diff --git a/render/FreeSans18pt7b.png b/render/FreeSans18pt7b.png new file mode 100644 index 0000000..699f476 Binary files /dev/null and b/render/FreeSans18pt7b.png differ diff --git a/render/FreeSans24pt7b.png b/render/FreeSans24pt7b.png new file mode 100644 index 0000000..fb8a1d4 Binary files /dev/null and b/render/FreeSans24pt7b.png differ diff --git a/render/FreeSans9pt7b.png b/render/FreeSans9pt7b.png new file mode 100644 index 0000000..25be194 Binary files /dev/null and b/render/FreeSans9pt7b.png differ diff --git a/render/FreeSansBold12pt7b.png b/render/FreeSansBold12pt7b.png new file mode 100644 index 0000000..a3f9bf3 Binary files /dev/null and b/render/FreeSansBold12pt7b.png differ diff --git a/render/FreeSansBold18pt7b.png b/render/FreeSansBold18pt7b.png new file mode 100644 index 0000000..ac220e9 Binary files /dev/null and b/render/FreeSansBold18pt7b.png differ diff --git a/render/FreeSansBold24pt7b.png b/render/FreeSansBold24pt7b.png new file mode 100644 index 0000000..2155a47 Binary files /dev/null and b/render/FreeSansBold24pt7b.png differ diff --git a/render/FreeSansBold9pt7b.png b/render/FreeSansBold9pt7b.png new file mode 100644 index 0000000..3e8ef90 Binary files /dev/null and b/render/FreeSansBold9pt7b.png differ diff --git a/render/FreeSansBoldOblique12pt7b.png b/render/FreeSansBoldOblique12pt7b.png new file mode 100644 index 0000000..246ca4b Binary files /dev/null and b/render/FreeSansBoldOblique12pt7b.png differ diff --git a/render/FreeSansBoldOblique18pt7b.png b/render/FreeSansBoldOblique18pt7b.png new file mode 100644 index 0000000..0730493 Binary files /dev/null and b/render/FreeSansBoldOblique18pt7b.png differ diff --git a/render/FreeSansBoldOblique24pt7b.png b/render/FreeSansBoldOblique24pt7b.png new file mode 100644 index 0000000..887d8ff Binary files /dev/null and b/render/FreeSansBoldOblique24pt7b.png differ diff --git a/render/FreeSansBoldOblique9pt7b.png b/render/FreeSansBoldOblique9pt7b.png new file mode 100644 index 0000000..108486c Binary files /dev/null and b/render/FreeSansBoldOblique9pt7b.png differ diff --git a/render/FreeSansOblique12pt7b.png b/render/FreeSansOblique12pt7b.png new file mode 100644 index 0000000..3e5a626 Binary files /dev/null and b/render/FreeSansOblique12pt7b.png differ diff --git a/render/FreeSansOblique18pt7b.png b/render/FreeSansOblique18pt7b.png new file mode 100644 index 0000000..c699c4b Binary files /dev/null and b/render/FreeSansOblique18pt7b.png differ diff --git a/render/FreeSansOblique24pt7b.png b/render/FreeSansOblique24pt7b.png new file mode 100644 index 0000000..93ca0d7 Binary files /dev/null and b/render/FreeSansOblique24pt7b.png differ diff --git a/render/FreeSansOblique9pt7b.png b/render/FreeSansOblique9pt7b.png new file mode 100644 index 0000000..fab5b71 Binary files /dev/null and b/render/FreeSansOblique9pt7b.png differ diff --git a/render/FreeSerif12pt7b.png b/render/FreeSerif12pt7b.png new file mode 100644 index 0000000..e31d2ae Binary files /dev/null and b/render/FreeSerif12pt7b.png differ diff --git a/render/FreeSerif18pt7b.png b/render/FreeSerif18pt7b.png new file mode 100644 index 0000000..31017ad Binary files /dev/null and b/render/FreeSerif18pt7b.png differ diff --git a/render/FreeSerif24pt7b.png b/render/FreeSerif24pt7b.png new file mode 100644 index 0000000..5e0cd7a Binary files /dev/null and b/render/FreeSerif24pt7b.png differ diff --git a/render/FreeSerif9pt7b.png b/render/FreeSerif9pt7b.png new file mode 100644 index 0000000..df1a2dd Binary files /dev/null and b/render/FreeSerif9pt7b.png differ diff --git a/render/FreeSerifBold12pt7b.png b/render/FreeSerifBold12pt7b.png new file mode 100644 index 0000000..8817a4e Binary files /dev/null and b/render/FreeSerifBold12pt7b.png differ diff --git a/render/FreeSerifBold18pt7b.png b/render/FreeSerifBold18pt7b.png new file mode 100644 index 0000000..d586907 Binary files /dev/null and b/render/FreeSerifBold18pt7b.png differ diff --git a/render/FreeSerifBold24pt7b.png b/render/FreeSerifBold24pt7b.png new file mode 100644 index 0000000..2451455 Binary files /dev/null and b/render/FreeSerifBold24pt7b.png differ diff --git a/render/FreeSerifBold9pt7b.png b/render/FreeSerifBold9pt7b.png new file mode 100644 index 0000000..051c1bc Binary files /dev/null and b/render/FreeSerifBold9pt7b.png differ diff --git a/render/FreeSerifBoldItalic12pt7b.png b/render/FreeSerifBoldItalic12pt7b.png new file mode 100644 index 0000000..fdfca93 Binary files /dev/null and b/render/FreeSerifBoldItalic12pt7b.png differ diff --git a/render/FreeSerifBoldItalic18pt7b.png b/render/FreeSerifBoldItalic18pt7b.png new file mode 100644 index 0000000..e526aa2 Binary files /dev/null and b/render/FreeSerifBoldItalic18pt7b.png differ diff --git a/render/FreeSerifBoldItalic24pt7b.png b/render/FreeSerifBoldItalic24pt7b.png new file mode 100644 index 0000000..5d8d7fa Binary files /dev/null and b/render/FreeSerifBoldItalic24pt7b.png differ diff --git a/render/FreeSerifBoldItalic9pt7b.png b/render/FreeSerifBoldItalic9pt7b.png new file mode 100644 index 0000000..04c0c1b Binary files /dev/null and b/render/FreeSerifBoldItalic9pt7b.png differ diff --git a/render/FreeSerifItalic12pt7b.png b/render/FreeSerifItalic12pt7b.png new file mode 100644 index 0000000..8681283 Binary files /dev/null and b/render/FreeSerifItalic12pt7b.png differ diff --git a/render/FreeSerifItalic18pt7b.png b/render/FreeSerifItalic18pt7b.png new file mode 100644 index 0000000..0d3d440 Binary files /dev/null and b/render/FreeSerifItalic18pt7b.png differ diff --git a/render/FreeSerifItalic24pt7b.png b/render/FreeSerifItalic24pt7b.png new file mode 100644 index 0000000..49cab3d Binary files /dev/null and b/render/FreeSerifItalic24pt7b.png differ diff --git a/render/FreeSerifItalic9pt7b.png b/render/FreeSerifItalic9pt7b.png new file mode 100644 index 0000000..f901cc6 Binary files /dev/null and b/render/FreeSerifItalic9pt7b.png differ diff --git a/render/Makefile b/render/Makefile new file mode 100644 index 0000000..2bcf58b --- /dev/null +++ b/render/Makefile @@ -0,0 +1,20 @@ +CPP=g++ +CPPFLAGS=-Wall -g -I. -DARDUINO=100 +OBJS=Adafruit_GFX.o RenderGFX.o render.o +LIBS=-lgd -lpng +TARGET=render +GFX_PATH=../ + +all: $(TARGET) + +render: $(OBJS) + $(CPP) -o $@ $^ $(LIBS) + +%.o: %.c + $(CPP) -c -o $@ $< $(CPPFLAGS) + +Adafruit_GFX.o: $(GFX_PATH)/Adafruit_GFX.cpp + $(CPP) -c -o $@ $< $(CPPFLAGS) + +clean: + rm -rf $(OBJS) $(TARGET) diff --git a/render/Org_01.png b/render/Org_01.png new file mode 100644 index 0000000..eb8fb25 Binary files /dev/null and b/render/Org_01.png differ diff --git a/render/Picopixel.png b/render/Picopixel.png new file mode 100644 index 0000000..2746619 Binary files /dev/null and b/render/Picopixel.png differ diff --git a/render/Print.h b/render/Print.h new file mode 100644 index 0000000..09099fc --- /dev/null +++ b/render/Print.h @@ -0,0 +1,28 @@ +#ifndef __PRINT_H__ +#define __PRINT_H__ + +#include + +class Print { +public: + virtual size_t write(uint8_t) = 0; + + virtual size_t write(const uint8_t *buffer, size_t size) { + size_t n = 0; + while (size--) { + if (write(*buffer++)) + n++; + else + break; + } + return n; + } + + size_t print(const char *str) { return write(str, strlen(str)); } + + size_t write(const char *buffer, size_t size) { + return write((const uint8_t *)buffer, size); + } +}; + +#endif diff --git a/render/README.md b/render/README.md new file mode 100644 index 0000000..ad99333 --- /dev/null +++ b/render/README.md @@ -0,0 +1,176 @@ +# Adafruit GFX Examples Rendering + +A little tool to render examples of all the fonts included in the Adafruit GFX library. + +**Compile**: + +`$ make` + +**Run**: + +`$ ./render` + +**Update Readme**: + +`$ ./update_readme.sh` + +## Fonts +### DefaultFont +![DefaultFont](DefaultFont.png) + +### FreeMono12pt7b +![FreeMono12pt7b](FreeMono12pt7b.png) + +### FreeMono18pt7b +![FreeMono18pt7b](FreeMono18pt7b.png) + +### FreeMono24pt7b +![FreeMono24pt7b](FreeMono24pt7b.png) + +### FreeMono9pt7b +![FreeMono9pt7b](FreeMono9pt7b.png) + +### FreeMonoBold12pt7b +![FreeMonoBold12pt7b](FreeMonoBold12pt7b.png) + +### FreeMonoBold18pt7b +![FreeMonoBold18pt7b](FreeMonoBold18pt7b.png) + +### FreeMonoBold24pt7b +![FreeMonoBold24pt7b](FreeMonoBold24pt7b.png) + +### FreeMonoBold9pt7b +![FreeMonoBold9pt7b](FreeMonoBold9pt7b.png) + +### FreeMonoBoldOblique12pt7b +![FreeMonoBoldOblique12pt7b](FreeMonoBoldOblique12pt7b.png) + +### FreeMonoBoldOblique18pt7b +![FreeMonoBoldOblique18pt7b](FreeMonoBoldOblique18pt7b.png) + +### FreeMonoBoldOblique24pt7b +![FreeMonoBoldOblique24pt7b](FreeMonoBoldOblique24pt7b.png) + +### FreeMonoBoldOblique9pt7b +![FreeMonoBoldOblique9pt7b](FreeMonoBoldOblique9pt7b.png) + +### FreeMonoOblique12pt7b +![FreeMonoOblique12pt7b](FreeMonoOblique12pt7b.png) + +### FreeMonoOblique18pt7b +![FreeMonoOblique18pt7b](FreeMonoOblique18pt7b.png) + +### FreeMonoOblique24pt7b +![FreeMonoOblique24pt7b](FreeMonoOblique24pt7b.png) + +### FreeMonoOblique9pt7b +![FreeMonoOblique9pt7b](FreeMonoOblique9pt7b.png) + +### FreeSans12pt7b +![FreeSans12pt7b](FreeSans12pt7b.png) + +### FreeSans18pt7b +![FreeSans18pt7b](FreeSans18pt7b.png) + +### FreeSans24pt7b +![FreeSans24pt7b](FreeSans24pt7b.png) + +### FreeSans9pt7b +![FreeSans9pt7b](FreeSans9pt7b.png) + +### FreeSansBold12pt7b +![FreeSansBold12pt7b](FreeSansBold12pt7b.png) + +### FreeSansBold18pt7b +![FreeSansBold18pt7b](FreeSansBold18pt7b.png) + +### FreeSansBold24pt7b +![FreeSansBold24pt7b](FreeSansBold24pt7b.png) + +### FreeSansBold9pt7b +![FreeSansBold9pt7b](FreeSansBold9pt7b.png) + +### FreeSansBoldOblique12pt7b +![FreeSansBoldOblique12pt7b](FreeSansBoldOblique12pt7b.png) + +### FreeSansBoldOblique18pt7b +![FreeSansBoldOblique18pt7b](FreeSansBoldOblique18pt7b.png) + +### FreeSansBoldOblique24pt7b +![FreeSansBoldOblique24pt7b](FreeSansBoldOblique24pt7b.png) + +### FreeSansBoldOblique9pt7b +![FreeSansBoldOblique9pt7b](FreeSansBoldOblique9pt7b.png) + +### FreeSansOblique12pt7b +![FreeSansOblique12pt7b](FreeSansOblique12pt7b.png) + +### FreeSansOblique18pt7b +![FreeSansOblique18pt7b](FreeSansOblique18pt7b.png) + +### FreeSansOblique24pt7b +![FreeSansOblique24pt7b](FreeSansOblique24pt7b.png) + +### FreeSansOblique9pt7b +![FreeSansOblique9pt7b](FreeSansOblique9pt7b.png) + +### FreeSerif12pt7b +![FreeSerif12pt7b](FreeSerif12pt7b.png) + +### FreeSerif18pt7b +![FreeSerif18pt7b](FreeSerif18pt7b.png) + +### FreeSerif24pt7b +![FreeSerif24pt7b](FreeSerif24pt7b.png) + +### FreeSerif9pt7b +![FreeSerif9pt7b](FreeSerif9pt7b.png) + +### FreeSerifBold12pt7b +![FreeSerifBold12pt7b](FreeSerifBold12pt7b.png) + +### FreeSerifBold18pt7b +![FreeSerifBold18pt7b](FreeSerifBold18pt7b.png) + +### FreeSerifBold24pt7b +![FreeSerifBold24pt7b](FreeSerifBold24pt7b.png) + +### FreeSerifBold9pt7b +![FreeSerifBold9pt7b](FreeSerifBold9pt7b.png) + +### FreeSerifBoldItalic12pt7b +![FreeSerifBoldItalic12pt7b](FreeSerifBoldItalic12pt7b.png) + +### FreeSerifBoldItalic18pt7b +![FreeSerifBoldItalic18pt7b](FreeSerifBoldItalic18pt7b.png) + +### FreeSerifBoldItalic24pt7b +![FreeSerifBoldItalic24pt7b](FreeSerifBoldItalic24pt7b.png) + +### FreeSerifBoldItalic9pt7b +![FreeSerifBoldItalic9pt7b](FreeSerifBoldItalic9pt7b.png) + +### FreeSerifItalic12pt7b +![FreeSerifItalic12pt7b](FreeSerifItalic12pt7b.png) + +### FreeSerifItalic18pt7b +![FreeSerifItalic18pt7b](FreeSerifItalic18pt7b.png) + +### FreeSerifItalic24pt7b +![FreeSerifItalic24pt7b](FreeSerifItalic24pt7b.png) + +### FreeSerifItalic9pt7b +![FreeSerifItalic9pt7b](FreeSerifItalic9pt7b.png) + +### Org_01 +![Org_01](Org_01.png) + +### Picopixel +![Picopixel](Picopixel.png) + +### Tiny3x3a2pt7b +![Tiny3x3a2pt7b](Tiny3x3a2pt7b.png) + +### TomThumb +![TomThumb](TomThumb.png) + diff --git a/render/RenderGFX.cpp b/render/RenderGFX.cpp new file mode 100644 index 0000000..fde47a5 --- /dev/null +++ b/render/RenderGFX.cpp @@ -0,0 +1,22 @@ +#include "RenderGFX.h" + +#include + +RenderGFX::RenderGFX(uint16_t w, uint16_t h) : Adafruit_GFX(w, h) { + + im = gdImageCreate(w, h); +} + +void RenderGFX::drawPixel(int16_t x, int16_t y, uint16_t color) { + gdImageSetPixel(im, x, y, color); +} + +uint16_t RenderGFX::color(uint8_t r, uint8_t g, uint8_t b) { + return gdImageColorAllocate(im, r, g, b); +} + +void RenderGFX::save(const char *name) { + FILE *pngout = fopen(name, "wb"); + gdImagePng(im, pngout); + fclose(pngout); +} diff --git a/render/RenderGFX.h b/render/RenderGFX.h new file mode 100644 index 0000000..6d54c49 --- /dev/null +++ b/render/RenderGFX.h @@ -0,0 +1,22 @@ +#ifndef __RENDERGFX_H +#define __RENDERGFX_H + +#include "../Adafruit_GFX.h" +#include "Arduino.h" +#include + +class RenderGFX : public Adafruit_GFX { +public: + RenderGFX(uint16_t w, uint16_t h); + + virtual void drawPixel(int16_t x, int16_t y, uint16_t color); + + virtual uint16_t color(uint8_t r, uint8_t g, uint8_t b); + + virtual void save(const char *name); + +protected: + gdImagePtr im; +}; + +#endif diff --git a/render/Tiny3x3a2pt7b.png b/render/Tiny3x3a2pt7b.png new file mode 100644 index 0000000..3e6329e Binary files /dev/null and b/render/Tiny3x3a2pt7b.png differ diff --git a/render/TomThumb.png b/render/TomThumb.png new file mode 100644 index 0000000..d5243c6 Binary files /dev/null and b/render/TomThumb.png differ diff --git a/render/render.cpp b/render/render.cpp new file mode 100644 index 0000000..da17caa --- /dev/null +++ b/render/render.cpp @@ -0,0 +1,159 @@ +#include "Arduino.h" +#include "RenderGFX.h" +#include +#include + +// Update includes: +// for FILE in ../Fonts/*.h; do printf '#include "%s"\n' "$FILE"; done +#include "../Fonts/FreeMono12pt7b.h" +#include "../Fonts/FreeMono18pt7b.h" +#include "../Fonts/FreeMono24pt7b.h" +#include "../Fonts/FreeMono9pt7b.h" +#include "../Fonts/FreeMonoBold12pt7b.h" +#include "../Fonts/FreeMonoBold18pt7b.h" +#include "../Fonts/FreeMonoBold24pt7b.h" +#include "../Fonts/FreeMonoBold9pt7b.h" +#include "../Fonts/FreeMonoBoldOblique12pt7b.h" +#include "../Fonts/FreeMonoBoldOblique18pt7b.h" +#include "../Fonts/FreeMonoBoldOblique24pt7b.h" +#include "../Fonts/FreeMonoBoldOblique9pt7b.h" +#include "../Fonts/FreeMonoOblique12pt7b.h" +#include "../Fonts/FreeMonoOblique18pt7b.h" +#include "../Fonts/FreeMonoOblique24pt7b.h" +#include "../Fonts/FreeMonoOblique9pt7b.h" +#include "../Fonts/FreeSans12pt7b.h" +#include "../Fonts/FreeSans18pt7b.h" +#include "../Fonts/FreeSans24pt7b.h" +#include "../Fonts/FreeSans9pt7b.h" +#include "../Fonts/FreeSansBold12pt7b.h" +#include "../Fonts/FreeSansBold18pt7b.h" +#include "../Fonts/FreeSansBold24pt7b.h" +#include "../Fonts/FreeSansBold9pt7b.h" +#include "../Fonts/FreeSansBoldOblique12pt7b.h" +#include "../Fonts/FreeSansBoldOblique18pt7b.h" +#include "../Fonts/FreeSansBoldOblique24pt7b.h" +#include "../Fonts/FreeSansBoldOblique9pt7b.h" +#include "../Fonts/FreeSansOblique12pt7b.h" +#include "../Fonts/FreeSansOblique18pt7b.h" +#include "../Fonts/FreeSansOblique24pt7b.h" +#include "../Fonts/FreeSansOblique9pt7b.h" +#include "../Fonts/FreeSerif12pt7b.h" +#include "../Fonts/FreeSerif18pt7b.h" +#include "../Fonts/FreeSerif24pt7b.h" +#include "../Fonts/FreeSerif9pt7b.h" +#include "../Fonts/FreeSerifBold12pt7b.h" +#include "../Fonts/FreeSerifBold18pt7b.h" +#include "../Fonts/FreeSerifBold24pt7b.h" +#include "../Fonts/FreeSerifBold9pt7b.h" +#include "../Fonts/FreeSerifBoldItalic12pt7b.h" +#include "../Fonts/FreeSerifBoldItalic18pt7b.h" +#include "../Fonts/FreeSerifBoldItalic24pt7b.h" +#include "../Fonts/FreeSerifBoldItalic9pt7b.h" +#include "../Fonts/FreeSerifItalic12pt7b.h" +#include "../Fonts/FreeSerifItalic18pt7b.h" +#include "../Fonts/FreeSerifItalic24pt7b.h" +#include "../Fonts/FreeSerifItalic9pt7b.h" +#include "../Fonts/Org_01.h" +#include "../Fonts/Picopixel.h" +#include "../Fonts/Tiny3x3a2pt7b.h" +#include "../Fonts/TomThumb.h" +#include "../gfxfont.h" + +#define SCALE 2 +#define BORDER_SIZE 5 * SCALE + +void render(const char *filename, GFXfont *font, bool correctBox = true) { + printf("%s\n", filename); + const char *text = "The Quick Brown Fox Jumps Over The Lazy Dog"; + int16_t sizex, sizey; + uint16_t sizew, sizeh; + + RenderGFX render(1000, 1000); + render.setTextWrap(false); + render.setTextSize(SCALE); + render.setFont(font); + render.getTextBounds(text, 0, 0, &sizex, &sizey, &sizew, &sizeh); + printf("Size: %d, %d, %d, %d\n", sizex, sizey, sizew, sizeh); + + render = RenderGFX(sizew + 2 * BORDER_SIZE, sizeh + 2 * BORDER_SIZE); + int black = render.color(0, 0, 0); + int white = render.color(255, 255, 255); + int lgrey = render.color(200, 200, 200); + + int yoff = BORDER_SIZE - (correctBox ? sizey : 0); + + render.fillScreen(white); + render.setFont(font); + render.setCursor(BORDER_SIZE, yoff); + render.setTextSize(SCALE); + render.setTextColor(black); + render.print(text); + render.drawRect(BORDER_SIZE, BORDER_SIZE, sizew, sizeh, lgrey); + render.save(filename); +} + +void render(const char *filename, GFXfont font, bool correctBox = true) { + render(filename, &font, correctBox); +} + +int main(int argc, char **argv) { + // Update render calls: + // for FILE in ../Fonts/*.h; do + // NAME=$(basename "$FILE" .h); + // printf ' render("%s.png", %s);\n' "$NAME" "$NAME"; + // done + render("FreeMono12pt7b.png", FreeMono12pt7b); + render("FreeMono18pt7b.png", FreeMono18pt7b); + render("FreeMono24pt7b.png", FreeMono24pt7b); + render("FreeMono9pt7b.png", FreeMono9pt7b); + render("FreeMonoBold12pt7b.png", FreeMonoBold12pt7b); + render("FreeMonoBold18pt7b.png", FreeMonoBold18pt7b); + render("FreeMonoBold24pt7b.png", FreeMonoBold24pt7b); + render("FreeMonoBold9pt7b.png", FreeMonoBold9pt7b); + render("FreeMonoBoldOblique12pt7b.png", FreeMonoBoldOblique12pt7b); + render("FreeMonoBoldOblique18pt7b.png", FreeMonoBoldOblique18pt7b); + render("FreeMonoBoldOblique24pt7b.png", FreeMonoBoldOblique24pt7b); + render("FreeMonoBoldOblique9pt7b.png", FreeMonoBoldOblique9pt7b); + render("FreeMonoOblique12pt7b.png", FreeMonoOblique12pt7b); + render("FreeMonoOblique18pt7b.png", FreeMonoOblique18pt7b); + render("FreeMonoOblique24pt7b.png", FreeMonoOblique24pt7b); + render("FreeMonoOblique9pt7b.png", FreeMonoOblique9pt7b); + render("FreeSans12pt7b.png", FreeSans12pt7b); + render("FreeSans18pt7b.png", FreeSans18pt7b); + render("FreeSans24pt7b.png", FreeSans24pt7b); + render("FreeSans9pt7b.png", FreeSans9pt7b); + render("FreeSansBold12pt7b.png", FreeSansBold12pt7b); + render("FreeSansBold18pt7b.png", FreeSansBold18pt7b); + render("FreeSansBold24pt7b.png", FreeSansBold24pt7b); + render("FreeSansBold9pt7b.png", FreeSansBold9pt7b); + render("FreeSansBoldOblique12pt7b.png", FreeSansBoldOblique12pt7b); + render("FreeSansBoldOblique18pt7b.png", FreeSansBoldOblique18pt7b); + render("FreeSansBoldOblique24pt7b.png", FreeSansBoldOblique24pt7b); + render("FreeSansBoldOblique9pt7b.png", FreeSansBoldOblique9pt7b); + render("FreeSansOblique12pt7b.png", FreeSansOblique12pt7b); + render("FreeSansOblique18pt7b.png", FreeSansOblique18pt7b); + render("FreeSansOblique24pt7b.png", FreeSansOblique24pt7b); + render("FreeSansOblique9pt7b.png", FreeSansOblique9pt7b); + render("FreeSerif12pt7b.png", FreeSerif12pt7b); + render("FreeSerif18pt7b.png", FreeSerif18pt7b); + render("FreeSerif24pt7b.png", FreeSerif24pt7b); + render("FreeSerif9pt7b.png", FreeSerif9pt7b); + render("FreeSerifBold12pt7b.png", FreeSerifBold12pt7b); + render("FreeSerifBold18pt7b.png", FreeSerifBold18pt7b); + render("FreeSerifBold24pt7b.png", FreeSerifBold24pt7b); + render("FreeSerifBold9pt7b.png", FreeSerifBold9pt7b); + render("FreeSerifBoldItalic12pt7b.png", FreeSerifBoldItalic12pt7b); + render("FreeSerifBoldItalic18pt7b.png", FreeSerifBoldItalic18pt7b); + render("FreeSerifBoldItalic24pt7b.png", FreeSerifBoldItalic24pt7b); + render("FreeSerifBoldItalic9pt7b.png", FreeSerifBoldItalic9pt7b); + render("FreeSerifItalic12pt7b.png", FreeSerifItalic12pt7b); + render("FreeSerifItalic18pt7b.png", FreeSerifItalic18pt7b); + render("FreeSerifItalic24pt7b.png", FreeSerifItalic24pt7b); + render("FreeSerifItalic9pt7b.png", FreeSerifItalic9pt7b); + render("Org_01.png", Org_01); + render("Picopixel.png", Picopixel); + render("Tiny3x3a2pt7b.png", Tiny3x3a2pt7b); + render("TomThumb.png", TomThumb); + render("DefaultFont.png", NULL); + return 0; +} diff --git a/render/update_readme.sh b/render/update_readme.sh new file mode 100755 index 0000000..9c6624f --- /dev/null +++ b/render/update_readme.sh @@ -0,0 +1,5 @@ +sed -i -n '0,/## Fonts/p' README.md +for FILE in *.png; do + NAME=${FILE%.*}; + echo -e "### $NAME\n![$NAME]($FILE)\n"; +done >> README.md