mirror of
https://github.com/storytold/deckcraft.git
synced 2026-12-01 18:23:52 -06:00
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:
@@ -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}");
|
||||
}
|
||||
Reference in New Issue
Block a user