Fonts refactoring and Add Font dialog (#660)

* fonts rework - start

* fonts rework - continue

* fonts rework - fetch google font

* fonts rework - issue fixes

* fonts rework - add fonts to downloaded image

* fonts rework - add methods dialog

* fonts rework - add methods description

* fonts update - move version to 1.661

* fonts - remove unused file
This commit is contained in:
Azgaar 2021-09-09 00:12:45 +03:00 committed by Peter
parent a5f4939875
commit efb545c6c5
4 changed files with 32 additions and 44 deletions

View file

@ -237,6 +237,15 @@ function parseLoadedData(data) {
if (data[2]) mapCoordinates = JSON.parse(data[2]);
if (data[4]) notes = JSON.parse(data[4]);
if (data[33]) rulers.fromString(data[33]);
if (data[34]) {
const usedFonts = JSON.parse(data[34]);
usedFonts.forEach(usedFont => {
const {family: usedFamily, unicodeRange: usedRange, variant: usedVariant} = usedFont;
const defaultFont = fonts.find(({family, unicodeRange, variant}) => family === usedFamily && unicodeRange === usedRange && variant === usedVariant);
if (!defaultFont) fonts.push(usedFont);
declareFont(usedFont);
});
}
const biomes = data[3].split('|');
biomesData = applyDefaultBiomesSystem();
@ -310,8 +319,6 @@ function parseLoadedData(data) {
burgLabels = labels.select('#burgLabels');
})();
loadUsedFonts();
void (function parseGridData() {
grid = JSON.parse(data[6]);
calculateVoronoi(grid, grid.points);
@ -425,18 +432,8 @@ function parseLoadedData(data) {
Religions.generate();
// 1.0 adds a legend box
legend = svg.append('g').attr('id', 'legend');
legend
.attr('font-family', 'Almendra SC')
.attr('data-font', 'Almendra+SC')
.attr('font-size', 13)
.attr('data-size', 13)
.attr('data-x', 99)
.attr('data-y', 93)
.attr('stroke-width', 2.5)
.attr('stroke', '#812929')
.attr('stroke-dasharray', '0 4 10 4')
.attr('stroke-linecap', 'round');
legend = svg.append("g").attr("id", "legend");
legend.attr("font-family", "Almendra SC").attr("font-size", 13).attr("data-size", 13).attr("data-x", 99).attr("data-y", 93).attr("stroke-width", 2.5).attr("stroke", "#812929").attr("stroke-dasharray", "0 4 10 4").attr("stroke-linecap", "round");
// 1.0 separated drawBorders fron drawStates()
stateBorders = borders.append('g').attr('id', 'stateBorders');