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
+12
View File
@@ -75,6 +75,18 @@ https://fonts.google.com/specimen/Didact+Gothic?query=did#about
License: Open Font License.
https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL
### TYPEWRITER CONDENSED FONT
By Volker Busse - F25 Digital Typeface Design
License: None given
https://www.dafont.com/typewriter-condensed.font
### ANOTHER TYPEWRITER Font
By Johan Holmdahl
License: None given
https://www.dafont.com/another-typewriter.font
## Game Icons
ICONS - https://game-icons.net/
@@ -0,0 +1,2 @@
Another Typewriter.
Freeware by Johan Holmdahl 1999.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

+48 -12
View File
@@ -2,12 +2,58 @@
@import url("https://fonts.googleapis.com/css2?family=Didact+Gothic");
@import url('https://fonts.googleapis.com/css2?family=Special+Elite&display=swap');
@font-face {
font-family: 'atwriter';
src: url('../assets/font/another-typewriter/atwriter.ttf') format('truetype'); /* Chrome 4+, Firefox 3.5, Opera 10+, Safari 3—5 */
}
@font-face {
font-family: TypeWriterCondensed;
src: url("../assets/font/typewriter-condensed/typewcond_regular.otf") format("opentype");
}
@font-face {
font-family: TypeWriterCondensed;
font-weight: bold;
src: url("../assets/font/typewriter-condensed/typewcond_bold.otf") format("opentype");
}
@font-face {
font-family: TypeWriterCondensed;
font-weight: 600;
src: url("../assets/font/typewriter-condensed/typewcond_demi.otf") format("opentype");
}
/* Global styles */
/* switch fonts to include "Special Elite" as option? */
/*
.window-app {
font-family: "Martel", 'Signika', sans-serif !important;
font-family: "TypeWriterCondensed", "atwriter", "Martel", 'Signika', sans-serif !important;
height: auto;
}
*/
/*
section.window-content{
background: url("../assets/img/old_paper.jpg") !important;
}
*/
.typewriter-condensed-font{
font-family: "TypeWriterCondensed", sans-serif !important;
}
.martel-font{
font-family: "Martel", sans-serif !important;
}
.signika-font{
font-family: "Signika", sans-serif !important;
}
.atwriter-font{
font-family: "atwriter", sans-serif !important;
}
.rollable:hover, .rollable:focus {
color: #000;
@@ -141,15 +187,6 @@
text-align: left;
}
/* Styles limited to delta green sheets */
.deltagreen {
font-family: "Didact Gothic", "Roboto", sans-serif;
}
.deltagreen .item-form {
font-family: "Didact Gothic", "Roboto", sans-serif;
}
.deltagreen .sheet-header {
-webkit-box-flex: 0;
-ms-flex: 0 0 400px;
@@ -167,7 +204,6 @@
-webkit-box-pack: start;
-ms-flex-pack: start;
justify-content: flex-start;
}
.deltagreen .sheet-header .profile-img {
+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)
}
});
}
+1 -1
View File
@@ -1,4 +1,4 @@
<form class="{{cssClass}} flexcol" autocomplete="off">
<form class="{{cssClass}} {{getFontFamilySystemSettingClass}} flexcol" autocomplete="off">
{{!-- Sheet Header --}}
<header class="sheet-header">
+1 -1
View File
@@ -1,4 +1,4 @@
<form class="{{cssClass}} flexcol" autocomplete="off">
<form class="{{cssClass}} {{getFontFamilySystemSettingClass}} flexcol" autocomplete="off">
{{!-- Sheet Header --}}
<header class="sheet-header">
+1 -1
View File
@@ -1,4 +1,4 @@
<form class="{{cssClass}}" autocomplete="off">
<form class="{{cssClass}} {{getFontFamilySystemSettingClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
<div class="header-fields">
+1 -1
View File
@@ -1,4 +1,4 @@
<form class="{{cssClass}}" autocomplete="off">
<form class="{{cssClass}} {{getFontFamilySystemSettingClass}}" autocomplete="off">
<header class="sheet-header">
<div class="flexrow">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}" />
+1 -1
View File
@@ -1,4 +1,4 @@
<form class="{{cssClass}}" autocomplete="off">
<form class="{{cssClass}} {{getFontFamilySystemSettingClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
<div class="header-fields">
+1 -1
View File
@@ -1,4 +1,4 @@
<form class="{{cssClass}}" autocomplete="off">
<form class="{{cssClass}} {{getFontFamilySystemSettingClass}}" autocomplete="off">
{{!-- Sheet Tab Navigation --}}
<nav class="sheet-tabs tabs" data-group="primary">
+1 -1
View File
@@ -1,5 +1,5 @@
{{!-- I don't actually use this file, but leaving it around for now --}}
<form class="{{cssClass}}" autocomplete="off">
<form class="{{cssClass}} {{getFontFamilySystemSettingClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
<div class="header-fields">
+1 -1
View File
@@ -1,4 +1,4 @@
<form class="{{cssClass}}" autocomplete="off">
<form class="{{cssClass}} {{getFontFamilySystemSettingClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
<div class="header-fields">