changeset 2143:2a82f5b9c4c0

work around a fl_width() bug Pretty easy workaround, yes? :)
author corvid <corvid@lavabit.com>
date Do, 21 Jul 2011 01:29:53 +0000
parents 39732d8f7abd
children d587288ee7b4
files dw/fltkplatform.cc dw/fltkui.cc
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dw/fltkplatform.cc	Di Jul 19 15:29:29 2011 -0400
+++ b/dw/fltkplatform.cc	Do Jul 21 01:29:53 2011 +0000
@@ -123,7 +123,9 @@
    font = family->get (fa);
 
    fl_font(font, size);
-   spaceWidth = misc::max(0, (int)fl_width(' ') + letterSpacing);
+   /* WORKAROUND: fl_width(uint_t) is not working on non-xft X.
+    * Reported to FLTK as STR #2688 */
+   spaceWidth = misc::max(0, (int)fl_width(" ") + letterSpacing);
    int xx, xy, xw, xh;
    fl_text_extents("x", xx, xy, xw, xh);
    xHeight = xh;
--- a/dw/fltkui.cc	Di Jul 19 15:29:29 2011 -0400
+++ b/dw/fltkui.cc	Do Jul 21 01:29:53 2011 +0000
@@ -539,8 +539,10 @@
    if (displayed() && style) {
       FltkFont *font = (FltkFont*)style->font;
       fl_font(font->font,font->size);
+      /* WORKAROUND: fl_width(uint_t) is not working on non-xft X.
+       * Reported to FLTK as STR #2688 */
       requisition->width =
-         (int)fl_width ('n')
+         (int)fl_width ("n")
          * (maxLength == UNLIMITED_MAX_LENGTH ? 10 : maxLength)
          + label_w + (2 * RELIEF_X_THICKNESS);
       requisition->ascent = font->ascent + RELIEF_Y_THICKNESS;
@@ -657,8 +659,10 @@
    if (style) {
       FltkFont *font = (FltkFont*)style->font;
       fl_font(font->font,font->size);
+      /* WORKAROUND: fl_width(uint_t) is not working on non-xft X.
+       * Reported to FLTK as STR #2688 */
       requisition->width =
-         (int)fl_width ('n') * numCols + 2 * RELIEF_X_THICKNESS;
+         (int)fl_width ("n") * numCols + 2 * RELIEF_X_THICKNESS;
       requisition->ascent =
          RELIEF_Y_THICKNESS + font->ascent +
          (font->ascent + font->descent) * (numRows - 1);