added most of the functionality for choosing font

This commit is contained in:
TheLastScrub
2021-03-15 22:15:14 -07:00
parent 27d914f840
commit 2f91ca0aa1
18 changed files with 116 additions and 21 deletions
+27 -1
View File
@@ -4,7 +4,7 @@ import { DeltaGreenActorSheet } from "./actor/actor-sheet.js";
import { DeltaGreenItem } from "./item/item.js";
import { DeltaGreenItemSheet } from "./item/item-sheet.js";
import { sendPercentileTestToChat, sendLethalityTestToChat, sendDamageRollToChat } from "./roll/roll.js";
import { registerSystemSettings } from "./settings.js"
import { preloadHandlebarsTemplates } from "./templates.js";
Hooks.once('init', async function() {
@@ -26,6 +26,9 @@ Hooks.once('init', async function() {
decimals: 0
};
// Register System Settings
registerSystemSettings();
// Define custom Entity classes
CONFIG.Actor.entityClass = DeltaGreenActor;
CONFIG.Item.entityClass = DeltaGreenItem;
@@ -106,6 +109,29 @@ Hooks.once('init', async function() {
return "";
}
});
// looks at system setting for what font to use and returns the class that is then used in the handlebars template that
// generates the character sheet.
Handlebars.registerHelper('getFontFamilySystemSettingClass', function() {
let setting = game.settings.get("deltagreen", "characterSheetFont");
if(setting === "TypeWriterCondensed"){
return "typewriter-condensed-font";
}
else if(setting === "Martel"){
return "martel-font";
}
else if(setting === "Signika"){
return "signika-font";
}
else if(setting === "atwriter"){
return "atwriter-font";
}
else{
return "martel-font";
}
});
});
Hooks.once("ready", async function() {
+19
View File
@@ -0,0 +1,19 @@
export const registerSystemSettings = function() {
game.settings.register('deltagreen', 'characterSheetFont', {
name: "World Font Choice",
hint: "Choose font style for use throughout this world.",
scope: "world", // This specifies a world-stored setting
config: true, // This specifies that the setting appears in the configuration view
type: String,
choices: { // If choices are defined, the resulting setting will be a select menu
"TypeWriterCondensed": "Condensed Typewriter",
"atwriter": "Another Typewriter",
"Martel": "Martel",
"Signika": "Signika"
},
default: "TypeWriterCondensed", // The default value for the setting
onChange: value => { // A callback function which triggers when the setting is changed
console.log(value)
}
});
}