From 999918c4962de2ae2bf1acaab2f5f50024a259e1 Mon Sep 17 00:00:00 2001 From: scuri Date: Fri, 23 Oct 2009 19:01:28 +0000 Subject: Fixed: CanvasText for WD when using text with multiple lines. --- src/cd_text.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/cd_text.c') 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++) -- cgit v1.2.3