Fix [Bug] PPTX inherited symbol-font bullets render as literal characters

Fixes #1935.

- crates/text/src/symbol.rs
- crates/text/src/shape.rs
- crates/text/tests/autocraft_regression_1935.rs
This commit is contained in:
aiongg
2026-11-07 10:38:16 +00:00
parent 170c5591b5
commit 6cee207f77
2 changed files with 15 additions and 1 deletions
+3 -1
View File
@@ -277,7 +277,7 @@ pub fn map_symbol_bullet(c: &str, font: Option<&str>) -> String {
}
// Only the legacy symbol fonts: "Noto Sans Symbols" and the like are Unicode fonts whose
// characters (❑ ❖) are drawn as they are. Private-use codes are mapped only when no font is named.
if f.contains("wingdings") || f == "symbol" || (font.is_none() && ('\u{f000}'..='\u{f0ff}').contains(&first)) {
if f.contains("wingdings") || f.starts_with("monotype sorts") || f == "symbol" || (font.is_none() && ('\u{f000}'..='\u{f0ff}').contains(&first)) {
let code = (first as u32) & 0xff;
// Wingdings 2 and 3 put different shapes at the same codes.
if f.starts_with("wingdings 2") {
@@ -304,6 +304,8 @@ pub fn map_symbol_bullet(c: &str, font: Option<&str>) -> String {
return m.to_string();
}
let m = match code {
0x6d if f.starts_with("monotype sorts") => '○',
0xf0 if f.contains("wingdings") => '⇨',
0xa7 => '▪',
0xd8 => '➢',
0xfc => '✓',
@@ -0,0 +1,12 @@
use deckcraft_text::map_symbol_bullet;
#[test]
fn monotype_sorts_m_bullet_is_open_circle() {
assert_eq!(map_symbol_bullet("m", Some("Monotype Sorts")), "\u{25CB}");
}
#[test]
fn wingdings_eth_bullet_is_right_arrow() {
assert_eq!(map_symbol_bullet("\u{f0}", Some("Wingdings")), "\u{21E8}");
assert_eq!(map_symbol_bullet("\u{f0f0}", Some("Wingdings")), "\u{21E8}");
}