Arduino GLCD Library: Sketch Migration

# Sketch Migration

The distribution includes the system font and arial14 font, but these are now in a subdirectory called 'fonts' so you will need to modify the include statement, for example change:

    #include "SystemFont5x7.h"       // system font

To

    #include "fonts/SystemFont5x7.h"       // system font

Bitmaps are now in a subdirectory called 'bitmaps' so change :

     #include "ArduinoIcon.h"  // the bitmap distributed with the ks0108 lib

To

    #include "bitmaps/ArduinoIcon.h"  // 64x64 bitmap

The file bitmap filenames now include the width and height so while the ArduinoIcon.h bitmap file is available for backward compability and will map to ArduinoIcon64x64.h it is recommended to use the new bitmap file names for clarity.

If you are using any of the following functions you should either change the code use the new function names.

- DrawVertLine(x, y, length, color) is now: DrawVLine(x, y, length, color)
- DrawHoriLine(x, y, length, color) is now : DrawHLine(x, y, length, color)
- ClearSysTextLine(row) is now EraseTextLine(row)

Alternatively you may add the deprecated include header file to your sketch toautomatically map the deprecated old functions name to the newer names.

    #include "include/glcd_Deprecated.h" // header to map old function names to new functin names

The character output functions behave differently in the new library. The new library now sets or clears all pixels of a font (glyph), the old library did not consistently erase pixels in the whitespace below the glyph. This means that if there are graphics very close below the character they may be overwritten with the new text ouput code. The workaround is to either move the graphics objects so they are not cleared when the text is written or to draw the graphical objects after the text is displayed.

Another change is the way a string wraps on the newline character. The ks0108 library wrapped to the column where the string started, the glcd library now wraps to the beginning of the text area. See the section on Text Areas to see how you can use this new capability to control where text will wrap on the display.

See the section on Configuration for details on the new configuration files. You can use the same wiring as the old library but the configuration file format has changed. The ks0108_Config,h file included in the distribution uses exactly the same pins as the ks0108_Arduino.h file supplied with the old library, but if you changed the Arduino pin numbers you will need to modify ks0108_Config to match your wiring.

For an example of a ks0108 library sketch that has been migrated to the glcd library see the ks0108example sketch in the glcd library examples.