mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-04-05 20:55:01 +08:00
parent
69e2b7bb08
commit
e789691100
Binary file not shown.
@ -0,0 +1,24 @@
|
||||
namespace UglyToad.PdfPig.Tests.Integration
|
||||
{
|
||||
using System.Linq;
|
||||
|
||||
public class Type1FontSimpleTests
|
||||
{
|
||||
[Fact]
|
||||
public void Issue807()
|
||||
{
|
||||
var file = IntegrationHelpers.GetDocumentPath("Diacritics_export.pdf");
|
||||
|
||||
using (var document = PdfDocument.Open(file))
|
||||
{
|
||||
var page = document.GetPage(1);
|
||||
var words = page.GetWords().ToArray();
|
||||
|
||||
Assert.Equal(3, words.Length);
|
||||
Assert.Equal("Espinosa", words[0].Text);
|
||||
Assert.Equal("Spínola", words[1].Text);
|
||||
Assert.Equal("Moraña,", words[2].Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -90,14 +90,13 @@
|
||||
|
||||
public bool TryGetUnicode(int characterCode, [NotNullWhen(true)] out string? value)
|
||||
{
|
||||
if (toUnicodeCMap.CanMapToUnicode)
|
||||
value = null;
|
||||
if (toUnicodeCMap.CanMapToUnicode && toUnicodeCMap.TryGet(characterCode, out value))
|
||||
{
|
||||
return toUnicodeCMap.TryGet(characterCode, out value);
|
||||
return true;
|
||||
}
|
||||
|
||||
value = null;
|
||||
|
||||
if (encoding == null)
|
||||
if (encoding is null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -132,7 +131,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return value is not null;
|
||||
}
|
||||
|
||||
public CharacterBoundingBox GetBoundingBox(int characterCode)
|
||||
|
@ -52,16 +52,29 @@
|
||||
|
||||
public bool TryGetUnicode(int characterCode, [NotNullWhen(true)] out string? value)
|
||||
{
|
||||
if (toUnicodeCMap.CanMapToUnicode)
|
||||
value = null;
|
||||
|
||||
if (toUnicodeCMap.CanMapToUnicode && toUnicodeCMap.TryGet(characterCode, out value))
|
||||
{
|
||||
return toUnicodeCMap.TryGet(characterCode, out value);
|
||||
return true;
|
||||
}
|
||||
|
||||
var name = encoding.GetName(characterCode);
|
||||
if (encoding is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
value = GlyphList.AdobeGlyphList.NameToUnicode(name);
|
||||
try
|
||||
{
|
||||
var name = encoding.GetName(characterCode);
|
||||
value = GlyphList.AdobeGlyphList.NameToUnicode(name);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return value is not null;
|
||||
}
|
||||
|
||||
public CharacterBoundingBox GetBoundingBox(int characterCode)
|
||||
|
Loading…
Reference in New Issue
Block a user