Fwd: libsvg bug and proposed patch

Clay Hopperdietzel <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>

-------- Original Message --------
Subject: 	libsvg bug and proposed patch
Date: 	Tue, 20 Mar 2012 19:11:08 +0000
From: 	Clay Hopperdietzel <[email protected]>
To: 	[email protected], [email protected]


All,

does libsvg have an active maintainer?

I sumbitted a patch a week ago to who seemed to be the owners of this, 
but got no response.

The message follows.

If there is a better way of getting these taken care of, please advise.

Clay

----------

I hope this is the proper approach to filing a bug report, if not, 
please direct me to the proper place.

I'm using libsvg-0.1.4 with libsvg-cairo-0.1.6

I created an SVG using inkscape.

The relevent part of this given below:

<path
    
style="fill:#ac8a00;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
    d="m 15,36.233643 18.047549,-20 26.952451,10 7.202838,30 
-2.202838,30 -37.675769,-10 z"
    id="path4723"
    inkscape:connector-curvature="0" />

this figure was not rendering properly with libsvg, but was in inkscape 
plus chrome web browser.

After running with cairo trace, discovered that the net sum of what this 
did was a number of move commands, followed by a close path.

I believe that the problem is failure to observe the following from 
http://www.w3.org/TR/SVG/paths.html 
<http://www.w3.org/TR/SVG/paths.html#PathDataClosePathCommand>

8.3.2 moveto

"... If a moveto is followed by multiple pairs of coordinates, the 
subsequent pairs are treated as implicit lineto commands. Hence, 
implicit lineto commands will be relative if the moveto is relative, and 
absolute if the moveto is absolute. ..."

attached is a patch which applied to libsvg seems to correct this problem.

Thank you for your attention.

[email protected]

--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
libsvg-20120320.patch (text/x-patch, 1.5 KB)
*** svg_path.c.orig	Mon Apr 11 15:51:47 2005
--- svg_path.c	Tue Mar 20 18:53:13 2012
*************** _svg_path_add_from_str (svg_path_t *path
*** 391,396 ****
--- 391,397 ----
      svg_status_t status;
      const svg_path_cmd_info_t *cmd_info;
      double arg[SVG_PATH_CMD_MAX_ARGS];
+     int next_cmd=0;
  
      s = path_str;
      while (*s) {
*************** _svg_path_add_from_str (svg_path_t *path
*** 404,409 ****
--- 405,412 ----
  	    return status;
  	s++;
  
+ 	next_cmd = cmd_info->cmd;
+ 
  	while (1) {
  	    status = _svg_str_parse_csv_doubles (s, arg, cmd_info->num_args, &end);
  	    s = end;
*************** _svg_path_add_from_str (svg_path_t *path
*** 411,422 ****
  		goto NEXT_CMD;
  	    if (status)
  		return status;
! 	    switch (cmd_info->cmd) {
  	    case SVG_PATH_CMD_MOVE_TO:
  		status = _svg_path_move_to (path, arg[0], arg[1]);
  		break;
  	    case SVG_PATH_CMD_REL_MOVE_TO:
  		status = _svg_path_rel_move_to (path, arg[0], arg[1]);
  		break;
  	    case SVG_PATH_CMD_LINE_TO:
  		status = _svg_path_line_to (path, arg[0], arg[1]);
--- 414,427 ----
  		goto NEXT_CMD;
  	    if (status)
  		return status;
! 	    switch (next_cmd) {
  	    case SVG_PATH_CMD_MOVE_TO:
  		status = _svg_path_move_to (path, arg[0], arg[1]);
+ 		next_cmd = SVG_PATH_CMD_LINE_TO;
  		break;
  	    case SVG_PATH_CMD_REL_MOVE_TO:
  		status = _svg_path_rel_move_to (path, arg[0], arg[1]);
+ 		next_cmd = SVG_PATH_CMD_REL_LINE_TO;
  		break;
  	    case SVG_PATH_CMD_LINE_TO:
  		status = _svg_path_line_to (path, arg[0], arg[1]);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.