// font bitmap allocation
  BITMAP Font[26];

  void LoadCharacters (void)
   {
   int i;
   char str[30];

      for (i=0; i<26 ; i++)
	{
	sprintf(str,"font\\%c.bmp",(char)65+i);
	bitmap_load(str,&Font[i]);
	farfree(Font[i].palette);
	}
   }

// free characters
   void FreeCharacters (void)
   {
   int i;
      for (i=0; i<26 ; i++)
	{
	farfree(Font[i].data);
	}
   }

// print characters
  void PrintChar (int x,int y,char character,int Flag)
   {
   int index = (int)character - 65;
   if ( (index < 0) || (index > 25) ) {return;}
   if (Flag){ bitmap_show_tranparency(&Font[index],x,y); }
   else     { bitmap_show_buffer_db(&Font[index],x,y);   }
   }

// print string
  void  PrintString(int x,int y,char *string,int trans_flag)
{
//the function blits a string using blit char
	int index;
	for (index=0;string[index]!=0;index++)
	{
	PrintChar(x+((index)<<3),y,string[index],trans_flag);
	}//end for
}//end
// rom functions
void PrintRomChar(int xc,int yc,char c,int color,int trans_flag)
{

//this uses the rom char set to blit a character.
//Bits r extracted out of each character byte 2 represent char

	int offset, x, y;
	unsigned char far *work_char;
	unsigned char bit_mask=0x80; //starting offset in ROM table

	work_char = rom_char_set + c * CHAR_HEIGHT;
	//COMPUTE THe offset of the video buffer
	offset=(yc<<8)+(yc<<6)+xc;
	for (y=0;y<CHAR_HEIGHT;y++)
	{
	//reset bit mask
		bit_mask=0x80;
		for(x=0;x<CHAR_WIDTH;x++)
		{
			//test for transparent pixel 0 else draw
			if ((*work_char & bit_mask))
			double_buffer[offset+x]=color+y;
			else if (!trans_flag)
			double_buffer[offset+x]=0;
			//takes care of transparency
			//shift bit mask
			bit_mask= (bit_mask >> 1);
		}//end for
	//move to next line
	offset+=SCREEN_WIDTH;
	work_char++;
	}//end for y
}//end blit char

void  PrintRomString(int x,int y,int color,char *string,int trans_flag)
{
//the function blits a string using blit char
	int index;
	for (index=0;string[index]!=0;index++)
	{
	PrintRomChar(x+(index<<3),y,string[index],color,trans_flag);
	}//end for
}//end blit strring

