mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-22 12:03:25 -04:00
(ar)(ko) fix banner font registration for banner
This commit is contained in:
parent
153867d79d
commit
456ca7e126
@ -3,24 +3,26 @@ import fs from 'fs';
|
||||
|
||||
const __dirname = new URL('.', import.meta.url).pathname;
|
||||
|
||||
const vars = {};
|
||||
const vars: Record<string, string> = {};
|
||||
|
||||
for (const [, name, value] of fs.readFileSync(`${__dirname}/../data/variables.scss`).toString('utf-8')
|
||||
.matchAll(/^\$([^:]+): '([^']+)'(?:, '[^']+')*;$/gm)) {
|
||||
vars[name] = value;
|
||||
}
|
||||
|
||||
const fontSources = {
|
||||
Quicksand: 'quicksand-v21-latin-ext_latin-{weight}.ttf',
|
||||
const fontSources: Record<string, string> = {
|
||||
'Baloo Bhaijaan 2': 'baloo-bhaijaan-2-v19-arabic_latin-{weight}.ttf',
|
||||
'Nanum Gothic': 'nanum-gothic-v17-latin_korean-{weight}.ttf',
|
||||
Nunito: 'nunito-v16-latin-ext_latin_cyrillic-ext_cyrillic-{weight}.ttf',
|
||||
Quicksand: 'quicksand-v21-latin-ext_latin-{weight}.ttf',
|
||||
'Zen Maru Gothic': 'zen-maru-gothic-v4-latin_japanese-{weight}.ttf',
|
||||
};
|
||||
|
||||
const weightsValues = {
|
||||
const weightsValues: Record<string, string> = {
|
||||
bold: '700',
|
||||
};
|
||||
|
||||
export const registerLocaleFont = (v, weights = ['regular']) => {
|
||||
export const registerLocaleFont = (v: string, weights: string[] = ['regular']): string => {
|
||||
const family = vars[v];
|
||||
const source = fontSources[family];
|
||||
for (const weight of weights) {
|
@ -8,7 +8,7 @@ import { loadTsv } from '../../src/tsv.js';
|
||||
import { handleErrorAsync } from '../../src/helpers.ts';
|
||||
import { Translator } from '../../src/translator.js';
|
||||
import { CacheObject } from '../../src/cache.js';
|
||||
import { registerLocaleFont } from '../localeFont.js';
|
||||
import { registerLocaleFont } from '../localeFont.ts';
|
||||
|
||||
const translations = loadSuml('translations');
|
||||
const baseTranslations = loadSumlFromBase('locale/_base/translations');
|
||||
|
@ -5,7 +5,7 @@ import { createCanvas, loadImage, registerFont } from 'canvas';
|
||||
import { loadSuml } from '../loader.ts';
|
||||
import { clearKey, handleErrorAsync, isTroll } from '../../src/helpers.ts';
|
||||
import { caches } from '../../src/cache.js';
|
||||
import { registerLocaleFont } from '../localeFont.js';
|
||||
import { registerLocaleFont } from '../localeFont.ts';
|
||||
import auditLog from '../audit.ts';
|
||||
|
||||
const translations = loadSuml('translations');
|
||||
|
Loading…
x
Reference in New Issue
Block a user