diff --git a/src/App.vue b/src/App.vue index 7fe9ce5..99f4e9b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,12 +1,13 @@ @@ -125,17 +127,18 @@ function submit() {

Start script tagging

- Adds a 0-score placeholder for every family that supports the script and every - category below. Families with a wght axis get a variable placeholder at the wght - extremes, and at the wdth extremes too when they have wdth. Families that already - have any tagging for a category, for all scripts or for this script, are skipped. + Adds a 0-score placeholder for the category to every family that supports the script. + Families with a wght axis get a variable placeholder at the wght extremes, and at the + wdth extremes too when they have wdth. Families that already have any tagging for the + category, for all scripts or for this script, are skipped. OK then opens three panels + for the category: the new placeholders, every tagging for the script, and every tagging.

Script

-

Categories

- +

Category

+
{{ families.length }} families support {{ script }}: @@ -145,7 +148,7 @@ function submit() {

- +
diff --git a/src/components/TagsByCategories.vue b/src/components/TagsByCategories.vue index d1a7551..d0edae8 100644 --- a/src/components/TagsByCategories.vue +++ b/src/components/TagsByCategories.vue @@ -20,19 +20,36 @@ const props = defineProps({ vfDisplayMode: { type: String as () => 'animated' | 'list', default: 'animated' + }, + // Initial state of the controls, for panels opened with a preset + initialSortBy: { + type: String, + default: 'family' + }, + initialScriptFilter: { + type: Array as () => string[], + default: () => [] + }, + initialPlaceholdersOnly: { + type: Boolean, + default: false + }, + initialSampleText: { + type: String, + default: '' } }); const selectedCategories = ref(props.categories); -const sortBy = ref('family'); // Default sorting option +const sortBy = ref(props.initialSortBy); const tagFilter = ref(''); const axisFilter = ref(''); const reverseTags = ref(false); const variableOnly = ref(false); const staticOnly = ref(false); -const scriptFilter = ref([]); -const placeholdersOnly = ref(false); -const sampleText = ref(''); +const scriptFilter = ref([...props.initialScriptFilter]); +const placeholdersOnly = ref(props.initialPlaceholdersOnly); +const sampleText = ref(props.initialSampleText); // Every script any font supports, from the family metadata subsets const scriptOptions = computed(() => { diff --git a/src/pangrams.ts b/src/pangrams.ts new file mode 100644 index 0000000..8400ad9 --- /dev/null +++ b/src/pangrams.ts @@ -0,0 +1,53 @@ +// Sample text per script, keyed by the subset names in the family metadata. +// Two words at most per script, so Latin plus one script is four words at most. + +export const LATIN_SAMPLE = "Hello world"; + +export const SAMPLES: Record = { + latin: LATIN_SAMPLE, + vietnamese: "Xin chào", + cyrillic: "Привет мир", + greek: "Καλημέρα κόσμε", + armenian: "Բարև աշխարհ", + georgian: "გამარჯობა მსოფლიო", + hebrew: "שלום עולם", + arabic: "مرحبا بالعالم", + syriac: "ܫܠܡܐ ܥܠܡܐ", + ethiopic: "ሰላም ዓለም", + devanagari: "नमस्ते दुनिया", + bengali: "নমস্কার বিশ্ব", + gurmukhi: "ਨਮਸਤੇ ਦੁਨੀਆ", + gujarati: "નમસ્તે દુનિયા", + oriya: "ନମସ୍କାର ଦୁନିଆ", + tamil: "வணக்கம் உலகம்", + telugu: "నమస్కారం ప్రపంచం", + kannada: "ನಮಸ್ಕಾರ ಜಗತ್ತು", + malayalam: "നമസ്കാരം ലോകം", + sinhala: "ආයුබෝවන් ලෝකය", + thai: "สวัสดี ชาวโลก", + lao: "ສະບາຍດີ ໂລກ", + khmer: "សួស្តី ពិភពលោក", + myanmar: "မင်္ဂလာပါ ကမ္ဘာ", + tibetan: "བཀྲ་ཤིས་བདེ་ལེགས།", + japanese: "こんにちは 世界", + korean: "안녕 세상", + "chinese-simplified": "你好 世界", + "chinese-traditional": "你好 世界", + "chinese-hongkong": "你好 世界", + cherokee: "ᎣᏏᏲ ᎡᎶᎯ", + "canadian-aboriginal": "ᐊᐃ ᓄᓇ", +}; + +export function hasSample(script: string): boolean { + return script in SAMPLES; +} + +// Latin first, then the sample for each other script that has one. Scripts +// without a sample add nothing, so the result is never empty. +export function sampleTextFor(scripts: string[]): string { + const parts = [LATIN_SAMPLE]; + for (const script of scripts) { + if (script !== "latin" && hasSample(script)) parts.push(SAMPLES[script]); + } + return parts.join(" "); +}