Project

General

Profile

LibHaru » History » Version 1

Koen Deforche, 11/12/2010 10:56 AM

1 1 Koen Deforche
h1. LibHaru
2
3
Wt requires the following patch for libHaru to render arcs correctly. This patch has been tested against libhar 2.1.0 and 2.2.0
4
5
<pre>
6
--- libharu-2.1.0/src/hpdf_page_operator.c	2008-05-27 20:23:31.000000000 +0200
7
+++ libharu-2.1.0-patched/src/hpdf_page_operator.c	2010-07-22 10:05:21.000000000 +0200
8
@@ -2192,7 +2192,7 @@
9
 
10
     HPDF_PTRACE ((" HPDF_Page_Arc\n"));
11
 
12
-    if (ang1 >= ang2 || (ang2 - ang1) >= 360)
13
+    if (fabs(ang2 - ang1) >= 360)
14
         HPDF_RaiseError (page->error, HPDF_PAGE_OUT_OF_RANGE, 0);
15
 
16
     if (ret != HPDF_OK)
17
@@ -2205,10 +2205,10 @@
18
 
19
 
20
     for (;;) {
21
-        if (ang2 - ang1 <= 90)
22
+        if (fabs(ang2 - ang1) <= 90)
23
             return InternalArc (page, x, y, ray, ang1, ang2, cont_flg);
24
         else {
25
-            HPDF_REAL tmp_ang = ang1 + 90;
26
+	    HPDF_REAL tmp_ang = (ang2 > ang1 ? ang1 + 90 : ang1 - 90);
27
 
28
             if ((ret = InternalArc (page, x, y, ray, ang1, tmp_ang, cont_flg))
29
                     != HPDF_OK)
30
@@ -2217,7 +2217,7 @@
31
             ang1 = tmp_ang;
32
         }
33
 
34
-        if (ang1 >= ang2)
35
+        if (fabs(ang1 - ang2) < 0.1)
36
             break;
37
 
38
         cont_flg = HPDF_TRUE;
39
@@ -2280,7 +2280,11 @@
40
         pbuf = HPDF_FToA (pbuf, (HPDF_REAL)x0, eptr);
41
         *pbuf++ = ' ';
42
         pbuf = HPDF_FToA (pbuf, (HPDF_REAL)y0, eptr);
43
-        pbuf = (char *)HPDF_StrCpy (pbuf, " m\012", eptr);
44
+
45
+	if (attr->gmode == HPDF_GMODE_PATH_OBJECT)
46
+	  pbuf = (char *)HPDF_StrCpy (pbuf, " l\012", eptr);
47
+	else
48
+	  pbuf = (char *)HPDF_StrCpy (pbuf, " m\012", eptr);
49
     }
50
 
51
     pbuf = HPDF_FToA (pbuf, (HPDF_REAL)x1, eptr);
52
</pre>