mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-08-20 06:38:07 +08:00
Fix ByteEncodingCMapTable.CharacterCodeToGlyphIndex() to account for glyph mapping length, add test and fix #881
This commit is contained in:
parent
ad785328e1
commit
8ce6bcc2a7
@ -46,7 +46,7 @@
|
||||
|
||||
public int CharacterCodeToGlyphIndex(int characterCode)
|
||||
{
|
||||
if (characterCode < 0 || characterCode >= GlyphMappingLength)
|
||||
if (characterCode < 0 || characterCode >= glyphMapping.Length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
BIN
src/UglyToad.PdfPig.Tests/Integration/Documents/issue_881.pdf
Normal file
BIN
src/UglyToad.PdfPig.Tests/Integration/Documents/issue_881.pdf
Normal file
Binary file not shown.
24
src/UglyToad.PdfPig.Tests/Integration/TrueTypeTests.cs
Normal file
24
src/UglyToad.PdfPig.Tests/Integration/TrueTypeTests.cs
Normal file
@ -0,0 +1,24 @@
|
||||
namespace UglyToad.PdfPig.Tests.Integration
|
||||
{
|
||||
using System.Linq;
|
||||
|
||||
public class TrueTypeTests
|
||||
{
|
||||
[Fact]
|
||||
public void Issue881()
|
||||
{
|
||||
var file = IntegrationHelpers.GetDocumentPath("issue_881.pdf");
|
||||
|
||||
using (var document = PdfDocument.Open(file))
|
||||
{
|
||||
var page = document.GetPage(1);
|
||||
var words = page.GetWords().ToArray();
|
||||
Assert.Equal(4, words.Length);
|
||||
Assert.Equal("IDNR:", words[0].Text);
|
||||
Assert.Equal("4174", words[1].Text);
|
||||
Assert.Equal("/", words[2].Text);
|
||||
Assert.Equal("06.08.2018", words[3].Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user