Closed GoogleCodeExporter closed 9 years ago
Hi. Thanks for the report.
Can you possibly attach the file that caused the problem? If that is not
possible, can you try reducing the file to a simple form that still exhibits
the problem?
Original comment by paul.leb...@gmail.com
on 21 Jan 2014 at 9:17
I'll do you one better, here's the fix:
// Parse a colour component value (0..255 or 0%-100%)
private static int parseColourComponent(final TextScanner scan)
throws SAXException {
float comp = scan.nextFloat();
if (scan.consume('%')) {
// Spec says to follow CSS rules, which says out-of-range values
should
// be clamped.
comp = comp < 0 ? 0 : comp > 100 ? 100 : comp;
return (int) (comp * 255.0 / 100.0);
} else {
comp = comp < 0 ? 0 : comp > 255 ? 255 : comp;
return (int) comp;
}
}
Original comment by nadiasve...@gmail.com
on 21 Jan 2014 at 9:47
Hmmm... Neither SVG1.1, SVG 1.2 or CSS 2.1 allows float values in "rgb()"
colour values. So technically this is not a bug. SVG2 does allow float
values, however.
Was the file generated by a commercial program, or was it hand-written?
Chances are I will still merge this patch, since it is better to be permissive.
But it would still be good to know.
Original comment by paul.leb...@gmail.com
on 21 Jan 2014 at 10:23
Commercial. Adobe InDesign.
Original comment by nadiasve...@gmail.com
on 21 Jan 2014 at 10:39
Just so I know I am coping properly with the type of values InDesign generates,
would you mind pasting an actual example an faulty rgb() value from one of your
file please?
Better still, an actual file would still be useful for my test suite if you
have one you can share. Thanks.
Original comment by paul.leb...@gmail.com
on 26 Jan 2014 at 1:54
Correction to my comment #3. Number (float) values are allowed in colour
components that are percentages. This is allowed by the CSS spec. The fact
that the SVG spec says integer is an error.
I now suspect that InDesign wasn't producing bad files at all and was just
using floats in percentage colour components (eg. "rgb(0, 0, 33.33%)").
Original comment by paul.leb...@gmail.com
on 27 Jan 2014 at 9:25
Fixed.
Issue30: Allow numbers (floats) in rgb colour components.
Original comment by paul.leb...@gmail.com
on 27 Jan 2014 at 9:26
Original issue reported on code.google.com by
nadiasve...@gmail.com
on 21 Jan 2014 at 9:02