summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscuri <scuri>2009-10-23 19:01:28 +0000
committerscuri <scuri>2009-10-23 19:01:28 +0000
commit999918c4962de2ae2bf1acaab2f5f50024a259e1 (patch)
treeb4e40d8a1197efd64456ee67db189a039746d409
parent5753ae89d5266a664a6468ce7df31ef0d8a6ae2a (diff)
Fixed: CanvasText for WD when using text with multiple lines.
-rw-r--r--html/en/history.html6
-rw-r--r--src/cd_text.c17
2 files changed, 21 insertions, 2 deletions
diff --git a/html/en/history.html b/html/en/history.html
index 795c285..8dd485a 100644
--- a/html/en/history.html
+++ b/html/en/history.html
@@ -19,7 +19,7 @@
<body>
<h2>History of Changes</h2>
-<h3>CVS (20/Oct/2008)</h3>
+<h3>CVS (23/Oct/2009)</h3>
<ul>
<li><span class="style1">Changed</span><span class="hist_changed">:</span>
Freetype updated to version 2.3.11.</li>
@@ -35,8 +35,10 @@
<li><span style="color: #FF0000">Fixed:</span> indexing of <strong>
cdImageRGB</strong>, <strong>cdImageRGBA</strong> and <strong>cdBitmap</strong>
objects in Lua.</li>
+ <li><span style="color: #FF0000">Fixed:</span> <strong>CanvasText</strong>
+ for WD when using text with multiple lines.</li>
</ul>
-<h3><a href="http://sourceforge.net/projects/canvasdraw/files/5.2/">Version 5.2</a> (26/Jun/2008)</h3>
+<h3><a href="http://sourceforge.net/projects/canvasdraw/files/5.2/">Version 5.2</a> (26/Jun/2009)</h3>
<ul>
<li><span style="color: #0000FF">New:</span> functions <strong>
CanvasGetVectorTextBox, CanvasGetVectorFontSize</strong> and <strong>
diff --git a/src/cd_text.c b/src/cd_text.c
index 4b3e839..2568e25 100644
--- a/src/cd_text.c
+++ b/src/cd_text.c
@@ -166,6 +166,23 @@ void cdfCanvasText(cdCanvas* canvas, double x, double y, const char *s)
else /* CD_CENTER || CD_EAST || CD_WEST */ /* it is relative to the full text */
cdfMovePoint(&x, &y, 0, (num_line-1)*line_height/2.0, sin_theta, cos_theta);
}
+ else
+ {
+ int align = canvas->text_alignment;
+
+ /* position vertically at the first line */
+ if (align == CD_NORTH || align == CD_NORTH_EAST || align == CD_NORTH_WEST || /* it is relative to the full text */
+ align == CD_BASE_LEFT || align == CD_BASE_CENTER || align == CD_BASE_RIGHT) /* it is relative to the first line already */
+ {
+ /* Already at position */
+ }
+ else if (align == CD_SOUTH || align == CD_SOUTH_EAST || align == CD_SOUTH_WEST) /* it is relative to the full text */
+ {
+ y += (num_line-1)*line_height;
+ }
+ else /* CD_CENTER || CD_EAST || CD_WEST */ /* it is relative to the full text */
+ y += ((num_line-1)*line_height)/2.0;
+ }
p = s;
for(i = 0; i < num_line; i++)