Skip to content

Commit

Permalink
WIP: use toml_edit::easy instead of toml to fix array of arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Dec 5, 2022
1 parent 2266ccc commit 160e11f
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions fontir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ read-fonts = { git = 'https://github.com/googlefonts/fontations' }
bitflags = "1.3"
serde = {version = "1.0", features = ["derive"] }
toml = "0.5.9"
toml_edit = { version = "0.15.0", features = ["easy"] }
bincode = "1.3.3"
filetime = "0.2.18"
thiserror = "1.0.37"
Expand Down
2 changes: 1 addition & 1 deletion fontir/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ pub enum WorkError {
#[error("Conversion of glyph '{0}' to IR failed: {1}")]
GlyphIrWorkError(String, String),
#[error("toml error")]
TomlSerError(#[from] toml::ser::Error),
TomlSerError(#[from] toml_edit::ser::Error),
}
1 change: 0 additions & 1 deletion fontir/src/ir.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! Serde types for font IR. See TODO:PublicLink.

use std::collections::{BTreeMap, HashMap};

use serde::{Deserialize, Serialize};
Expand Down
1 change: 1 addition & 0 deletions ufo2fontir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ fontir = { version = "0.0.1", path = "../fontir" }

serde = {version = "1.0", features = ["derive"] }
toml = "0.5.9"
toml_edit = { version = "0.15.0", features = ["easy"] }

# TODO use a version of norad with https://github.com/linebender/norad/pull/272 once one exists
# norad = "0.7.0"
Expand Down
2 changes: 1 addition & 1 deletion ufo2fontir/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ impl Work<()> for GlyphIrWork {
// FIXME: this currently fails because TomlSerError(KeyNotString); need to find
// a way to serialize a HashMap<PathBuf, Vec<DesignSpaceLocation>>
let glyph_ir_toml =
toml::ser::to_string_pretty(&glyph_ir).map_err(WorkError::TomlSerError)?;
toml_edit::easy::to_string_pretty(&glyph_ir).map_err(WorkError::TomlSerError)?;
fs::write(&self.ir_file, glyph_ir_toml).map_err(WorkError::IoError)?;
Ok(())
}
Expand Down

0 comments on commit 160e11f

Please sign in to comment.