/* PLEASE NOTE: This file and the routines it contains were written by David Randall. e-mail: drandall99@charter.net Some routines were modified by myself. */ // C Source File // Created 3/5/2005; 11:08:48 AM #include #include "pcpress.h" #include "FontUtils.h" UserFontType userFont; void SetUserFont(char* pFont, unsigned char fontWidth, unsigned char fontHeight) { userFont.pFont = pFont; userFont.height = fontHeight; userFont.width = fontWidth; } void GrayUserDrawStrLength(unsigned char x, unsigned char y, char* str, unsigned short color, unsigned short invert, unsigned short length) { char tmpBuf[64]; memcpy (&tmpBuf[0], str, length); tmpBuf[length] = 0; GrayUserDrawStr(x, y, &tmpBuf[0]); } void GrayUserDrawStr(unsigned char x, unsigned char y, char* str) { unsigned char* charSprite; unsigned char nextX = x; //unsigned short eorMask = 0; /*if (invert) { eorMask = ((1 << userFont.width) - 1) << (8 - userFont.width); }*/ while ((*str) && (nextX + userFont.width < 240) && (y + userFont.height < 128)) { if ((unsigned char)*str > 128 && (unsigned char)*str != 160) { charSprite = userFont.pFont + (128 * userFont.height + 1); } else if ((unsigned char)*str == 160) { charSprite = userFont.pFont + (129 * userFont.height + 1); } else { charSprite = userFont.pFont + ((unsigned char)*str * userFont.height); } GraySingleSprite8_XOR_R ( nextX, y, userFont.height, charSprite, GrayPlane0, GrayPlane1 ); nextX += userFont.width; str++; } } void UppercaseString(char* pString) { while (*pString) { if (*pString >= 97 && *pString <= 122) *pString &= 0xdf; pString++; } }