After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 333057 - stroke-widths thinner than 0.11pt (declared in css) are rendered incorrectly
stroke-widths thinner than 0.11pt (declared in css) are rendered incorrectly
Status: RESOLVED FIXED
Product: libcroco
Classification: Core
Component: General
unspecified
Other All
: Normal normal
: ---
Assigned To: libcroco maintainers
libcroco maintainers
Depends on:
Blocks:
 
 
Reported: 2006-03-01 22:36 UTC by Gustav Broberg
Modified: 2006-03-02 01:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Testcase of different stroke widths (629 bytes, image/svg+xml)
2006-03-01 22:40 UTC, Gustav Broberg
  Details
stroke-test.svg rasterized with batik (reference) (14.09 KB, image/png)
2006-03-01 22:42 UTC, Gustav Broberg
  Details
stroke-test.svg rasterized with librsvg (17.16 KB, image/png)
2006-03-01 22:44 UTC, Gustav Broberg
  Details
not the prettiest thing in the world... (2.19 KB, patch)
2006-03-02 00:53 UTC, Dominic Lachowicz
none Details | Review
preferable patch (2.62 KB, patch)
2006-03-02 00:59 UTC, Dominic Lachowicz
none Details | Review

Description Gustav Broberg 2006-03-01 22:36:09 UTC
Please describe the problem:
Using a CSS style with a stroke-width thinner than 0.11pt will cause librsvg to
render the stroke with a width of about 1pt.

.foo {stroke:#000000;stroke-width:0.11pt;fill:none} <-- ok, 0.11pt stroke
.bar {stroke:#000000;stroke-width:0.1pt;fill:none}  <-- not ok, ~1pt stroke

Note that this problem does not occur when using a non-css style:

style="stroke:#000000;stroke-width:0.1pt;fill:none" <-- ok


Steps to reproduce:
1. rsvg-convert stroke-test.svg > stroke-test-librsvg.png
2. eog stroke-test-librsvg.png 


Actual results:
See attached output

Expected results:
See batik output

Does this happen every time?
Yes

Other information:
Comment 1 Gustav Broberg 2006-03-01 22:40:45 UTC
Created attachment 60431 [details]
Testcase of different stroke widths
Comment 2 Gustav Broberg 2006-03-01 22:42:24 UTC
Created attachment 60432 [details]
stroke-test.svg rasterized with batik (reference)
Comment 3 Gustav Broberg 2006-03-01 22:44:10 UTC
Created attachment 60433 [details]
stroke-test.svg rasterized with librsvg
Comment 4 Dominic Lachowicz 2006-03-02 00:04:23 UTC
In rsvg-styles.c:926 (where we do CSS handling), we get back from libcroco:

expr = (gchar *)cr_term_to_string (a_expr);
(gdb) p expr
$5 = (gchar *) 0x8bd8e18 "1pt"

In other words, this initially looks like a bug in libcroco. I'm reassigning.
Comment 5 Dominic Lachowicz 2006-03-02 00:33:57 UTC
There's some shady logic in cr_tknzr_parse_num () and possibly cr_utils_n_to_0_dot_n ().

The "int_part" vs. "dec_part" is guaranteed to be wrong for (example) "0.09", as it will produce:

int_part: 0
dec_part: 9

Converting that to a double produces 0.9
Comment 6 Dominic Lachowicz 2006-03-02 00:53:02 UTC
Created attachment 60444 [details] [review]
not the prettiest thing in the world...

But it gets the job done. If it (or another suitable fix) isn't not committed in a day or two, I guess that I'll commit it.
Comment 7 Dominic Lachowicz 2006-03-02 00:59:02 UTC
Created attachment 60446 [details] [review]
preferable patch
Comment 8 Dominic Lachowicz 2006-03-02 01:13:14 UTC
No commits since 1 year in libcroco's CVS. I'll commit this myself.