AI-native design editor. Open-source Figma alternative.
feat: move font settings from a Typography popover into Settings › Fonts (#1495)
Danila Poyarkovcbc5c55d4217
diff --git a/changes/1495/changed.md b/changes/1495/changed.mdnew file mode 100644index 000000000..0a2fd50de--- /dev/null+++ b/changes/1495/changed.md@@ -0,0 +1 @@+- Font settings, including system font access, online font providers, fallback packs, and the downloaded font cache, moved from a popover in the Typography section to **Settings › Fonts**; the gear in Typography opens it.diff --git a/packages/docs/de/user-guide/text-editing.md b/packages/docs/de/user-guide/text-editing.mdindex 76ff70b46..2abc69e4a 100644--- a/packages/docs/de/user-guide/text-editing.md+++ b/packages/docs/de/user-guide/text-editing.md@@ -45,6 +45,8 @@ Die Schriftauswahl unterstützt Suche, Vorschau, virtuelles Scrollen und das Ans- Chrome und Edge können Systemschriften im Browser verwenden.- Heruntergeladene Schriftschnitte werden lokal gespeichert.+Zugriff auf Systemschriften und Online-Anbieter verwaltest du unter **Einstellungen › Schriften**, die das Zahnrad neben der Schriftfamilie öffnet; in der Desktop-App verwaltet die Seite auch heruntergeladene Schriften und Fallback-Pakete.+## Fehlende SchriftenKann eine Familie oder ein Schnitt nicht geladen werden, zeigt OpenPencil eine Warnung mit den verwendeten Ersatzschriften. Betroffene Ebenen können ausgewählt und die Schriften erneut geladen werden.diff --git a/packages/docs/pl/user-guide/text-editing.md b/packages/docs/pl/user-guide/text-editing.mdindex eff31f866..61cb380e2 100644--- a/packages/docs/pl/user-guide/text-editing.md+++ b/packages/docs/pl/user-guide/text-editing.md@@ -79,6 +79,8 @@ Dostępne odmiany zależą od rodziny, na przykład Regular, Medium, Bold i Blac- **Przeglądarka:** czcionki systemowe są dostępne w Chrome i Edge; katalogi internetowe wymagają aplikacji komputerowej.- **Pobrane czcionki:** aplikacja zapisuje pobrane odmiany do ponownego użycia na tym komputerze.+Dostęp do czcionek systemowych i dostawców online ustawisz w **Ustawienia › Czcionki**, które otwiera koło zębate obok rodziny czcionek; w aplikacji desktopowej strona zarządza też pobranymi czcionkami i pakietami zastępczymi.+## Brakujące czcionki i zamiennikiJeśli odpowiednia rodzina lub odmiana nie może zostać załadowana, OpenPencil pokazuje ostrzeżenie nad edytorem i nie przedstawia zastępczego wyglądu jako wiernego projektowi.diff --git a/packages/docs/ru/user-guide/text-editing.md b/packages/docs/ru/user-guide/text-editing.mdindex 8f5d3d443..684e2cdc7 100644--- a/packages/docs/ru/user-guide/text-editing.md+++ b/packages/docs/ru/user-guide/text-editing.md@@ -81,6 +81,8 @@ OpenPencil позволяет создавать текстовые объект- **Браузер:** системные шрифты доступны в Chrome и Edge; сетевые каталоги требуют настольного приложения.- **Загруженные шрифты:** приложение сохраняет скачанные начертания для повторного использования на этом компьютере.+Доступ к системным шрифтам и онлайн-провайдеры настраиваются в разделе «Настройки › Шрифты», который открывается нажатием на шестерёнку рядом с семейством шрифтов; в настольном приложении там же управляются скачанные шрифты и резервные наборы.+## Отсутствующие шрифты и заменыЕсли нужное семейство или начертание загрузить не удалось, OpenPencil показывает предупреждение над редактором и не выдаёт отображение с заменой за точное воспроизведение типографики.diff --git a/packages/docs/user-guide/text-editing.md b/packages/docs/user-guide/text-editing.mdindex d6025560b..3114b2883 100644--- a/packages/docs/user-guide/text-editing.md+++ b/packages/docs/user-guide/text-editing.md@@ -84,6 +84,8 @@ Change the font weight in the Typography section of the properties panel. Availa- **Browser** — system fonts are available in Chrome and Edge with local-font permission. Enabled Fontsource, Bunny Fonts, and Fontshare providers can load online fonts, subject to network access and browser CORS rules; Google Fonts is disabled in the OpenPencil browser app- **Downloaded fonts** — the desktop app caches downloaded faces for reuse on the same machine+Allow system font access and choose online providers in **Settings › Fonts**, which the gear next to the font family opens; in the desktop app it also manages downloaded fonts and fallback packs.+## Missing Fonts and SubstitutionsWhen a requested family or style cannot be loaded, OpenPencil displays a warning above the editor instead of silently treating fallback rendering as faithful typography.diff --git a/packages/vue/src/i18n/locales/de/fonts.json b/packages/vue/src/i18n/locales/de/fonts.jsonindex 7743e76c7..ac89b5143 100644--- a/packages/vue/src/i18n/locales/de/fonts.json+++ b/packages/vue/src/i18n/locales/de/fonts.json@@ -5,6 +5,10 @@"localFonts": "Lokale Schriften","onlineFonts": "Online-Schriften","downloadedCache": "Download-Cache",+ "cachedFontCount": {+ "one": "{count} Schrift",+ "many": "{count} Schriften"+ },"systemFontAccess": "Zugriff auf Systemschriften","systemFontsAvailable": "Systemschriften sind verfügbar.","allowBrowserFontAccess": "Browser-Schriftzugriff erlauben, wenn Systemschriften fehlen.",diff --git a/packages/vue/src/i18n/locales/de/settings.json b/packages/vue/src/i18n/locales/de/settings.jsonindex 7b8bd6529..c53b8509a 100644--- a/packages/vue/src/i18n/locales/de/settings.json+++ b/packages/vue/src/i18n/locales/de/settings.json@@ -29,6 +29,7 @@"toolAccess": "Werkzeugzugriff","storage": "Speicher","cloud": "Cloud",+ "fonts": "Schriften","animations": "Animationen","animationsSystem": "Systemeinstellung","animationsOff": "Aus",diff --git a/packages/vue/src/i18n/locales/es/fonts.json b/packages/vue/src/i18n/locales/es/fonts.jsonindex f057b7d87..2485670c8 100644--- a/packages/vue/src/i18n/locales/es/fonts.json+++ b/packages/vue/src/i18n/locales/es/fonts.json@@ -5,6 +5,10 @@"localFonts": "Fuentes locales","onlineFonts": "Fuentes en línea","downloadedCache": "Caché descargada",+ "cachedFontCount": {+ "one": "{count} fuente",+ "many": "{count} fuentes"+ },"systemFontAccess": "Acceso a fuentes del sistema","systemFontsAvailable": "Las fuentes del sistema están disponibles.","allowBrowserFontAccess": "Permite el acceso a fuentes del navegador cuando falten fuentes del sistema.",diff --git a/packages/vue/src/i18n/locales/es/settings.json b/packages/vue/src/i18n/locales/es/settings.jsonindex f658f07fc..5b8a04be4 100644--- a/packages/vue/src/i18n/locales/es/settings.json+++ b/packages/vue/src/i18n/locales/es/settings.json@@ -29,6 +29,7 @@"toolAccess": "Acceso a herramientas","storage": "Almacenamiento","cloud": "Nube",+ "fonts": "Fuentes","animations": "Animaciones","animationsSystem": "Seguir al sistema","animationsOff": "Desactivadas",diff --git a/packages/vue/src/i18n/locales/fr/fonts.json b/packages/vue/src/i18n/locales/fr/fonts.jsonindex d3e513102..006b10f08 100644--- a/packages/vue/src/i18n/locales/fr/fonts.json+++ b/packages/vue/src/i18n/locales/fr/fonts.json@@ -5,6 +5,10 @@"localFonts": "Polices locales","onlineFonts": "Polices en ligne","downloadedCache": "Cache téléchargé",+ "cachedFontCount": {+ "one": "{count} police",+ "many": "{count} polices"+ },"systemFontAccess": "Accès aux polices système","systemFontsAvailable": "Les polices système sont disponibles.","allowBrowserFontAccess": "Autorisez l’accès du navigateur aux polices lorsque des polices système manquent.",diff --git a/packages/vue/src/i18n/locales/fr/settings.json b/packages/vue/src/i18n/locales/fr/settings.jsonindex d3b5ccfda..8d8460916 100644--- a/packages/vue/src/i18n/locales/fr/settings.json+++ b/packages/vue/src/i18n/locales/fr/settings.json@@ -29,6 +29,7 @@"toolAccess": "Accès aux outils","storage": "Stockage","cloud": "Cloud",+ "fonts": "Polices","animations": "Animations","animationsSystem": "Suivre le système","animationsOff": "Désactivées",diff --git a/packages/vue/src/i18n/locales/it/fonts.json b/packages/vue/src/i18n/locales/it/fonts.jsonindex f2e6ed073..d2126b38c 100644--- a/packages/vue/src/i18n/locales/it/fonts.json+++ b/packages/vue/src/i18n/locales/it/fonts.json@@ -5,6 +5,10 @@"localFonts": "Font locali","onlineFonts": "Font online","downloadedCache": "Cache scaricata",+ "cachedFontCount": {+ "one": "{count} font",+ "many": "{count} font"+ },"systemFontAccess": "Accesso ai font di sistema","systemFontsAvailable": "I font di sistema sono disponibili.","allowBrowserFontAccess": "Consenti l’accesso ai font del browser quando mancano font di sistema.",diff --git a/packages/vue/src/i18n/locales/it/settings.json b/packages/vue/src/i18n/locales/it/settings.jsonindex 7d7080680..eb12cd8b5 100644--- a/packages/vue/src/i18n/locales/it/settings.json+++ b/packages/vue/src/i18n/locales/it/settings.json@@ -29,6 +29,7 @@"toolAccess": "Accesso agli strumenti","storage": "Archiviazione","cloud": "Cloud",+ "fonts": "Font","animations": "Animazioni","animationsSystem": "Segui il sistema","animationsOff": "Disattivate",diff --git a/packages/vue/src/i18n/locales/ja/fonts.json b/packages/vue/src/i18n/locales/ja/fonts.jsonindex e20abcdf5..053751a20 100644--- a/packages/vue/src/i18n/locales/ja/fonts.json+++ b/packages/vue/src/i18n/locales/ja/fonts.json@@ -5,6 +5,9 @@"localFonts": "ローカルフォント","onlineFonts": "オンラインフォント","downloadedCache": "ダウンロード済みキャッシュ",+ "cachedFontCount": {+ "many": "{count} 個のフォント"+ },"systemFontAccess": "システムフォントアクセス","systemFontsAvailable": "システムフォントを利用できます。","allowBrowserFontAccess": "システムフォントが見つからない場合にブラウザーのフォントアクセスを許可します。",diff --git a/packages/vue/src/i18n/locales/ja/settings.json b/packages/vue/src/i18n/locales/ja/settings.jsonindex 3e6477ee7..5696ae89e 100644--- a/packages/vue/src/i18n/locales/ja/settings.json+++ b/packages/vue/src/i18n/locales/ja/settings.json@@ -29,6 +29,7 @@"toolAccess": "ツールへのアクセス","storage": "ストレージ","cloud": "クラウド",+ "fonts": "フォント","animations": "アニメーション","animationsSystem": "システム設定に従う","animationsOff": "オフ",diff --git a/packages/vue/src/i18n/locales/pl/fonts.json b/packages/vue/src/i18n/locales/pl/fonts.jsonindex a9161ba9c..f559d9670 100644--- a/packages/vue/src/i18n/locales/pl/fonts.json+++ b/packages/vue/src/i18n/locales/pl/fonts.json@@ -5,6 +5,11 @@"localFonts": "Czcionki lokalne","onlineFonts": "Czcionki online","downloadedCache": "Pobrana pamięć podręczna",+ "cachedFontCount": {+ "one": "{count} czcionka",+ "few": "{count} czcionki",+ "many": "{count} czcionek"+ },"systemFontAccess": "Dostęp do czcionek systemowych","systemFontsAvailable": "Czcionki systemowe są dostępne.","allowBrowserFontAccess": "Zezwól przeglądarce na dostęp do czcionek, gdy brakuje czcionek systemowych.",diff --git a/packages/vue/src/i18n/locales/pl/settings.json b/packages/vue/src/i18n/locales/pl/settings.jsonindex 3a319bbbb..80f50fb4c 100644--- a/packages/vue/src/i18n/locales/pl/settings.json+++ b/packages/vue/src/i18n/locales/pl/settings.json@@ -29,6 +29,7 @@"toolAccess": "Dostęp do narzędzi","storage": "Przechowywanie","cloud": "Chmura",+ "fonts": "Czcionki","animations": "Animacje","animationsSystem": "Zgodnie z systemem","animationsOff": "Wyłączone",diff --git a/packages/vue/src/i18n/locales/ru/fonts.json b/packages/vue/src/i18n/locales/ru/fonts.jsonindex 40225170f..a862e742c 100644--- a/packages/vue/src/i18n/locales/ru/fonts.json+++ b/packages/vue/src/i18n/locales/ru/fonts.json@@ -5,6 +5,11 @@"localFonts": "Локальные шрифты","onlineFonts": "Онлайн-шрифты","downloadedCache": "Кэш загрузок",+ "cachedFontCount": {+ "one": "{count} шрифт",+ "few": "{count} шрифта",+ "many": "{count} шрифтов"+ },"systemFontAccess": "Доступ к системным шрифтам","systemFontsAvailable": "Системные шрифты доступны.","allowBrowserFontAccess": "Разрешите доступ браузера к шрифтам, если системные шрифты отсутствуют.",diff --git a/packages/vue/src/i18n/locales/ru/settings.json b/packages/vue/src/i18n/locales/ru/settings.jsonindex 79c109efb..b8f4518ad 100644--- a/packages/vue/src/i18n/locales/ru/settings.json+++ b/packages/vue/src/i18n/locales/ru/settings.json@@ -29,6 +29,7 @@"toolAccess": "Доступ к инструментам","storage": "Хранилище","cloud": "Облако",+ "fonts": "Шрифты","animations": "Анимации","animationsSystem": "Как в системе","animationsOff": "Выключены",diff --git a/packages/vue/src/i18n/locales/zh-cn/fonts.json b/packages/vue/src/i18n/locales/zh-cn/fonts.jsonindex af5fa0010..f7d86880c 100644--- a/packages/vue/src/i18n/locales/zh-cn/fonts.json+++ b/packages/vue/src/i18n/locales/zh-cn/fonts.json@@ -5,6 +5,9 @@"localFonts": "本地字体","onlineFonts": "在线字体","downloadedCache": "下载缓存",+ "cachedFontCount": {+ "many": "{count} 个字体"+ },"systemFontAccess": "系统字体访问","systemFontsAvailable": "系统字体可用。","allowBrowserFontAccess": "缺少系统字体时,允许浏览器访问字体。",diff --git a/packages/vue/src/i18n/locales/zh-cn/settings.json b/packages/vue/src/i18n/locales/zh-cn/settings.jsonindex 9d5bed5d6..e63e32156 100644--- a/packages/vue/src/i18n/locales/zh-cn/settings.json+++ b/packages/vue/src/i18n/locales/zh-cn/settings.json@@ -29,6 +29,7 @@"toolAccess": "工具访问权限","storage": "存储","cloud": "云",+ "fonts": "字体","animations": "动画","animationsSystem": "跟随系统","animationsOff": "关闭",diff --git a/packages/vue/src/i18n/messages/fonts.ts b/packages/vue/src/i18n/messages/fonts.tsindex 654a47aa3..10cf20f7b 100644--- a/packages/vue/src/i18n/messages/fonts.ts+++ b/packages/vue/src/i18n/messages/fonts.ts@@ -1,4 +1,4 @@-import { params } from '@nanostores/i18n'+import { count, params } from '@nanostores/i18n'import { i18n } from '#vue/i18n/create'@@ -23,6 +23,7 @@ export const fontsMessageDefaults = {localFonts: 'Local fonts',onlineFonts: 'Online fonts',downloadedCache: 'Downloaded cache',+ cachedFontCount: count({ one: '{count} font', many: '{count} fonts' }),systemFontAccess: 'System font access',systemFontsAvailable: 'System fonts are available.',allowBrowserFontAccess: 'Allow browser font access when system fonts are missing.',diff --git a/packages/vue/src/i18n/messages/settings.ts b/packages/vue/src/i18n/messages/settings.tsindex ce7c1a108..412f7da5d 100644--- a/packages/vue/src/i18n/messages/settings.ts+++ b/packages/vue/src/i18n/messages/settings.ts@@ -53,6 +53,7 @@ export const settingsMessageDefaults = {usage: 'Usage',diagnostics: 'Diagnostics',privacy: 'Privacy',+ fonts: 'Fonts',media: 'Media',mcp: 'MCP',toolAccess: 'Tool access',diff --git a/src/app/settings/dialog.ts b/src/app/settings/dialog.tsindex 77459910d..717203cb9 100644--- a/src/app/settings/dialog.ts+++ b/src/app/settings/dialog.ts@@ -9,6 +9,7 @@ export type SettingsSection =| 'privacy'| 'mcp'| 'tools'+ | 'fonts'| 'media'| 'storage'| 'cloud'diff --git a/src/components/font-settings/use.ts b/src/app/settings/fonts/use.tssimilarity index 100%rename from src/components/font-settings/use.tsrename to src/app/settings/fonts/use.tsdiff --git a/src/components/font-settings/FontSettingsPopover.vue b/src/components/font-settings/FontSettingsPopover.vuedeleted file mode 100644index ec416f31a..000000000--- a/src/components/font-settings/FontSettingsPopover.vue+++ /dev/null@@ -1,262 +0,0 @@-<script setup lang="ts">-import { PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger } from 'reka-ui'-import { onMounted } from 'vue'--import { WEB_FONT_PROVIDER_IDS, WEB_FONT_PROVIDER_LABELS } from '@open-pencil/core/text'-import type { WebFontProviderId } from '@open-pencil/core/text'-import { useI18n } from '@open-pencil/vue/i18n'-import { useRetainedPopup } from '@open-pencil/vue/lifecycle/retention'-import { vTestId } from '@open-pencil/vue/testing'--import { isTauri } from '@/app/tauri/env'-import AppButton from '@/components/ui/button/AppButton.vue'-import { usePopoverUI } from '@/components/ui/overlay/popover'-import Tip from '@/components/ui/overlay/Tip.vue'--import { useFontSettings } from './use'--const { fonts, common } = useI18n()-const cls = usePopoverUI({ content: 'isolate z-[51] w-80 p-3' })-const trigger = 'shrink-0'-const secondaryButton = {- color: 'neutral' as const,- variant: 'soft' as const,- size: 'xs' as const-}-const primaryButton = {- color: 'primary' as const,- variant: 'solid' as const,- size: 'xs' as const-}-const showDownloadedFonts = isTauri()-const webFontProviderIds = WEB_FONT_PROVIDER_IDS-const { open: popoverOpen, portalActive } = useRetainedPopup()--const {- accessState,- accessStateLabel,- busyAction,- cacheCount,- cacheSize,- cacheUpdatedLabel,- canRequestLocalFonts,- status,- onlineFontsEnabled,- fontProviderSettings,- clearCache,- downloadFallbacks,- refreshSummary,- requestAccess,- setFontProviderEnabled,- setOnlineFontsEnabled-} = useFontSettings()--function setPopoverOpen(value: boolean) {- popoverOpen.value = value- if (value) void refreshSummary()-}--function isProviderEnabled(provider: WebFontProviderId) {- return fontProviderSettings.value[provider]-}--function onProviderToggle(provider: WebFontProviderId, event: Event) {- const input = event.target- if (!(input instanceof HTMLInputElement)) return- setFontProviderEnabled(provider, input.checked)-}--onMounted(() => {- void refreshSummary()-})-</script>--<template>- <PopoverRoot v-model:open="popoverOpen" @update:open="setPopoverOpen">- <Tip :label="fonts.settingsTitle" :disabled="popoverOpen">- <PopoverTrigger- data-test-id="font-settings-trigger"- :aria-label="fonts.settingsTitle"- :class="trigger"- >- <icon-lucide-settings class="size-3.5" />- </PopoverTrigger>- </Tip>-- <PopoverPortal v-if="portalActive">- <PopoverContent- data-test-id="font-settings-panel"- side="left"- :side-offset="8"- align="start"- :collision-padding="16"- :avoid-collisions="true"- :class="cls.content"- >- <div class="flex flex-col gap-3">- <div class="flex items-start gap-2">- <div- class="flex size-8 shrink-0 items-center justify-center rounded bg-input text-muted"- >- <icon-lucide-type class="size-4" />- </div>- <div>- <h3 class="text-[11px] font-semibold text-surface">{{ fonts.settingsTitle }}</h3>- <p class="mt-0.5 text-[10px] leading-relaxed text-muted">- {{- showDownloadedFonts- ? fonts.settingsDesktopDescription- : fonts.settingsBrowserDescription- }}- </p>- </div>- </div>-- <div class="grid gap-1.5 rounded border border-border bg-input/40 p-2 text-[10px]">- <div class="flex justify-between gap-3 text-muted">- <span>{{ fonts.localFonts }}</span>- <span class="text-surface">{{ accessStateLabel }}</span>- </div>- <div class="flex justify-between gap-3 text-muted">- <span>{{ fonts.onlineFonts }}</span>- <span class="text-surface">{{- onlineFontsEnabled ? common.enabled : common.disabled- }}</span>- </div>- <div v-if="showDownloadedFonts" class="flex justify-between gap-3 text-muted">- <span>{{ fonts.downloadedCache }}</span>- <span class="text-surface">{{ cacheCount }} fonts · {{ cacheSize }}</span>- </div>- <div v-if="showDownloadedFonts" class="flex justify-between gap-3 text-muted">- <span>{{ common.lastUpdated }}</span>- <span class="text-surface">{{ cacheUpdatedLabel }}</span>- </div>- </div>-- <div class="space-y-1.5">- <div class="grid grid-cols-[1fr_auto] gap-2 rounded border border-border p-2">- <div>- <p class="text-[10px] font-medium text-surface">{{ fonts.systemFontAccess }}</p>- <p class="mt-0.5 text-[10px] leading-relaxed text-muted">- {{- accessState === 'granted'- ? fonts.systemFontsAvailable- : fonts.allowBrowserFontAccess- }}- </p>- </div>- <AppButton- type="button"- data-test-id="font-settings-request-access"- :color="secondaryButton.color"- :variant="secondaryButton.variant"- :size="secondaryButton.size"- :disabled="busyAction !== null || !canRequestLocalFonts"- @click="requestAccess"- >- {{ busyAction === 'access' ? common.requesting : common.allow }}- </AppButton>- </div>-- <div class="grid gap-2 rounded border border-border p-2">- <div class="grid grid-cols-[1fr_auto] gap-2">- <div>- <p class="text-[10px] font-medium text-surface">- {{ fonts.onlineFontProviders }}- </p>- <p class="mt-0.5 text-[10px] leading-relaxed text-muted">- {{ fonts.downloadMissingWebFonts }}- </p>- </div>- <AppButton- type="button"- data-test-id="font-settings-toggle-online-fonts"- :color="secondaryButton.color"- :variant="secondaryButton.variant"- :size="secondaryButton.size"- :disabled="busyAction !== null"- @click="setOnlineFontsEnabled(!onlineFontsEnabled)"- >- {{ onlineFontsEnabled ? common.disable : common.enable }}- </AppButton>- </div>-- <div class="grid gap-1 border-t border-border pt-2">- <label- v-for="provider in webFontProviderIds"- :key="provider"- class="flex items-center justify-between gap-2 text-[10px] text-muted"- >- <span>{{ WEB_FONT_PROVIDER_LABELS[provider] }}</span>- <input- type="checkbox"- class="size-3 accent-accent disabled:opacity-50"- :checked="isProviderEnabled(provider)"- :disabled="busyAction !== null || !onlineFontsEnabled"- v-test-id="`font-settings-provider-${provider}`"- @change="onProviderToggle(provider, $event)"- />- </label>- </div>- </div>-- <div- v-if="showDownloadedFonts"- class="grid grid-cols-[1fr_auto] gap-2 rounded border border-border p-2"- >- <div>- <p class="text-[10px] font-medium text-surface">{{ fonts.fallbackPacks }}</p>- <p class="mt-0.5 text-[10px] leading-relaxed text-muted">- {{ fonts.downloadFallbackPacksDescription }}- </p>- </div>- <AppButton- type="button"- data-test-id="font-settings-download-fallbacks"- :color="primaryButton.color"- :variant="primaryButton.variant"- :size="primaryButton.size"- :disabled="busyAction !== null"- @click="downloadFallbacks"- >- {{ busyAction === 'download' ? common.downloading : common.download }}- </AppButton>- </div>- </div>-- <div v-if="showDownloadedFonts" class="grid grid-cols-2 gap-1.5">- <AppButton- type="button"- data-test-id="font-settings-refresh-cache"- :color="secondaryButton.color"- :variant="secondaryButton.variant"- :size="secondaryButton.size"- :disabled="busyAction !== null"- @click="refreshSummary"- >- {{ common.refresh }}- </AppButton>- <AppButton- type="button"- data-test-id="font-settings-clear-cache"- :color="secondaryButton.color"- :variant="secondaryButton.variant"- :size="secondaryButton.size"- :disabled="busyAction !== null || cacheCount === 0"- @click="clearCache"- >- {{ fonts.clearCache }}- </AppButton>- </div>-- <p- v-if="status"- class="rounded bg-input px-2 py-1.5 text-[10px] leading-relaxed text-muted"- >- {{ status }}- </p>- </div>- </PopoverContent>- </PopoverPortal>- </PopoverRoot>-</template>diff --git a/src/components/properties/TypographySection.vue b/src/components/properties/TypographySection.vueindex 2234798b9..9f1c3588a 100644--- a/src/components/properties/TypographySection.vue+++ b/src/components/properties/TypographySection.vue@@ -6,9 +6,9 @@ import { useI18n } from '@open-pencil/vue/i18n'import { TypographyControlsRoot } from '@open-pencil/vue/primitives/TypographyControls'import { loadFont } from '@/app/editor/fonts'+import { openSettingsDialog } from '@/app/settings/dialog'import { appMenuShortcutLabel } from '@/app/shell/menu/shortcut'import FontPicker from '@/components/font-picker/FontPicker.vue'-import FontSettingsPopover from '@/components/font-settings/FontSettingsPopover.vue'import NumberField from '@/components/inputs/NumberField.vue'import SharedStyleField from '@/components/properties/shared-style/SharedStyleField.vue'import LineHeightField from '@/components/properties/typography/LineHeightField.vue'@@ -22,7 +22,7 @@ import AppSelect from '@/components/ui/select/AppSelect.vue'import SegmentedControl from '@/components/ui/select/SegmentedControl.vue'import AppSwitch from '@/components/ui/toggle/AppSwitch.vue'-const { panels, menu } = useI18n()+const { panels, menu, fonts } = useI18n()const fontLoader = { load: loadFont }const alignmentOptions = computed(() => [{ value: 'LEFT', label: panels.value.alignLeft },@@ -87,7 +87,15 @@ function picked<T>(value: MixedValue<T>): T | '' {:placeholder="panels.mixed"@select="ctx.actions.setFamily"/>- <FontSettingsPopover />+ <!-- Where fonts come from is an app preference; it lives in Settings. -->+ <IconButton+ :label="fonts.settingsTitle"+ size="xs"+ data-test-id="font-settings-trigger"+ @click="openSettingsDialog('fonts')"+ >+ <icon-lucide-settings class="size-3.5" />+ </IconButton><Tipv-if="ctx.hasMissingFonts.value":label="diff --git a/src/components/settings/SettingsDialog.vue b/src/components/settings/SettingsDialog.vueindex a1c6d1821..54d37ca8e 100644--- a/src/components/settings/SettingsDialog.vue+++ b/src/components/settings/SettingsDialog.vue@@ -17,6 +17,7 @@ import { provideSettingsNavigation } from '@/app/settings/navigation/use'import { CloudSettingsSection } from '@/components/cloud/integration'import ChatSettingsSection from '@/components/settings/chat/ChatSettingsSection.vue'import DiagnosticsSettingsPanel from '@/components/settings/diagnostics/DiagnosticsSettingsPanel.vue'+import FontSettingsPanel from '@/components/settings/fonts/FontSettingsPanel.vue'import GeneralSettingsPanel from '@/components/settings/general/GeneralSettingsPanel.vue'import SettingsBreadcrumb from '@/components/settings/layout/SettingsBreadcrumb.vue'import SettingsPage from '@/components/settings/layout/SettingsPage.vue'@@ -57,6 +58,7 @@ const sections = computed({ value: 'privacy', label: settings.value.privacy },{ value: 'mcp', label: settings.value.mcp },{ value: 'tools', label: settings.value.toolAccess },+ { value: 'fonts', label: settings.value.fonts },{ value: 'media', label: settings.value.media },{ value: 'storage', label: settings.value.storage },...(CLOUD_INCLUDED ? [{ value: 'cloud' as const, label: settings.value.cloud }] : [])@@ -154,6 +156,10 @@ function onOpenChange(open: boolean): void {<template #leading><icon-lucide-sliders-horizontal class="size-3.5" /></template>{{ settings.toolAccess }}</AppTabsTrigger>+ <AppTabsTrigger value="fonts" data-test-id="settings-section-fonts">+ <template #leading><icon-lucide-type class="size-3.5" /></template>+ {{ settings.fonts }}+ </AppTabsTrigger><AppTabsTrigger value="media" data-test-id="settings-section-media"><template #leading><icon-lucide-image class="size-3.5" /></template>{{ settings.media }}@@ -196,6 +202,9 @@ function onOpenChange(open: boolean): void {<AppTabsContent value="tools" as-child><ToolAccessSettingsPanel /></AppTabsContent>+ <AppTabsContent value="fonts" as-child>+ <FontSettingsPanel />+ </AppTabsContent><AppTabsContent value="media" as-child><MediaSettingsPanel /></AppTabsContent>diff --git a/src/components/settings/fonts/FontSettingsPanel.vue b/src/components/settings/fonts/FontSettingsPanel.vuenew file mode 100644index 000000000..99397e507--- /dev/null+++ b/src/components/settings/fonts/FontSettingsPanel.vue@@ -0,0 +1,158 @@+<script setup lang="ts">+import { computed, onMounted } from 'vue'++import { WEB_FONT_PROVIDER_IDS, WEB_FONT_PROVIDER_LABELS } from '@open-pencil/core/text'+import type { WebFontProviderId } from '@open-pencil/core/text'+import { useI18n } from '@open-pencil/vue/i18n'++import { useFontSettings } from '@/app/settings/fonts/use'+import { isTauri } from '@/app/tauri/env'+import SettingsGroup from '@/components/settings/layout/SettingsGroup.vue'+import SettingsPage from '@/components/settings/layout/SettingsPage.vue'+import SettingsRow from '@/components/settings/layout/SettingsRow.vue'+import SettingsSection from '@/components/settings/layout/SettingsSection.vue'+import AppButton from '@/components/ui/button/AppButton.vue'+import AppSwitch from '@/components/ui/toggle/AppSwitch.vue'++/**+ * Where text gets its fonts: the system's, online providers', and on desktop the downloaded+ * cache and fallback packs.+ */+const { fonts, common } = useI18n()+/** Only the desktop app downloads fonts to disk; the browser leaves caching to itself. */+const desktop = isTauri()+const {+ accessState,+ accessStateLabel,+ busyAction,+ cacheCount,+ cacheSize,+ cacheUpdatedLabel,+ canRequestLocalFonts,+ status,+ onlineFontsEnabled,+ fontProviderSettings,+ clearCache,+ downloadFallbacks,+ refreshSummary,+ requestAccess,+ setFontProviderEnabled,+ setOnlineFontsEnabled+} = useFontSettings()++const online = computed(() => onlineFontsEnabled.value)+const providerEnabled = (provider: WebFontProviderId) => fontProviderSettings.value[provider]++onMounted(() => {+ void refreshSummary()+})+</script>++<template>+ <SettingsPage data-test-id="font-settings-panel">+ <div class="flex flex-col gap-6">+ <SettingsSection>+ <template #title>{{ fonts.settingsTitle }}</template>+ <template #description>{{+ desktop ? fonts.settingsDesktopDescription : fonts.settingsBrowserDescription+ }}</template>+ <SettingsGroup>+ <SettingsRow+ :label="fonts.systemFontAccess"+ :description="+ accessState === 'granted' ? fonts.systemFontsAvailable : fonts.allowBrowserFontAccess+ "+ >+ <AppButton+ v-if="canRequestLocalFonts"+ variant="outline"+ data-test-id="font-settings-request-access"+ :loading="busyAction === 'access'"+ :disabled="busyAction !== null"+ @click="requestAccess"+ >+ {{ common.allow }}+ </AppButton>+ <span v-else class="text-xs text-surface">{{ accessStateLabel }}</span>+ </SettingsRow>+ </SettingsGroup>+ </SettingsSection>++ <SettingsSection>+ <template #title>{{ fonts.onlineFontProviders }}</template>+ <template #description>{{ fonts.downloadMissingWebFonts }}</template>+ <SettingsGroup>+ <SettingsRow as="label" :label="fonts.onlineFonts">+ <AppSwitch+ :model-value="online"+ :label="fonts.onlineFonts"+ :disabled="busyAction !== null"+ @update:model-value="setOnlineFontsEnabled"+ />+ </SettingsRow>+ <SettingsRow+ v-for="provider in WEB_FONT_PROVIDER_IDS"+ :key="provider"+ as="label"+ :label="WEB_FONT_PROVIDER_LABELS[provider]"+ >+ <AppSwitch+ :model-value="providerEnabled(provider)"+ :label="WEB_FONT_PROVIDER_LABELS[provider]"+ :disabled="busyAction !== null || !online"+ @update:model-value="setFontProviderEnabled(provider, $event)"+ />+ </SettingsRow>+ </SettingsGroup>+ </SettingsSection>++ <SettingsSection v-if="desktop">+ <template #title>{{ fonts.downloadedCache }}</template>+ <SettingsGroup>+ <SettingsRow+ :label="`${fonts.cachedFontCount(cacheCount)} · ${cacheSize}`"+ :description="`${common.lastUpdated}: ${cacheUpdatedLabel}`"+ >+ <span class="flex gap-2">+ <AppButton+ variant="outline"+ data-test-id="font-settings-refresh-cache"+ :disabled="busyAction !== null"+ @click="refreshSummary"+ >+ {{ common.refresh }}+ </AppButton>+ <AppButton+ variant="outline"+ data-test-id="font-settings-clear-cache"+ :loading="busyAction === 'clear'"+ :disabled="busyAction !== null || cacheCount === 0"+ @click="clearCache"+ >+ {{ fonts.clearCache }}+ </AppButton>+ </span>+ </SettingsRow>+ <SettingsRow+ :label="fonts.fallbackPacks"+ :description="fonts.downloadFallbackPacksDescription"+ >+ <AppButton+ variant="outline"+ data-test-id="font-settings-download-fallbacks"+ :loading="busyAction === 'download'"+ :disabled="busyAction !== null"+ @click="downloadFallbacks"+ >+ {{ common.download }}+ </AppButton>+ </SettingsRow>+ </SettingsGroup>+ </SettingsSection>++ <p v-if="status" role="status" class="text-[11px] leading-relaxed text-muted">+ {{ status }}+ </p>+ </div>+ </SettingsPage>+</template>diff --git a/tests/e2e/fonts/settings.spec.ts b/tests/e2e/fonts/settings.spec.tsindex cc9eb655b..dd8a2b9bf 100644--- a/tests/e2e/fonts/settings.spec.ts+++ b/tests/e2e/fonts/settings.spec.ts@@ -2,7 +2,7 @@ import { expect, test } from '@playwright/test'import { CanvasHelper } from '#tests/helpers/canvas'-test('font settings popover exposes web font access without desktop-only cache actions', async ({+test('the font settings gear opens Settings › Fonts without desktop-only cache actions', async ({page}) => {await page.goto('/')@@ -45,24 +45,29 @@ test('font settings popover exposes web font access without desktop-only cache aawait fontSettings.click()await expect(page.locator('[role=tooltip]').filter({ hasText: 'Font settings' })).toHaveCount(0)- await expect(page.getByText('Allow browser access to local fonts')).toBeVisible()+ const panel = page.getByTestId('font-settings-panel')+ await expect(panel).toBeVisible()+ await expect(page.getByTestId('settings-section-fonts')).toHaveAttribute('aria-selected', 'true')+ await expect(panel.getByText('Allow browser access to local fonts')).toBeVisible()await expect(page.getByTestId('font-settings-request-access')).toBeVisible()- await expect(page.getByTestId('font-settings-toggle-online-fonts')).toHaveText('Disable')- await expect(page.getByTestId('font-settings-provider-google')).toBeChecked()- await expect(page.getByTestId('font-settings-provider-fontsource')).toBeChecked()- await expect(page.getByTestId('font-settings-provider-bunny')).not.toBeChecked()- await expect(page.getByTestId('font-settings-provider-fontshare')).not.toBeChecked()- await page.getByTestId('font-settings-toggle-online-fonts').click()- await expect(page.getByTestId('font-settings-toggle-online-fonts')).toHaveText('Enable')- await expect(page.getByTestId('font-settings-provider-google')).toBeDisabled()- await page.getByTestId('font-settings-toggle-online-fonts').click()- await expect(page.getByTestId('font-settings-toggle-online-fonts')).toHaveText('Disable')+ const online = panel.getByRole('switch', { name: 'Online fonts', exact: true })+ const provider = (name: string) => panel.getByRole('switch', { name, exact: true })+ await expect(online).toBeChecked()+ await expect(provider('Google Fonts')).toBeChecked()+ await expect(provider('Fontsource')).toBeChecked()+ await expect(provider('Bunny Fonts')).not.toBeChecked()+ await expect(provider('Fontshare')).not.toBeChecked()+ await online.click()+ await expect(online).not.toBeChecked()+ await expect(provider('Google Fonts')).toBeDisabled()+ await online.click()+ await expect(online).toBeChecked()await expect(page.getByTestId('font-settings-download-fallbacks')).toHaveCount(0)await expect(page.getByTestId('font-settings-refresh-cache')).toHaveCount(0)await expect(page.getByTestId('font-settings-clear-cache')).toHaveCount(0)await expect(page.getByText('Download CJK and Arabic fallbacks')).toHaveCount(0)await page.keyboard.press('Escape')- await expect(page.getByTestId('font-settings-panel')).toBeHidden()+ await expect(panel).toBeHidden()await expect(typography).toBeVisible()})diff --git a/tests/engine/app/settings/font.test.ts b/tests/engine/app/settings/font.test.tsindex 0313a557b..9c7282b31 100644--- a/tests/engine/app/settings/font.test.ts+++ b/tests/engine/app/settings/font.test.ts@@ -2,7 +2,7 @@ import { describe, expect, test } from 'bun:test'import { DEFAULT_WEB_FONT_PROVIDER_SETTINGS } from '@open-pencil/core/text'-import { useFontSettings, type FontSettingsActions } from '@/components/font-settings/use'+import { useFontSettings, type FontSettingsActions } from '@/app/settings/fonts/use'function actions(overrides: Partial<FontSettingsActions> = {}): FontSettingsActions {let accessState: ReturnType<FontSettingsActions['localFontAccessState']> = 'prompt'