Hersey fonts are in the low-level drawing routines of the TouchShield. To draw text easily on the TouchShield, simply use the text() function. If you’re adventurous or would like to learn about the low-level implementation then please read on…
Hersey Font Implementation
Hershey fonts are part of the SubPGraphics library. They are intended to work on the TouchShield Slide. They WILL work on the TouchShield Stealth but it does not have enough screen space for them to be very useful
Check out this page for samples of the fonts running on the touchSheild Slide
TouchShield-Slide Hershey Fonts
The Hershey fonts take a lot of space, between 5K and 10K for each font. If you enable all of them, it is over 140K. Currently the IDE only supports up to 126K on the TouchShield-Slide. So not all of the fonts can be enabled at a time. Also, if you are not using them, they are a lot of extra code to bring along. I have set the .h files up so that the code and data can easily be disabled or enabled without having to move any files around all using ”#define” statements and “ifdef” within the code.
In order to use the Hershey fonts, first make sure they are enabled in the “font.h” file
To disable the fonts put ”//” in start of the line.
NOTE: ALL OF THESE ENABLE DEFINES HAVE ”_” AT THE START AND END OF THEM, THIS WIKI DOES NOT DISPLAY THEM PROPERLY, REFER TO THE SOURCE CODE.
Then look at HersheyFonts.h
This file has all of the enables for each of the different fonts. If they are all enabled, they will not fit into memory. To enable a fonts, make sure there is no ”//” at the begining of the line. To disable a font, put ”//” in front of that line. For example below, TIMES_ROMAN is enabled and and TIMES_ROMAN_BOLD is disabled.
// #define ENABLE_HERSHEY_TIMES_ROMAN_BOLD
There is also an ability to rotate the fonts, this to can be turned on or off
Below that is a list of enums, again make sure the font you want is enabled.
In your sketch
HersheyDrawCString(kHerheyFont_Cursive, xLoc, yLoc, “TEST”, 20, 0, 1);
HersheyDrawCString(1, 20, 50, “TEST”, 20, 0, 1);
This is the docs from the source code
char fontNumber,- – -this is an 8 bit integer (not a char) specifying which font to draw.
short xloc, – - -16 bit int X location for start of string
short yloc,- – -16 bit int Y location for start of string
char *theCstr,- – -the char string to draw
char fontSize,- – -this is an 8 bit integer in points, 6 is about the smallest that can be read
short fontAngle,- – -16 bit integer in degrees (-180 -> +180) 0 degrees is horizontal (normal), positive is UP (counter-clockwise)
char penSize – - – 8 bit integer for line width. Currently ignored
This is my current list of fonts that I have working, the ones with the *
-“are not yet posted
Note Japanese is not complete. There are more characters than fit in the normal ASCII mapping. If anyone is interested in getting the complete Japanese char set up and running I will be glad to do it. I just need some help mapping the characters. My email address is in the source code