MBED Import of ADAFRUIT graphics library, BSD License
Dependents: GP9002adafruit GP9002af_gray
Notes on this library
This was imported into MBED specifically to support the GP9002 VFD, as a result it has some "hacks" to optimize it for the GP9002.
Due to the GP9002 internal organization it draws vertical lines much faster than horizontal (assuming you orient it "landscape"). This is likely to be true of other displays that have bits in a byte arranged vertically, which seems a common theme in small GLCDs. Some types may have a more CGA-like memory organization and will draw faster horizontally.
On a vertical-organised display the graphics functions are often substantially faster if X and Y are exchanged, especially with the dot-write optimization. This is because vertical lines can be written byte-at-a-time with no need for read-modify-write, and even when individual bits are written a significant number will "land" in the byte previously written. In contrast a horizontal line would require changing one bit of each byte in turn, requiring a sequence of set-address,read,write operations for each dot in turn.
I've hacked this in the library. I forget exactly how but I believe I simply exchanged X with W in the code for drawing filled shapes.
I would like to come up with a more generic way to do this, such as having internal coordinates that are not defined as X and Y, then leaving it up to the display library to "wrap" them in the way that is best for that display.
I would like to apologize for abandoning this project, but the test harness still exists and I might return to it, though I'm more interested in TFT systems like the STM discovery now.
fontconvert/makefonts.sh@0:3bf8ef959338, 2016-05-07 (annotated)
- Committer:
- oliverb
- Date:
- Sat May 07 12:50:37 2016 +0000
- Revision:
- 0:3bf8ef959338
Converting to Library, this is a base class that needs extending for a specific device. Note that as it stands it favors devices with vertical bit-organisation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
oliverb | 0:3bf8ef959338 | 1 | #!/bin/bash |
oliverb | 0:3bf8ef959338 | 2 | |
oliverb | 0:3bf8ef959338 | 3 | # Ugly little Bash script, generates a set of .h files for GFX using |
oliverb | 0:3bf8ef959338 | 4 | # GNU FreeFont sources. There are three fonts: 'Mono' (Courier-like), |
oliverb | 0:3bf8ef959338 | 5 | # 'Sans' (Helvetica-like) and 'Serif' (Times-like); four styles: regular, |
oliverb | 0:3bf8ef959338 | 6 | # bold, oblique or italic, and bold+oblique or bold+italic; and four |
oliverb | 0:3bf8ef959338 | 7 | # sizes: 9, 12, 18 and 24 point. No real error checking or anything, |
oliverb | 0:3bf8ef959338 | 8 | # this just powers through all the combinations, calling the fontconvert |
oliverb | 0:3bf8ef959338 | 9 | # utility and redirecting the output to a .h file for each combo. |
oliverb | 0:3bf8ef959338 | 10 | |
oliverb | 0:3bf8ef959338 | 11 | # Adafruit_GFX repository does not include the source outline fonts |
oliverb | 0:3bf8ef959338 | 12 | # (huge zipfile, different license) but they're easily acquired: |
oliverb | 0:3bf8ef959338 | 13 | # http://savannah.gnu.org/projects/freefont/ |
oliverb | 0:3bf8ef959338 | 14 | |
oliverb | 0:3bf8ef959338 | 15 | convert=./fontconvert |
oliverb | 0:3bf8ef959338 | 16 | inpath=~/Desktop/freefont/ |
oliverb | 0:3bf8ef959338 | 17 | outpath=../Fonts/ |
oliverb | 0:3bf8ef959338 | 18 | fonts=(FreeMono FreeSans FreeSerif) |
oliverb | 0:3bf8ef959338 | 19 | styles=("" Bold Italic BoldItalic Oblique BoldOblique) |
oliverb | 0:3bf8ef959338 | 20 | sizes=(9 12 18 24) |
oliverb | 0:3bf8ef959338 | 21 | |
oliverb | 0:3bf8ef959338 | 22 | for f in ${fonts[*]} |
oliverb | 0:3bf8ef959338 | 23 | do |
oliverb | 0:3bf8ef959338 | 24 | for index in ${!styles[*]} |
oliverb | 0:3bf8ef959338 | 25 | do |
oliverb | 0:3bf8ef959338 | 26 | st=${styles[$index]} |
oliverb | 0:3bf8ef959338 | 27 | for si in ${sizes[*]} |
oliverb | 0:3bf8ef959338 | 28 | do |
oliverb | 0:3bf8ef959338 | 29 | infile=$inpath$f$st".ttf" |
oliverb | 0:3bf8ef959338 | 30 | if [ -f $infile ] # Does source combination exist? |
oliverb | 0:3bf8ef959338 | 31 | then |
oliverb | 0:3bf8ef959338 | 32 | outfile=$outpath$f$st$si"pt7b.h" |
oliverb | 0:3bf8ef959338 | 33 | # printf "%s %s %s > %s\n" $convert $infile $si $outfile |
oliverb | 0:3bf8ef959338 | 34 | $convert $infile $si > $outfile |
oliverb | 0:3bf8ef959338 | 35 | fi |
oliverb | 0:3bf8ef959338 | 36 | done |
oliverb | 0:3bf8ef959338 | 37 | done |
oliverb | 0:3bf8ef959338 | 38 | done |