+ *maxlen = i;
+
+ if (outcolor)
+ *outcolor = colorindex;
+
+ return x;
+}
+
+float DrawQ_String_Scale(float startx, float starty, const char *text, size_t maxlen, float w, float h, float sw, float sh, float basered, float basegreen, float baseblue, float basealpha, int flags, int *outcolor, qboolean ignorecolorcodes, const dp_font_t *fnt)
+{
+ int shadow, colorindex = STRING_COLOR_DEFAULT;
+ size_t i;
+ float x = startx, y, s, t, u, v, thisw;
+ float *av, *at, *ac;
+ float color[4];
+ int batchcount;
+ static float vertex3f[QUADELEMENTS_MAXQUADS*4*3];
+ static float texcoord2f[QUADELEMENTS_MAXQUADS*4*2];
+ static float color4f[QUADELEMENTS_MAXQUADS*4*4];
+ Uchar ch, mapch, nextch;
+ Uchar prevch = 0; // used for kerning
+ int tempcolorindex;
+ int map_index = 0;
+ //ft2_font_map_t *prevmap = NULL; // the previous map
+ ft2_font_map_t *map = NULL; // the currently used map
+ ft2_font_map_t *fontmap = NULL; // the font map for the size
+ float ftbase_y;
+ const char *text_start = text;
+ float kx, ky;
+ ft2_font_t *ft2 = fnt->ft2;
+ qboolean snap = true;
+ float pix_x, pix_y;
+ size_t bytes_left;
+ float dw, dh;
+ const float *width_of;
+
+ int tw, th;
+ tw = R_TextureWidth(fnt->tex);
+ th = R_TextureHeight(fnt->tex);
+
+ if (!h) h = w;
+ if (!h) {
+ h = w = 1;
+ snap = false;
+ }
+
+ starty -= (fnt->scale - 1) * h * 0.5; // center
+ w *= fnt->scale;
+ h *= fnt->scale;
+
+ if (ft2 != NULL)
+ {
+ if (snap)
+ map_index = Font_IndexForSize(ft2, h, &w, &h);
+ else
+ map_index = Font_IndexForSize(ft2, h, NULL, NULL);
+ fontmap = Font_MapForIndex(ft2, map_index);
+ }
+
+ dw = w * sw;
+ dh = h * sh;
+
+ // draw the font at its baseline when using freetype
+ //ftbase_x = 0;
+ ftbase_y = dh * (4.5/6.0);
+
+ if (maxlen < 1)
+ maxlen = 1<<30;
+
+ _DrawQ_ProcessDrawFlag(flags);
+
+ R_Mesh_ColorPointer(color4f, 0, 0);
+ R_Mesh_ResetTextureState();
+ if (!fontmap)
+ R_Mesh_TexBind(0, fnt->tex);
+ R_Mesh_TexCoordPointer(0, 2, texcoord2f, 0, 0);
+ R_Mesh_VertexPointer(vertex3f, 0, 0);
+ R_SetupShader_Generic(fnt->tex, NULL, GL_MODULATE, 1);
+