mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-11-24 16:53:20 +08:00
Update NameToUnicodeConvertAglSpecification to test what was intended
Some checks failed
Build, test and publish draft / build (push) Has been cancelled
Build and test [MacOS] / build (push) Has been cancelled
Run Common Crawl Tests / build (0000-0001) (push) Has been cancelled
Run Common Crawl Tests / build (0002-0003) (push) Has been cancelled
Run Common Crawl Tests / build (0004-0005) (push) Has been cancelled
Run Common Crawl Tests / build (0006-0007) (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
Nightly Release / Check if this commit has already been published (push) Has been cancelled
Nightly Release / tests (push) Has been cancelled
Nightly Release / build_and_publish_nightly (push) Has been cancelled
Some checks failed
Build, test and publish draft / build (push) Has been cancelled
Build and test [MacOS] / build (push) Has been cancelled
Run Common Crawl Tests / build (0000-0001) (push) Has been cancelled
Run Common Crawl Tests / build (0002-0003) (push) Has been cancelled
Run Common Crawl Tests / build (0004-0005) (push) Has been cancelled
Run Common Crawl Tests / build (0006-0007) (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
Nightly Release / Check if this commit has already been published (push) Has been cancelled
Nightly Release / tests (push) Has been cancelled
Nightly Release / build_and_publish_nightly (push) Has been cancelled
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
namespace UglyToad.PdfPig.Tests.Fonts.Encodings
|
||||
{
|
||||
using System.Text;
|
||||
using PdfPig.Fonts;
|
||||
|
||||
public class GlyphListTests
|
||||
@@ -92,7 +93,7 @@
|
||||
}
|
||||
|
||||
|
||||
[Fact(Skip = "TODO - String don't match")]
|
||||
[Fact]
|
||||
public void NameToUnicodeConvertAglSpecification()
|
||||
{
|
||||
// https://github.com/adobe-type-tools/agl-specification?tab=readme-ov-file#3-examples
|
||||
@@ -103,7 +104,22 @@
|
||||
|
||||
var result = list.NameToUnicode("Lcommaaccent_uni20AC0308_u1040C.alternate");
|
||||
|
||||
Assert.Equal("\u013B\u20AC\u0308\u1040C", result);
|
||||
// This value is not encodable in single characters in UTF-16, so we get a surrogate pair for the final unicode character
|
||||
Assert.Equal("\u013B\u20AC\u0308\uD801\uDC0C", result);
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
// But in .Net we can get the unicode rune values to verify that this is really the expected value
|
||||
var runes = result.EnumerateRunes().ToList();
|
||||
|
||||
Assert.Equal(4, runes.Count);
|
||||
|
||||
Assert.Equal(0x013B, runes[0].Value);
|
||||
Assert.Equal(0x20AC, runes[1].Value);
|
||||
Assert.Equal(0x0308, runes[2].Value);
|
||||
Assert.Equal(0x1040C, runes[3].Value);
|
||||
#endif
|
||||
// Ok, so we know this is what the actual string is. Now lets encode that last value the C# way
|
||||
Assert.Equal("\u013B\u20AC\u0308\U0001040C", result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user