Skip to content

Commit

Permalink
Update settings.js
Browse files Browse the repository at this point in the history
Fix #260
  • Loading branch information
mclemente committed Sep 1, 2024
1 parent e8691b3 commit 74434d3
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/module/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,21 @@ export const registerSettings = function () {
});

const getFonts = () => {
const obj = {};
Object.keys(CONFIG.fontDefinitions).forEach((f) => {
obj[f] = f;
});
if (!(CONFIG.canvasTextStyle.fontFamily in obj)) {
obj[CONFIG.canvasTextStyle.fontFamily] = CONFIG.canvasTextStyle.fontFamily;
const fontSources = {
...CONFIG.fontDefinitions,
...game.settings.get("core", "fonts"),
};
const fonts = Object.keys(fontSources).reduce((acc, font) => {
acc[font] = font;
return acc;
}, {});

const defaultFont = CONFIG.canvasTextStyle.fontFamily;
if (!(defaultFont in fonts)) {
fonts[defaultFont] = defaultFont;
}
return obj;

return fonts;
};
addMenuSetting("core.menuSettings.fontFamily", {
name: game.i18n.localize("EDITOR.Font"),
Expand Down

0 comments on commit 74434d3

Please sign in to comment.