Git Product home page Git Product logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on May 30, 2024
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 [email protected] on 21 Jan 2014 at 9:17

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 30, 2024
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 [email protected] on 21 Jan 2014 at 9:47

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 30, 2024
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 [email protected] on 21 Jan 2014 at 10:23

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 30, 2024
Commercial. Adobe InDesign.

Original comment by [email protected] on 21 Jan 2014 at 10:39

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 30, 2024
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 [email protected] on 26 Jan 2014 at 1:54

  • Changed state: Accepted

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 30, 2024
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 [email protected] on 27 Jan 2014 at 9:25

from androidsvg.

GoogleCodeExporter avatar GoogleCodeExporter commented on May 30, 2024
Fixed.

Issue30: Allow numbers (floats) in rgb colour components.


Original comment by [email protected] on 27 Jan 2014 at 9:26

  • Changed state: Fixed

from androidsvg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.