Add multiple fonts
This commit is contained in:
+32
-1
@@ -20,6 +20,35 @@ class MyThoughts extends Main {
|
||||
public const PROJECT_NAME = 'MyThoughts';
|
||||
public const DEFAULT_LANG = 'en';
|
||||
|
||||
/**
|
||||
* The hands the book can be written in.
|
||||
*
|
||||
* One list, here, because two things need it and they must not drift: the
|
||||
* settings picker offers it, and updateSettings() validates against it.
|
||||
*
|
||||
* `scale` is the type size as a fraction of one ruled line. It is not
|
||||
* cosmetic - every one of these hands has a different x-height for the same
|
||||
* em, so a single size would leave one sitting on the rule and the next
|
||||
* floating above it. The values are measured, not chosen.
|
||||
*
|
||||
* Adding one here also needs its webfont imported in src/scripts/fonts.js.
|
||||
*/
|
||||
public const HANDS = [
|
||||
['id' => 'caveat', 'name' => 'Caveat', 'family' => '"Caveat Variable", "Caveat"', 'scale' => 0.82],
|
||||
['id' => 'kalam', 'name' => 'Kalam', 'family' => '"Kalam"', 'scale' => 0.81],
|
||||
['id' => 'patrick', 'name' => 'Patrick Hand', 'family' => '"Patrick Hand"', 'scale' => 0.8],
|
||||
['id' => 'shadows', 'name' => 'Shadows Into Light', 'family' => '"Shadows Into Light"', 'scale' => 0.7],
|
||||
['id' => 'architect', 'name' => "Architect's Daughter",'family' => '"Architects Daughter"', 'scale' => 0.68],
|
||||
['id' => 'indie', 'name' => 'Indie Flower', 'family' => '"Indie Flower"', 'scale' => 0.67]
|
||||
];
|
||||
|
||||
public const DEFAULT_HAND = 'caveat';
|
||||
|
||||
/** @return string[] ids of every hand on offer */
|
||||
public static function getHandIds(): array {
|
||||
return array_column(self::HANDS, 'id');
|
||||
}
|
||||
|
||||
//The dictionaries shipped in resources/lang. Listed rather than globbed:
|
||||
//Translator resolves its folder relative to the calling script, and the
|
||||
//settings panel needs the list on a page load either way.
|
||||
@@ -62,7 +91,7 @@ class MyThoughts extends Main {
|
||||
protected function getSqlOptions() {
|
||||
return [
|
||||
'tables' => [
|
||||
User::USER_TABLE => ['name', 'email', 'password', 'token', 'token_exp', 'language', 'timezone', 'clearance'],
|
||||
User::USER_TABLE => ['name', 'email', 'password', 'token', 'token_exp', 'language', 'timezone', 'hand', 'clearance'],
|
||||
Journal::ENTRY_TABLE=> [Db::getId(User::USER_TABLE), 'content', 'status', 'started_on', 'closed_on', 'timezone']
|
||||
],
|
||||
'types' => [
|
||||
@@ -71,6 +100,7 @@ class MyThoughts extends Main {
|
||||
'password' => "VARCHAR(255) NOT NULL DEFAULT ''",
|
||||
'token' => "VARCHAR(64) NOT NULL DEFAULT ''",
|
||||
'token_exp' => 'TIMESTAMP DEFAULT 0',
|
||||
'hand' => "VARCHAR(20) NOT NULL DEFAULT '".self::DEFAULT_HAND."'",
|
||||
'language' => 'VARCHAR(2)',
|
||||
'timezone' => 'CHAR(64) NOT NULL', //see mysql.time_zone_name
|
||||
'clearance' => 'TINYINT(1) DEFAULT '.User::CLEARANCE_USER,
|
||||
@@ -102,6 +132,7 @@ class MyThoughts extends Main {
|
||||
'consts' => [
|
||||
'title' => self::PROJECT_NAME,
|
||||
'languages' => self::LANGUAGES,
|
||||
'hands' => self::HANDS,
|
||||
'chunk_size' => Journal::CHUNK_SIZE,
|
||||
'default_timezone' => Settings::TIMEZONE,
|
||||
'autosave_delay' => 1200, //ms of stillness before a save
|
||||
|
||||
Reference in New Issue
Block a user