mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
v. 0.59.05b
This commit is contained in:
parent
efd6a0eda3
commit
5ddbfed1e4
1 changed files with 3 additions and 1 deletions
|
|
@ -5734,11 +5734,13 @@ function fantasyMap() {
|
||||||
// downalod map as SVG or PNG file
|
// downalod map as SVG or PNG file
|
||||||
function saveAsImage(type) {
|
function saveAsImage(type) {
|
||||||
console.time("saveAsImage");
|
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
|
const fontsInUse = []; // to store fonts currently in use
|
||||||
labels.selectAll("g").each(function(d) {
|
labels.selectAll("g").each(function(d) {
|
||||||
const font = d3.select(this).attr("data-font");
|
const font = d3.select(this).attr("data-font");
|
||||||
if (!font) return;
|
if (!font) return;
|
||||||
|
if (webSafe.indexOf(font) !== -1) return; // do not fetch web-safe fonts
|
||||||
if (fontsInUse.indexOf(font) === -1) fontsInUse.push(font);
|
if (fontsInUse.indexOf(font) === -1) fontsInUse.push(font);
|
||||||
});
|
});
|
||||||
const fontsToLoad = "https://fonts.googleapis.com/css?family=" + fontsInUse.join("|");
|
const fontsToLoad = "https://fonts.googleapis.com/css?family=" + fontsInUse.join("|");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue