mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-07-15 17:12:34 +08:00
Use StringToken.GetBytes() in ShowPositionedText() to fix #668 and add test
This commit is contained in:
parent
04fc8d696d
commit
f886e98705
File diff suppressed because one or more lines are too long
32
src/UglyToad.PdfPig.Tests/Integration/EncodingsTests.cs
Normal file
32
src/UglyToad.PdfPig.Tests/Integration/EncodingsTests.cs
Normal file
@ -0,0 +1,32 @@
|
||||
namespace UglyToad.PdfPig.Tests.Integration
|
||||
{
|
||||
using PdfPig.Core;
|
||||
using PdfPig.Geometry;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
|
||||
public class EncodingsTests
|
||||
{
|
||||
[Fact]
|
||||
public void Issue688()
|
||||
{
|
||||
string path = IntegrationHelpers.GetDocumentPath("Indexed-DeviceRGB-JPXDecode-0-.0.0.255.0.-Font-F1_1_missing_char_255-1.pdf");
|
||||
using (var document = PdfDocument.Open(path))
|
||||
{
|
||||
var page = document.GetPage(1);
|
||||
var letters = page.Letters;
|
||||
Assert.NotEmpty(letters);
|
||||
|
||||
var rect = new PdfRectangle(207, 158, 229, 168.5);
|
||||
|
||||
var missingChars = letters.Where(l => rect.Contains(l.GlyphRectangle)).ToArray();
|
||||
|
||||
Assert.NotEmpty(missingChars);
|
||||
Assert.True(missingChars.Length == 2);
|
||||
|
||||
Assert.Equal("先", missingChars[0].Value);
|
||||
Assert.Equal("祖", missingChars[1].Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -388,7 +388,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
bytes = OtherEncodings.StringAsLatin1Bytes(((StringToken)token).Data);
|
||||
bytes = ((StringToken)token).GetBytes();
|
||||
}
|
||||
|
||||
ShowText(new ByteArrayInputBytes(bytes));
|
||||
|
Loading…
Reference in New Issue
Block a user