iOS/buildlibs/armv7/allegro-4.4.2/addons/allegrogl/src/fontconv.c
/* Creates a call lists from given glyph coords. Returns list base.*/
Creates a call lists from given glyph coords. Returns list base.
Creates a call lists from given glyph coords . Returns list base .
static int create_textured_font_call_lists(AGL_GLYPH *coords, int max, BITMAP *bmp,
													float scale, int *height) {
	GLuint list;
	int i;
	int rev = scale < 0 ? 1 : 0;
	scale = fabs(scale);
	list = glGenLists(max);
	for (i = 0; i < max; i++) {
		float tx = (float)coords[i].x / bmp->w;
		float ty = 1.0 - (float)coords[i].y / bmp->h;
		float dtx = (float)(coords[i].w) / bmp->w;
		float dty = (float)(coords[i].h) / bmp->h;
		float xoffs = (float)coords[i].offset_x / scale;
		float yoffs = (float)coords[i].offset_y / scale;
		float woffs = (float)coords[i].w / scale;
		float hoffs = (float)coords[i].h / scale;
		float sizew = (float)(coords[i].offset_x + coords[i].w
					+ coords[i].offset_w) / scale;
		int sizeh = iroundf((coords[i].offset_y + coords[i].h
		            + coords[i].offset_h) / scale);
		if ((*height) < sizeh)
			*height = sizeh;
		if (rev) {
			hoffs = -hoffs;
			yoffs = -yoffs;
		}
		glNewList(list + i, GL_COMPILE);
		glBegin(GL_QUADS);
			glTexCoord2f(tx, ty);
			glVertex2f(xoffs, -yoffs);
			glTexCoord2f(tx + dtx, ty);
			glVertex2f(xoffs + woffs, -yoffs);
			glTexCoord2f(tx + dtx, ty - dty);
			glVertex2f(xoffs + woffs, -yoffs - hoffs);
			glTexCoord2f(tx, ty - dty);
			glVertex2f(xoffs, -yoffs - hoffs);
		glEnd();
		glTranslatef(sizew, 0, 0);
		glEndList();
	}
	return list;
}
static int create_textured_font_call_lists ( AGL_GLYPH * coords , int max , BITMAP * bmp , float scale , int * height ) { GLuint list ; int i ; int rev = scale < 0 ? 1 : 0 ; scale = fabs ( scale ) ; list = glGenLists ( max ) ; for ( i = 0 ; i < max ; i ++ ) { float tx = ( float ) coords [ i ] . x / bmp -> w ; float ty = 1.0 - ( float ) coords [ i ] . y / bmp -> h ; float dtx = ( float ) ( coords [ i ] . w ) / bmp -> w ; float dty = ( float ) ( coords [ i ] . h ) / bmp -> h ; float xoffs = ( float ) coords [ i ] . offset_x / scale ; float yoffs = ( float ) coords [ i ] . offset_y / scale ; float woffs = ( float ) coords [ i ] . w / scale ; float hoffs = ( float ) coords [ i ] . h / scale ; float sizew = ( float ) ( coords [ i ] . offset_x + coords [ i ] . w + coords [ i ] . offset_w ) / scale ; int sizeh = iroundf ( ( coords [ i ] . offset_y + coords [ i ] . h + coords [ i ] . offset_h ) / scale ) ; if ( ( * height ) < sizeh ) * height = sizeh ; if ( rev ) { hoffs = - hoffs ; yoffs = - yoffs ; } glNewList ( list + i , GL_COMPILE ) ; glBegin ( GL_QUADS ) ; glTexCoord2f ( tx , ty ) ; glVertex2f ( xoffs , - yoffs ) ; glTexCoord2f ( tx + dtx , ty ) ; glVertex2f ( xoffs + woffs , - yoffs ) ; glTexCoord2f ( tx + dtx , ty - dty ) ; glVertex2f ( xoffs + woffs , - yoffs - hoffs ) ; glTexCoord2f ( tx , ty - dty ) ; glVertex2f ( xoffs , - yoffs - hoffs ) ; glEnd ( ) ; glTranslatef ( sizew , 0 , 0 ) ; glEndList ( ) ; } return list ; }
Creates a call lists from given glyph coords.
Creates a call lists from given glyph coords .
/* Coords of glyph in texture (texture coords) */ /* Size of glyph in texture (texture coords) */ /* Offset to apply to glyph (output coords) */ /* Size of rendered glyph (output coords) */ /* Size of overall screen character including dead space */