Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Map Wingdings, Webdings and Symbol characters to Unicode in Word and PowerPoint
KnifeLemon9dafed279b07
diff --git a/docs/ENGINES.md b/docs/ENGINES.mdindex 7add95c5..7690e4a9 100644--- a/docs/ENGINES.md+++ b/docs/ENGINES.md@@ -318,6 +318,10 @@ Readers turn the source into a small document model (`Hwp/Hwpx/HwpxModel.cs`) an- paragraph formatting (alignment, indents, spacing, line spacing, tab stops, keep with next);- character formatting (fonts incl. theme fonts, size, colour, highlight and shading, bold/italic/underline/strike, super/subscript, spacing);- lists with Word's numbering formats (1., 가., ①, i., bullets);+ - symbols of Wingdings, Wingdings 2, Wingdings 3, Webdings and Symbol (Insert → Symbol, bullets, text typed in+ those fonts) as the Unicode characters they show: check boxes ☐ ☑ ☒, check marks and crosses, arrows, stars,+ hands, phone and mail signs, Greek letters and math signs (`Hwp/Hwpx/SymbolFonts.cs`, #350; PPTX bullets and+ text too). Codes without a table entry stay as before (an unknown bullet is "●");- tables with merged cells, column widths, borders and shading from the table style and cells, repeated header rows;- pictures inline and floating, text boxes, rectangles/ellipses/lines with solid or gradient fills, groups;- footnotes, endnotes, bookmarks, hyperlinks (web and within the document, e.g. a table of contents);diff --git a/src/Filee.Engines/Hwp/Hwpx/Docx/DocxReader.Styles.cs b/src/Filee.Engines/Hwp/Hwpx/Docx/DocxReader.Styles.csindex 3c53af87..d944fa69 100644--- a/src/Filee.Engines/Hwp/Hwpx/Docx/DocxReader.Styles.cs+++ b/src/Filee.Engines/Hwp/Hwpx/Docx/DocxReader.Styles.cs@@ -450,7 +450,7 @@ internal sealed partial class DocxReader{var bullet = level.Format == "bullet";numbering.Levels.Add(bullet- ? new HNumberingLevel("DIGIT", BulletText(level.Text), level.Start, Bullet: true)+ ? new HNumberingLevel("DIGIT", BulletText(level.Text, LevelFont(level.RPr)), level.Start, Bullet: true): new HNumberingLevel(NumberFormat(level.Format), NumberText(level.Text, level.Format), level.Start, Bullet: false));}_numberings[numId] = numbering;@@ -485,8 +485,15 @@ internal sealed partial class DocxReaderreturn new string(chars);}- /// <summary>Word bullets often use Symbol/Wingdings private-use code points; map them to Unicode.</summary>- private static string BulletText(string text) => text switch+ /// <summary>The font of a list level's marker (w:lvl/w:rPr/w:rFonts), e.g. Wingdings for ▪ and ☐ bullets.</summary>+ private static string? LevelFont(XElement? rPr) =>+ rPr?.Element(W + "rFonts") is { } fonts ? Attr(fonts, "ascii") ?? Attr(fonts, "hAnsi") : null;++ /// <summary>+ /// Word bullets often use Symbol/Wingdings private-use code points; map them to Unicode, by the bullet's font+ /// when it is a symbol font (SymbolFonts), else by the usual bullets of those fonts.+ /// </summary>+ private static string BulletText(string text, string? font = null) => SymbolFonts.Map(font, text) ?? text switch{"" => "●","\uF0B7" or "\uF09F" => "•",diff --git a/src/Filee.Engines/Hwp/Hwpx/Docx/DocxReader.cs b/src/Filee.Engines/Hwp/Hwpx/Docx/DocxReader.csindex feae01ce..513f3967 100644--- a/src/Filee.Engines/Hwp/Hwpx/Docx/DocxReader.cs+++ b/src/Filee.Engines/Hwp/Hwpx/Docx/DocxReader.cs@@ -587,7 +587,11 @@ internal sealed partial class DocxReader{case "t":if (ShowsText())- builder.Add(new HText(child.Value, format));+ {+ // Text typed in Wingdings & co. ("þ" for ☑) becomes the Unicode characters it shows.+ foreach (var text in SymbolFonts.Runs(child.Value, format))+ builder.Add(text);+ }break;case "tab" or "ptab":if (ShowsText())@@ -618,8 +622,13 @@ internal sealed partial class DocxReaderbuilder.Add(new HText("-", format));break;case "sym":+ // Insert → Symbol: a code of the font in w:font (☑ is F052 in Wingdings 2), in Unicode where known.if (ShowsText() && int.TryParse(Attr(child, "char"), System.Globalization.NumberStyles.HexNumber, null, out var code))- builder.Add(new HText(BulletText(((char)code).ToString()), format));+ {+ builder.Add(SymbolFonts.Map(Attr(child, "font"), code) is { } symbol+ ? new HText(symbol, SymbolFonts.WithoutSymbolFont(format))+ : new HText(BulletText(((char)code).ToString()), format));+ }break;case "fldChar":FieldChar(child, builder, format);diff --git a/src/Filee.Engines/Hwp/Hwpx/Docx/OmmlReader.cs b/src/Filee.Engines/Hwp/Hwpx/Docx/OmmlReader.csindex fffd45e7..0e5c4673 100644--- a/src/Filee.Engines/Hwp/Hwpx/Docx/OmmlReader.cs+++ b/src/Filee.Engines/Hwp/Hwpx/Docx/OmmlReader.cs@@ -482,7 +482,7 @@ internal static class OmmlReaderif (child.Name == M + "t" || child.Name == W + "t")text.Append(child.Value);else if (child.Name == W + "sym" && int.TryParse((string?)child.Attribute(W + "char"), System.Globalization.NumberStyles.HexNumber, null, out var code))- text.Append((char)code);+ text.Append(SymbolFonts.Map((string?)child.Attribute(W + "font"), code) ?? ((char)code).ToString());}Text(text.ToString(), output, style);}diff --git a/src/Filee.Engines/Hwp/Hwpx/Pptx/PptxReader.Text.cs b/src/Filee.Engines/Hwp/Hwpx/Pptx/PptxReader.Text.csindex 6c3c1ce5..500ea477 100644--- a/src/Filee.Engines/Hwp/Hwpx/Pptx/PptxReader.Text.cs+++ b/src/Filee.Engines/Hwp/Hwpx/Pptx/PptxReader.Text.cs@@ -113,14 +113,15 @@ internal sealed partial class PptxReaderif (text.Length == 0)continue;var link = ExternalLink(partPath, (string?)run.Element(A + "rPr")?.Element(A + "hlinkClick")?.Attribute(R + "id"));+ // Text in Wingdings & co. as the Unicode characters it shows.if (link is null){- paragraph.Inlines.Add(new HText(text, format));+ paragraph.Inlines.AddRange(SymbolFonts.Runs(text, format));}else{var hLink = new HLink(link);- hLink.Content.Add(new HText(text, format));+ hLink.Content.AddRange(SymbolFonts.Runs(text, format));paragraph.Inlines.Add(hLink);}}@@ -222,7 +223,12 @@ internal sealed partial class PptxReaderif (style.Element(A + "buNone") is not null)return null;if (style.Element(A + "buChar") is { } character)- return new BulletInfo((string?)character.Attribute("char") ?? "•", null, 1);+ {+ // "§" in Wingdings is ▪, "ü" ✓: a bullet in a symbol font as the Unicode character it shows.+ var text = (string?)character.Attribute("char") ?? "•";+ var font = chain.Select(s => s.Element(A + "buFont") ?? s.Element(A + "buFontTx")).FirstOrDefault(f => f is not null);+ return new BulletInfo(SymbolFonts.Map((string?)font?.Attribute("typeface"), text) ?? text, null, 1);+ }if (style.Element(A + "buAutoNum") is { } number)return new BulletInfo(null, (string?)number.Attribute("type") ?? "arabicPeriod",int.TryParse((string?)number.Attribute("startAt"), out var start) ? start : 1);diff --git a/src/Filee.Engines/Hwp/Hwpx/SymbolFonts.cs b/src/Filee.Engines/Hwp/Hwpx/SymbolFonts.csnew file mode 100644index 00000000..b3b5e29d--- /dev/null+++ b/src/Filee.Engines/Hwp/Hwpx/SymbolFonts.cs@@ -0,0 +1,153 @@+// Symbol fonts (Wingdings, Wingdings 2, Wingdings 3, Webdings, Symbol) draw their own pictures in place of letters:+// a check box picked in Word's Insert → Symbol is stored as a code of the font (w:sym w:font="Wingdings 2"+// w:char="F052"), in the private use area F020–F0FF, and text typed in such a font as the plain byte ("R"). Another+// font shows nothing or a wrong sign for those codes, so the readers write the Unicode character the picture stands+// for (#350): check boxes, check marks and crosses, circles, squares, diamonds and stars (bullets), arrows, pointing+// hands, phone and mail signs, circled numbers, and Symbol's Greek letters and math signs. Codes the tables do not+// know keep the readers' old handling.+//+// Every character here is in the Basic Multilingual Plane and in Segoe UI Symbol, which every Windows has: rhwp+// draws a character its font lacks with the first installed font that has it, so these always come out.++using System.Text;++namespace Filee.Engines.Hwp.Hwpx;++internal static class SymbolFonts+{+ /// <summary>Unicode text by font (name without spaces) and code (20–FF); a space in a row skips a code.</summary>+ private static readonly Dictionary<string, Dictionary<int, string>> Tables = new(StringComparer.OrdinalIgnoreCase)+ {+ ["Wingdings"] = Table(+ (0x21, "✏✂✁"),+ (0x28, "☎✆✉✉"),+ (0x36, "⌛⌨"),+ (0x3E, "✇✍ ✌"),+ (0x45, "☜☞☝☟ ☺ ☹ ☠⚐ ✈☼ ❄ ✞ ✠✡☪☯ ☸♈♉♊♋♌♍♎♏♐♑♒♓"),+ (0x6C, "●❍■□□❑❒⬧⧫◆❖⬥⌧ ⌘"),+ (0x7D, "❝❞"),+ (0x80, "⓪①②③④⑤⑥⑦⑧⑨⑩⓿❶❷❸❹❺❻❼❽❾❿"),+ (0x9E, "·•▪○○ ◉◎ ▪☐ ✦★✶✴✹✵ ⌖⟡⌑ ✪✰"),+ (0xD5, "⌫⌦ ➢"),+ (0xDC, "➲"),+ (0xDF, "←→↑↓↖↗↙↘⬅➡⬆⬇⬉⬈⬋⬊⇦⇨⇧⇩⬄⇳⬁⬀⬃⬂"),+ (0xFB, "✗✓☒☑")),+ ["Wingdings2"] = Table(+ (0x25, "✄✂☏"),+ (0x3E, "☜☞☚☛☜☞☚☛☝☟☝☟☝☟☝☟"),+ (0x4F, "✗✓☒☑☒☒⊗⊗⊘⊘&&&&‽‽‽‽"),+ (0x69, "⓪①②③④⑤⑥⑦⑧⑨⑩⓿❶❷❸❹❺❻❼❽❾❿"),+ (0x80, "☉○☽☾ ✝✝"),+ (0x95, "·•●●○○ ⊙◉▪▪■■☐□□□▣▣▣ ⬩⬩⬩◆◇◈◈◈ ⬪⬪⬪⧫◊ ◖◗◓◒"),+ (0xCD, "✕✕✕✖✖✖✖"),+ (0xE7, "✦✦★★✶✶"),+ (0xF2, "✧☆"),+ (0xF6, "✦ ※⁂")),+ ["Wingdings3"] = Table(+ (0x21, "←→↑↓↖↗↙↘⇤⇥⤒⤓⇱⇲⇞⇟↔↕⇠⇢⇡⇣↯↵↳↰↱"),+ (0x44, "⇆⇅ ⇇⇉⇈⇊"),+ (0x50, "↻↺⎋ ⌥␣ ⇪⇦⇨"),+ (0x66, "←→↑↓↖↗↙↘↔↕▲▼△▽◀▶◁▷◣◢◤◥◂▸▴"),+ (0x80, "▾▴▾◂▸⮜⮞⮝⮟"),+ (0x89, "←→↑↓←→↑↓←→↑↓⬅➡⬆⬇←→↑↓←→↑↓⬅➡⬆⬇←→←→⬅➡"),+ (0xB1, "⬅➡"),+ (0xC5, "⬅➡⬆⬇"),+ (0xD1, "←→↑↓↖↗↙↘←→↑↓↖↗↙↘⬅➡⬆⬇⬉⬈⬋⬊")),+ ["Webdings"] = Table(+ (0x33, "◀▶▲▼⏪⏩⏮⏭⏸■●"),+ (0x59, "♥"),+ (0x61, "✔ ☐ ■ ⓘ ●"),+ (0x72, "✖"),+ (0xC9, "☎"),+ (0xEA, "△"),+ (0xF1, "✈")),+ ["Symbol"] = Table(+ (0x21, "!∀#∃%&∋()∗+,−./0123456789:;<=>?≅ΑΒΧΔΕΦΓΗΙϑΚΛΜΝΟΠΘΡΣΤΥςΩΞΨΖ[∴]⊥_ αβχδεφγηιϕκλμνοπθρστυϖωξψζ{|}∼"),+ (0xA0, "€ϒ′≤⁄∞ƒ♣♦♥♠↔←↑→↓°±″≥×∝∂•÷≠≡≈… ↵ℵℑℜ℘⊗⊕∅∩∪⊃⊇⊄⊂⊆∈∉∠∇®©™∏√⋅¬∧∨⇔⇐⇑⇒⇓◊⟨®©™∑"),+ (0xF1, "⟩∫")),+ };++ private static Dictionary<int, string> Table(params (int First, string Characters)[] rows)+ {+ var table = new Dictionary<int, string>();+ foreach (var (first, characters) in rows)+ {+ for (var i = 0; i < characters.Length; i++)+ {+ if (characters[i] != ' ')+ table[first + i] = characters[i].ToString();+ }+ }+ return table;+ }++ private static Dictionary<int, string>? Of(string? font) =>+ font is not null && Tables.TryGetValue(font.Replace(" ", "", StringComparison.Ordinal), out var table) ? table : null;++ /// <summary>Wingdings, Wingdings 2, Wingdings 3, Webdings or Symbol (any case, with or without spaces).</summary>+ public static bool IsSymbolFont(string? font) => Of(font) is not null;++ /// <summary>+ /// The Unicode character code <paramref name="code"/> of a symbol font stands for (F020–F0FF or 20–FF), or null+ /// for another font or a code the tables do not know.+ /// </summary>+ public static string? Map(string? font, int code)+ {+ if (Of(font) is not { } table)+ return null;+ if (code is >= 0xF000 and <= 0xF0FF)+ code -= 0xF000;+ return table.GetValueOrDefault(code);+ }++ /// <summary>A whole text of a symbol font in Unicode, or null unless every character is known.</summary>+ public static string? Map(string? font, string text)+ {+ if (text.Length == 0 || Of(font) is null)+ return null;+ var result = new StringBuilder();+ foreach (var c in text)+ {+ if (Map(font, c) is not { } mapped)+ return null;+ result.Append(mapped);+ }+ return result.ToString();+ }++ /// <summary>The format without symbol fonts: the Unicode characters are drawn with the text font.</summary>+ public static HCharFormat WithoutSymbolFont(HCharFormat format)+ {+ var eastAsian = IsSymbolFont(format.EastAsianFont) ? null : format.EastAsianFont;+ return format with { Font = IsSymbolFont(format.Font) ? eastAsian : format.Font, EastAsianFont = eastAsian };+ }++ /// <summary>+ /// Text in <paramref name="format"/>: in a symbol font, the characters the tables know become their Unicode+ /// characters without the symbol font, and the others stay as they are.+ /// </summary>+ public static IEnumerable<HText> Runs(string text, HCharFormat format)+ {+ if (!IsSymbolFont(format.Font))+ {+ yield return new HText(text, format);+ yield break;+ }+ var plain = WithoutSymbolFont(format);+ var run = new StringBuilder();+ var mappedRun = false;+ foreach (var c in text)+ {+ var mapped = Map(format.Font, c);+ if (run.Length > 0 && mappedRun != mapped is not null)+ {+ yield return new HText(run.ToString(), mappedRun ? plain : format);+ run.Clear();+ }+ mappedRun = mapped is not null;+ run.Append(mapped ?? c.ToString());+ }+ if (run.Length > 0)+ yield return new HText(run.ToString(), mappedRun ? plain : format);+ }+}diff --git a/tests/Filee.Engines.Tests/SymbolFontTests.cs b/tests/Filee.Engines.Tests/SymbolFontTests.csnew file mode 100644index 00000000..3134f466--- /dev/null+++ b/tests/Filee.Engines.Tests/SymbolFontTests.cs@@ -0,0 +1,154 @@+// Symbols of Wingdings, Wingdings 2, Wingdings 3, Webdings and Symbol (#350): Word's Insert → Symbol stores a check+// box as a code of the font (w:sym w:font="Wingdings 2" w:char="F052"); the built-in Word → HWPX/PDF route drew every+// such symbol as a black dot "●" and Wingdings' empty box as "◆". They now arrive as the Unicode characters they show.++using Filee.Core.Conversion;+using Filee.Core.Presets;+using Filee.Engines.Hwp.Hwpx;+using UglyToad.PdfPig;+using static Filee.Engines.Tests.DocxBuilder;+using static Filee.Engines.Tests.HwpxAssert;++namespace Filee.Engines.Tests;++public class SymbolFontTests(EngineFixture fx) : IClassFixture<EngineFixture>+{+ private static string Sym(string font, string code) => $"<w:r><w:sym w:font=\"{font}\" w:char=\"{code}\"/></w:r>";++ /// <summary>The check boxes and marks people insert, with the text each one must become.</summary>+ private static readonly (string Font, string Code, string Text)[] Symbols =+ [+ ("Wingdings 2", "F052", "☑"), ("Wingdings 2", "F0A3", "☐"), ("Wingdings 2", "F054", "☒"),+ ("Wingdings 2", "F050", "✓"), ("Wingdings 2", "F04F", "✗"),+ ("Wingdings", "F0FE", "☑"), ("Wingdings", "F0A8", "☐"), ("Wingdings", "F0FD", "☒"), ("Wingdings", "F0FC", "✓"),+ ("Wingdings", "F06F", "□"), ("Wingdings", "F0E0", "→"), ("Wingdings", "F046", "☞"), ("Wingdings", "F028", "☎"),+ ("Wingdings", "F02A", "✉"), ("Wingdings", "F081", "①"),+ ("Wingdings 3", "F075", "▶"), ("Webdings", "F061", "✔"),+ ("Symbol", "F061", "α"), ("Symbol", "F057", "Ω"), ("Symbol", "F0B3", "≥"), ("Symbol", "F0B7", "•"),+ ];++ private async Task<string> ConvertAsync(DocxBuilder docx, string target = "hwpx")+ {+ var source = docx.Save(Path.Combine(fx.NewFolder(), "symbols.docx"));+ var job = await fx.ConvertAsync([source], new Preset { TargetFormat = target });+ Assert.True(job.State == JobState.Completed, string.Join("; ", job.Files.Select(f => f.ErrorDetail)));+ return job.Outputs.Single();+ }++ private static DocxBuilder SymbolDocument()+ {+ var docx = new DocxBuilder();+ foreach (var (font, code, _) in Symbols)+ docx.Paragraph(P(R($"{font} {code}: ") + Sym(font, code)));+ return docx;+ }++ [Fact]+ public async Task Inserted_symbols_become_the_characters_they_show()+ {+ var hwpx = await ConvertAsync(SymbolDocument());+ ValidPackage(hwpx, 0);+ var section = Xml(hwpx);+ foreach (var (font, code, text) in Symbols)+ Assert.EndsWith(text, ParagraphWith(section, $"{font} {code}: ").Value.Trim());+ Assert.DoesNotContain("●", section.Value);+ Assert.DoesNotContain("◆", section.Value);+ }++ [Fact]+ public async Task An_unknown_symbol_keeps_the_old_placeholder()+ {+ var hwpx = await ConvertAsync(new DocxBuilder().Paragraph(P(R("bomb: ") + Sym("Wingdings", "F04D"))));+ Assert.EndsWith("●", ParagraphWith(Xml(hwpx), "bomb: ").Value.Trim());+ }++ [Fact]+ public async Task Text_typed_in_a_symbol_font_is_drawn_in_the_text_font()+ {+ // "þ" in Wingdings is ☑, "R" in Wingdings 2 too, "a" in Symbol α.+ var docx = new DocxBuilder().Paragraph(P(+ R("þ", "<w:rFonts w:ascii=\"Wingdings\" w:hAnsi=\"Wingdings\"/>") ++ R("R", "<w:rFonts w:ascii=\"Wingdings 2\" w:hAnsi=\"Wingdings 2\"/>") ++ R("a", "<w:rFonts w:ascii=\"Symbol\" w:hAnsi=\"Symbol\"/>") ++ R(" done")));+ var hwpx = await ConvertAsync(docx);+ Assert.Contains("☑☑α done", Xml(hwpx).Value);+ // The characters carry the paragraph's text font: no run asks for a symbol font any more.+ Assert.DoesNotContain("Wingdings", Xml(hwpx, "Contents/header.xml").ToString());+ Assert.DoesNotContain("Symbol\"", Xml(hwpx, "Contents/header.xml").ToString());+ }++ [Theory]+ [InlineData("Wingdings", "", "☐")] // Word's check-list bullet, ◆ before #350+ [InlineData("Wingdings", "", "☑")]+ [InlineData("Wingdings", "", "▪")]+ [InlineData("Wingdings", "", "➢")]+ [InlineData("Symbol", "", "♦")]+ [InlineData("Symbol", "", "•")]+ [InlineData("Wingdings 2", "", "☐")]+ [InlineData(null, "", "◆")] // no font: the usual Symbol bullets as before+ public async Task List_bullets_follow_their_symbol_font(string? font, string bullet, string expected)+ {+ var rPr = font is null ? "" : $"<w:rPr><w:rFonts w:ascii=\"{font}\" w:hAnsi=\"{font}\" w:hint=\"default\"/></w:rPr>";+ var docx = new DocxBuilder+ {+ Numbering = $"<w:abstractNum w:abstractNumId=\"1\"><w:lvl w:ilvl=\"0\"><w:numFmt w:val=\"bullet\"/><w:lvlText w:val=\"{bullet}\"/>{rPr}</w:lvl></w:abstractNum>" ++ "<w:num w:numId=\"1\"><w:abstractNumId w:val=\"1\"/></w:num>",+ };+ docx.Paragraph(P(R("item"), "<w:numPr><w:ilvl w:val=\"0\"/><w:numId w:val=\"1\"/></w:numPr>"));+ var head = Xml(await ConvertAsync(docx), "Contents/header.xml");+ Assert.Equal(expected, head.Descendants(Hh + "numbering").Last().Elements(Hh + "paraHead").First().Value);+ }++ [Fact]+ public async Task Slide_bullets_and_text_in_symbol_fonts_become_their_characters()+ {+ var pptx = new PptxBuilder();+ pptx.Slide(+ "<p:sp><p:nvSpPr><p:cNvPr id=\"20\" name=\"List\"/><p:cNvSpPr/><p:nvPr/></p:nvSpPr>" ++ "<p:spPr><a:xfrm><a:off x=\"838200\" y=\"838200\"/><a:ext cx=\"6000000\" cy=\"3000000\"/></a:xfrm><a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom></p:spPr>" ++ "<p:txBody><a:bodyPr/><a:lstStyle/>" ++ "<a:p><a:pPr marL=\"228600\" indent=\"-228600\"><a:buFont typeface=\"Wingdings\" pitchFamily=\"2\" charset=\"2\"/><a:buChar char=\"§\"/></a:pPr><a:r><a:rPr lang=\"en-US\"/><a:t>square item</a:t></a:r></a:p>" ++ "<a:p><a:pPr marL=\"228600\" indent=\"-228600\"><a:buFont typeface=\"Wingdings\" pitchFamily=\"2\" charset=\"2\"/><a:buChar char=\"ü\"/></a:pPr><a:r><a:rPr lang=\"en-US\"/><a:t>checked item</a:t></a:r></a:p>" ++ "<a:p><a:r><a:rPr lang=\"en-US\"><a:latin typeface=\"Wingdings 2\"/></a:rPr><a:t>R</a:t></a:r><a:r><a:rPr lang=\"en-US\"/><a:t> agreed</a:t></a:r></a:p>" ++ "</p:txBody></p:sp>");+ var source = pptx.Save(Path.Combine(fx.NewFolder(), "symbols.pptx"));+ var job = await fx.ConvertAsync([source], new Preset { TargetFormat = "hwpx" });+ Assert.True(job.State == JobState.Completed, string.Join("; ", job.Files.Select(f => f.ErrorDetail)));+ var text = Xml(job.Outputs.Single()).Value;+ Assert.Contains("▪ square item", text);+ Assert.Contains("✓ checked item", text);+ Assert.Contains("☑ agreed", text);+ }++ [Fact]+ public async Task Rhwp_draws_the_check_boxes_in_the_pdf()+ {+ var rhwp = fx.Converters.Single(c => c.Id == "rhwp");+ Assert.SkipUnless(fx.Catalog.StatusOf(rhwp).IsAvailable, "rhwp not found (pwsh build/fetch-engines.ps1 -Only rhwp)");++ var pdf = await ConvertAsync(SymbolDocument(), "pdf");+ using var document = PdfDocument.Open(pdf);+ var letters = document.GetPages().SelectMany(p => p.Letters).ToList();+ var text = string.Concat(letters.Select(l => l.Value));+ foreach (var symbol in new[] { "☑", "☐", "☒", "✓", "✗", "α", "≥" })+ Assert.Contains(symbol, text);+ Assert.DoesNotContain("●", text);+ // Drawn with a real font, not as an empty box: every check box letter has a glyph with some width.+ Assert.All(letters.Where(l => l.Value is "☑" or "☐" or "☒"), l => Assert.True(l.Width > 0, $"{l.Value} in {l.FontName}"));+ }++ [Fact]+ public void Tables_map_both_code_forms_and_ignore_other_fonts()+ {+ Assert.Equal("☑", SymbolFonts.Map("Wingdings 2", 0xF052));+ Assert.Equal("☑", SymbolFonts.Map("wingdings2", 0x52));+ Assert.Equal("☐", SymbolFonts.Map("WINGDINGS", ""));+ Assert.Null(SymbolFonts.Map("Wingdings", 0xF04D)); // a bomb: no Unicode character of the plane we draw+ Assert.Null(SymbolFonts.Map("Calibri", 0xF052));+ Assert.Null(SymbolFonts.Map(null, 0xF052));+ Assert.Null(SymbolFonts.Map("Wingdings", "þM"));+ Assert.True(SymbolFonts.IsSymbolFont("Webdings"));+ Assert.False(SymbolFonts.IsSymbolFont("Segoe UI Symbol"));+ }+}