Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This fixes a regression in recent commit b8e82bc. That commit added the characters `eE+-` to the list of accepted characters within the middle of a float string. However, the `+-` characters are only valid immediately after the `eE` characters. This broke SVGS that don't use whitespace between floats with negative numbers. Consider the following snippet from a real SVG: ``` <path d="M0 9.913V.487c0-.435.514-.651.812-.34l6.551 ... ``` With the commit referenced above, the string `0-.435` gets interpreted as a single float value which fails to parse as a float. I've fixed this by splitting the function to parse floats into 3 parts: 1) before the decimal point char first = AcceptChar("0123456789." + (allow_sign ? "+-" : "")); ScanWhile(char.IsDigit); 2) after the decimal point if (first != '.' && ScanOne(".")) { ScanWhile(char.IsDigit); } 3) the exponent if (ScanOne("eE")) { ScanOne("+-"); ScanWhile(char.IsDigit); } This fixes the parser so that it only includes the `+-` characters if they properly appear immediately after the `eE` characters.
- Loading branch information