Also fixed monospace font for d3-graphviz engine

VS code graphviz extensions use d3-graphviz, which supports `Courier`
fontname but does not support `monospace`. This caused graphs to render
poorly because the text sizes were wrong.
This commit is contained in:
Rich Kadel
2020-09-09 14:49:32 -07:00
parent c19b2370e4
commit f7aee330c7
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -634,7 +634,7 @@ pub fn render_opts<'a, N, E, G, W>(g: &'a G, w: &mut W, options: &[RenderOption]
let mut graph_attrs = Vec::new();
let mut content_attrs = Vec::new();
if options.contains(&RenderOption::Monospace) {
let font = r#"fontname="monospace""#;
let font = r#"fontname="Courier, monospace""#;
graph_attrs.push(font);
content_attrs.push(font);
};
+1 -1
View File
@@ -55,7 +55,7 @@ pub fn write_mir_fn_graphviz<'tcx, W>(
writeln!(w, "{} {}Mir_{} {{", kind, cluster, def_name)?;
// Global graph properties
let font = r#"fontname="monospace""#;
let font = r#"fontname="Courier, monospace""#;
let mut graph_attrs = vec![font];
let mut content_attrs = vec![font];
+3 -3
View File
@@ -1,7 +1,7 @@
digraph Mir_0_3 {
graph [fontname="monospace"];
node [fontname="monospace"];
edge [fontname="monospace"];
graph [fontname="Courier, monospace"];
node [fontname="Courier, monospace"];
edge [fontname="Courier, monospace"];
label=<fn main() -&gt; ()<br align="left"/>>;
bb0__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">0</td></tr><tr><td align="left" balign="left">_0 = const ()<br/></td></tr><tr><td align="left">goto</td></tr></table>>];
bb1__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">1</td></tr><tr><td align="left">resume</td></tr></table>>];