mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-07-16 10:39:22 +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)
|
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 is null)
|
||||||
|
|
||||||
if (encoding == null)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -132,7 +131,7 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return value is not null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharacterBoundingBox GetBoundingBox(int characterCode)
|
public CharacterBoundingBox GetBoundingBox(int characterCode)
|
||||||
|
@ -52,16 +52,29 @@
|
|||||||
|
|
||||||
public bool TryGetUnicode(int characterCode, [NotNullWhen(true)] out string? value)
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (encoding is null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
var name = encoding.GetName(characterCode);
|
var name = encoding.GetName(characterCode);
|
||||||
|
|
||||||
value = GlyphList.AdobeGlyphList.NameToUnicode(name);
|
value = GlyphList.AdobeGlyphList.NameToUnicode(name);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return value is not null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharacterBoundingBox GetBoundingBox(int characterCode)
|
public CharacterBoundingBox GetBoundingBox(int characterCode)
|
||||||
|
Loading…
Reference in New Issue
Block a user