mirror of
https://github.com/storytold/gridcraft.git
synced 2026-12-01 10:14:21 -06:00
Fonts: outlined letters kept through XLSX open and save
An XLSX font's <outline/> was never read, so outlined (hollow) letters came back solid after a save. The model's Font gains `outline` (serde default false, left out of JSON when off, part of the hand-written Hash), read in read_font and written by font_xml after <strike/> as Excel orders it, for cell fonts and differential formats. home.formatCells sets it through the style JSON. GridCraft does not draw outlined text yet. Split out of the ODS branch, which also maps style:text-outline onto it.
This commit is contained in:
@@ -870,6 +870,18 @@ mod tests {
|
||||
assert_eq!(s.execute("cell.get", json!({"cell": "A1"})).unwrap()["style"]["num_fmt"], "0.00");
|
||||
}
|
||||
|
||||
/// Outlined letters have no Font-group command; Format Cells' style JSON sets and clears them.
|
||||
#[test]
|
||||
fn format_cells_sets_outlined_letters() {
|
||||
let mut s = crate::Session::new();
|
||||
s.new_workbook();
|
||||
s.execute("cell.set", json!({"cell": "A1", "input": "x"})).unwrap();
|
||||
s.execute("home.formatCells", json!({"range": "A1", "style": {"font": {"outline": true}}})).unwrap();
|
||||
assert_eq!(s.execute("cell.get", json!({"cell": "A1"})).unwrap()["style"]["font"]["outline"], true);
|
||||
s.execute("home.formatCells", json!({"range": "A1", "style": {"font": {"outline": false}}})).unwrap();
|
||||
assert!(s.execute("cell.get", json!({"cell": "A1"})).unwrap()["style"]["font"].get("outline").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn width_units() {
|
||||
assert_eq!(chars_to_points(8.43), 64.0);
|
||||
|
||||
Reference in New Issue
Block a user