From 90f8f97bfd392ee88d0f684bc739c69258fec564 Mon Sep 17 00:00:00 2001 From: Eliot Jones Date: Fri, 3 Jan 2020 14:35:47 +0000 Subject: [PATCH] add simple test case for subsetting issue #98 adds a single test which proves that the invalid truetype subsetting with roboto is related to our font subsetting code, since we can subset the same text correctly with windows calibri we must be reading roboto incorrectly. --- .../Writer/PdfDocumentBuilderTests.cs | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/UglyToad.PdfPig.Tests/Writer/PdfDocumentBuilderTests.cs b/src/UglyToad.PdfPig.Tests/Writer/PdfDocumentBuilderTests.cs index 7909a1ae..01f5f073 100644 --- a/src/UglyToad.PdfPig.Tests/Writer/PdfDocumentBuilderTests.cs +++ b/src/UglyToad.PdfPig.Tests/Writer/PdfDocumentBuilderTests.cs @@ -145,6 +145,35 @@ } } + [Fact] + public void CanWriteRobotoAccentedCharacters() + { + var builder = new PdfDocumentBuilder(); + + builder.DocumentInformation.Title = "Hello Roboto!"; + + var page = builder.AddPage(PageSize.A4); + + var font = builder.AddTrueTypeFont(TrueTypeTestHelper.GetFileBytes("Roboto-Regular.ttf")); + + page.AddText("eé", 12, new PdfPoint(30, 520), font); + + Assert.NotEmpty(page.Operations); + + var b = builder.Build(); + + WriteFile(nameof(CanWriteRobotoAccentedCharacters), b); + + Assert.NotEmpty(b); + + using (var document = PdfDocument.Open(b)) + { + var page1 = document.GetPage(1); + + Assert.Equal("eé", page1.Text); + } + } + [Fact] public void WindowsOnlyCanWriteSinglePageAccentedCharactersSystemFont() {