From 5dc9e10627a82d0b72ed1735f802364d9d2d9315 Mon Sep 17 00:00:00 2001 From: corvid Date: Thu, 21 Jul 2011 01:29:53 +0000 Subject: work around a fl_width() bug Pretty easy workaround, yes? :) --- dw/fltkplatform.cc | 4 +++- dw/fltkui.cc | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'dw') diff --git a/dw/fltkplatform.cc b/dw/fltkplatform.cc index d28dbdea..62f2daba 100644 --- a/dw/fltkplatform.cc +++ b/dw/fltkplatform.cc @@ -123,7 +123,9 @@ FltkFont::FltkFont (core::style::FontAttrs *attrs) 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; diff --git a/dw/fltkui.cc b/dw/fltkui.cc index 5405d92e..788df084 100644 --- a/dw/fltkui.cc +++ b/dw/fltkui.cc @@ -539,8 +539,10 @@ void FltkEntryResource::sizeRequest (core::Requisition *requisition) 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 @@ void FltkMultiLineTextResource::sizeRequest (core::Requisition *requisition) 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); -- cgit v1.2.3