From f29f1cc8ed77ba21ad2c87f7c33fb71d147639a5 Mon Sep 17 00:00:00 2001 From: Mark Needham Date: Sun, 6 Jul 2014 00:46:33 +0100 Subject: [PATCH] experimenting with using the lato webfont so the font can be embedded in the svg and display nicely on all the machines --- graph-editor.js | 5 +++++ style/graph-style-chunky.css | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/graph-editor.js b/graph-editor.js index 7927ee0..eb361e7 100644 --- a/graph-editor.js +++ b/graph-editor.js @@ -18,6 +18,11 @@ window.onload = function() .append("svg:svg") .attr("class", "graphdiagram"); + d3.xhr("/Lato-base64.txt", function(data) { + var result = data.response; + d3.select("#canvas svg").insert("style", "g").html("@font-face { font-family: \"Lato\"; font-style: normal; font-weight: 400; src: url(\"data:font/truetype;charset=utf-8;base64," + result + "\");}"); + }); + var diagram = gd.diagram() .scaling(gd.scaling.centerOrScaleDiagramToFitSvg) .overlay(function(layoutModel, view) { diff --git a/style/graph-style-chunky.css b/style/graph-style-chunky.css index 303148e..803062a 100644 --- a/style/graph-style-chunky.css +++ b/style/graph-style-chunky.css @@ -1,5 +1,5 @@ .graph-diagram-markup { - font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif; + font-family: 'Lato', "Gill Sans", "Gill Sans MT", Calibri, sans-serif; } .graph-diagram-markup .node {