Closed jan-ai closed 4 years ago
Hi,
Thanks for reporting. I have been working on this particular issue, the fix will be pushed shortly.
For the time being, it’s recommended to set:
CultureInfo.CurrentCulture = new CultureInfo("en-GB");
I know it’s not ideal but does the job. FYI, there is a big push being done by the blazor team to improve SVG support, hopefully this issue will be addressed.
As setting the CurrentCulture will also influence other input, I changed the followings:
For the class Margin and Size this was done using an overwrite of ToString function, which is the preferable way from my point of view, as it's transparent to the usage of such classes in CSS styles. Which looks like
public override string ToString() => $"{Value.ToString (CultureInfo.InvariantCulture)}{Units}";
An explizite invariant culture was added to all other number conversions. This might be also changed to a more transparent way for anyone using this fields/properties by adding dedicated classes for these kind of fields/properties. Therefore reducing possibility of future errors not applying correct conversions. E.g.
stroke-width: @(Theme.Panel.Grid.Minor.Y.Width.ToString (CultureInfo.InvariantCulture));
Duplicate #1
CSS requires numbers using dots (instead of commas). The code just uses standard number to string conversions (implicitly ToString ()) without setting any culture Information. Therefore the svgs generated do not work, when cultures are used which have numbers using commas instead of dots. E.g. style="width: 578,15" instead of corretly generating "width: 578.15"
I've done all the nessecary work on my local repository, but can't create a pull request on your project. Let me know the way in case I should share the code with your project.