diff options
-rw-r--r-- | dw/fltkpreview.cc | 8 | ||||
-rw-r--r-- | dw/fltkpreview.hh | 5 | ||||
-rw-r--r-- | dw/fltkviewbase.cc | 18 | ||||
-rw-r--r-- | dw/fltkviewbase.hh | 5 | ||||
-rw-r--r-- | dw/image.cc | 6 | ||||
-rw-r--r-- | dw/view.hh | 5 |
6 files changed, 43 insertions, 4 deletions
diff --git a/dw/fltkpreview.cc b/dw/fltkpreview.cc index fbf139c9..907e129c 100644 --- a/dw/fltkpreview.cc +++ b/dw/fltkpreview.cc @@ -146,6 +146,14 @@ void FltkPreview::drawText (core::style::Font *font, fl_draw(text, len, translateCanvasXToViewX (x), translateCanvasYToViewY(y)); } +void FltkPreview::drawSimpleWrappedText (core::style::Font *font, + core::style::Color *color, + core::style::Color::Shading shading, + int x, int y, int w, int h, + const char *text, int len) +{ +} + void FltkPreview::drawImage (core::Imgbuf *imgbuf, int xRoot, int yRoot, int x, int y, int width, int height) { diff --git a/dw/fltkpreview.hh b/dw/fltkpreview.hh index 06d5a537..9e0f4eb1 100644 --- a/dw/fltkpreview.hh +++ b/dw/fltkpreview.hh @@ -42,6 +42,11 @@ public: core::style::Color *color, core::style::Color::Shading shading, int x, int y, const char *text, int len); + void drawSimpleWrappedText (core::style::Font *font, + core::style::Color *color, + core::style::Color::Shading shading, + int x, int y, int w, int h, + const char *text, int len); void drawImage (core::Imgbuf *imgbuf, int xRoot, int yRoot, int x, int y, int width, int height); diff --git a/dw/fltkviewbase.cc b/dw/fltkviewbase.cc index a01adf1a..ce8dc475 100644 --- a/dw/fltkviewbase.cc +++ b/dw/fltkviewbase.cc @@ -582,6 +582,24 @@ void FltkWidgetView::drawText (core::style::Font *font, } } +/* + * "simple" in that it ignores letter-spacing, etc. This was added for image + * alt text where none of that matters. + */ +void FltkWidgetView::drawSimpleWrappedText (core::style::Font *font, + core::style::Color *color, + core::style::Color::Shading shading, + int X, int Y, int W, int H, + const char *text, int len) +{ + FltkFont *ff = (FltkFont*)font; + fl_font(ff->font, ff->size); + fl_color(((FltkColor*)color)->colors[shading]); + fl_draw(text, + translateCanvasXToViewX (X), translateCanvasYToViewY (Y), + W, H, FL_ALIGN_TOP|FL_ALIGN_LEFT|FL_ALIGN_WRAP, NULL, 0); +} + void FltkWidgetView::drawImage (core::Imgbuf *imgbuf, int xRoot, int yRoot, int X, int Y, int width, int height) { diff --git a/dw/fltkviewbase.hh b/dw/fltkviewbase.hh index 03cf26d8..e6e85694 100644 --- a/dw/fltkviewbase.hh +++ b/dw/fltkviewbase.hh @@ -116,6 +116,11 @@ public: core::style::Color *color, core::style::Color::Shading shading, int x, int y, const char *text, int len); + void drawSimpleWrappedText (core::style::Font *font, + core::style::Color *color, + core::style::Color::Shading shading, + int x, int y, int w, int h, + const char *text, int len); void drawImage (core::Imgbuf *imgbuf, int xRoot, int yRoot, int x, int y, int width, int height); diff --git a/dw/image.cc b/dw/image.cc index 827cd753..50083151 100644 --- a/dw/image.cc +++ b/dw/image.cc @@ -384,11 +384,11 @@ void Image::draw (core::View *view, core::Rectangle *area) getContentHeight()); } - usedView->drawText (getStyle()->font, getStyle()->color, + usedView->drawSimpleWrappedText (getStyle()->font, getStyle()->color, core::style::Color::SHADING_NORMAL, allocation.x + getStyle()->boxOffsetX (), - allocation.y + getStyle()->boxOffsetY () - + getStyle()->font->ascent, + allocation.y + getStyle()->boxOffsetY (), + getContentWidth(), getContentHeight(), altText, strlen(altText)); if (clippingView) @@ -179,7 +179,10 @@ public: style::Color *color, style::Color::Shading shading, int x, int y, const char *text, int len) = 0; - + virtual void drawSimpleWrappedText (style::Font *font, style::Color *color, + style::Color::Shading shading, + int x, int y, int w, int h, + const char *text, int len) = 0; virtual void drawImage (Imgbuf *imgbuf, int xRoot, int yRoot, int x, int y, int width, int height) = 0; |