Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

feat(ui)!: classify built-in fonts with FontCategory (#7946)

白熱0097d983fa67
diff --git a/packages/ui/src/facade/__tests__/f-univer.spec.ts b/packages/ui/src/facade/__tests__/f-univer.spec.ts
index 77327c0efa..598a518314 100644
--- a/packages/ui/src/facade/__tests__/f-univer.spec.ts
+++ b/packages/ui/src/facade/__tests__/f-univer.spec.ts
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-import type { IMenuSchema } from '@univerjs/ui';
import {
CommandType,
ICommandService,
@@ -28,38 +27,29 @@ import {
import { FUniver } from '@univerjs/core/facade';
import { MessageType } from '@univerjs/design';
import { IRenderManagerService, RenderManagerService } from '@univerjs/engine-render';
-import {
- BuiltInUIPart,
- ComponentManager,
- CopyCommand,
- DesktopDialogService,
- DesktopMessageService,
- DesktopRibbonService,
- DesktopSidebarService,
- FontService,
- IDialogService,
- IFontService,
- IMenuManagerService,
- IMessageService,
- IPlatformService,
- IRibbonService,
- IShortcutService,
- ISidebarService,
- IUIPartsService,
- IUIRuntimeScopeService,
- KeyCode,
- MenuManagerService,
- PasteCommand,
- PlatformService,
- RibbonStartGroup,
- ShortcutService,
- UI_PLUGIN_CONFIG_KEY,
- UIPartsService,
- UIRuntimeScopeService,
-} from '@univerjs/ui';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
+import type { IMenuSchema } from '../../services/menu/menu-manager.service';
+import { ComponentManager } from '../../common/component-manager';
+import { UI_PLUGIN_CONFIG_KEY } from '../../config/config';
+import { CopyCommand, PasteCommand } from '../../services/clipboard/clipboard.command';
+import { DesktopDialogService } from '../../services/dialog/desktop-dialog.service';
+import { IDialogService } from '../../services/dialog/dialog.service';
+import { FontCategory, FontService, IFontService } from '../../services/font.service';
+import { IMenuManagerService, MenuManagerService } from '../../services/menu/menu-manager.service';
+import { RibbonStartGroup } from '../../services/menu/types';
+import { DesktopMessageService } from '../../services/message/desktop-message.service';
+import { IMessageService } from '../../services/message/message.service';
+import { BuiltInUIPart, IUIPartsService, UIPartsService } from '../../services/parts/parts.service';
+import { IPlatformService, PlatformService } from '../../services/platform/platform.service';
+import { DesktopRibbonService, IRibbonService } from '../../services/ribbon/ribbon.service';
+import { IUIRuntimeScopeService, UIRuntimeScopeService } from '../../services/runtime-scope/ui-runtime-scope.service';
+import { KeyCode } from '../../services/shortcut/keycode';
+import { IShortcutService, ShortcutService } from '../../services/shortcut/shortcut.service';
+import { DesktopSidebarService } from '../../services/sidebar/desktop-sidebar.service';
+import { ISidebarService } from '../../services/sidebar/sidebar.service';
import { FShortcut } from '../f-shortcut';
-import '@univerjs/ui/facade';
+import '../f-enum';
+import '../f-univer';
class FakeShortcutService {
static dispatched: KeyboardEvent[] = [];
@@ -293,12 +283,12 @@ describe('ui facade', () => {
const component = () => null;
const disposable = univerAPI.registerComponent('custom-component', component);
- univerAPI.addFonts([{ value: 'CustomSans', label: 'Custom Sans', category: 'sans-serif' }]);
+ univerAPI.addFonts([{ value: 'CustomSans', label: 'Custom Sans', category: FontCategory.SANS_SERIF }]);
expect(univerAPI.getURL().href).toBe(window.location.href);
expect(univerAPI.getComponentManager()).toBe(componentManager);
expect(componentManager.get('custom-component')).toBe(component);
- expect(fontService.getFontByValue('CustomSans')).toMatchObject({ label: 'Custom Sans' });
+ expect(fontService.getFontByValue('CustomSans')).toMatchObject({ label: 'Custom Sans', category: FontCategory.SANS_SERIF });
disposable.dispose();
expect(componentManager.get('custom-component')).toBeUndefined();
diff --git a/packages/ui/src/facade/f-univer.ts b/packages/ui/src/facade/f-univer.ts
index d0de96644f..538f194a8d 100644
--- a/packages/ui/src/facade/f-univer.ts
+++ b/packages/ui/src/facade/f-univer.ts
@@ -26,7 +26,6 @@ import type {
MenuConfig,
RibbonType,
} from '@univerjs/ui';
-import type { IFacadeMenuItem, IFacadeSubmenuItem } from './f-menu-builder';
import { IConfigService } from '@univerjs/core';
import { FUniver } from '@univerjs/core/facade';
import { IRenderManagerService } from '@univerjs/engine-render';
@@ -43,6 +42,7 @@ import {
PasteCommand,
UI_PLUGIN_CONFIG_KEY,
} from '@univerjs/ui';
+import type { IFacadeMenuItem, IFacadeSubmenuItem } from './f-menu-builder';
import { FMenu, FSubmenu } from './f-menu-builder';
import { FShortcut } from './f-shortcut';
@@ -480,16 +480,18 @@ export interface IFUniverUIMixin {
* @param fonts The array of font configurations to add.
* @example
* ```ts
+ * import { FontCategory } from '@univerjs/ui';
+ *
* univerAPI.addFonts([
* {
* value: 'CustomFont1',
* label: 'Custom Font 1',
- * category: 'sans-serif',
+ * category: FontCategory.SANS_SERIF,
* },
* {
* value: 'CustomFont2',
* label: 'Custom Font 2',
- * category: 'serif',
+ * category: FontCategory.SERIF,
* },
* ]);
* ```
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index 309fe6cc65..91e7803cf0 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -75,7 +75,7 @@ export type {
IFloatDom,
IFloatDomLayout,
} from './services/dom/canvas-dom-layer.service';
-export { FontService, IFontService } from './services/font.service';
+export { FontCategory, FontService, IFontService } from './services/font.service';
export type { IFontConfig } from './services/font.service';
export { bindFormatPainterCanvas } from './services/format-painter/format-painter-canvas';
export { FormatPainterSessionService } from './services/format-painter/format-painter-session.service';
diff --git a/packages/ui/src/services/__tests__/font.service.spec.ts b/packages/ui/src/services/__tests__/font.service.spec.ts
index cd341d3b88..b80c4304d9 100644
--- a/packages/ui/src/services/__tests__/font.service.spec.ts
+++ b/packages/ui/src/services/__tests__/font.service.spec.ts
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-import type { IUniverUIConfig } from '../../config/config';
import { ConfigService, IConfigService, Injector } from '@univerjs/core';
import { afterEach, describe, expect, it, vi } from 'vitest';
+import type { IUniverUIConfig } from '../../config/config';
import { UI_PLUGIN_CONFIG_KEY } from '../../config/config';
-import { FontService, IFontService } from '../font.service';
+import { FontCategory, FontService, IFontService } from '../font.service';
class CustomFontConfigService extends ConfigService {
override getConfig<T>(key: string): T {
@@ -26,7 +26,7 @@ class CustomFontConfigService extends ConfigService {
return {
customFontFamily: {
override: true,
- list: [{ value: 'OnlyCustom', label: 'Only Custom', category: 'display' }],
+ list: [{ value: 'OnlyCustom', label: 'Only Custom', category: FontCategory.DISPLAY }],
},
} as IUniverUIConfig as T;
}
@@ -35,8 +35,11 @@ class CustomFontConfigService extends ConfigService {
}
}
-function createService(configService: new (...args: any[]) => IConfigService = ConfigService): IFontService {
+const injectors: Injector[] = [];
+
+function createService(configService: typeof ConfigService = ConfigService): IFontService {
const injector = new Injector();
+ injectors.push(injector);
injector.add([IConfigService, { useClass: configService }]);
injector.add([IFontService, { useClass: FontService }]);
return injector.get(IFontService);
@@ -44,13 +47,14 @@ function createService(configService: new (...args: any[]) => IConfigService = C
describe('FontService', () => {
afterEach(() => {
+ injectors.splice(0).forEach((injector) => injector.dispose());
vi.unstubAllGlobals();
});
it('maintains the font catalog used by font family pickers', () => {
const service = createService();
- service.addFont({ value: 'Inter', label: 'Inter', category: 'sans-serif' });
+ service.addFont({ value: 'Inter', label: 'Inter', category: FontCategory.SANS_SERIF });
service.updateFont('Inter', { label: 'Inter UI' });
expect(service.getFontByValue('Inter')).toMatchObject({ label: 'Inter UI' });
@@ -58,25 +62,42 @@ describe('FontService', () => {
expect(service.getFontByValue('Inter')).toBeUndefined();
});
- it('uses the filtered reference catalog as the default font list', () => {
- const values = createService().getFonts().map((font) => font.value);
+ it('exposes monospaced catalog fonts and custom fonts through the same category', () => {
+ const service = createService();
+ service.addFont({ value: 'Custom Mono', label: 'Custom Mono', category: FontCategory.MONOSPACE });
+ const fonts = service.getFonts().filter((font) => font.category === FontCategory.MONOSPACE);
- expect(values).toHaveLength(197);
- expect(values.slice(0, 8)).toEqual([
- '宋体',
- 'Arial',
- 'Baskerville',
- 'Comic Sans MS',
+ expect(fonts.map((font) => font.value)).toEqual([
'Courier New',
- 'Helvetica',
- 'Times New Roman',
- 'Verdana',
+ 'Courier',
+ 'BIZ UDGothic',
+ 'BIZ UDMincho',
+ 'Andale Mono',
+ 'Menlo',
+ 'Monaco',
+ 'PCMyungjo',
+ 'PT Mono',
+ 'Custom Mono',
]);
- expect(values).toContain('Zapfino');
- expect(values).not.toContain('Microsoft YaHei');
- expect(values).not.toContain('正文字体');
- expect(values.some((value) => value.startsWith('MiSans'))).toBe(false);
- expect(values.some((value) => value.toUpperCase().includes('WPS'))).toBe(false);
+ expect(service.getFontByValue('Arial')?.category).not.toBe(FontCategory.MONOSPACE);
+ service.resetToDefaults();
+ expect(service.getFontByValue('Custom Mono')).toBeUndefined();
+ expect(service.getFontByValue('Menlo')?.category).toBe(FontCategory.MONOSPACE);
+ });
+
+ it('classifies every built-in font so consumers can filter the shared catalog', () => {
+ const service = createService();
+ expect(service.getFonts().every((font) => font.category != null)).toBe(true);
+ expect(service.getFontByValue('宋体')?.category).toBe(FontCategory.SERIF);
+ expect(service.getFontByValue('Arial')?.category).toBe(FontCategory.SANS_SERIF);
+ expect(service.getFontByValue('楷体-简')?.category).toBe(FontCategory.HANDWRITING);
+ expect(service.getFontByValue('Bauhaus 93')?.category).toBe(FontCategory.DISPLAY);
+ expect(service.getFontByValue('Courier New')?.category).toBe(FontCategory.MONOSPACE);
+
+ service.updateFont('Arial', { category: FontCategory.DISPLAY });
+ expect(service.fonts$.getValue().filter((font) => font.category === FontCategory.DISPLAY).map((font) => font.value)).toContain('Arial');
+ service.resetToDefaults();
+ expect(service.getFontByValue('Arial')?.category).toBe(FontCategory.SANS_SERIF);
});
it('rejects duplicate font values to keep font selection stable', () => {
@@ -89,7 +110,7 @@ describe('FontService', () => {
it('loads override font configuration and rejects updates to missing fonts', () => {
const service = createService(CustomFontConfigService);
- expect(service.getFonts()).toEqual([{ value: 'OnlyCustom', label: 'Only Custom', category: 'display' }]);
+ expect(service.getFonts()).toEqual([{ value: 'OnlyCustom', label: 'Only Custom', category: FontCategory.DISPLAY }]);
expect(() => service.updateFont('Arial', { label: 'Missing' })).toThrow('Font with value "Arial" not found.');
expect(service.removeFont('Arial')).toBe(false);
});
diff --git a/packages/ui/src/services/font.service.ts b/packages/ui/src/services/font.service.ts
index 44da1767f7..72d479a0bb 100644
--- a/packages/ui/src/services/font.service.ts
+++ b/packages/ui/src/services/font.service.ts
@@ -15,13 +15,21 @@
*/
import type { IDisposable } from '@univerjs/core';
-import type { IUniverUIConfig } from '../config/config';
import { createIdentifier, IConfigService } from '@univerjs/core';
import { BehaviorSubject } from 'rxjs';
+import type { IUniverUIConfig } from '../config/config';
import { UI_PLUGIN_CONFIG_KEY } from '../config/config';
export const IFontService = createIdentifier<IFontService>('univer.font-service');
+export enum FontCategory {
+ SANS_SERIF = 'sans-serif',
+ SERIF = 'serif',
+ MONOSPACE = 'monospace',
+ DISPLAY = 'display',
+ HANDWRITING = 'handwriting',
+}
+
/**
* Font configuration interface
*/
@@ -39,212 +47,212 @@ export interface IFontConfig {
label: string;
/**
- * Font category for UI grouping (optional)
+ * Font classification. Monospaced fonts are available in code block font pickers.
*/
- category?: 'sans-serif' | 'serif' | 'monospace' | 'display' | 'handwriting';
+ category?: FontCategory;
}
-const DEFAULT_FONT_NAMES = [
- '宋体',
- 'Arial',
- 'Baskerville',
- 'Comic Sans MS',
- 'Courier New',
- 'Helvetica',
- 'Times New Roman',
- 'Verdana',
- 'Apple LiGothic',
- 'Apple LiSung',
- 'Hei',
- 'Kai',
- 'LiHei Pro',
- 'LiSong Pro',
- 'STFangsong',
- 'STHeiti',
- 'STKaiti',
- 'STSong',
- '报隶-繁',
- '报隶-简',
- '冬青黑体简体中文',
- '黑体-繁',
- '黑体-简',
- '华文仿宋',
- '华文楷体',
- '华文宋体',
- '楷体-繁',
- '楷体-简',
- '兰亭黑-繁',
- '兰亭黑-简',
- '隶变-繁',
- '隶变-简',
- '凌慧体-繁',
- '凌慧体-简',
- '翩翩体-繁',
- '翩翩体-简',
- '苹方-繁',
- '苹方-港',
- '苹方-简',
- '手札体-繁',
- '手札体-简',
- '宋体-繁',
- '宋体-简',
- '娃娃体-繁',
- '娃娃体-简',
- '魏碑-繁',
- '魏碑-简',
- '行楷-繁',
- '行楷-简',
- '雅痞-繁',
- '雅痞-简',
- '圆体-繁',
- '圆体-简',
- 'Arial Black',
- 'Big Caslon',
- 'Courier',
- 'Didot',
- 'Futura',
- 'Georgia',
- 'Helvetica Neue',
- 'Optima',
- 'Times',
- 'Tahoma',
- 'BIZ UDGothic',
- 'BIZ UDMincho',
- 'Hiragino Maru Gothic Pro',
- 'Hiragino Maru Gothic ProN',
- 'Hiragino Mincho Pro',
- 'Hiragino Mincho ProN',
- 'Hiragino Sans',
- 'Klee',
- 'Osaka',
- 'Toppan Bunkyu Gothic',
- 'Toppan Bunkyu Midashi Gothic',
- 'Toppan Bunkyu Midashi Mincho',
- 'Toppan Bunkyu Mincho',
- 'Tsukushi A Round Gothic',
- 'Tsukushi B Round Gothic',
- 'YuKyokasho',
- 'YuKyokasho Yoko',
- 'YuMincho +36p Kana',
- 'American Typewriter',
- 'Andale Mono',
- 'Apple Chancery',
- 'Apple SD Gothic Neo',
- 'Apple Symbols',
- 'AppleGothic',
- 'AppleMyungjo',
- 'Arial Unicode MS',
- 'Athelas',
- 'Avenir',
- 'Avenir Next',
- 'Avenir Next Condensed',
- 'Ayuthaya',
- 'Bangla MN',
- 'Bangla Sangam MN',
- 'Bauhaus 93',
- 'Bodoni 72',
- 'Bodoni 72 Oldstyle',
- 'Bodoni 72 Smallcaps',
- 'Bodoni Ornaments',
- 'Bookshelf Symbol 7',
- 'Bradley Hand',
- 'Chalkboard',
- 'Chalkboard SE',
- 'Chalkduster',
- 'Charter',
- 'Cochin',
- 'Copperplate',
- 'Devanagari Sangam MN',
- 'Din Alternate',
- 'Euphemia UCAS',
- 'Galvji',
- 'Geneva',
- 'Gill Sans',
- 'Gujarati Sangam MN',
- 'GungSeo',
- 'Gurmukhi MN',
- 'Gurmukhi Sangam MN',
- 'HeadLineA',
- 'Herculanum',
- 'Hiragino Kaku Gothic Pro',
- 'Hiragino Kaku Gothic ProN',
- 'Hiragino Kaku Gothic Std',
- 'Hiragino Kaku Gothic StdN',
- 'Hoefler Text',
- 'Impact',
- 'InaiMathi',
- 'Iowan Old Style',
- 'Kannada MN',
- 'Kannada Sangam MN',
- 'Kefa',
- 'Khmer MN',
- 'Khmer Sangam MN',
- 'Kohinoor Bangla',
- 'Kohinoor Devanagari',
- 'Kohinoor Telugu',
- 'Krungthep',
- 'Lao MN',
- 'Lao Sangam MN',
- 'Lucida Grande',
- 'Luminari',
- 'Malayalam MN',
- 'Malayalam Sangam MN',
- 'Marion',
- 'Marker Felt',
- 'Menlo',
- 'Microsoft Sans Serif',
- 'Modern No. 20',
- 'Monaco',
- 'Mukta Mahee',
- 'Nanum Brush Script',
- 'Nanum Gothic',
- 'Nanum Myeongjo',
- 'Nanum Pen Script',
- 'Noteworthy',
- 'Oriya MN',
- 'Oriya Sangam MN',
- 'Palatino',
- 'Papyrus',
- 'PCMyungjo',
- 'Phosphate',
- 'PilGi',
- 'Plantagenet Cherokee',
- 'PT Mono',
- 'PT Sans',
- 'PT Sans Caption',
- 'PT Serif',
- 'PT Serif Caption',
- 'Rockwell',
- 'Sathu',
- 'Savoye LET',
- 'Seravek',
- 'Shree Devanagari 714',
- 'SignPainter',
- 'Silom',
- 'Sinhala MN',
- 'Sinhala Sangam MN',
- 'Skia',
- 'Snell Roundhand',
- 'STIXGeneral',
- 'Sukhumvit Set',
- 'Superclarendon',
- 'Tamil MN',
- 'Tamil Sangam MN',
- 'Telugu MN',
- 'Telugu Sangam MN',
- 'Trattatello',
- 'Trebuchet MS',
- 'Webdings',
- 'Wingdings',
- 'Wingdings 2',
- 'Wingdings 3',
- 'YuGothic',
- 'YuGothic Light',
- 'YuGothic Medium',
- 'Zapfino',
-] as const;
-
-const DEFAULT_FONT_LIST: IFontConfig[] = DEFAULT_FONT_NAMES.map((value) => ({ value, label: value }));
+const DEFAULT_FONTS = [
+ ['宋体', { category: FontCategory.SERIF }],
+ ['Arial', { category: FontCategory.SANS_SERIF }],
+ ['Baskerville', { category: FontCategory.SERIF }],
+ ['Comic Sans MS', { category: FontCategory.HANDWRITING }],
+ ['Courier New', { category: FontCategory.MONOSPACE }],
+ ['Helvetica', { category: FontCategory.SANS_SERIF }],
+ ['Times New Roman', { category: FontCategory.SERIF }],
+ ['Verdana', { category: FontCategory.SANS_SERIF }],
+ ['Apple LiGothic', { category: FontCategory.SANS_SERIF }],
+ ['Apple LiSung', { category: FontCategory.SERIF }],
+ ['Hei', { category: FontCategory.SANS_SERIF }],
+ ['Kai', { category: FontCategory.HANDWRITING }],
+ ['LiHei Pro', { category: FontCategory.SANS_SERIF }],
+ ['LiSong Pro', { category: FontCategory.SERIF }],
+ ['STFangsong', { category: FontCategory.SERIF }],
+ ['STHeiti', { category: FontCategory.SANS_SERIF }],
+ ['STKaiti', { category: FontCategory.HANDWRITING }],
+ ['STSong', { category: FontCategory.SERIF }],
+ ['报隶-繁', { category: FontCategory.HANDWRITING }],
+ ['报隶-简', { category: FontCategory.HANDWRITING }],
+ ['冬青黑体简体中文', { category: FontCategory.SANS_SERIF }],
+ ['黑体-繁', { category: FontCategory.SANS_SERIF }],
+ ['黑体-简', { category: FontCategory.SANS_SERIF }],
+ ['华文仿宋', { category: FontCategory.SERIF }],
+ ['华文楷体', { category: FontCategory.HANDWRITING }],
+ ['华文宋体', { category: FontCategory.SERIF }],
+ ['楷体-繁', { category: FontCategory.HANDWRITING }],
+ ['楷体-简', { category: FontCategory.HANDWRITING }],
+ ['兰亭黑-繁', { category: FontCategory.SANS_SERIF }],
+ ['兰亭黑-简', { category: FontCategory.SANS_SERIF }],
+ ['隶变-繁', { category: FontCategory.HANDWRITING }],
+ ['隶变-简', { category: FontCategory.HANDWRITING }],
+ ['凌慧体-繁', { category: FontCategory.HANDWRITING }],
+ ['凌慧体-简', { category: FontCategory.HANDWRITING }],
+ ['翩翩体-繁', { category: FontCategory.HANDWRITING }],
+ ['翩翩体-简', { category: FontCategory.HANDWRITING }],
+ ['苹方-繁', { category: FontCategory.SANS_SERIF }],
+ ['苹方-港', { category: FontCategory.SANS_SERIF }],
+ ['苹方-简', { category: FontCategory.SANS_SERIF }],
+ ['手札体-繁', { category: FontCategory.HANDWRITING }],
+ ['手札体-简', { category: FontCategory.HANDWRITING }],
+ ['宋体-繁', { category: FontCategory.SERIF }],
+ ['宋体-简', { category: FontCategory.SERIF }],
+ ['娃娃体-繁', { category: FontCategory.HANDWRITING }],
+ ['娃娃体-简', { category: FontCategory.HANDWRITING }],
+ ['魏碑-繁', { category: FontCategory.HANDWRITING }],
+ ['魏碑-简', { category: FontCategory.HANDWRITING }],
+ ['行楷-繁', { category: FontCategory.HANDWRITING }],
+ ['行楷-简', { category: FontCategory.HANDWRITING }],
+ ['雅痞-繁', { category: FontCategory.DISPLAY }],
+ ['雅痞-简', { category: FontCategory.DISPLAY }],
+ ['圆体-繁', { category: FontCategory.SANS_SERIF }],
+ ['圆体-简', { category: FontCategory.SANS_SERIF }],
+ ['Arial Black', { category: FontCategory.SANS_SERIF }],
+ ['Big Caslon', { category: FontCategory.SERIF }],
+ ['Courier', { category: FontCategory.MONOSPACE }],
+ ['Didot', { category: FontCategory.SERIF }],
+ ['Futura', { category: FontCategory.SANS_SERIF }],
+ ['Georgia', { category: FontCategory.SERIF }],
+ ['Helvetica Neue', { category: FontCategory.SANS_SERIF }],
+ ['Optima', { category: FontCategory.SANS_SERIF }],
+ ['Times', { category: FontCategory.SERIF }],
+ ['Tahoma', { category: FontCategory.SANS_SERIF }],
+ ['BIZ UDGothic', { category: FontCategory.MONOSPACE }],
+ ['BIZ UDMincho', { category: FontCategory.MONOSPACE }],
+ ['Hiragino Maru Gothic Pro', { category: FontCategory.SANS_SERIF }],
+ ['Hiragino Maru Gothic ProN', { category: FontCategory.SANS_SERIF }],
+ ['Hiragino Mincho Pro', { category: FontCategory.SERIF }],
+ ['Hiragino Mincho ProN', { category: FontCategory.SERIF }],
+ ['Hiragino Sans', { category: FontCategory.SANS_SERIF }],
+ ['Klee', { category: FontCategory.HANDWRITING }],
+ ['Osaka', { category: FontCategory.SANS_SERIF }],
+ ['Toppan Bunkyu Gothic', { category: FontCategory.SANS_SERIF }],
+ ['Toppan Bunkyu Midashi Gothic', { category: FontCategory.SANS_SERIF }],
+ ['Toppan Bunkyu Midashi Mincho', { category: FontCategory.SERIF }],
+ ['Toppan Bunkyu Mincho', { category: FontCategory.SERIF }],
+ ['Tsukushi A Round Gothic', { category: FontCategory.SANS_SERIF }],
+ ['Tsukushi B Round Gothic', { category: FontCategory.SANS_SERIF }],
+ ['YuKyokasho', { category: FontCategory.HANDWRITING }],
+ ['YuKyokasho Yoko', { category: FontCategory.HANDWRITING }],
+ ['YuMincho +36p Kana', { category: FontCategory.SERIF }],
+ ['American Typewriter', { category: FontCategory.SERIF }],
+ ['Andale Mono', { category: FontCategory.MONOSPACE }],
+ ['Apple Chancery', { category: FontCategory.HANDWRITING }],
+ ['Apple SD Gothic Neo', { category: FontCategory.SANS_SERIF }],
+ ['Apple Symbols', { category: FontCategory.DISPLAY }],
+ ['AppleGothic', { category: FontCategory.SANS_SERIF }],
+ ['AppleMyungjo', { category: FontCategory.SERIF }],
+ ['Arial Unicode MS', { category: FontCategory.SANS_SERIF }],
+ ['Athelas', { category: FontCategory.SERIF }],
+ ['Avenir', { category: FontCategory.SANS_SERIF }],
+ ['Avenir Next', { category: FontCategory.SANS_SERIF }],
+ ['Avenir Next Condensed', { category: FontCategory.SANS_SERIF }],
+ ['Ayuthaya', { category: FontCategory.SANS_SERIF }],
+ ['Bangla MN', { category: FontCategory.SERIF }],
+ ['Bangla Sangam MN', { category: FontCategory.SANS_SERIF }],
+ ['Bauhaus 93', { category: FontCategory.DISPLAY }],
+ ['Bodoni 72', { category: FontCategory.SERIF }],
+ ['Bodoni 72 Oldstyle', { category: FontCategory.SERIF }],
+ ['Bodoni 72 Smallcaps', { category: FontCategory.SERIF }],
+ ['Bodoni Ornaments', { category: FontCategory.DISPLAY }],
+ ['Bookshelf Symbol 7', { category: FontCategory.DISPLAY }],
+ ['Bradley Hand', { category: FontCategory.HANDWRITING }],
+ ['Chalkboard', { category: FontCategory.HANDWRITING }],
+ ['Chalkboard SE', { category: FontCategory.HANDWRITING }],
+ ['Chalkduster', { category: FontCategory.HANDWRITING }],
+ ['Charter', { category: FontCategory.SERIF }],
+ ['Cochin', { category: FontCategory.SERIF }],
+ ['Copperplate', { category: FontCategory.SERIF }],
+ ['Devanagari Sangam MN', { category: FontCategory.SANS_SERIF }],
+ ['Din Alternate', { category: FontCategory.SANS_SERIF }],
+ ['Euphemia UCAS', { category: FontCategory.SANS_SERIF }],
+ ['Galvji', { category: FontCategory.SANS_SERIF }],
+ ['Geneva', { category: FontCategory.SANS_SERIF }],
+ ['Gill Sans', { category: FontCategory.SANS_SERIF }],
+ ['Gujarati Sangam MN', { category: FontCategory.SANS_SERIF }],
+ ['GungSeo', { category: FontCategory.HANDWRITING }],
+ ['Gurmukhi MN', { category: FontCategory.SERIF }],
+ ['Gurmukhi Sangam MN', { category: FontCategory.SANS_SERIF }],
+ ['HeadLineA', { category: FontCategory.DISPLAY }],
+ ['Herculanum', { category: FontCategory.DISPLAY }],
+ ['Hiragino Kaku Gothic Pro', { category: FontCategory.SANS_SERIF }],
+ ['Hiragino Kaku Gothic ProN', { category: FontCategory.SANS_SERIF }],
+ ['Hiragino Kaku Gothic Std', { category: FontCategory.SANS_SERIF }],
+ ['Hiragino Kaku Gothic StdN', { category: FontCategory.SANS_SERIF }],
+ ['Hoefler Text', { category: FontCategory.SERIF }],
+ ['Impact', { category: FontCategory.SANS_SERIF }],
+ ['InaiMathi', { category: FontCategory.SANS_SERIF }],
+ ['Iowan Old Style', { category: FontCategory.SERIF }],
+ ['Kannada MN', { category: FontCategory.SERIF }],
+ ['Kannada Sangam MN', { category: FontCategory.SANS_SERIF }],
+ ['Kefa', { category: FontCategory.SERIF }],
+ ['Khmer MN', { category: FontCategory.SERIF }],
+ ['Khmer Sangam MN', { category: FontCategory.SANS_SERIF }],
+ ['Kohinoor Bangla', { category: FontCategory.SANS_SERIF }],
+ ['Kohinoor Devanagari', { category: FontCategory.SANS_SERIF }],
+ ['Kohinoor Telugu', { category: FontCategory.SANS_SERIF }],
+ ['Krungthep', { category: FontCategory.SANS_SERIF }],
+ ['Lao MN', { category: FontCategory.SERIF }],
+ ['Lao Sangam MN', { category: FontCategory.SANS_SERIF }],
+ ['Lucida Grande', { category: FontCategory.SANS_SERIF }],
+ ['Luminari', { category: FontCategory.DISPLAY }],
+ ['Malayalam MN', { category: FontCategory.SERIF }],
+ ['Malayalam Sangam MN', { category: FontCategory.SANS_SERIF }],
+ ['Marion', { category: FontCategory.SERIF }],
+ ['Marker Felt', { category: FontCategory.HANDWRITING }],
+ ['Menlo', { category: FontCategory.MONOSPACE }],
+ ['Microsoft Sans Serif', { category: FontCategory.SANS_SERIF }],
+ ['Modern No. 20', { category: FontCategory.SERIF }],
+ ['Monaco', { category: FontCategory.MONOSPACE }],
+ ['Mukta Mahee', { category: FontCategory.SANS_SERIF }],
+ ['Nanum Brush Script', { category: FontCategory.HANDWRITING }],
+ ['Nanum Gothic', { category: FontCategory.SANS_SERIF }],
+ ['Nanum Myeongjo', { category: FontCategory.SERIF }],
+ ['Nanum Pen Script', { category: FontCategory.HANDWRITING }],
+ ['Noteworthy', { category: FontCategory.HANDWRITING }],
+ ['Oriya MN', { category: FontCategory.SERIF }],
+ ['Oriya Sangam MN', { category: FontCategory.SANS_SERIF }],
+ ['Palatino', { category: FontCategory.SERIF }],
+ ['Papyrus', { category: FontCategory.DISPLAY }],
+ ['PCMyungjo', { category: FontCategory.MONOSPACE }],
+ ['Phosphate', { category: FontCategory.DISPLAY }],
+ ['PilGi', { category: FontCategory.HANDWRITING }],
+ ['Plantagenet Cherokee', { category: FontCategory.SERIF }],
+ ['PT Mono', { category: FontCategory.MONOSPACE }],
+ ['PT Sans', { category: FontCategory.SANS_SERIF }],
+ ['PT Sans Caption', { category: FontCategory.SANS_SERIF }],
+ ['PT Serif', { category: FontCategory.SERIF }],
+ ['PT Serif Caption', { category: FontCategory.SERIF }],
+ ['Rockwell', { category: FontCategory.SERIF }],
+ ['Sathu', { category: FontCategory.SANS_SERIF }],
+ ['Savoye LET', { category: FontCategory.HANDWRITING }],
+ ['Seravek', { category: FontCategory.SANS_SERIF }],
+ ['Shree Devanagari 714', { category: FontCategory.SANS_SERIF }],
+ ['SignPainter', { category: FontCategory.HANDWRITING }],
+ ['Silom', { category: FontCategory.DISPLAY }],
+ ['Sinhala MN', { category: FontCategory.SERIF }],
+ ['Sinhala Sangam MN', { category: FontCategory.SANS_SERIF }],
+ ['Skia', { category: FontCategory.SANS_SERIF }],
+ ['Snell Roundhand', { category: FontCategory.HANDWRITING }],
+ ['STIXGeneral', { category: FontCategory.SERIF }],
+ ['Sukhumvit Set', { category: FontCategory.SANS_SERIF }],
+ ['Superclarendon', { category: FontCategory.SERIF }],
+ ['Tamil MN', { category: FontCategory.SERIF }],
+ ['Tamil Sangam MN', { category: FontCategory.SANS_SERIF }],
+ ['Telugu MN', { category: FontCategory.SERIF }],
+ ['Telugu Sangam MN', { category: FontCategory.SANS_SERIF }],
+ ['Trattatello', { category: FontCategory.HANDWRITING }],
+ ['Trebuchet MS', { category: FontCategory.SANS_SERIF }],
+ ['Webdings', { category: FontCategory.DISPLAY }],
+ ['Wingdings', { category: FontCategory.DISPLAY }],
+ ['Wingdings 2', { category: FontCategory.DISPLAY }],
+ ['Wingdings 3', { category: FontCategory.DISPLAY }],
+ ['YuGothic', { category: FontCategory.SANS_SERIF }],
+ ['YuGothic Light', { category: FontCategory.SANS_SERIF }],
+ ['YuGothic Medium', { category: FontCategory.SANS_SERIF }],
+ ['Zapfino', { category: FontCategory.HANDWRITING }],
+] as const satisfies ReadonlyArray<readonly [string, Omit<IFontConfig, 'value' | 'label'>]>;
+
+const DEFAULT_FONT_LIST: IFontConfig[] = DEFAULT_FONTS.map(([value, config]) => ({ value, label: value, ...config }));
export interface IFontService {
/**