File: 32_arcbox-zeroradius.patch

package info (click to toggle)
fig2dev 1%3A3.2.9a-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,708 kB
  • sloc: ansic: 38,164; sh: 7,981; makefile: 162; csh: 12
file content (47 lines) | stat: -rw-r--r-- 1,499 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From: Thomas Loimer <thomas.loimer@tuwien.ac.at>
Date: Tue, 21 Jan 2025 20:50:15 +0100
Origin: upstream, https://sourceforge.net/p/mcj/fig2dev/ci/ff9aba2
Forwarded: not-needed
Bug: https://sourceforge.net/p/mcj/tickets/184/
Subject: Allow an arc-box with zero radius, ticket #184
 In the pict2e output, a rectangle with rounded corners, dashed line type and
 zero corner-radius would cause a crash. Convert rectangles with rounded
 corners and zero corner-radius to regular rectangles.

--- a/fig2dev/read.c
+++ b/fig2dev/read.c
@@ -1037,6 +1037,14 @@ sanitize_lineobject(F_line *l, int line_
 							line_no);
 					return -1;
 				}
+				if (l->type == T_ARC_BOX && l->radius == 0) {
+					put_msg("A %s, but zero corner radius "
+							"at line %d - convert "
+							"to a rectangle.",
+							obj_name[l->type - 2],
+							line_no);
+					l->type = T_BOX;
+				}
 			}
 
 		} else { /* T_BOX || T_POLYGON */
--- a/fig2dev/tests/read.at
+++ b/fig2dev/tests/read.at
@@ -123,6 +123,17 @@ A rectangle with 3 corners at line 11 -
 ])
 AT_CLEANUP
 
+AT_SETUP([convert an arc-box with zero radius to a box])
+AT_KEYWORDS(read.c arc-box)
+AT_CHECK([fig2dev -L pict2e <<EOF
+FIG_FILE_TOP
+2 4 1 1 0 0 50 -1 -1 4.0 0 0 0 0 0 5
+	0 0 300 0 300 300 0 300 0 0
+EOF
+],0,ignore,[A rectangle with rounded corners, but zero corner radius at line 11 - convert to a rectangle.
+])
+AT_CLEANUP
+
 AT_SETUP([fail on a malformed arc-box])
 AT_KEYWORDS(read.c malformed arc-box)
 AT_CHECK([fig2dev -L pict2e <<EOF