added most of the functionality for choosing font
This commit is contained in:
+27
-1
@@ -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() {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user