static asstring_t *QAS_StringFromCharCode( unsigned int charCode ) { return objectString_FactoryBuffer( Q_WCharToUtf8Char( charCode ), Q_WCharUtf8Length( charCode ) ); }
/* * FTLIB_DrawClampChar * * Draws one graphics character with 0 being transparent. * Clipped to [xmin, ymin; xmax, ymax]. */ void FTLIB_DrawClampChar( int x, int y, wchar_t num, int xmin, int ymin, int xmax, int ymax, qfontface_t *font, vec4_t color ) { qglyph_t *glyph; int x2, y2; float s1 = 0.0f, t1 = 0.0f, s2 = 1.0f, t2 = 1.0f; float tw, th; fdrawchar_t draw = trap_R_DrawStretchPic; if( ( num <= ' ' ) || !font || ( xmax <= xmin ) || ( ymax <= ymin ) ) return; glyph = FTLIB_GetGlyph( font, num ); if( !glyph ) { num = FTLIB_REPLACEMENT_GLYPH; glyph = FTLIB_GetGlyph( font, num ); } if( !glyph->shader ) font->f->renderString( font, Q_WCharToUtf8Char( num ) ); if( !glyph->width || !glyph->height ) return; x += glyph->x_offset; y += font->glyphYOffset + glyph->y_offset; x2 = x + glyph->width; y2 = y + glyph->height; if( ( x > xmax ) || ( y > ymax ) || ( x2 <= xmin ) || ( y2 <= ymin ) ) return; ++xmax; ++ymax; if( x < xmin ) { s1 = ( xmin - x ) / ( float )glyph->width; x = xmin; } if( y < ymin ) { t1 = ( ymin - y ) / ( float )glyph->height; y = ymin; } if( x2 > xmax ) { s2 = 1.0f - ( x2 - xmax ) / ( float )glyph->width; x2 = xmax; } if( y2 > ymax ) { t2 = 1.0f - ( y2 - ymax ) / ( float )glyph->height; y2 = ymax; } tw = glyph->s2 - glyph->s1; th = glyph->t2 - glyph->t1; if( drawCharIntercept ) draw = drawCharIntercept; draw( x, y, x2 - x, y2 - y, glyph->s1 + tw * s1, glyph->t1 + th * t1, glyph->s1 + tw * s2, glyph->t1 + th * t2, color, glyph->shader ); }