From 2a8f0675bccd419f1c4dfeda65ae091e3228275a Mon Sep 17 00:00:00 2001 From: Steffen Becker Date: Tue, 11 Aug 2026 21:22:13 +0000 Subject: [PATCH] fix: Word's hollow bullet is the letter it is MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A Courier New "o" was mapped to ◦ for looks. LibreOffice and Word both draw the glyph the numbering names, so the nested lists of the gravity summary now read like theirs. --- src/lib/utils/bulletListTypes.ts | 2 -- tests/docx-roundtrip.test.ts | 2 +- tests/unit/bullet-list-types.test.ts | 5 +++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/utils/bulletListTypes.ts b/src/lib/utils/bulletListTypes.ts index 3d8c6f0..a35ed38 100644 --- a/src/lib/utils/bulletListTypes.ts +++ b/src/lib/utils/bulletListTypes.ts @@ -72,8 +72,6 @@ function mapSymbolChar(char: string, font: string | null | undefined): string | return map[code & 0xff] ?? null; } if (isPua) return null; - // Word's classic hollow bullet is a Courier New "o" — render it as a real circle. - if (char === 'o' && (font ?? '').toLowerCase().startsWith('courier')) return '◦'; return char; } diff --git a/tests/docx-roundtrip.test.ts b/tests/docx-roundtrip.test.ts index 584db55..4d14761 100644 --- a/tests/docx-roundtrip.test.ts +++ b/tests/docx-roundtrip.test.ts @@ -545,7 +545,7 @@ describe('DOCX import of a foreign Word document', () => { expect(top.attrs?.bulletChar).toBe('❖'); // Wingdings U+F076 const nested = walk(top, 'bulletList').find((b) => b !== top)!; expect(walk(nested, 'text')[0].text).toBe('Courier hollow'); - expect(nested.attrs?.bulletChar ?? null).toBe(null); // Courier 'o' = default ◦ at level 2 + expect(nested.attrs?.bulletChar).toBe('o'); // Word's hollow bullet is the letter, as LO draws it }); it("imports Word's legal numbering (%1.%2.) as a multilevel list", () => { diff --git a/tests/unit/bullet-list-types.test.ts b/tests/unit/bullet-list-types.test.ts index 984c01a..89b765d 100644 --- a/tests/unit/bullet-list-types.test.ts +++ b/tests/unit/bullet-list-types.test.ts @@ -53,8 +53,9 @@ describe('bulletCharFromDocx (Word numbering.xml patterns)', () => { expect(bulletCharFromDocx('v', 'Wingdings')).toBe('❖'); }); - it("maps Courier New 'o' (Word's hollow bullet) to ◦", () => { - expect(bulletCharFromDocx('o', 'Courier New')).toBe('◦'); + it("keeps Word's hollow bullet the letter it is", () => { + // A Courier New "o" — LibreOffice and Word both draw the glyph, not a ring. + expect(bulletCharFromDocx('o', 'Courier New')).toBe('o'); }); it('passes literal chars in text fonts through', () => {