Ejemplo n.º 1
0
Archivo: mktextr.c Proyecto: zear/sabre
void write_tmap(FILE *f, int which)
{
  int i,j;
  unsigned char  *bfptr;
  fprintf(f,"{\n");
  fprintf(f,"%d %d %d\n",textr_width,textr_height,textr_trans);
  for (i=0;i<textr_height;i++)
    {
      bfptr = image.buffer + (image.xsize * i) + (which * textr_width);
      fprintf(f,"\t");
      for (j=0;j<textr_width;j++)
	fprintf(f,"%s ", format_byte(*bfptr++));
      fprintf(f,"\n");
    }
  fprintf(f,"}\n");
}
Ejemplo n.º 2
0
int
render_glyph(Glyph *g, SDL_Surface **ret) {
	SDL_Color color = {0,0,0}, bgcolor={0xff,0xff,0xff};
	int bold, italic, underline, strikethrough, sup, sub, supsub;
	int font;
	int baseline;
	char *byte;
	TTF_Font **fs;
	
	byte = g->bytes;
	if (format_byte(*byte, &bold, &italic, &underline, &strikethrough, &sup, &sub, &supsub))
		byte++;
	
	if (sup || sub || supsub)
		fs = su_fonts;
	else
		fs = fonts;
		
	baseline = 0;
	if (sub)
		baseline = 9;
	else if(supsub)
		baseline = 3;
	
	if (bold && italic)
		font = FONT_BOLD_ITALIC;
	else if (bold)
		font = FONT_BOLD;
	else if (italic)
		font = FONT_ITALIC;
	else
		font = FONT_NORMAL;
		
	if (underline && strikethrough)
		TTF_SetFontStyle(fs[font], TTF_STYLE_UNDERLINE | TTF_STYLE_STRIKETHROUGH);
	else if (underline)
		TTF_SetFontStyle(fs[font], TTF_STYLE_UNDERLINE);
	else if (strikethrough)
		TTF_SetFontStyle(fs[font], TTF_STYLE_STRIKETHROUGH);
	
	*ret = TTF_RenderUTF8_Shaded(fs[font], byte, color, bgcolor);
	TTF_SetFontStyle(fs[font], TTF_STYLE_NORMAL);
	
	return baseline;
}