diff --git a/src/UglyToad.PdfPig.Core/PdfPoint.cs b/src/UglyToad.PdfPig.Core/PdfPoint.cs index 7955c8ad..60fc5f9b 100644 --- a/src/UglyToad.PdfPig.Core/PdfPoint.cs +++ b/src/UglyToad.PdfPig.Core/PdfPoint.cs @@ -1,6 +1,7 @@ namespace UglyToad.PdfPig.Core { using System.Diagnostics; + using System.Globalization; /// /// A point in a PDF file. @@ -112,7 +113,7 @@ /// public override string ToString() { - return $"(x:{X}, y:{Y})"; + return $"(x:{X.ToString(CultureInfo.InvariantCulture)}, y:{Y.ToString(CultureInfo.InvariantCulture)})"; } } } diff --git a/src/UglyToad.PdfPig.Core/PdfRectangle.cs b/src/UglyToad.PdfPig.Core/PdfRectangle.cs index 808b1d48..41562c90 100644 --- a/src/UglyToad.PdfPig.Core/PdfRectangle.cs +++ b/src/UglyToad.PdfPig.Core/PdfRectangle.cs @@ -1,6 +1,7 @@ namespace UglyToad.PdfPig.Core { using System; + using System.Globalization; /// /// A rectangle in a PDF file. @@ -208,7 +209,7 @@ /// public override string ToString() { - return $"[{TopLeft}, {Width}, {Height}]"; + return $"[{TopLeft}, {Width.ToString(CultureInfo.InvariantCulture)}, {Height.ToString(CultureInfo.InvariantCulture)}]"; } } } diff --git a/src/UglyToad.PdfPig.Fonts/CompactFontFormat/CharStrings/Type2CharStrings.cs b/src/UglyToad.PdfPig.Fonts/CompactFontFormat/CharStrings/Type2CharStrings.cs index 78ec81ec..f60b409b 100644 --- a/src/UglyToad.PdfPig.Fonts/CompactFontFormat/CharStrings/Type2CharStrings.cs +++ b/src/UglyToad.PdfPig.Fonts/CompactFontFormat/CharStrings/Type2CharStrings.cs @@ -2,6 +2,7 @@ { using System; using System.Collections.Generic; + using System.Globalization; using System.Text; using Core; @@ -184,7 +185,7 @@ if (i >= 0) { var value = Values[i]; - stringBuilder.AppendLine(value.ToString("N")); + stringBuilder.AppendLine(value.ToString("N", CultureInfo.InvariantCulture)); } foreach (var identifier in GetCommandsAt(i + 1)) diff --git a/src/UglyToad.PdfPig.Fonts/Type1/CharStrings/Type1CharstringDecryptedBytes.cs b/src/UglyToad.PdfPig.Fonts/Type1/CharStrings/Type1CharstringDecryptedBytes.cs index b1ec7b57..3827d4cf 100644 --- a/src/UglyToad.PdfPig.Fonts/Type1/CharStrings/Type1CharstringDecryptedBytes.cs +++ b/src/UglyToad.PdfPig.Fonts/Type1/CharStrings/Type1CharstringDecryptedBytes.cs @@ -2,6 +2,7 @@ { using System; using System.Collections.Generic; + using System.Globalization; internal class Type1CharstringDecryptedBytes { @@ -25,7 +26,7 @@ { Bytes = bytes ?? throw new ArgumentNullException(nameof(bytes)); Index = index; - Name = name ?? index.ToString(); + Name = name ?? index.ToString(CultureInfo.InvariantCulture); Source = SourceType.Charstring; } diff --git a/src/UglyToad.PdfPig.Tests/Tokenization/ArrayTokenizerTests.cs b/src/UglyToad.PdfPig.Tests/Tokenization/ArrayTokenizerTests.cs index 43aec37a..45d70fa6 100644 --- a/src/UglyToad.PdfPig.Tests/Tokenization/ArrayTokenizerTests.cs +++ b/src/UglyToad.PdfPig.Tests/Tokenization/ArrayTokenizerTests.cs @@ -1,6 +1,7 @@ namespace UglyToad.PdfPig.Tests.Tokenization { using System.Collections.Generic; + using System.Threading; using PdfPig.Tokenization; using PdfPig.Tokens; using Xunit; @@ -17,6 +18,7 @@ [InlineData("\0")] public void InvalidFirstCharacter_ReturnsFalse(string s) { + var cult = Thread.CurrentThread.CurrentCulture; var input = StringBytesTestConverter.Convert(s); var result = tokenizer.TryTokenize(input.First, input.Bytes, out var token); diff --git a/src/UglyToad.PdfPig/Content/PageRotationDegrees.cs b/src/UglyToad.PdfPig/Content/PageRotationDegrees.cs index 571cc408..261e9b8f 100644 --- a/src/UglyToad.PdfPig/Content/PageRotationDegrees.cs +++ b/src/UglyToad.PdfPig/Content/PageRotationDegrees.cs @@ -1,14 +1,12 @@ namespace UglyToad.PdfPig.Content { using System; - using System.Diagnostics.Contracts; - using Core; - using Geometry; + using System.Globalization; /// /// Represents the rotation of a page in a PDF document defined by the page dictionary in degrees clockwise. /// - public struct PageRotationDegrees : IEquatable + public readonly struct PageRotationDegrees : IEquatable { /// /// The rotation of the page in degrees clockwise. @@ -76,7 +74,7 @@ /// public override string ToString() { - return Value.ToString(); + return Value.ToString(CultureInfo.InvariantCulture); } /// diff --git a/src/UglyToad.PdfPig/Geometry/UserSpaceUnit.cs b/src/UglyToad.PdfPig/Geometry/UserSpaceUnit.cs index ba40c6a7..65f15a22 100644 --- a/src/UglyToad.PdfPig/Geometry/UserSpaceUnit.cs +++ b/src/UglyToad.PdfPig/Geometry/UserSpaceUnit.cs @@ -1,12 +1,13 @@ namespace UglyToad.PdfPig.Geometry { using System; + using System.Globalization; /// /// By default user space units correspond to 1/72nd of an inch (a typographic point). /// The UserUnit entry in a page dictionary can define the space units as a different multiple of 1/72 (1 point). /// - internal struct UserSpaceUnit + internal readonly struct UserSpaceUnit { public static readonly UserSpaceUnit Default = new UserSpaceUnit(1); @@ -30,7 +31,7 @@ public override string ToString() { - return PointMultiples.ToString(); + return PointMultiples.ToString(CultureInfo.InvariantCulture); } } } diff --git a/src/UglyToad.PdfPig/PdfFonts/CharacterIdentifierSystemInfo.cs b/src/UglyToad.PdfPig/PdfFonts/CharacterIdentifierSystemInfo.cs index a7def673..2ccbb64e 100644 --- a/src/UglyToad.PdfPig/PdfFonts/CharacterIdentifierSystemInfo.cs +++ b/src/UglyToad.PdfPig/PdfFonts/CharacterIdentifierSystemInfo.cs @@ -1,11 +1,12 @@ namespace UglyToad.PdfPig.PdfFonts { + using System.Globalization; using CidFonts; /// /// Specifies the character collection associated with the (CIDFont). /// - internal struct CharacterIdentifierSystemInfo + internal readonly struct CharacterIdentifierSystemInfo { /// /// Identifies the issuer of the character collection. @@ -31,7 +32,7 @@ public override string ToString() { - return $"{Registry}-{Ordering}-{Supplement}"; + return $"{Registry}-{Ordering}-{Supplement.ToString(CultureInfo.InvariantCulture)}"; } } } \ No newline at end of file diff --git a/src/UglyToad.PdfPig/PdfFonts/Parser/Handlers/TrueTypeFontHandler.cs b/src/UglyToad.PdfPig/PdfFonts/Parser/Handlers/TrueTypeFontHandler.cs index d030262a..aa887dbe 100644 --- a/src/UglyToad.PdfPig/PdfFonts/Parser/Handlers/TrueTypeFontHandler.cs +++ b/src/UglyToad.PdfPig/PdfFonts/Parser/Handlers/TrueTypeFontHandler.cs @@ -2,6 +2,7 @@ { using System; using System.Collections.Generic; + using System.Globalization; using System.Linq; using Cmap; using Core; @@ -136,7 +137,7 @@ } else { - glyphName = index.ToString(); + glyphName = index.ToString(CultureInfo.InvariantCulture); } fakeEncoding[i] = glyphName;