- int sw, sh;
- GLfloat scale = 0.6;
- char *title = frame->title ? frame->title : "(untitled)";
- sw = texture_string_width (ss->texfont, title, &sh);
-
- glTranslatef (-sw*scale*0.5, -h - sh*scale, z);
+ int sw, sh, ascent, descent;
+ GLfloat scale = 1;
+ const char *title = frame->title ? frame->title : "(untitled)";
+ XCharStruct e;
+
+ /* #### Highly approximate, but doing real clipping is harder... */
+ int max = 35;
+ if (strlen(title) > max)
+ title += strlen(title) - max;
+
+ texture_string_metrics (ss->texfont, title, &e, &ascent, &descent);
+ sw = e.width;
+ sh = ascent + descent;
+
+ /* Scale the text to match the pixel size of the photo */
+ scale *= w / 300.0;
+
+ /* Move to below photo */
+ glTranslatef (0, -h - sh * (polaroid_p ? 2.2 : 0.5), 0);
+ glTranslatef (-sw*scale/2, sh*scale/2, z);