//Shows a text in the text zone void showMessage(char* pS, byte pFontSize){ if (mButtonDisplayLabel == 0) return; //Refresh the display of the label display button drawARDTButton(*mButtonDisplayLabel); HersheyDrawCString( kHerheyFont_Futural, mButtonDisplayLabel->rect.left+5, mButtonDisplayLabel->rect.top + ((mButtonDisplayLabel->rect.bottom - mButtonDisplayLabel->rect.top) /2), pS, pFontSize, 0, 1); }
//******************************************************************************* void HersheyDisplayFontSamples(RECT *displayRect) { int xLoc, yLoc; int xLoc2; int fontSize; char fontName[32]; short fontNum; RGBColor myColor; if (gWidth < 200) { xLoc = 5; } else { xLoc = 25; } if (gWidth > 150) { xLoc2 = gWidth / 2; } else { xLoc2 = 2 * gWidth; //* yes, this puts it off the screen } for (fontNum = kHershey_FirstFontNumber; fontNum <kHersheyFont_last; fontNum++) { SetRGBcolor(&myColor, random(100, 255), random(100, 255), random(100, 255)); RGBForeColor(&myColor); EraseScreen(); FrameRect(displayRect); GetHersheyFontName(fontNum, fontName); yLoc = 10; DrawCString(xLoc, yLoc, "Hershey fonts"); yLoc += 12; //******************************************************************************* DrawCString(xLoc, yLoc, fontName); DrawCString(xLoc2, yLoc, "Size 6"); yLoc += 20; fontSize = 8; HersheyDrawCString(fontNum, xLoc, yLoc, "ABCDEFGHIJKLMNOPQRSTUVWXYZ !@#$%^&()[];'><", fontSize, 0, 1); yLoc += 15; HersheyDrawCString(fontNum, xLoc, yLoc, "abcdefghijklmnopqrstuvwzyz 1234567890 ", fontSize, 0, 1); yLoc += 15; if (yLoc < gHeight) { //******************************************************************************* DrawCString(xLoc, yLoc, fontName); DrawCString(xLoc2, yLoc, "Size 10"); fontSize = 10; yLoc += 25; HersheyDrawCString(fontNum, xLoc, yLoc, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", fontSize, 0, 1); yLoc += 25; HersheyDrawCString(fontNum, xLoc, yLoc, "abcdefghijklmnopqrstuvwzyz 1234567890 ", fontSize, 0, 1); yLoc += 25; } if (yLoc < gHeight) { //******************************************************************************* DrawCString(xLoc, yLoc, fontName); DrawCString(xLoc2, yLoc, "Size 40"); fontSize = 40; yLoc += 40; HersheyDrawCString(fontNum, xLoc, yLoc, "ABCDEFGHIJKL", fontSize, 0, 1); yLoc += 30; } if (yLoc < (gHeight - 40)) { //******************************************************************************* DrawCString(xLoc, yLoc, fontName); DrawCString(xLoc2, yLoc, "Size 70"); fontSize = 70; yLoc += 70; HersheyDrawCString(fontNum, xLoc + 15, yLoc, "ABCDEFG", fontSize, 0, 1); yLoc += 30; } delay(3000); } }
//******************************************************************************** void HersheyDisplayFontList(RECT *displayRect, boolean showSize) { int xLoc, yLoc; int xLoc2; int ii; char theFontName[32]; long fontDataLen; short myDisplayWidth; RGBColor myColor; Boolean drawHeader; #ifdef _USE_WHITE_BACKGROUND_ SetRGBcolor(&myColor, 255, 255, 255); fill(255); #else SetRGBcolor(&myColor, 0, 0, 0); #endif RGBBackColor(&myColor); myDisplayWidth = displayRect->right - displayRect->left; EraseRect(displayRect); #ifdef _USE_WHITE_BACKGROUND_ SetRGBcolor(&myColor, 0, 0, 0); #else SetRGBcolor(&myColor, random(100, 255), random(100, 255), random(100, 255)); #endif RGBForeColor(&myColor); if (myDisplayWidth < 200) { xLoc = 5; } else { xLoc = 25; } xLoc2 = myDisplayWidth / 2; drawHeader = true; for (ii = kHershey_FirstFontNumber; ii <kHersheyFont_last; ii++) { if (drawHeader) { EraseScreen(); // EraseRect(displayRect); FrameRect(displayRect); yLoc = 10; DrawCString(5, yLoc, "Installed Hershey Fonts"); yLoc += 16; drawHeader = false; } GetHersheyFontName(ii, theFontName); DrawCString(xLoc, yLoc, theFontName); if (myDisplayWidth > 150) { if (showSize) { fontDataLen = GetHersheyFontTableSize(ii); sprintf(theFontName, "%ld bytes", fontDataLen); DrawCString((displayRect->left + xLoc2), yLoc, theFontName); } else { //* print some sample text HersheyDrawCString(ii, xLoc2, yLoc + 7, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 15, 0, 1); } } yLoc += 16; if (yLoc > displayRect->bottom) { delay(2000); drawHeader = true; } } }