diff --git a/README.md b/README.md index 005a918..58c1a00 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,10 @@ $ nix run nixpkgs#termsnap -- --columns 80 --lines 36 -- ls --color=always -l $ nix run nixpkgs#termsnap -- --interactive --out ./interactive-bash.svg -- bash ``` +The above takes Termsnap from the nixpkgs repository. To use the most up to +date version on this repository's main branch, substitute `nixpkgs#termsnap` by +`github:tomcur/termsnap`. + ## A note on fonts The SVG generated by Termsnap makes assumptions about the metrics of the font diff --git a/termsnap-lib/src/lib.rs b/termsnap-lib/src/lib.rs index c6f6bf0..9c8c370 100644 --- a/termsnap-lib/src/lib.rs +++ b/termsnap-lib/src/lib.rs @@ -2,7 +2,7 @@ //! SVG files. //! //! ```rust -//! use termsnap_lib::{Term, VoidPtyWriter}; +//! use termsnap_lib::{FontMetrics, Term, VoidPtyWriter}; //! //! // Create a new terminal emulator and process some bytes. //! let mut term = Term::new(24, 80, VoidPtyWriter); @@ -20,7 +20,7 @@ //! assert_eq!(&format!("{}", screen.get(0, 10).unwrap().fg), "#859900"); //! //! // Render the screen to SVG. -//! println!("{}", screen.to_svg(&[])); +//! println!("{}", screen.to_svg(&[], FontMetrics::DEFAULT)); //! ``` #![forbid(unsafe_code)] @@ -67,11 +67,13 @@ impl FontMetrics { /// or Menlo. If this is not accurate, it will be noticeable as overlap or gaps between box /// drawing characters. /// - /// ``` - /// units_per_em: 1000 - /// advance: 600.0 - /// line_height: 1200.0 - /// descent: 300.0 + /// ```norun + /// FontMetrics { + /// units_per_em: 1000, + /// advance: 600.0, + /// line_height: 1200.0, + /// descent: 300.0, + /// } /// ``` pub const DEFAULT: FontMetrics = FontMetrics { units_per_em: 1000,