Skip to content

Commit 291ab14

Browse files
author
Patrick
committed
Fixed wrong character for decimal places
1 parent 9851ab9 commit 291ab14

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

RtfPipe/Html/CssString.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using RtfPipe.Tokens;
22
using System;
33
using System.Collections.Generic;
4+
using System.Globalization;
45
using System.Linq;
56
using System.Text;
67

@@ -33,7 +34,7 @@ public CssString(IEnumerable<IToken> tokens, ElementType elementType, IEnumerabl
3334
if (token is Font font)
3435
Append(font);
3536
else if (token is FontSize fontSize)
36-
Append("font-size", fontSize.Value.ToPt().ToString("0.#") + "pt");
37+
Append("font-size", fontSize.Value.ToPt().ToString("0.#", CultureInfo.InvariantCulture) + "pt");
3738
else if (token is BackgroundColor background)
3839
Append("background", "#" + background.Value);
3940
else if (token is ParagraphBackgroundColor backgroundPara)
@@ -104,8 +105,8 @@ public CssString(IEnumerable<IToken> tokens, ElementType elementType, IEnumerabl
104105
{
105106
if (tokens.OfType<LineSpacingMultiple>().Any(m => m.Value == 1))
106107
{
107-
if ((Math.Abs(lineSpace.Value) / 240.0).ToString("0.#") != "1")
108-
Append("line-height", (Math.Abs(lineSpace.Value) * DefaultBrowserLineHeight / 240.0).ToString("0.#"));
108+
if ((Math.Abs(lineSpace.Value) / 240.0).ToString("0.#", CultureInfo.InvariantCulture) != "1")
109+
Append("line-height", (Math.Abs(lineSpace.Value) * DefaultBrowserLineHeight / 240.0).ToString("0.#", CultureInfo.InvariantCulture));
109110
}
110111
else if (lineSpace.Value < 0)
111112
{
@@ -389,7 +390,7 @@ public CssString Append(string property, BorderToken border)
389390
}
390391
else
391392
{
392-
_builder.Append(width.ToString("0")).Append("px ");
393+
_builder.Append(width.ToString("0", CultureInfo.InvariantCulture)).Append("px ");
393394

394395
switch (border.Style)
395396
{
@@ -496,7 +497,7 @@ public CssString Append(string property, params UnitValue[] values)
496497
{
497498
if (i > 0)
498499
_builder.Append(' ');
499-
var px = values[i].ToPx().ToString("0.#");
500+
var px = values[i].ToPx().ToString("0.#", CultureInfo.InvariantCulture);
500501
_builder.Append(px);
501502
if (px != "0")
502503
_builder.Append("px");

0 commit comments

Comments
 (0)