v. 0.59.05b

This commit is contained in:
Azgaar 2018-08-29 18:19:26 +03:00 committed by GitHub
parent efd6a0eda3
commit 5ddbfed1e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5734,11 +5734,13 @@ function fantasyMap() {
// downalod map as SVG or PNG file
function saveAsImage(type) {
console.time("saveAsImage");
// get all used fonts
const webSafe = ["Georgia", "Times+New+Roman", "Comic+Sans+MS", "Lucida+Sans+Unicode", "Courier+New", "Verdana", "Arial", "Impact"];
// get non-standard fonts used for labels to fetch them from web
const fontsInUse = []; // to store fonts currently in use
labels.selectAll("g").each(function(d) {
const font = d3.select(this).attr("data-font");
if (!font) return;
if (webSafe.indexOf(font) !== -1) return; // do not fetch web-safe fonts
if (fontsInUse.indexOf(font) === -1) fontsInUse.push(font);
});
const fontsToLoad = "https://fonts.googleapis.com/css?family=" + fontsInUse.join("|");