EasyBMP Extensions: Font
Font is an extension to EasyBMP that provides a fully-scalable, anti-aliased font.
Click here to download the extension. (Contained in the extensions package)
Here is the main function:
int PrintString( BMP& Image, char* String, int TopLeftX, int TopLeftY,
int Height, RGBApixel Color)
This function prints the string String onto the BMP object Image with height Height and color Color. The top left corner of the text string will be located at pixel (TopLeftX,TopLeftY). It returns the location of the right edge of the printing (including spacing), measured in pixels. You can use this returned value to print another string immediately after the current string.
Also note that I have defined COPYRIGHT_SYMBOL=-100, and so you can always change a character of a string to that value to add a copyright symbol. Consider the following sample code:
BMP Image;
Image.SetSize(640,480);
RGBApixel FontColor;
FontColor.Red = 255; FontColor.Green = 0; FontColor.Blue = 0;
Image.SetSize(640,480);
char* TextString;
TextString = new char [2050];
strcpy( TextString , "Copyright c 2005 the EasyBMP Project" );
TextString[10] = COPYRIGHT_SYMBOL;
PrintString(Image, TextString, 5,5, 12, FontColor );
Here is a sample image of the font extension in action: