diff options
author | Sebastian Geerken <devnull@localhost> | 2014-08-11 11:30:38 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2014-08-11 11:30:38 +0200 |
commit | 97764507a86656fa1976352519680cb181a9e895 (patch) | |
tree | 510ae5b65575f13e4a5e9e7849327ee20927a2ad /dw/image.cc | |
parent | 47c69d0359c720eed2afb8329e827dee76539de1 (diff) |
Image: enough space for alt text (again).
Diffstat (limited to 'dw/image.cc')
-rw-r--r-- | dw/image.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/dw/image.cc b/dw/image.cc index d04d993b..77286871 100644 --- a/dw/image.cc +++ b/dw/image.cc @@ -179,8 +179,21 @@ void Image::sizeRequestImpl (core::Requisition *requisition) if (buffer) { requisition->width = buffer->getRootWidth (); requisition->ascent = buffer->getRootHeight (); - } else - requisition->width = requisition->ascent = 0; + } else { + if (altText && altText[0]) { + if (altTextWidth == -1) + altTextWidth = + layout->textWidth (getStyle()->font, altText, strlen (altText)); + + requisition->width = altTextWidth; + requisition->ascent = getStyle()->font->ascent; + requisition->descent = getStyle()->font->descent; + } else { + requisition->width = 0; + requisition->ascent = 0; + requisition->descent = 0; + } + } requisition->width += boxDiffWidth (); requisition->ascent += boxOffsetY (); |