Changeset 540 for trunk/thune/gl/draw_list.c
- Timestamp:
- 07/04/08 03:46:13 (5 months ago)
- Files:
-
- 1 modified
-
trunk/thune/gl/draw_list.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/thune/gl/draw_list.c
r536 r540 242 242 Advances x. 243 243 */ 244 static TexFontGlyph* renderGlyphXY( const TexFont* txf, int c, 245 GLfloat* xp, GLfloat y, 244 static TexFontGlyph* renderGlyphXY( const TexFont* txf, 245 GLfloat texW, GLfloat texH, 246 int c, GLfloat* xp, GLfloat y, 246 247 const TexFontGlyph* leftGI ) 247 248 { 248 GLfloat w, h; 249 GLfloat tw, th; 249 GLfloat gw, gh; 250 250 GLfloat gx, gy; 251 251 GLfloat min_s, max_s; … … 257 257 if( tgi ) 258 258 { 259 w = (GLfloat) txf->tex_width; 260 h = (GLfloat) txf->tex_height; 261 262 tw = (GLfloat) tgi->width; 263 th = (GLfloat) tgi->height; 264 259 gw = (GLfloat) tgi->width; 260 gh = (GLfloat) tgi->height; 265 261 gx = (GLfloat) tgi->x; 266 262 gy = (GLfloat) tgi->y; 267 263 268 min_s = gx / w; 269 min_t = 1.0f - (gy / h); 270 max_s = (gx + tw) / w; 271 max_t = 1.0f - ((gy + th) / h); 264 min_s = gx / texW; 265 max_s = (gx + gw) / texW; 266 #if 0 267 min_t = 1.0f - (gy / texH); 268 max_t = 1.0f - ((gy + gh) / texH); 269 #else 270 min_t = gy / texH; 271 max_t = (gy - gh) / texH; 272 #endif 272 273 273 274 xkern = leftGI ? txf_kerning( txf, leftGI, tgi ) : 0; … … 278 279 279 280 glTexCoord2f( min_s, min_t ); glVertex2f( gx, gy ); 280 glTexCoord2f( max_s, min_t ); glVertex2f( gx + tw, gy );281 glTexCoord2f( max_s, max_t ); glVertex2f( gx + tw, gy + th );282 glTexCoord2f( min_s, max_t ); glVertex2f( gx, gy + th );281 glTexCoord2f( max_s, min_t ); glVertex2f( gx + gw, gy ); 282 glTexCoord2f( max_s, max_t ); glVertex2f( gx + gw, gy + gh ); 283 glTexCoord2f( min_s, max_t ); glVertex2f( gx, gy + gh ); 283 284 } 284 285 return tgi; … … 302 303 { 303 304 GLfloat x, y; 305 GLfloat tw, th; 304 306 TexFontGlyph* prev = 0; 307 308 tw = (GLfloat) tf->tex_width; 309 th = (GLfloat) tf->tex_height; 305 310 306 311 if( (it != end) ) … … 317 322 { 318 323 x = (GLfloat) tf->max_ascent; 319 y -= x * 1.5f; // Estimate of line spacing.324 y -= txf_lineSpacing( tf ); 320 325 x = grState.penX; 321 326 prev = 0; … … 328 333 else 329 334 { 330 prev = renderGlyphXY( tf, *it, &x, y, prev );335 prev = renderGlyphXY( tf, tw, th, *it, &x, y, prev ); 331 336 } 332 337 ++it;
