1
Fork 0

Make graphviz font configurable

Alternative to PR ##76776.

To change the graphviz output to use an alternative `fontname` value,
add a command line option like: `rustc --graphviz-font=monospace`.
This commit is contained in:
Rich Kadel 2020-09-16 08:10:06 -07:00
parent f7aee330c7
commit 5c29332ace
4 changed files with 17 additions and 11 deletions

View file

@ -306,7 +306,8 @@ where
let mut buf = Vec::new();
let graphviz = graphviz::Formatter::new(body, def_id, results, style);
let mut render_opts = vec![dot::RenderOption::Monospace];
let mut render_opts =
vec![dot::RenderOption::Fontname(tcx.sess.opts.debugging_opts.graphviz_font.clone())];
if tcx.sess.opts.debugging_opts.graphviz_dark_mode {
render_opts.push(dot::RenderOption::DarkTheme);
}

View file

@ -55,9 +55,9 @@ where
writeln!(w, "{} {}Mir_{} {{", kind, cluster, def_name)?;
// Global graph properties
let font = r#"fontname="Courier, monospace""#;
let mut graph_attrs = vec![font];
let mut content_attrs = vec![font];
let font = format!(r#"fontname="{}""#, tcx.sess.opts.debugging_opts.graphviz_font);
let mut graph_attrs = vec![&font[..]];
let mut content_attrs = vec![&font[..]];
let dark_mode = tcx.sess.opts.debugging_opts.graphviz_dark_mode;
if dark_mode {