mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-06-28 15:30:17 +08:00
fix bug with hex names mapping to unicode in the glyph list.
This commit is contained in:
parent
f717cd9d4d
commit
c88db947ad
@ -66,5 +66,31 @@
|
|||||||
|
|
||||||
Assert.Equal("B", result);
|
Assert.Equal("B", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void NameToUnicodeConvertsHexAndUsesHexValue()
|
||||||
|
{
|
||||||
|
var list = new GlyphList(new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
{"B", "X"}
|
||||||
|
});
|
||||||
|
|
||||||
|
var result = list.NameToUnicode("uni0042");
|
||||||
|
|
||||||
|
Assert.Equal("B", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void NameToUnicodeConvertsShortHexAndUsesHexValue()
|
||||||
|
{
|
||||||
|
var list = new GlyphList(new Dictionary<string, string>
|
||||||
|
{
|
||||||
|
{"E", "Æ"}
|
||||||
|
});
|
||||||
|
|
||||||
|
var result = list.NameToUnicode("u0045");
|
||||||
|
|
||||||
|
Assert.Equal("E", result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@
|
|||||||
|
|
||||||
for (int chPos = 3; chPos + 4 <= nameLength; chPos += 4)
|
for (int chPos = 3; chPos + 4 <= nameLength; chPos += 4)
|
||||||
{
|
{
|
||||||
int codePoint = int.Parse(name.Substring(chPos, chPos + 4), NumberStyles.HexNumber);
|
int codePoint = int.Parse(name.Substring(chPos, 4), NumberStyles.HexNumber);
|
||||||
|
|
||||||
if (codePoint > 0xD7FF && codePoint < 0xE000)
|
if (codePoint > 0xD7FF && codePoint < 0xE000)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user