fix: Word's hollow bullet is the letter it is

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.
This commit is contained in:
Steffen Becker committed 2026-08-11 21:22:13 +00:00
1 parent 5969795d04
commit 2a8f0675bc
3 files changed
+4 -5

No files matched your search

-2
View File
@@ -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;
}
+1 -1
View File
@@ -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", () => {
+3 -2
View File
@@ -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', () => {