summaryrefslogtreecommitdiff
path: root/dmagick
diff options
context:
space:
mode:
authorMike Wey2011-11-15 23:56:00 +0100
committerMike Wey2011-11-15 23:56:00 +0100
commit3def606051550fbee11aa5dc92a5c5dced4585b3 (patch)
tree224b9c0f68f3acf1e924fc4f436c6d0a1bd4f7c3 /dmagick
parentfd957399a181a168a46f047a9a880f0848379023 (diff)
Also take the height into account when word wrapping.
Diffstat (limited to 'dmagick')
-rw-r--r--dmagick/Image.d6
1 files changed, 6 insertions, 0 deletions
diff --git a/dmagick/Image.d b/dmagick/Image.d
index b9e727e..f407389 100644
--- a/dmagick/Image.d
+++ b/dmagick/Image.d
@@ -4293,6 +4293,9 @@ class Image
size_t pos;
string[] lines;
+ double lineHeight = getTypeMetrics([text[0]]).height;
+ size_t maxLines = cast(size_t)(boundingBox.height / lineHeight);
+
while ( !text.empty )
{
for ( size_t i; i < text.length; i++ )
@@ -4322,6 +4325,9 @@ class Image
lines ~= text[0 .. pos].strip();
text = text[min(pos+1, text.length) .. $];
pos = 0;
+
+ if ( lines.length == maxLines )
+ break;
}
return join(lines, "\n");