@pairdraw/core 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/outline-stroke.d.ts.map +1 -1
- package/dist/canvas/outline-stroke.js.map +1 -1
- package/dist/canvas/overlays/prototype.d.ts +2 -5
- package/dist/canvas/overlays/prototype.d.ts.map +1 -1
- package/dist/canvas/overlays/prototype.js +3 -19
- package/dist/canvas/overlays/prototype.js.map +1 -1
- package/dist/canvas/renderer/fonts.js +2 -1
- package/dist/canvas/renderer/fonts.js.map +1 -1
- package/dist/canvas/renderer.d.ts +4 -0
- package/dist/canvas/renderer.d.ts.map +1 -1
- package/dist/canvas/renderer.js +4 -0
- package/dist/canvas/renderer.js.map +1 -1
- package/dist/canvas/scene.d.ts.map +1 -1
- package/dist/canvas/scene.js +61 -37
- package/dist/canvas/scene.js.map +1 -1
- package/dist/canvas/text/font-families.d.ts +4 -3
- package/dist/canvas/text/font-families.d.ts.map +1 -1
- package/dist/canvas/text/font-families.js +8 -7
- package/dist/canvas/text/font-families.js.map +1 -1
- package/dist/canvas/text/index.d.ts.map +1 -1
- package/dist/canvas/text/index.js +1 -1
- package/dist/canvas/text/index.js.map +1 -1
- package/dist/canvas/text/paragraph/index.js +2 -2
- package/dist/canvas/text/paragraph/index.js.map +1 -1
- package/dist/canvas/text/placed.js +2 -2
- package/dist/canvas/text/placed.js.map +1 -1
- package/dist/canvas/text/renderer.d.ts +2 -0
- package/dist/canvas/text/renderer.d.ts.map +1 -1
- package/dist/design-jsx/renderer.d.ts.map +1 -1
- package/dist/editor/bridges/undo.d.ts +1 -1
- package/dist/editor/create.d.ts +1 -1
- package/dist/figma-api/index.d.ts +43 -8
- package/dist/figma-api/index.d.ts.map +1 -1
- package/dist/figma-api/index.js +48 -6
- package/dist/figma-api/index.js.map +1 -1
- package/dist/figma-api/serialization.js +10 -0
- package/dist/figma-api/serialization.js.map +1 -1
- package/dist/geometry/connectors.js +2 -14
- package/dist/geometry/connectors.js.map +1 -1
- package/dist/geometry/index.d.ts +2 -2
- package/dist/geometry/scene.d.ts +3 -1
- package/dist/geometry/scene.d.ts.map +1 -1
- package/dist/geometry/scene.js +16 -1
- package/dist/geometry/scene.js.map +1 -1
- package/dist/geometry/types.d.ts +7 -1
- package/dist/geometry/types.d.ts.map +1 -1
- package/dist/io/formats/drawio/export.d.ts.map +1 -1
- package/dist/io/formats/drawio/export.js +10 -0
- package/dist/io/formats/drawio/export.js.map +1 -1
- package/dist/io/formats/drawio/index.d.ts.map +1 -1
- package/dist/io/formats/drawio/index.js +32 -1
- package/dist/io/formats/drawio/index.js.map +1 -1
- package/dist/io/formats/drawio/shapes.d.ts +10 -5
- package/dist/io/formats/drawio/shapes.d.ts.map +1 -1
- package/dist/io/formats/drawio/shapes.js +10 -6
- package/dist/io/formats/drawio/shapes.js.map +1 -1
- package/dist/io/formats/drawio/warnings.d.ts +11 -0
- package/dist/io/formats/drawio/warnings.d.ts.map +1 -0
- package/dist/io/formats/drawio/warnings.js +23 -0
- package/dist/io/formats/drawio/warnings.js.map +1 -0
- package/dist/io/formats/pdf/dom.d.ts +10 -1
- package/dist/io/formats/pdf/dom.d.ts.map +1 -1
- package/dist/io/formats/pdf/dom.js +31 -1
- package/dist/io/formats/pdf/dom.js.map +1 -1
- package/dist/io/formats/pdf/export.js +3 -2
- package/dist/io/formats/pdf/export.js.map +1 -1
- package/dist/io/formats/raster/headless.d.ts +2 -2
- package/dist/io/formats/raster/headless.d.ts.map +1 -1
- package/dist/io/formats/raster/headless.js +2 -2
- package/dist/io/formats/raster/headless.js.map +1 -1
- package/dist/io/formats/raster/render.d.ts +1 -1
- package/dist/io/formats/raster/render.d.ts.map +1 -1
- package/dist/io/formats/raster/render.js +2 -2
- package/dist/io/formats/raster/render.js.map +1 -1
- package/dist/io/formats.d.ts.map +1 -1
- package/dist/io/formats.js +3 -1
- package/dist/io/formats.js.map +1 -1
- package/dist/io/registry.d.ts +2 -0
- package/dist/io/registry.d.ts.map +1 -1
- package/dist/io/registry.js +5 -0
- package/dist/io/registry.js.map +1 -1
- package/dist/io/types.d.ts +2 -0
- package/dist/io/types.d.ts.map +1 -1
- package/dist/library/snapshot.d.ts.map +1 -1
- package/dist/library/snapshot.js +1 -0
- package/dist/library/snapshot.js.map +1 -1
- package/dist/lint/linter.d.ts.map +1 -1
- package/dist/lint/linter.js +11 -2
- package/dist/lint/linter.js.map +1 -1
- package/dist/rpc/variables-command.d.ts.map +1 -1
- package/dist/rpc/variables-command.js +4 -2
- package/dist/rpc/variables-command.js.map +1 -1
- package/dist/text/coverage.d.ts.map +1 -1
- package/dist/text/coverage.js +6 -3
- package/dist/text/coverage.js.map +1 -1
- package/dist/text/fallbacks.d.ts +8 -2
- package/dist/text/fallbacks.d.ts.map +1 -1
- package/dist/text/fallbacks.js +73 -7
- package/dist/text/fallbacks.js.map +1 -1
- package/dist/text/font/manager.d.ts +14 -6
- package/dist/text/font/manager.d.ts.map +1 -1
- package/dist/text/font/manager.js +40 -14
- package/dist/text/font/manager.js.map +1 -1
- package/dist/text/index.d.ts +2 -2
- package/dist/text/index.js +2 -2
- package/dist/text/outlines.js +1 -1
- package/dist/text/outlines.js.map +1 -1
- package/dist/text/path/caret.d.ts +2 -4
- package/dist/text/path/caret.d.ts.map +1 -1
- package/dist/text/path/caret.js.map +1 -1
- package/dist/text/prepare.d.ts +5 -1
- package/dist/text/prepare.d.ts.map +1 -1
- package/dist/text/prepare.js +19 -2
- package/dist/text/prepare.js.map +1 -1
- package/dist/text/web-font/assets.d.ts.map +1 -1
- package/dist/text/web-font/assets.js +13 -21
- package/dist/text/web-font/assets.js.map +1 -1
- package/dist/text/web-font/resolver.d.ts.map +1 -1
- package/dist/text/web-font/resolver.js +4 -1
- package/dist/text/web-font/resolver.js.map +1 -1
- package/dist/tools/create/components.d.ts +2 -1
- package/dist/tools/create/components.d.ts.map +1 -1
- package/dist/tools/create/components.js +27 -1
- package/dist/tools/create/components.js.map +1 -1
- package/dist/tools/create/icons.d.ts.map +1 -1
- package/dist/tools/create/icons.js +11 -5
- package/dist/tools/create/icons.js.map +1 -1
- package/dist/tools/create/vector.d.ts.map +1 -1
- package/dist/tools/create/vector.js +9 -6
- package/dist/tools/create/vector.js.map +1 -1
- package/dist/tools/create.d.ts +2 -2
- package/dist/tools/create.js +2 -2
- package/dist/tools/modify/effects.d.ts.map +1 -1
- package/dist/tools/modify/effects.js +5 -3
- package/dist/tools/modify/effects.js.map +1 -1
- package/dist/tools/modify/matching.d.ts.map +1 -1
- package/dist/tools/modify/matching.js +9 -6
- package/dist/tools/modify/matching.js.map +1 -1
- package/dist/tools/modify/paint.d.ts.map +1 -1
- package/dist/tools/modify/paint.js +7 -5
- package/dist/tools/modify/paint.js.map +1 -1
- package/dist/tools/modify/text.d.ts.map +1 -1
- package/dist/tools/modify/text.js +28 -8
- package/dist/tools/modify/text.js.map +1 -1
- package/dist/tools/read/libraries.d.ts.map +1 -1
- package/dist/tools/read/libraries.js +16 -4
- package/dist/tools/read/libraries.js.map +1 -1
- package/dist/tools/read/pages.d.ts.map +1 -1
- package/dist/tools/read/pages.js.map +1 -1
- package/dist/tools/registry/extended.d.ts.map +1 -1
- package/dist/tools/registry/extended.js +2 -1
- package/dist/tools/registry/extended.js.map +1 -1
- package/dist/tools/schema.d.ts +24 -5
- package/dist/tools/schema.d.ts.map +1 -1
- package/dist/tools/schema.js +80 -6
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/structure/batch.d.ts.map +1 -1
- package/dist/tools/structure/batch.js +4 -3
- package/dist/tools/structure/batch.js.map +1 -1
- package/dist/tools/variables/values.d.ts.map +1 -1
- package/dist/tools/variables/values.js +4 -2
- package/dist/tools/variables/values.js.map +1 -1
- package/dist/tools/vector/export.d.ts.map +1 -1
- package/dist/tools/vector/export.js +5 -2
- package/dist/tools/vector/export.js.map +1 -1
- package/package.json +9 -9
- package/src/canvas/outline-stroke.ts +2 -6
- package/src/canvas/overlays/prototype.ts +5 -27
- package/src/canvas/renderer/fonts.ts +2 -1
- package/src/canvas/renderer.ts +4 -0
- package/src/canvas/scene.ts +92 -63
- package/src/canvas/text/font-families.ts +8 -7
- package/src/canvas/text/index.ts +3 -1
- package/src/canvas/text/paragraph/index.ts +2 -2
- package/src/canvas/text/placed.ts +2 -2
- package/src/canvas/text/renderer.ts +2 -0
- package/src/figma-api/index.ts +90 -9
- package/src/figma-api/serialization.ts +14 -0
- package/src/geometry/connectors.ts +2 -12
- package/src/geometry/index.ts +1 -1
- package/src/geometry/scene.ts +19 -0
- package/src/geometry/types.ts +8 -0
- package/src/io/formats/drawio/export.ts +11 -0
- package/src/io/formats/drawio/index.ts +36 -1
- package/src/io/formats/drawio/shapes.ts +13 -9
- package/src/io/formats/drawio/warnings.ts +27 -0
- package/src/io/formats/pdf/dom.ts +29 -0
- package/src/io/formats/pdf/export.ts +3 -2
- package/src/io/formats/raster/headless.ts +10 -3
- package/src/io/formats/raster/render.ts +4 -2
- package/src/io/formats.ts +3 -1
- package/src/io/registry.ts +12 -0
- package/src/io/types.ts +2 -0
- package/src/library/snapshot.ts +1 -0
- package/src/lint/linter.ts +12 -2
- package/src/rpc/variables-command.ts +6 -5
- package/src/text/coverage.ts +17 -2
- package/src/text/fallbacks.ts +81 -7
- package/src/text/font/manager.ts +50 -17
- package/src/text/outlines.ts +1 -1
- package/src/text/path/caret.ts +3 -4
- package/src/text/prepare.ts +34 -2
- package/src/text/web-font/assets.ts +11 -15
- package/src/text/web-font/resolver.ts +7 -1
- package/src/tools/create/components.ts +33 -0
- package/src/tools/create/icons.ts +13 -5
- package/src/tools/create/vector.ts +16 -6
- package/src/tools/create.ts +1 -0
- package/src/tools/modify/effects.ts +11 -4
- package/src/tools/modify/matching.ts +10 -6
- package/src/tools/modify/paint.ts +13 -5
- package/src/tools/modify/text.ts +53 -20
- package/src/tools/read/libraries.ts +21 -4
- package/src/tools/read/pages.ts +1 -0
- package/src/tools/registry/extended.ts +2 -0
- package/src/tools/schema.ts +109 -5
- package/src/tools/structure/batch.ts +10 -5
- package/src/tools/variables/values.ts +6 -3
- package/src/tools/vector/export.ts +5 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","names":[],"sources":["../../../src/text/font/manager.ts"],"sourcesContent":["/* eslint-disable max-lines -- font loading and registration share FontManager lifecycle state */\n\nimport type { CanvasKit, TypefaceFontProvider } from 'canvaskit-wasm'\n\nimport type { FontVariation, SceneGraph } from '@pairdraw/scene-graph'\nimport {\n faceLoadKey,\n namesWeight,\n normalizeFontFamily,\n parseFontStyle,\n styleToWeight\n} from '@pairdraw/scene-graph/font-style'\n\nimport { DEFAULT_FONT_FAMILY, IS_BROWSER } from '#core/constants'\nimport { fontFallbackEntry, type FontFallbackScript } from '#core/text/fallbacks'\nimport { BundledFonts, type BundledFontLocator } from '#core/text/font/bundled'\nimport { FamilyFaceCatalog, type HostFontFamily } from '#core/text/font/catalog'\nimport { fontFaceRenderFamily, type FamilyFace } from '#core/text/font/faces'\nimport { loadHarfBuzz } from '#core/text/font/harfbuzz'\nimport { LocalFonts } from '#core/text/font/local'\nimport { sameFontFile, SharedReads, withHarfBuzz } from '#core/text/font/reads'\nimport {\n UnsupportedFontFormatError,\n type DownloadedFontCache,\n type FontFamilyOption,\n type FontInfo,\n type FontLoadedSource,\n type FontUnavailableReason,\n type HostFontLoader,\n type LocalFontAccessState\n} from '#core/text/font/sources'\nimport {\n fontAxes,\n hasNamedInstance,\n namedInstances,\n namedInstanceVariations,\n type FontAxis,\n type NamedInstance\n} from '#core/text/font/variation'\nimport { collectGraphFontKeys } from '#core/text/requirements/collect'\nimport { normalizedCoverageText, WebFontResolver } from '#core/text/web-font/resolver'\nimport type { WebFontFetch, WebFontProviderId } from '#core/text/web-font/resolver'\n\nexport type { BundledFontLocator } from '#core/text/font/bundled'\n\nexport class FontManager {\n private loadedFamilies = new Map<string, ArrayBuffer>()\n private loadedFamilySources = new Map<string, FontLoadedSource>()\n private unavailableFaces = new Map<string, FontUnavailableReason>()\n private supplementalFamilyData = new Map<string, ArrayBuffer[]>()\n /** The name each file of a family loaded from several files is registered under. */\n private fileFamilies = new Map<ArrayBuffer, string>()\n /**\n * Families a style's file was replaced in, such as a web font fetched again for more characters.\n * The old file stays registered first under the family's name, and CanvasKit draws with the\n * first file it has for a style, so these draw from each file's own name.\n */\n private replacedFamilies = new Set<string>()\n /**\n * The files each style's own file replaced, by `family|style`. They stay its fallbacks under\n * names of their own, never beside the file that replaced them, where CanvasKit would pick\n * between the two by the weight each declares.\n */\n private replacedFileData = new Map<string, Set<ArrayBuffer>>()\n private remoteCoverage = new Map<string, Set<string>>()\n private instanceVariations = new WeakMap<ArrayBuffer, Map<string, FontVariation[] | null>>()\n private variations = new WeakMap<\n ArrayBuffer,\n { axes: FontAxis[]; instances: NamedInstance[] } | null\n >()\n private blockedNodeIds = new Set<string>()\n private fontProvider: TypefaceFontProvider | null = null\n private fontProviders = new Set<TypefaceFontProvider>()\n private providerCanvasKits = new WeakMap<TypefaceFontProvider, CanvasKit>()\n private registrationGeneration = 0\n private providerRegistrations = new WeakMap<TypefaceFontProvider, Map<string, Set<ArrayBuffer>>>()\n private downloadedFontCache: DownloadedFontCache | null = null\n private fallbackUserAgent: string | undefined\n private hostFontLoader: HostFontLoader | null = null\n private readonly hostFontRequests = new SharedReads()\n private webFonts = new WebFontResolver()\n private readonly faceListeners = new Set<(family: string, style: string) => void>()\n private readonly bundled = new BundledFonts()\n private readonly localFonts = new LocalFonts()\n private readonly faces = new FamilyFaceCatalog({\n localFonts: () => this.localFonts.list(),\n webFaces: (family) => this.webFonts.familyFaces(family),\n bundledStyles: (family) => this.bundled.styles(family)\n })\n private cjkFallbackFamilies: string[] = []\n private cjkFallbackPromise: Promise<string[]> | null = null\n private arabicFallbackFamilies: string[] = []\n private arabicFallbackPromise: Promise<string[]> | null = null\n\n attachProvider(canvasKit: CanvasKit, provider: TypefaceFontProvider): void {\n this.fontProviders.add(provider)\n this.providerCanvasKits.set(provider, canvasKit)\n this.fontProvider = provider\n this.providerRegistrations.set(provider, new Map())\n this.registrationGeneration++\n for (const [cacheKey, data] of this.loadedFamilies) {\n const separator = cacheKey.indexOf('|')\n const family = cacheKey.slice(0, separator)\n this.registerFontInProvider(provider, family, data)\n for (const supplemental of this.supplementalFamilyData.get(cacheKey) ?? []) {\n this.registerFontInProvider(provider, family, supplemental)\n }\n }\n }\n\n detachProvider(provider: TypefaceFontProvider): void {\n this.fontProviders.delete(provider)\n this.providerRegistrations.delete(provider)\n if (this.fontProvider === provider) {\n this.fontProvider = Array.from(this.fontProviders).at(-1) ?? null\n }\n }\n\n provider(): TypefaceFontProvider | null {\n return this.fontProvider\n }\n\n /** The latest attached provider made by `canvasKit`; another build's provider cannot shape with it. */\n providerFor(canvasKit: CanvasKit): TypefaceFontProvider | null {\n return (\n Array.from(this.fontProviders)\n .reverse()\n .find((provider) => this.providerCanvasKits.get(provider) === canvasKit) ?? null\n )\n }\n\n generation(): number {\n return this.registrationGeneration\n }\n\n blockNodesUntilFontsResolve(nodeIds: readonly string[]): void {\n for (const nodeId of nodeIds) this.blockedNodeIds.add(nodeId)\n }\n\n unblockNodes(nodeIds: readonly string[]): void {\n for (const nodeId of nodeIds) this.blockedNodeIds.delete(nodeId)\n }\n\n isNodeBlocked(nodeId: string): boolean {\n return this.blockedNodeIds.has(nodeId)\n }\n\n localAccessState(): LocalFontAccessState {\n return this.localFonts.accessState()\n }\n\n setDownloadedFontCache(cache: DownloadedFontCache | null): void {\n this.downloadedFontCache = cache\n }\n\n setFallbackUserAgent(userAgent: string | undefined): void {\n this.fallbackUserAgent = userAgent\n }\n\n setHostFontLoader(loader: HostFontLoader | null): void {\n this.hostFontLoader = loader\n this.hostFontRequests.clear()\n }\n\n /** Lets a host that bundles `@pairdraw/core/assets` itself say where each file ended up. */\n setBundledFontLocator(locate: BundledFontLocator | null): void {\n this.bundled.setLocator(locate)\n }\n\n setOnlineFontProviders(settings: Partial<Record<WebFontProviderId, boolean>>): void {\n this.webFonts.setEnabled(settings)\n this.faces.forget()\n }\n\n /** The system fonts a desktop host lists, by family, with the style names of their faces. */\n setHostFontCatalog(fonts: readonly HostFontFamily[]): void {\n this.faces.setHostCatalog(fonts)\n }\n\n /**\n * The faces a family has: its installed fonts', else a web provider's, else the bundled ones;\n * `null` when nothing says, so a caller offers every weight.\n */\n familyFaces(family: string): Promise<FamilyFace[] | null> {\n return this.faces.faces(family)\n }\n\n /** The faces `familyFaces` found for a family, once it has; `undefined` before. */\n loadedFamilyFaces(family: string): FamilyFace[] | null | undefined {\n return this.faces.foundFaces(family)\n }\n\n /** Whether a family has this face, or nothing found so far says it has not. */\n offersFace(family: string, weight: number, italic: boolean): boolean {\n return this.faces.offersFace(family, weight, italic)\n }\n\n /** Calls the listener whenever the faces found so far are forgotten. */\n onFamilyFacesReset(listener: () => void): () => void {\n return this.faces.onReset(listener)\n }\n\n /** The faces known for a family without asking a provider; see {@link FamilyFaceCatalog}. */\n familyFacesSync(family: string): FamilyFace[] | null {\n return this.faces.facesSync(family)\n }\n\n setWebFontFetch(fetcher: WebFontFetch | null): void {\n this.webFonts.setRemoteFetch(fetcher)\n }\n\n resetWebFontFailures(family?: string, style?: string): void {\n this.webFonts.resetFailures(family, style)\n }\n\n enabledOnlineFontProviders(): WebFontProviderId[] {\n return this.webFonts.enabledProviders()\n }\n\n loadCachedFont(family: string, style = 'Regular', characters = ''): Promise<ArrayBuffer | null> {\n return withHarfBuzz(this.restoreCachedFont(family, style, characters))\n }\n\n private async restoreCachedFont(\n family: string,\n style = 'Regular',\n characters = ''\n ): Promise<ArrayBuffer | null> {\n const cached = await this.readDownloadedFont(family, style, characters)\n if (!cached) return null\n const key = `${family}|${style}`\n const loadedCoverage = this.remoteCoverage.get(key) ?? new Set<string>()\n for (const character of normalizedCoverageText(characters)) loadedCoverage.add(character)\n this.remoteCoverage.set(key, loadedCoverage)\n return this.registerAndCache(family, style, cached, 'cache')\n }\n\n async requestLocalFontAccess(): Promise<FontInfo[]> {\n const fonts = await this.localFonts.requestAccess()\n this.faces.forget()\n return fonts\n }\n\n async listFamilies(): Promise<string[]> {\n const options = await this.listFamilyOptions()\n return options.map((option) => option.family)\n }\n\n /**\n * The families loaded from font files, such as a document's fonts, which no catalog lists:\n * installed, web, and bundled sources name their families without the files. A registered\n * family keeps its `document` source however it loads next, so the picker shows where the\n * file it draws from came from.\n */\n registeredFamilyOptions(): FontFamilyOption[] {\n const options: FontFamilyOption[] = []\n const seen = new Set<string>()\n for (const key of this.loadedFamilies.keys()) {\n const family = key.slice(0, key.lastIndexOf('|'))\n if (seen.has(family) || this.loadedFamilySources.get(key) !== 'registered') continue\n seen.add(family)\n options.push({ family, source: 'document' })\n }\n return options.sort((a, b) => a.family.localeCompare(b.family))\n }\n\n async listFamilyOptions(): Promise<FontFamilyOption[]> {\n const fonts = this.localFonts.list() ?? (await this.requestLocalFontAccess())\n const webFontFamilies = await Promise.all(\n this.enabledOnlineFontProviders().map(async (provider) => ({\n provider,\n families: await this.webFonts.listFamilies(provider)\n }))\n )\n const byFamily = new Map<string, FontFamilyOption>()\n byFamily.set(DEFAULT_FONT_FAMILY, { family: DEFAULT_FONT_FAMILY, source: 'bundled' })\n for (const { provider, families } of webFontFamilies) {\n for (const family of families) {\n if (!byFamily.has(family)) byFamily.set(family, { family, source: provider })\n }\n }\n for (const font of fonts) byFamily.set(font.family, { family: font.family, source: 'local' })\n // A family loaded from a font file draws from that file, whatever the catalogs say.\n for (const option of this.registeredFamilyOptions()) byFamily.set(option.family, option)\n return [...byFamily.values()].sort((a, b) => a.family.localeCompare(b.family))\n }\n\n preloadWebFontFamilies(): void {\n this.webFonts.preloadFamilies()\n }\n\n /** Reads a bundled font; concurrent loads of one file share a request. */\n fetchBundledFont(url: string): Promise<ArrayBuffer | null> {\n return this.bundled.fetch(url)\n }\n\n loadLocalFont(family: string, style = 'Regular'): Promise<ArrayBuffer | null> {\n return withHarfBuzz(this.findLocalOrBundledFont(family, style))\n }\n\n private async findLocalOrBundledFont(\n family: string,\n style = 'Regular'\n ): Promise<ArrayBuffer | null> {\n const loaded = this.loadedFamilies.get(`${family}|${style}`)\n if (loaded) {\n this.registerFontInCanvasKit(family, loaded)\n return loaded\n }\n return (\n (await this.loadInstalledFont(family, style)) ?? (await this.loadBundledFont(family, style))\n )\n }\n\n /** The face installed on this machine, from the host or the browser's local fonts. */\n private async loadInstalledFont(family: string, style: string): Promise<ArrayBuffer | null> {\n const hostBuffer = await this.loadHostFont(family, style)\n if (hostBuffer) return this.registerAndCache(family, style, hostBuffer, 'local')\n const localBuffer = await this.localFonts.read(family, style)\n return localBuffer ? this.registerAndCache(family, style, localBuffer, 'local') : null\n }\n\n private async loadBundledFont(family: string, style: string): Promise<ArrayBuffer | null> {\n const bundledURL = this.bundled.file(family, style)\n if (!bundledURL) return null\n try {\n const buffer = await this.fetchBundledFont(bundledURL)\n return buffer ? this.registerAndCache(family, style, buffer, 'bundled') : null\n } catch (e) {\n console.warn(`Bundled font load failed for \"${family}\" ${style}:`, e)\n return null\n }\n }\n\n loadRemoteFont(\n family: string,\n style = 'Regular',\n characters = '',\n signal?: AbortSignal\n ): Promise<ArrayBuffer | null> {\n return withHarfBuzz(this.downloadFont(family, style, characters, signal))\n }\n\n private async downloadFont(\n family: string,\n style = 'Regular',\n characters = '',\n signal?: AbortSignal\n ): Promise<ArrayBuffer | null> {\n signal?.throwIfAborted()\n if (typeof fetch === 'undefined') return null\n const coverage = this.remoteCoverage.get(`${family}|${style}`)\n if (\n characters &&\n coverage &&\n Array.from(characters).every((character) => coverage.has(character))\n ) {\n return this.loadedData(family, style)\n }\n try {\n const requestedCharacters = normalizedCoverageText(\n `${coverage ? Array.from(coverage).join('') : ''}${characters}`\n )\n const normalized = normalizeFontFamily(family)\n const families = normalized === family ? [family] : [family, normalized]\n const resolved = await this.webFonts.fetchFont(families, style, requestedCharacters, signal)\n if (!resolved || resolved.buffers.length === 0) return null\n const primary = resolved.buffers[0]\n // Providers serve faces by weight; a named face comes only from a variable file that has it.\n if (!namesWeight(style) && !hasNamedInstance(primary, style)) return null\n await this.writeDownloadedFont(family, style, primary, requestedCharacters)\n const registered = this.registerAndCache(family, style, primary, resolved.provider)\n const loadedCoverage = this.remoteCoverage.get(`${family}|${style}`) ?? new Set<string>()\n for (const character of requestedCharacters) loadedCoverage.add(character)\n this.remoteCoverage.set(`${family}|${style}`, loadedCoverage)\n for (const supplemental of resolved.buffers.slice(1)) {\n this.registerSupplemental(family, style, supplemental)\n }\n return registered\n } catch (e) {\n if (signal?.aborted) throw e\n console.warn(`Web font fetch failed for \"${family}\" ${style}:`, e)\n return null\n }\n }\n\n loadFont(\n family: string,\n style = 'Regular',\n characters = '',\n signal?: AbortSignal\n ): Promise<ArrayBuffer | null> {\n return withHarfBuzz(this.findFont(family, style, characters, signal))\n }\n\n private async findFont(\n family: string,\n style = 'Regular',\n characters = '',\n signal?: AbortSignal\n ): Promise<ArrayBuffer | null> {\n signal?.throwIfAborted()\n const loaded = this.loadedData(family, style)\n if (loaded) {\n this.registerFontInCanvasKit(family, loaded)\n return this.withRemoteCoverage(family, style, loaded, characters, signal)\n }\n // An installed face of the style comes first; otherwise a variable file the family already\n // loaded draws it.\n const installed = await this.loadInstalledFont(family, style)\n if (installed) return installed\n const shared = this.sharedVariableFace(family, style)\n if (shared) return this.withRemoteCoverage(family, style, shared, characters, signal)\n\n return (\n (await this.loadBundledFont(family, style)) ??\n (await this.loadCachedFont(family, style, characters)) ??\n (await this.loadRemoteFont(family, style, characters, signal))\n )\n }\n\n /**\n * `data`, or a web font fetched again with `characters` when it came from the web without them,\n * as a provider cuts a font down to the text it is asked for.\n */\n private async withRemoteCoverage(\n family: string,\n style: string,\n data: ArrayBuffer,\n characters: string,\n signal?: AbortSignal\n ): Promise<ArrayBuffer> {\n const remoteCoverage = this.remoteCoverage.get(`${family}|${style}`)\n const missingRemoteCoverage = Boolean(\n characters &&\n remoteCoverage &&\n Array.from(characters).some((character) => !remoteCoverage.has(character))\n )\n return missingRemoteCoverage\n ? ((await this.loadRemoteFont(family, style, characters, signal)) ?? data)\n : data\n }\n\n /**\n * A variable font the family loaded for another style in the same slant whose weight axis\n * reaches this style's weight, registered for this style too: one file draws every weight.\n */\n private sharedVariableFace(family: string, style: string): ArrayBuffer | null {\n const { weight, italic } = parseFontStyle(style)\n // A face named apart from its weight (\"Condensed Bold\") is drawn by a file that has it.\n const named = !namesWeight(style)\n for (const [key, data] of this.loadedFamilies) {\n if (!key.startsWith(`${family}|`)) continue\n if (parseFontStyle(key.slice(family.length + 1)).italic !== italic) continue\n if (named && !hasNamedInstance(data, style)) continue\n const wght = fontAxes(data)?.find((axis) => axis.tag === 'wght')\n if (!wght || (!named && (weight < wght.min || weight > wght.max))) continue\n const coverage = this.remoteCoverage.get(key)\n if (coverage) this.remoteCoverage.set(`${family}|${style}`, new Set(coverage))\n return this.registerAndCache(family, style, data, this.loadedFamilySources.get(key))\n }\n return null\n }\n\n async ensureNodeFont(family: string, weight: number): Promise<void> {\n await this.loadFont(family, faceLoadKey(weight))\n }\n\n /** Registers a font the caller already has, resolving once its outlines can be read. */\n async markLoaded(\n family: string,\n style: string,\n data: ArrayBuffer,\n source: FontLoadedSource = 'registered'\n ): Promise<void> {\n this.registerAndCache(family, style, data, source)\n await loadHarfBuzz()\n }\n\n loadedFontSource(family: string, style: string): FontLoadedSource | null {\n return this.loadedFamilySources.get(`${family}|${style}`) ?? null\n }\n\n /** Why the host could not load an installed face, when it reported a reason. */\n unavailableReason(family: string, style: string): FontUnavailableReason | null {\n return this.unavailableFaces.get(`${family}|${style}`) ?? null\n }\n\n isLoaded(family: string): boolean {\n return [...this.loadedFamilies.keys()].some((k) => k.startsWith(`${family}|`))\n }\n\n isStyleLoaded(family: string, style: string): boolean {\n return this.loadedFamilies.has(`${family}|${style}`)\n }\n\n remoteStyleNeedsCoverage(family: string, style: string, characters: readonly string[]): boolean {\n const coverage = this.remoteCoverage.get(`${family}|${style}`)\n return !!coverage && characters.some((character) => !coverage.has(character))\n }\n\n loadedData(family: string, style: string): ArrayBuffer | null {\n return this.loadedFamilies.get(`${family}|${style}`) ?? null\n }\n\n /**\n * The variation axes and named instances of a family's variable font, from a face it has loaded,\n * in the slant asked for where it has one: `null` when the faces it has loaded are static,\n * `undefined` when it has loaded none.\n */\n familyVariation(\n family: string,\n italic?: boolean\n ): { data: ArrayBuffer; axes: FontAxis[]; instances: NamedInstance[] } | null | undefined {\n let loaded = false\n let other: { data: ArrayBuffer; axes: FontAxis[]; instances: NamedInstance[] } | null = null\n for (const [key, data] of this.loadedFamilies) {\n if (!key.startsWith(`${family}|`)) continue\n loaded = true\n let variation = this.variations.get(data)\n if (variation === undefined) {\n const axes = fontAxes(data)\n variation = axes ? { axes, instances: namedInstances(data) } : null\n this.variations.set(data, variation)\n }\n if (!variation) continue\n const slant = parseFontStyle(key.slice(family.length + 1)).italic\n if (italic === undefined || slant === italic) return { data, ...variation }\n other ??= { data, ...variation }\n }\n return loaded ? other : undefined\n }\n\n /** Axis coordinates for `style` when the loaded face is a variable font, otherwise `null`. */\n namedInstanceVariations(family: string, style: string): FontVariation[] | null {\n const data = this.loadedData(family, style)\n if (!data) return null\n let byStyle = this.instanceVariations.get(data)\n if (!byStyle) {\n byStyle = new Map()\n this.instanceVariations.set(data, byStyle)\n }\n if (!byStyle.has(style)) byStyle.set(style, namedInstanceVariations(data, style))\n return byStyle.get(style) ?? null\n }\n\n /**\n * The family CanvasKit is asked for to draw `style` of `family`. A family loaded from one file\n * draws under its own name, with every coverage shard, as some CJK and Arabic faces need to\n * paint. Loaded from several files, such as a bundled static face beside a downloaded variable\n * one, CanvasKit would pick among them by the weight each file declares, which can tie; each\n * style then draws from the file loaded for it, registered with its shards under a name of the\n * file's own. So does a family a style's file was replaced in, whose old file CanvasKit would\n * keep drawing under the family's name. Only the style's coverage shards join its file under\n * that name: a file it replaced, such as a static face cached before a variable one was\n * fetched, could declare the weight asked for and be drawn instead of the file it is outlined\n * from, so it draws only as a fallback, from `renderShardFamilies`.\n */\n renderFamily(family: string, style: string): string {\n const data = this.loadedData(family, style)\n if (!data || (this.familyFileCount(family) < 2 && !this.replacedFamilies.has(family)))\n return family\n const name = this.fileFamily(family, data)\n const replaced = this.replacedFileData.get(`${family}|${style}`)\n for (const shard of this.supplementalFamilyData.get(`${family}|${style}`) ?? [])\n if (!replaced?.has(shard)) this.registerFontInCanvasKit(name, shard)\n return name\n }\n\n /**\n * The names CanvasKit draws the other files of `style` of `family` under, such as the coverage\n * shards of a web font split by unicode-range. CanvasKit draws a character only from the first\n * file registered under a name, so each shard is a family of its own that text falls back to.\n */\n renderShardFamilies(family: string, style: string): string[] {\n return (this.supplementalFamilyData.get(`${family}|${style}`) ?? []).map((data) =>\n this.fileFamily(family, data)\n )\n }\n\n /** The files of `style` of `family` after its own, such as the shards of a split web font. */\n shardData(family: string, style: string): readonly ArrayBuffer[] {\n return this.supplementalFamilyData.get(`${family}|${style}`) ?? []\n }\n\n /** The name one file of `family` is registered under on its own. */\n private fileFamily(family: string, data: ArrayBuffer): string {\n let name = this.fileFamilies.get(data)\n if (!name) {\n name = fontFaceRenderFamily(family, `file ${this.fileFamilies.size + 1}`)\n this.fileFamilies.set(data, name)\n }\n this.registerFontInCanvasKit(name, data)\n return name\n }\n\n /** How many files the family's loaded styles come from. */\n private familyFileCount(family: string): number {\n const files = new Set<ArrayBuffer>()\n for (const [key, data] of this.loadedFamilies) if (key.startsWith(`${family}|`)) files.add(data)\n return files.size\n }\n\n collectFontKeys(graph: SceneGraph, nodeIds: string[]): Array<[string, string]> {\n return collectGraphFontKeys(graph, nodeIds)\n }\n\n async ensureCJKFallback(): Promise<string[]> {\n if (this.cjkFallbackFamilies.length > 0) return this.cjkFallbackFamilies\n if (this.cjkFallbackPromise) return this.cjkFallbackPromise\n\n this.cjkFallbackPromise = this.ensureFallbackFamilies('cjk', this.cjkFallbackFamilies)\n return this.cjkFallbackPromise\n }\n\n getCJKFallbackFamilies(): string[] {\n return this.cjkFallbackFamilies\n }\n\n setCJKFallbackFamily(family: string): void {\n if (!this.cjkFallbackFamilies.includes(family)) {\n this.cjkFallbackFamilies.push(family)\n }\n }\n\n async ensureArabicFallback(): Promise<string[]> {\n if (this.arabicFallbackFamilies.length > 0) return this.arabicFallbackFamilies\n if (this.arabicFallbackPromise) return this.arabicFallbackPromise\n\n this.arabicFallbackPromise = this.ensureFallbackFamilies('arabic', this.arabicFallbackFamilies)\n return this.arabicFallbackPromise\n }\n\n ensureFallbackPack(\n scripts: FontFallbackScript[] = ['cjk', 'arabic'],\n characters = '',\n signal?: AbortSignal\n ): Promise<Partial<Record<FontFallbackScript, string[]>>> {\n return withHarfBuzz(this.loadFallbackPack(scripts, characters, signal))\n }\n\n private async loadFallbackPack(\n scripts: FontFallbackScript[] = ['cjk', 'arabic'],\n characters = '',\n signal?: AbortSignal\n ): Promise<Partial<Record<FontFallbackScript, string[]>>> {\n signal?.throwIfAborted()\n const result: Partial<Record<FontFallbackScript, string[]>> = {}\n await Promise.all(\n scripts.map(async (script) => {\n signal?.throwIfAborted()\n const target = script === 'arabic' ? this.arabicFallbackFamilies : this.cjkFallbackFamilies\n if (signal) {\n result[script] = await this.ensureFallbackFamilies(script, target, characters, signal)\n } else if (script === 'arabic' && !characters) {\n result[script] = await this.ensureArabicFallback()\n } else if (script === 'cjk' && !characters) {\n result[script] = await this.ensureCJKFallback()\n } else {\n result[script] = await this.ensureFallbackFamilies(script, target, characters)\n }\n })\n )\n signal?.throwIfAborted()\n return result\n }\n\n getArabicFallbackFamilies(): string[] {\n return this.arabicFallbackFamilies\n }\n\n setArabicFallbackFamily(family: string): void {\n if (!this.arabicFallbackFamilies.includes(family)) {\n this.arabicFallbackFamilies.push(family)\n }\n }\n\n private async ensureFallbackFamilies(\n script: FontFallbackScript,\n targetFamilies: string[],\n characters = '',\n signal?: AbortSignal\n ): Promise<string[]> {\n signal?.throwIfAborted()\n const manifest = fontFallbackEntry(script, this.fallbackUserAgent)\n\n for (const family of manifest.localFamilies) {\n signal?.throwIfAborted()\n const buffer =\n (await this.loadHostFont(family, 'Regular')) ?? (await this.localFonts.read(family))\n signal?.throwIfAborted()\n if (\n buffer &&\n this.registerAndCache(family, 'Regular', buffer, 'fallback') &&\n !targetFamilies.includes(family)\n ) {\n targetFamilies.push(family)\n }\n }\n\n if (targetFamilies.length === 0 || characters) {\n const results = await Promise.allSettled(\n manifest.remoteFamilies.map(async (family) => {\n signal?.throwIfAborted()\n const data = await this.loadRemoteFont(family, 'Regular', characters, signal)\n signal?.throwIfAborted()\n return data ? family : null\n })\n )\n for (const result of results) {\n if (\n result.status === 'fulfilled' &&\n result.value &&\n !targetFamilies.includes(result.value)\n ) {\n targetFamilies.push(result.value)\n }\n }\n }\n\n return targetFamilies\n }\n\n private loadHostFont(family: string, style: string): Promise<ArrayBuffer | null> {\n const loader = this.hostFontLoader\n if (!loader) return Promise.resolve(null)\n return this.hostFontRequests.read(`${family}|${style}`, () =>\n this.readHostFont(loader, family, style)\n )\n }\n\n private async readHostFont(\n loader: HostFontLoader,\n family: string,\n style: string\n ): Promise<ArrayBuffer | null> {\n const key = `${family}|${style}`\n try {\n const data = await loader(family, style)\n // A read that started under a loader the host has replaced must not register its bytes.\n if (this.hostFontLoader !== loader) return null\n if (data) this.unavailableFaces.delete(key)\n return data\n } catch (e) {\n // A failure from a replaced loader says nothing about the face the new loader serves.\n if (this.hostFontLoader !== loader) return null\n if (e instanceof UnsupportedFontFormatError) {\n this.unavailableFaces.set(key, e.reason)\n return null\n }\n console.warn(`Host fallback font load failed for \"${family}\" ${style}:`, e)\n return null\n }\n }\n\n private async readDownloadedFont(\n family: string,\n style: string,\n characters = ''\n ): Promise<ArrayBuffer | null> {\n if (!this.downloadedFontCache) return null\n try {\n return await this.downloadedFontCache.read(family, style, characters)\n } catch (e) {\n console.warn(`Downloaded font cache read failed for \"${family}\" ${style}:`, e)\n return null\n }\n }\n\n private async writeDownloadedFont(\n family: string,\n style: string,\n data: ArrayBuffer,\n characters = ''\n ): Promise<void> {\n if (!this.downloadedFontCache) return\n try {\n await this.downloadedFontCache.write(family, style, data, characters)\n } catch (e) {\n console.warn(`Downloaded font cache write failed for \"${family}\" ${style}:`, e)\n }\n }\n\n /** Adds `buffer` to the files of `style` after its own, returning the copy of it they keep. */\n private registerSupplemental(family: string, style: string, buffer: ArrayBuffer): ArrayBuffer {\n const key = `${family}|${style}`\n const supplemental = this.supplementalFamilyData.get(key) ?? []\n const kept = supplemental.find((file) => sameFontFile(file, buffer))\n if (kept) return kept\n supplemental.push(buffer)\n this.supplementalFamilyData.set(key, supplemental)\n this.registerFontInCanvasKit(family, buffer)\n this.registerFontInBrowser(family, style, buffer)\n return buffer\n }\n\n private registerAndCache(\n family: string,\n style: string,\n buffer: ArrayBuffer,\n source?: FontLoadedSource\n ): ArrayBuffer | null {\n const key = `${family}|${style}`\n const existing = this.loadedFamilies.get(key)\n if (existing && sameFontFile(existing, buffer)) {\n if (source) this.loadedFamilySources.set(key, source)\n this.registerFontInCanvasKit(family, existing)\n return existing\n }\n if (existing) {\n const replaced = this.replacedFileData.get(key) ?? new Set<ArrayBuffer>()\n replaced.add(this.registerSupplemental(family, style, existing))\n this.replacedFileData.set(key, replaced)\n this.replacedFamilies.add(family)\n }\n this.loadedFamilies.set(key, buffer)\n if (source) this.loadedFamilySources.set(key, source)\n this.registerFontInCanvasKit(family, buffer)\n this.registerFontInBrowser(family, style, buffer)\n for (const listener of this.faceListeners) listener(family, style)\n return buffer\n }\n\n /**\n * Calls the listener with each face once its file is registered, by whatever path it loaded:\n * a paste, a script, a retry, or the renderer.\n */\n onFaceLoaded(listener: (family: string, style: string) => void): () => void {\n this.faceListeners.add(listener)\n return () => this.faceListeners.delete(listener)\n }\n\n private registerFontInCanvasKit(family: string, data: ArrayBuffer): boolean {\n let registered = false\n for (const provider of this.fontProviders) {\n registered = this.registerFontInProvider(provider, family, data) || registered\n }\n return registered\n }\n\n private registerFontInProvider(\n provider: TypefaceFontProvider,\n family: string,\n data: ArrayBuffer\n ): boolean {\n if (data.byteLength < 4) return false\n const registrations = this.providerRegistrations.get(provider) ?? new Map()\n const registeredData = registrations.get(family)\n if (registeredData?.has(data)) return true\n try {\n provider.registerFont(data, family)\n const familyRegistrations = registeredData ?? new Set<ArrayBuffer>()\n familyRegistrations.add(data)\n registrations.set(family, familyRegistrations)\n this.providerRegistrations.set(provider, registrations)\n this.registrationGeneration++\n return true\n } catch {\n return false\n }\n }\n\n /** Makes a face available to the page's own text, such as fields over canvas labels. */\n registerFontInBrowser(family: string, style: string, data: ArrayBuffer) {\n if (!IS_BROWSER) return\n const weight = styleToWeight(style)\n const italic = style.toLowerCase().includes('italic') ? 'italic' : 'normal'\n const face = new FontFace(family, data, {\n weight: String(weight),\n style: italic\n })\n face\n .load()\n .then(() => document.fonts.add(face))\n .catch(() => {\n console.warn(`Failed to load font \"${family}\" (${style})`)\n })\n }\n}\n\nexport const fontManager = new FontManager()\n"],"mappings":";;;;;;;;;;;;;;AA6CA,IAAa,cAAb,MAAyB;CACvB,iCAAyB,IAAI,IAAyB;CACtD,sCAA8B,IAAI,IAA8B;CAChE,mCAA2B,IAAI,IAAmC;CAClE,yCAAiC,IAAI,IAA2B;;CAEhE,+BAAuB,IAAI,IAAyB;;;;;;CAMpD,mCAA2B,IAAI,IAAY;;;;;;CAM3C,mCAA2B,IAAI,IAA8B;CAC7D,iCAAyB,IAAI,IAAyB;CACtD,qCAA6B,IAAI,QAA0D;CAC3F,6BAAqB,IAAI,QAGvB;CACF,iCAAyB,IAAI,IAAY;CACzC,eAAoD;CACpD,gCAAwB,IAAI,IAA0B;CACtD,qCAA6B,IAAI,QAAyC;CAC1E,yBAAiC;CACjC,wCAAgC,IAAI,QAA6D;CACjG,sBAA0D;CAC1D;CACA,iBAAgD;CAChD,mBAAoC,IAAI,YAAY;CACpD,WAAmB,IAAI,gBAAgB;CACvC,gCAAiC,IAAI,IAA6C;CAClF,UAA2B,IAAI,aAAa;CAC5C,aAA8B,IAAI,WAAW;CAC7C,QAAyB,IAAI,kBAAkB;EAC7C,kBAAkB,KA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gC,QAAgB,MAA4B;EAC1E,IAAI,aAAa;EACjB,KAAK,MAAM,YAAY,KAAK,eAC1B,aAAa,KAAK,uBAAuB,UAAU,QAAQ,IAAI,KAAK;EAEtE,OAAO;CACT;CAEA,uBACE,UACA,QACA,MACS;EACT,IAAI,KAAK,aAAa,GAAG,OAAO;EAChC,MAAM,gBAAgB,KAAK,sBAAsB,IAAI,QAAQ,qBAAK,IAAI,IAAI;EAC1E,MAAM,iBAAiB,cAAc,IAAI,MAAM;EAC/C,IAAI,gBAAgB,IAAI,IAAI,GAAG,OAAO;EACtC,IAAI;GACF,SAAS,aAAa,MAAM,MAAM;GAClC,MAAM,sBAAsB,kCAAkB,IAAI,IAAiB;GACnE,oBAAoB,IAAI,IAAI;GAC5B,cAAc,IAAI,QAAQ,mBAAmB;GAC7C,KAAK,sBAAsB,IAAI,UAAU,aAAa;GACtD,KAAK;GACL,OAAO;EACT,QAAQ;GACN,OAAO;EACT;CACF;;CAGA,sBAAsB,QAAgB,OAAe,MAAmB;EACtE,IAAI,CAAC,YAAY;EACjB,MAAM,SAAS,cAAc,KAAK;EAClC,MAAM,SAAS,MAAM,YAAY,CAAC,CAAC,SAAS,QAAQ,IAAI,WAAW;EACnE,MAAM,OAAO,IAAI,SAAS,QAAQ,MAAM;GACtC,QAAQ,OAAO,MAAM;GACrB,OAAO;EACT,CAAC;EACD,KACG,KAAK,CAAC,CACN,WAAW,SAAS,MAAM,IAAI,IAAI,CAAC,CAAC,CACpC,YAAY;GACX,QAAQ,KAAK,wBAAwB,OAAO,KAAK,MAAM,EAAE;EAC3D,CAAC;CACL;AACF;AAEA,MAAa,cAAc,IAAI,YAAY"}
|
|
1
|
+
{"version":3,"file":"manager.js","names":[],"sources":["../../../src/text/font/manager.ts"],"sourcesContent":["/* eslint-disable max-lines -- font loading and registration share FontManager lifecycle state */\n\nimport type { CanvasKit, TypefaceFontProvider } from 'canvaskit-wasm'\nimport { uniq } from 'es-toolkit'\n\nimport type { FontVariation, SceneGraph } from '@pairdraw/scene-graph'\nimport {\n faceLoadKey,\n namesWeight,\n normalizeFontFamily,\n parseFontStyle,\n styleToWeight\n} from '@pairdraw/scene-graph/font-style'\n\nimport { DEFAULT_FONT_FAMILY, IS_BROWSER } from '#core/constants'\nimport {\n fontFallbackEntry,\n LETTER_FALLBACK_SCRIPTS,\n type FontFallbackScript,\n type LetterFallbackScript\n} from '#core/text/fallbacks'\nimport { BundledFonts, type BundledFontLocator } from '#core/text/font/bundled'\nimport { FamilyFaceCatalog, type HostFontFamily } from '#core/text/font/catalog'\nimport { fontFaceRenderFamily, type FamilyFace } from '#core/text/font/faces'\nimport { loadHarfBuzz } from '#core/text/font/harfbuzz'\nimport { LocalFonts } from '#core/text/font/local'\nimport { sameFontFile, SharedReads, withHarfBuzz } from '#core/text/font/reads'\nimport {\n UnsupportedFontFormatError,\n type DownloadedFontCache,\n type FontFamilyOption,\n type FontInfo,\n type FontLoadedSource,\n type FontUnavailableReason,\n type HostFontLoader,\n type LocalFontAccessState\n} from '#core/text/font/sources'\nimport {\n fontAxes,\n hasNamedInstance,\n namedInstances,\n namedInstanceVariations,\n type FontAxis,\n type NamedInstance\n} from '#core/text/font/variation'\nimport { collectGraphFontKeys } from '#core/text/requirements/collect'\nimport { normalizedCoverageText, WebFontResolver } from '#core/text/web-font/resolver'\nimport type { WebFontFetch, WebFontProviderId } from '#core/text/web-font/resolver'\n\nexport type { BundledFontLocator } from '#core/text/font/bundled'\n\nexport class FontManager {\n private loadedFamilies = new Map<string, ArrayBuffer>()\n private loadedFamilySources = new Map<string, FontLoadedSource>()\n private unavailableFaces = new Map<string, FontUnavailableReason>()\n private supplementalFamilyData = new Map<string, ArrayBuffer[]>()\n /** The name each file of a family loaded from several files is registered under. */\n private fileFamilies = new Map<ArrayBuffer, string>()\n /**\n * Families a style's file was replaced in, such as a web font fetched again for more characters.\n * The old file stays registered first under the family's name, and CanvasKit draws with the\n * first file it has for a style, so these draw from each file's own name.\n */\n private replacedFamilies = new Set<string>()\n /**\n * The files each style's own file replaced, by `family|style`. They stay its fallbacks under\n * names of their own, never beside the file that replaced them, where CanvasKit would pick\n * between the two by the weight each declares.\n */\n private replacedFileData = new Map<string, Set<ArrayBuffer>>()\n private remoteCoverage = new Map<string, Set<string>>()\n private instanceVariations = new WeakMap<ArrayBuffer, Map<string, FontVariation[] | null>>()\n private variations = new WeakMap<\n ArrayBuffer,\n { axes: FontAxis[]; instances: NamedInstance[] } | null\n >()\n private blockedNodeIds = new Set<string>()\n private fontProvider: TypefaceFontProvider | null = null\n private fontProviders = new Set<TypefaceFontProvider>()\n private providerCanvasKits = new WeakMap<TypefaceFontProvider, CanvasKit>()\n private registrationGeneration = 0\n private providerRegistrations = new WeakMap<TypefaceFontProvider, Map<string, Set<ArrayBuffer>>>()\n private downloadedFontCache: DownloadedFontCache | null = null\n private fallbackUserAgent: string | undefined\n private hostFontLoader: HostFontLoader | null = null\n private readonly hostFontRequests = new SharedReads()\n private webFonts = new WebFontResolver()\n private readonly faceListeners = new Set<(family: string, style: string) => void>()\n private readonly bundled = new BundledFonts()\n private readonly localFonts = new LocalFonts()\n private readonly faces = new FamilyFaceCatalog({\n localFonts: () => this.localFonts.list(),\n webFaces: (family) => this.webFonts.familyFaces(family),\n bundledStyles: (family) => this.bundled.styles(family)\n })\n private cjkFallbackFamilies: string[] = []\n private cjkFallbackPromise: Promise<string[]> | null = null\n /** The fallbacks of each script written in letters: Arabic, Hebrew, Thai, Devanagari. */\n private readonly letterFallbackFamilies = new Map<LetterFallbackScript, string[]>(\n LETTER_FALLBACK_SCRIPTS.map((script) => [script, []])\n )\n private readonly letterFallbackPromises = new Map<LetterFallbackScript, Promise<string[]>>()\n\n attachProvider(canvasKit: CanvasKit, provider: TypefaceFontProvider): void {\n this.fontProviders.add(provider)\n this.providerCanvasKits.set(provider, canvasKit)\n this.fontProvider = provider\n this.providerRegistrations.set(provider, new Map())\n this.registrationGeneration++\n for (const [cacheKey, data] of this.loadedFamilies) {\n const separator = cacheKey.indexOf('|')\n const family = cacheKey.slice(0, separator)\n this.registerFontInProvider(provider, family, data)\n for (const supplemental of this.supplementalFamilyData.get(cacheKey) ?? []) {\n this.registerFontInProvider(provider, family, supplemental)\n }\n }\n }\n\n detachProvider(provider: TypefaceFontProvider): void {\n this.fontProviders.delete(provider)\n this.providerRegistrations.delete(provider)\n if (this.fontProvider === provider) {\n this.fontProvider = Array.from(this.fontProviders).at(-1) ?? null\n }\n }\n\n provider(): TypefaceFontProvider | null {\n return this.fontProvider\n }\n\n /** The latest attached provider made by `canvasKit`; another build's provider cannot shape with it. */\n providerFor(canvasKit: CanvasKit): TypefaceFontProvider | null {\n return (\n Array.from(this.fontProviders)\n .reverse()\n .find((provider) => this.providerCanvasKits.get(provider) === canvasKit) ?? null\n )\n }\n\n generation(): number {\n return this.registrationGeneration\n }\n\n blockNodesUntilFontsResolve(nodeIds: readonly string[]): void {\n for (const nodeId of nodeIds) this.blockedNodeIds.add(nodeId)\n }\n\n unblockNodes(nodeIds: readonly string[]): void {\n for (const nodeId of nodeIds) this.blockedNodeIds.delete(nodeId)\n }\n\n isNodeBlocked(nodeId: string): boolean {\n return this.blockedNodeIds.has(nodeId)\n }\n\n localAccessState(): LocalFontAccessState {\n return this.localFonts.accessState()\n }\n\n setDownloadedFontCache(cache: DownloadedFontCache | null): void {\n this.downloadedFontCache = cache\n }\n\n setFallbackUserAgent(userAgent: string | undefined): void {\n this.fallbackUserAgent = userAgent\n }\n\n setHostFontLoader(loader: HostFontLoader | null): void {\n this.hostFontLoader = loader\n this.hostFontRequests.clear()\n }\n\n /** Lets a host that bundles `@pairdraw/core/assets` itself say where each file ended up. */\n setBundledFontLocator(locate: BundledFontLocator | null): void {\n this.bundled.setLocator(locate)\n }\n\n setOnlineFontProviders(settings: Partial<Record<WebFontProviderId, boolean>>): void {\n this.webFonts.setEnabled(settings)\n this.faces.forget()\n }\n\n /** The system fonts a desktop host lists, by family, with the style names of their faces. */\n setHostFontCatalog(fonts: readonly HostFontFamily[]): void {\n this.faces.setHostCatalog(fonts)\n }\n\n /**\n * The faces a family has: its installed fonts', else a web provider's, else the bundled ones;\n * `null` when nothing says, so a caller offers every weight.\n */\n familyFaces(family: string): Promise<FamilyFace[] | null> {\n return this.faces.faces(family)\n }\n\n /** The faces `familyFaces` found for a family, once it has; `undefined` before. */\n loadedFamilyFaces(family: string): FamilyFace[] | null | undefined {\n return this.faces.foundFaces(family)\n }\n\n /** Whether a family has this face, or nothing found so far says it has not. */\n offersFace(family: string, weight: number, italic: boolean): boolean {\n return this.faces.offersFace(family, weight, italic)\n }\n\n /** Calls the listener whenever the faces found so far are forgotten. */\n onFamilyFacesReset(listener: () => void): () => void {\n return this.faces.onReset(listener)\n }\n\n /** The faces known for a family without asking a provider; see {@link FamilyFaceCatalog}. */\n familyFacesSync(family: string): FamilyFace[] | null {\n return this.faces.facesSync(family)\n }\n\n setWebFontFetch(fetcher: WebFontFetch | null): void {\n this.webFonts.setRemoteFetch(fetcher)\n }\n\n resetWebFontFailures(family?: string, style?: string): void {\n this.webFonts.resetFailures(family, style)\n }\n\n enabledOnlineFontProviders(): WebFontProviderId[] {\n return this.webFonts.enabledProviders()\n }\n\n loadCachedFont(family: string, style = 'Regular', characters = ''): Promise<ArrayBuffer | null> {\n return withHarfBuzz(this.restoreCachedFont(family, style, characters))\n }\n\n private async restoreCachedFont(\n family: string,\n style = 'Regular',\n characters = ''\n ): Promise<ArrayBuffer | null> {\n const cached = await this.readDownloadedFont(family, style, characters)\n if (!cached) return null\n const key = `${family}|${style}`\n const loadedCoverage = this.remoteCoverage.get(key) ?? new Set<string>()\n for (const character of normalizedCoverageText(characters)) loadedCoverage.add(character)\n this.remoteCoverage.set(key, loadedCoverage)\n return this.registerAndCache(family, style, cached, 'cache')\n }\n\n async requestLocalFontAccess(): Promise<FontInfo[]> {\n const fonts = await this.localFonts.requestAccess()\n this.faces.forget()\n return fonts\n }\n\n async listFamilies(): Promise<string[]> {\n const options = await this.listFamilyOptions()\n return options.map((option) => option.family)\n }\n\n /**\n * The families loaded from font files, such as a document's fonts, which no catalog lists:\n * installed, web, and bundled sources name their families without the files. A registered\n * family keeps its `document` source however it loads next, so the picker shows where the\n * file it draws from came from.\n */\n registeredFamilyOptions(): FontFamilyOption[] {\n const options: FontFamilyOption[] = []\n const seen = new Set<string>()\n for (const key of this.loadedFamilies.keys()) {\n const family = key.slice(0, key.lastIndexOf('|'))\n if (seen.has(family) || this.loadedFamilySources.get(key) !== 'registered') continue\n seen.add(family)\n options.push({ family, source: 'document' })\n }\n return options.sort((a, b) => a.family.localeCompare(b.family))\n }\n\n async listFamilyOptions(): Promise<FontFamilyOption[]> {\n const fonts = this.localFonts.list() ?? (await this.requestLocalFontAccess())\n const webFontFamilies = await Promise.all(\n this.enabledOnlineFontProviders().map(async (provider) => ({\n provider,\n families: await this.webFonts.listFamilies(provider)\n }))\n )\n const byFamily = new Map<string, FontFamilyOption>()\n byFamily.set(DEFAULT_FONT_FAMILY, { family: DEFAULT_FONT_FAMILY, source: 'bundled' })\n for (const { provider, families } of webFontFamilies) {\n for (const family of families) {\n if (!byFamily.has(family)) byFamily.set(family, { family, source: provider })\n }\n }\n for (const font of fonts) byFamily.set(font.family, { family: font.family, source: 'local' })\n // A family loaded from a font file draws from that file, whatever the catalogs say.\n for (const option of this.registeredFamilyOptions()) byFamily.set(option.family, option)\n return [...byFamily.values()].sort((a, b) => a.family.localeCompare(b.family))\n }\n\n preloadWebFontFamilies(): void {\n this.webFonts.preloadFamilies()\n }\n\n /** Reads a bundled font; concurrent loads of one file share a request. */\n fetchBundledFont(url: string): Promise<ArrayBuffer | null> {\n return this.bundled.fetch(url)\n }\n\n loadLocalFont(family: string, style = 'Regular'): Promise<ArrayBuffer | null> {\n return withHarfBuzz(this.findLocalOrBundledFont(family, style))\n }\n\n private async findLocalOrBundledFont(\n family: string,\n style = 'Regular'\n ): Promise<ArrayBuffer | null> {\n const loaded = this.loadedFamilies.get(`${family}|${style}`)\n if (loaded) {\n this.registerFontInCanvasKit(family, loaded)\n return loaded\n }\n return (\n (await this.loadInstalledFont(family, style)) ?? (await this.loadBundledFont(family, style))\n )\n }\n\n /** The face installed on this machine, from the host or the browser's local fonts. */\n private async loadInstalledFont(family: string, style: string): Promise<ArrayBuffer | null> {\n const hostBuffer = await this.loadHostFont(family, style)\n if (hostBuffer) return this.registerAndCache(family, style, hostBuffer, 'local')\n const localBuffer = await this.localFonts.read(family, style)\n return localBuffer ? this.registerAndCache(family, style, localBuffer, 'local') : null\n }\n\n private async loadBundledFont(family: string, style: string): Promise<ArrayBuffer | null> {\n const bundledURL = this.bundled.file(family, style)\n if (!bundledURL) return null\n try {\n const buffer = await this.fetchBundledFont(bundledURL)\n return buffer ? this.registerAndCache(family, style, buffer, 'bundled') : null\n } catch (e) {\n console.warn(`Bundled font load failed for \"${family}\" ${style}:`, e)\n return null\n }\n }\n\n loadRemoteFont(\n family: string,\n style = 'Regular',\n characters = '',\n signal?: AbortSignal\n ): Promise<ArrayBuffer | null> {\n return withHarfBuzz(this.downloadFont(family, style, characters, signal))\n }\n\n private async downloadFont(\n family: string,\n style = 'Regular',\n characters = '',\n signal?: AbortSignal\n ): Promise<ArrayBuffer | null> {\n signal?.throwIfAborted()\n if (typeof fetch === 'undefined') return null\n const coverage = this.remoteCoverage.get(`${family}|${style}`)\n if (\n characters &&\n coverage &&\n Array.from(characters).every((character) => coverage.has(character))\n ) {\n return this.loadedData(family, style)\n }\n try {\n const requestedCharacters = normalizedCoverageText(\n `${coverage ? Array.from(coverage).join('') : ''}${characters}`\n )\n const normalized = normalizeFontFamily(family)\n const families = normalized === family ? [family] : [family, normalized]\n const resolved = await this.webFonts.fetchFont(families, style, requestedCharacters, signal)\n if (!resolved || resolved.buffers.length === 0) return null\n const primary = resolved.buffers[0]\n // Providers serve faces by weight; a named face comes only from a variable file that has it.\n if (!namesWeight(style) && !hasNamedInstance(primary, style)) return null\n await this.writeDownloadedFont(family, style, primary, requestedCharacters)\n const registered = this.registerAndCache(family, style, primary, resolved.provider)\n const loadedCoverage = this.remoteCoverage.get(`${family}|${style}`) ?? new Set<string>()\n for (const character of requestedCharacters) loadedCoverage.add(character)\n this.remoteCoverage.set(`${family}|${style}`, loadedCoverage)\n for (const supplemental of resolved.buffers.slice(1)) {\n this.registerSupplemental(family, style, supplemental)\n }\n return registered\n } catch (e) {\n if (signal?.aborted) throw e\n console.warn(`Web font fetch failed for \"${family}\" ${style}:`, e)\n return null\n }\n }\n\n loadFont(\n family: string,\n style = 'Regular',\n characters = '',\n signal?: AbortSignal\n ): Promise<ArrayBuffer | null> {\n return withHarfBuzz(this.findFont(family, style, characters, signal))\n }\n\n private async findFont(\n family: string,\n style = 'Regular',\n characters = '',\n signal?: AbortSignal\n ): Promise<ArrayBuffer | null> {\n signal?.throwIfAborted()\n const loaded = this.loadedData(family, style)\n if (loaded) {\n this.registerFontInCanvasKit(family, loaded)\n return this.withRemoteCoverage(family, style, loaded, characters, signal)\n }\n // An installed face of the style comes first; otherwise a variable file the family already\n // loaded draws it.\n const installed = await this.loadInstalledFont(family, style)\n if (installed) return installed\n const shared = this.sharedVariableFace(family, style)\n if (shared) return this.withRemoteCoverage(family, style, shared, characters, signal)\n\n return (\n (await this.loadBundledFont(family, style)) ??\n (await this.loadCachedFont(family, style, characters)) ??\n (await this.loadRemoteFont(family, style, characters, signal))\n )\n }\n\n /**\n * `data`, or a web font fetched again with `characters` when it came from the web without them,\n * as a provider cuts a font down to the text it is asked for.\n */\n private async withRemoteCoverage(\n family: string,\n style: string,\n data: ArrayBuffer,\n characters: string,\n signal?: AbortSignal\n ): Promise<ArrayBuffer> {\n const remoteCoverage = this.remoteCoverage.get(`${family}|${style}`)\n const missingRemoteCoverage = Boolean(\n characters &&\n remoteCoverage &&\n Array.from(characters).some((character) => !remoteCoverage.has(character))\n )\n return missingRemoteCoverage\n ? ((await this.loadRemoteFont(family, style, characters, signal)) ?? data)\n : data\n }\n\n /**\n * A variable font the family loaded for another style in the same slant whose weight axis\n * reaches this style's weight, registered for this style too: one file draws every weight.\n */\n private sharedVariableFace(family: string, style: string): ArrayBuffer | null {\n const { weight, italic } = parseFontStyle(style)\n // A face named apart from its weight (\"Condensed Bold\") is drawn by a file that has it.\n const named = !namesWeight(style)\n for (const [key, data] of this.loadedFamilies) {\n if (!key.startsWith(`${family}|`)) continue\n if (parseFontStyle(key.slice(family.length + 1)).italic !== italic) continue\n if (named && !hasNamedInstance(data, style)) continue\n const wght = fontAxes(data)?.find((axis) => axis.tag === 'wght')\n if (!wght || (!named && (weight < wght.min || weight > wght.max))) continue\n const coverage = this.remoteCoverage.get(key)\n if (coverage) this.remoteCoverage.set(`${family}|${style}`, new Set(coverage))\n return this.registerAndCache(family, style, data, this.loadedFamilySources.get(key))\n }\n return null\n }\n\n async ensureNodeFont(family: string, weight: number): Promise<void> {\n await this.loadFont(family, faceLoadKey(weight))\n }\n\n /** Registers a font the caller already has, resolving once its outlines can be read. */\n async markLoaded(\n family: string,\n style: string,\n data: ArrayBuffer,\n source: FontLoadedSource = 'registered'\n ): Promise<void> {\n this.registerAndCache(family, style, data, source)\n await loadHarfBuzz()\n }\n\n loadedFontSource(family: string, style: string): FontLoadedSource | null {\n return this.loadedFamilySources.get(`${family}|${style}`) ?? null\n }\n\n /** Why the host could not load an installed face, when it reported a reason. */\n unavailableReason(family: string, style: string): FontUnavailableReason | null {\n return this.unavailableFaces.get(`${family}|${style}`) ?? null\n }\n\n isLoaded(family: string): boolean {\n return [...this.loadedFamilies.keys()].some((k) => k.startsWith(`${family}|`))\n }\n\n isStyleLoaded(family: string, style: string): boolean {\n return this.loadedFamilies.has(`${family}|${style}`)\n }\n\n remoteStyleNeedsCoverage(family: string, style: string, characters: readonly string[]): boolean {\n const coverage = this.remoteCoverage.get(`${family}|${style}`)\n return !!coverage && characters.some((character) => !coverage.has(character))\n }\n\n loadedData(family: string, style: string): ArrayBuffer | null {\n return this.loadedFamilies.get(`${family}|${style}`) ?? null\n }\n\n /**\n * The variation axes and named instances of a family's variable font, from a face it has loaded,\n * in the slant asked for where it has one: `null` when the faces it has loaded are static,\n * `undefined` when it has loaded none.\n */\n familyVariation(\n family: string,\n italic?: boolean\n ): { data: ArrayBuffer; axes: FontAxis[]; instances: NamedInstance[] } | null | undefined {\n let loaded = false\n let other: { data: ArrayBuffer; axes: FontAxis[]; instances: NamedInstance[] } | null = null\n for (const [key, data] of this.loadedFamilies) {\n if (!key.startsWith(`${family}|`)) continue\n loaded = true\n let variation = this.variations.get(data)\n if (variation === undefined) {\n const axes = fontAxes(data)\n variation = axes ? { axes, instances: namedInstances(data) } : null\n this.variations.set(data, variation)\n }\n if (!variation) continue\n const slant = parseFontStyle(key.slice(family.length + 1)).italic\n if (italic === undefined || slant === italic) return { data, ...variation }\n other ??= { data, ...variation }\n }\n return loaded ? other : undefined\n }\n\n /** Axis coordinates for `style` when the loaded face is a variable font, otherwise `null`. */\n namedInstanceVariations(family: string, style: string): FontVariation[] | null {\n const data = this.loadedData(family, style)\n if (!data) return null\n let byStyle = this.instanceVariations.get(data)\n if (!byStyle) {\n byStyle = new Map()\n this.instanceVariations.set(data, byStyle)\n }\n if (!byStyle.has(style)) byStyle.set(style, namedInstanceVariations(data, style))\n return byStyle.get(style) ?? null\n }\n\n /**\n * The family CanvasKit is asked for to draw `style` of `family`. A family loaded from one file\n * draws under its own name, with every coverage shard, as some CJK and Arabic faces need to\n * paint. Loaded from several files, such as a bundled static face beside a downloaded variable\n * one, CanvasKit would pick among them by the weight each file declares, which can tie; each\n * style then draws from the file loaded for it, registered with its shards under a name of the\n * file's own. So does a family a style's file was replaced in, whose old file CanvasKit would\n * keep drawing under the family's name. Only the style's coverage shards join its file under\n * that name: a file it replaced, such as a static face cached before a variable one was\n * fetched, could declare the weight asked for and be drawn instead of the file it is outlined\n * from, so it draws only as a fallback, from `renderShardFamilies`.\n */\n renderFamily(family: string, style: string): string {\n const data = this.loadedData(family, style)\n if (!data || (this.familyFileCount(family) < 2 && !this.replacedFamilies.has(family)))\n return family\n const name = this.fileFamily(family, data)\n const replaced = this.replacedFileData.get(`${family}|${style}`)\n for (const shard of this.supplementalFamilyData.get(`${family}|${style}`) ?? [])\n if (!replaced?.has(shard)) this.registerFontInCanvasKit(name, shard)\n return name\n }\n\n /**\n * The names CanvasKit draws the other files of `style` of `family` under, such as the coverage\n * shards of a web font split by unicode-range. CanvasKit draws a character only from the first\n * file registered under a name, so each shard is a family of its own that text falls back to.\n */\n renderShardFamilies(family: string, style: string): string[] {\n return (this.supplementalFamilyData.get(`${family}|${style}`) ?? []).map((data) =>\n this.fileFamily(family, data)\n )\n }\n\n /** The files of `style` of `family` after its own, such as the shards of a split web font. */\n shardData(family: string, style: string): readonly ArrayBuffer[] {\n return this.supplementalFamilyData.get(`${family}|${style}`) ?? []\n }\n\n /** The name one file of `family` is registered under on its own. */\n private fileFamily(family: string, data: ArrayBuffer): string {\n let name = this.fileFamilies.get(data)\n if (!name) {\n name = fontFaceRenderFamily(family, `file ${this.fileFamilies.size + 1}`)\n this.fileFamilies.set(data, name)\n }\n this.registerFontInCanvasKit(name, data)\n return name\n }\n\n /** How many files the family's loaded styles come from. */\n private familyFileCount(family: string): number {\n const files = new Set<ArrayBuffer>()\n for (const [key, data] of this.loadedFamilies) if (key.startsWith(`${family}|`)) files.add(data)\n return files.size\n }\n\n collectFontKeys(graph: SceneGraph, nodeIds: string[]): Array<[string, string]> {\n return collectGraphFontKeys(graph, nodeIds)\n }\n\n async ensureCJKFallback(): Promise<string[]> {\n if (this.cjkFallbackFamilies.length > 0) return this.cjkFallbackFamilies\n if (this.cjkFallbackPromise) return this.cjkFallbackPromise\n\n this.cjkFallbackPromise = this.ensureFallbackFamilies('cjk', this.cjkFallbackFamilies)\n return this.cjkFallbackPromise\n }\n\n getCJKFallbackFamilies(): string[] {\n return this.cjkFallbackFamilies\n }\n\n setCJKFallbackFamily(family: string): void {\n if (!this.cjkFallbackFamilies.includes(family)) {\n this.cjkFallbackFamilies.push(family)\n }\n }\n\n private ensureLetterFallback(script: LetterFallbackScript): Promise<string[]> {\n const families = this.letterFamilies(script)\n if (families.length > 0) return Promise.resolve(families)\n let pending = this.letterFallbackPromises.get(script)\n if (!pending) {\n pending = this.ensureFallbackFamilies(script, families)\n this.letterFallbackPromises.set(script, pending)\n }\n return pending\n }\n\n private letterFamilies(script: LetterFallbackScript): string[] {\n let families = this.letterFallbackFamilies.get(script)\n if (!families) {\n families = []\n this.letterFallbackFamilies.set(script, families)\n }\n return families\n }\n\n /** The list a script's fallback families are kept in. */\n private fallbackTarget(script: FontFallbackScript): string[] {\n return isLetterFallbackScript(script) ? this.letterFamilies(script) : this.cjkFallbackFamilies\n }\n\n ensureFallbackPack(\n scripts: FontFallbackScript[] = ['cjk', 'arabic'],\n characters = '',\n signal?: AbortSignal\n ): Promise<Partial<Record<FontFallbackScript, string[]>>> {\n return withHarfBuzz(this.loadFallbackPack(scripts, characters, signal))\n }\n\n private async loadFallbackPack(\n scripts: FontFallbackScript[] = ['cjk', 'arabic'],\n characters = '',\n signal?: AbortSignal\n ): Promise<Partial<Record<FontFallbackScript, string[]>>> {\n signal?.throwIfAborted()\n const result: Partial<Record<FontFallbackScript, string[]>> = {}\n await Promise.all(\n scripts.map(async (script) => {\n signal?.throwIfAborted()\n const target = this.fallbackTarget(script)\n if (signal) {\n result[script] = await this.ensureFallbackFamilies(script, target, characters, signal)\n } else if (isLetterFallbackScript(script) && !characters) {\n result[script] = await this.ensureLetterFallback(script)\n } else if (script === 'cjk' && !characters) {\n result[script] = await this.ensureCJKFallback()\n } else {\n result[script] = await this.ensureFallbackFamilies(script, target, characters)\n }\n })\n )\n signal?.throwIfAborted()\n return result\n }\n\n /**\n * The fallbacks for scripts written in letters, Arabic first, in the order the renderer tries\n * them: each covers its own script, and all come before the CJK fallbacks.\n */\n getLetterFallbackFamilies(): string[] {\n return uniq(LETTER_FALLBACK_SCRIPTS.flatMap((script) => this.letterFamilies(script)))\n }\n\n setLetterFallbackFamily(script: LetterFallbackScript, family: string): void {\n const families = this.letterFamilies(script)\n if (!families.includes(family)) families.push(family)\n }\n\n private async ensureFallbackFamilies(\n script: FontFallbackScript,\n targetFamilies: string[],\n characters = '',\n signal?: AbortSignal\n ): Promise<string[]> {\n signal?.throwIfAborted()\n const manifest = fontFallbackEntry(script, this.fallbackUserAgent)\n\n for (const family of manifest.localFamilies) {\n signal?.throwIfAborted()\n const buffer =\n (await this.loadHostFont(family, 'Regular')) ?? (await this.localFonts.read(family))\n signal?.throwIfAborted()\n if (\n buffer &&\n this.registerAndCache(family, 'Regular', buffer, 'fallback') &&\n !targetFamilies.includes(family)\n ) {\n targetFamilies.push(family)\n }\n }\n\n if (targetFamilies.length === 0 || characters) {\n const results = await Promise.allSettled(\n manifest.remoteFamilies.map(async (family) => {\n signal?.throwIfAborted()\n const data = await this.loadRemoteFont(family, 'Regular', characters, signal)\n signal?.throwIfAborted()\n return data ? family : null\n })\n )\n for (const result of results) {\n if (\n result.status === 'fulfilled' &&\n result.value &&\n !targetFamilies.includes(result.value)\n ) {\n targetFamilies.push(result.value)\n }\n }\n }\n\n return targetFamilies\n }\n\n private loadHostFont(family: string, style: string): Promise<ArrayBuffer | null> {\n const loader = this.hostFontLoader\n if (!loader) return Promise.resolve(null)\n return this.hostFontRequests.read(`${family}|${style}`, () =>\n this.readHostFont(loader, family, style)\n )\n }\n\n private async readHostFont(\n loader: HostFontLoader,\n family: string,\n style: string\n ): Promise<ArrayBuffer | null> {\n const key = `${family}|${style}`\n try {\n const data = await loader(family, style)\n // A read that started under a loader the host has replaced must not register its bytes.\n if (this.hostFontLoader !== loader) return null\n if (data) this.unavailableFaces.delete(key)\n return data\n } catch (e) {\n // A failure from a replaced loader says nothing about the face the new loader serves.\n if (this.hostFontLoader !== loader) return null\n if (e instanceof UnsupportedFontFormatError) {\n this.unavailableFaces.set(key, e.reason)\n return null\n }\n console.warn(`Host fallback font load failed for \"${family}\" ${style}:`, e)\n return null\n }\n }\n\n private async readDownloadedFont(\n family: string,\n style: string,\n characters = ''\n ): Promise<ArrayBuffer | null> {\n if (!this.downloadedFontCache) return null\n try {\n return await this.downloadedFontCache.read(family, style, characters)\n } catch (e) {\n console.warn(`Downloaded font cache read failed for \"${family}\" ${style}:`, e)\n return null\n }\n }\n\n private async writeDownloadedFont(\n family: string,\n style: string,\n data: ArrayBuffer,\n characters = ''\n ): Promise<void> {\n if (!this.downloadedFontCache) return\n try {\n await this.downloadedFontCache.write(family, style, data, characters)\n } catch (e) {\n console.warn(`Downloaded font cache write failed for \"${family}\" ${style}:`, e)\n }\n }\n\n /** Adds `buffer` to the files of `style` after its own, returning the copy of it they keep. */\n private registerSupplemental(family: string, style: string, buffer: ArrayBuffer): ArrayBuffer {\n const key = `${family}|${style}`\n const supplemental = this.supplementalFamilyData.get(key) ?? []\n const kept = supplemental.find((file) => sameFontFile(file, buffer))\n if (kept) return kept\n supplemental.push(buffer)\n this.supplementalFamilyData.set(key, supplemental)\n this.registerFontInCanvasKit(family, buffer)\n this.registerFontInBrowser(family, style, buffer)\n return buffer\n }\n\n private registerAndCache(\n family: string,\n style: string,\n buffer: ArrayBuffer,\n source?: FontLoadedSource\n ): ArrayBuffer | null {\n const key = `${family}|${style}`\n const existing = this.loadedFamilies.get(key)\n if (existing && sameFontFile(existing, buffer)) {\n if (source) this.loadedFamilySources.set(key, source)\n this.registerFontInCanvasKit(family, existing)\n return existing\n }\n if (existing) {\n const replaced = this.replacedFileData.get(key) ?? new Set<ArrayBuffer>()\n replaced.add(this.registerSupplemental(family, style, existing))\n this.replacedFileData.set(key, replaced)\n this.replacedFamilies.add(family)\n }\n this.loadedFamilies.set(key, buffer)\n if (source) this.loadedFamilySources.set(key, source)\n this.registerFontInCanvasKit(family, buffer)\n this.registerFontInBrowser(family, style, buffer)\n for (const listener of this.faceListeners) listener(family, style)\n return buffer\n }\n\n /**\n * Calls the listener with each face once its file is registered, by whatever path it loaded:\n * a paste, a script, a retry, or the renderer.\n */\n onFaceLoaded(listener: (family: string, style: string) => void): () => void {\n this.faceListeners.add(listener)\n return () => this.faceListeners.delete(listener)\n }\n\n private registerFontInCanvasKit(family: string, data: ArrayBuffer): boolean {\n let registered = false\n for (const provider of this.fontProviders) {\n registered = this.registerFontInProvider(provider, family, data) || registered\n }\n return registered\n }\n\n private registerFontInProvider(\n provider: TypefaceFontProvider,\n family: string,\n data: ArrayBuffer\n ): boolean {\n if (data.byteLength < 4) return false\n const registrations = this.providerRegistrations.get(provider) ?? new Map()\n const registeredData = registrations.get(family)\n if (registeredData?.has(data)) return true\n try {\n provider.registerFont(data, family)\n const familyRegistrations = registeredData ?? new Set<ArrayBuffer>()\n familyRegistrations.add(data)\n registrations.set(family, familyRegistrations)\n this.providerRegistrations.set(provider, registrations)\n this.registrationGeneration++\n return true\n } catch {\n return false\n }\n }\n\n /** Makes a face available to the page's own text, such as fields over canvas labels. */\n registerFontInBrowser(family: string, style: string, data: ArrayBuffer) {\n if (!IS_BROWSER) return\n const weight = styleToWeight(style)\n const italic = style.toLowerCase().includes('italic') ? 'italic' : 'normal'\n const face = new FontFace(family, data, {\n weight: String(weight),\n style: italic\n })\n face\n .load()\n .then(() => document.fonts.add(face))\n .catch(() => {\n console.warn(`Failed to load font \"${family}\" (${style})`)\n })\n }\n}\n\nexport const fontManager = new FontManager()\n\nfunction isLetterFallbackScript(script: FontFallbackScript): script is LetterFallbackScript {\n return LETTER_FALLBACK_SCRIPTS.some((letter) => letter === script)\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmDA,IAAa,cAAb,MAAyB;CACvB,iCAAyB,IAAI,IAAyB;CACtD,sCAA8B,IAAI,IAA8B;CAChE,mCAA2B,IAAI,IAAmC;CAClE,yCAAiC,IAAI,IAA2B;;CAEhE,+BAAuB,IAAI,IAAyB;;;;;;CAMpD,mCAA2B,IAAI,IAAY;;;;;;CAM3C,mCAA2B,IAAI,IAA8B;CAC7D,iCAAyB,IAAI,IAAyB;CACtD,qCAA6B,IAAI,QAA0D;CAC3F,6BAAqB,IAAI,QAGvB;CACF,iCAAyB,IAAI,IAAY;CACzC,eAAoD;CACp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AM,sBAAsB,kCAAkB,IAAI,IAAiB;GACnE,oBAAoB,IAAI,IAAI;GAC5B,cAAc,IAAI,QAAQ,mBAAmB;GAC7C,KAAK,sBAAsB,IAAI,UAAU,aAAa;GACtD,KAAK;GACL,OAAO;EACT,QAAQ;GACN,OAAO;EACT;CACF;;CAGA,sBAAsB,QAAgB,OAAe,MAAmB;EACtE,IAAI,CAAC,YAAY;EACjB,MAAM,SAAS,cAAc,KAAK;EAClC,MAAM,SAAS,MAAM,YAAY,CAAC,CAAC,SAAS,QAAQ,IAAI,WAAW;EACnE,MAAM,OAAO,IAAI,SAAS,QAAQ,MAAM;GACtC,QAAQ,OAAO,MAAM;GACrB,OAAO;EACT,CAAC;EACD,KACG,KAAK,CAAC,CACN,WAAW,SAAS,MAAM,IAAI,IAAI,CAAC,CAAC,CACpC,YAAY;GACX,QAAQ,KAAK,wBAAwB,OAAO,KAAK,MAAM,EAAE;EAC3D,CAAC;CACL;AACF;AAEA,MAAa,cAAc,IAAI,YAAY;AAE3C,SAAS,uBAAuB,QAA4D;CAC1F,OAAO,wBAAwB,MAAM,WAAW,WAAW,MAAM;AACnE"}
|
package/dist/text/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { fitTextPathBoxToGlyphs } from "./path/fitting.js";
|
|
|
3
3
|
import { PathTextLayout, calibratePathTextLayout, layoutPathTextFromAdvances, reflowPathTextGlyphs } from "./path/layout.js";
|
|
4
4
|
import { PathPoint, SampledPath, nearestArcPoint, pointAtArc, sampleTextPath, textPathStartArc, textPathStartDistance } from "./path/sampling.js";
|
|
5
5
|
import { getTextPathData } from "./path/index.js";
|
|
6
|
-
import { ARABIC_CHARACTER, ARABIC_LOCAL_FALLBACK_FAMILIES, ARABIC_REMOTE_FALLBACK_FAMILIES, FontFallbackManifestEntry, FontFallbackScript, HANGUL_CHARACTER, HAN_CHARACTER, KANA_CHARACTER, TRADITIONAL_HAN_CHARACTER, cjkFallbackScriptForLanguage, cjkLocalFallbackFamilies, fontFallbackEntry, fontFallbackManifest, fontFallbackScriptForCharacter } from "./fallbacks.js";
|
|
6
|
+
import { ARABIC_CHARACTER, ARABIC_LOCAL_FALLBACK_FAMILIES, ARABIC_REMOTE_FALLBACK_FAMILIES, DEVANAGARI_CHARACTER, FontFallbackManifestEntry, FontFallbackScript, HANGUL_CHARACTER, HAN_CHARACTER, HEBREW_CHARACTER, KANA_CHARACTER, LETTER_FALLBACK_SCRIPTS, LetterFallbackScript, THAI_CHARACTER, TRADITIONAL_HAN_CHARACTER, cjkFallbackScriptForLanguage, cjkLocalFallbackFamilies, fontFallbackEntry, fontFallbackManifest, fontFallbackScriptForCharacter } from "./fallbacks.js";
|
|
7
7
|
import { FontCandidateSource, FontResolutionCandidate, FontResolutionDemand, FontResolutionEvent, FontResolutionListener, FontResolutionLoader, FontResolutionSettled, FontResolutionSnapshot, FontResolutionState } from "./resolver/types.js";
|
|
8
8
|
import { FontResolver } from "./resolver/resolver.js";
|
|
9
9
|
import { MissingGlyphOccurrence, ObservedShapedLine, missingGlyphCharacters, missingGlyphOccurrences, missingGlyphScripts, missingGlyphsByScript } from "./resolver/coverage.js";
|
|
@@ -30,4 +30,4 @@ import { adjustRunsForDelete, adjustRunsForInsert, applyStyleToRange, getStyleAt
|
|
|
30
30
|
import { GraphFontRequirements, collectGraphFontKeys, collectGraphFontRequirements, collectNodeFontFaces, textFontFace } from "./requirements/collect.js";
|
|
31
31
|
import { MissingGraphFontScriptsOptions, missingGraphFontScripts } from "./requirements/resolved.js";
|
|
32
32
|
import { prepareGraphFonts } from "./prepare.js";
|
|
33
|
-
export { ARABIC_CHARACTER, ARABIC_LOCAL_FALLBACK_FAMILIES, ARABIC_REMOTE_FALLBACK_FAMILIES, type BundledFontLocator, DEFAULT_WEB_FONT_PROVIDER_SETTINGS, DocumentFontEntry, DocumentFontFaceStatus, DocumentFontInput, DocumentFontStatus, DownloadedFontCache, FaceWeight, FamilyFace, FontAxis, FontCandidateSource, FontFaceRef, FontFaceStatus, FontFallbackManifestEntry, FontFallbackScript, FontFamilyOption, FontFamilySource, FontInfo, FontLoadedSource, FontManager, FontResolutionCandidate, FontResolutionDemand, FontResolutionEvent, FontResolutionListener, FontResolutionLoader, FontResolutionSettled, FontResolutionSnapshot, FontResolutionState, FontResolver, FontUnavailableReason, type GlyphOutlineProbe, GraphFontRequirements, HANGUL_CHARACTER, HAN_CHARACTER, type HarfBuzzSubsetLocator, type HostFontFamily, HostFontLoader, HyperlinkRunOptions, HyperlinkSpan, KANA_CHARACTER, LocalFontAccessState, MissingGlyphOccurrence, MissingGraphFontScriptsOptions, NamedInstance, ObservedShapedLine, type OutlineCommand, PathPoint, PathTextCaret, PathTextLayout, PathTextLineMetrics, ResolvedWebFont, SampledPath, TRADITIONAL_HAN_CHARACTER, TextCaret, TextCaseSegment, TextEditor, TextEditorState, TextFace, UnsupportedFontFormatError, WEB_FONT_PROVIDER_IDS, WEB_FONT_PROVIDER_LABELS, WebFontFetch, WebFontProviderId, WebFontResolver, adjustRunsForDelete, adjustRunsForInsert, applyStyleToRange, calibratePathTextLayout, chooseLocalFontMatch, cjkFallbackScriptForLanguage, cjkLocalFallbackFamilies, collectGraphFontKeys, collectGraphFontRequirements, collectNamedNodeFontFaces, collectNodeFontFaces, documentFontData, documentFontStatus, documentFontsOf, faceForStyle, faceStyleName, facesFromStyles, fitTextPathBoxToGlyphs, fontAxes, fontCoverageDemand, fontFaceDemand, fontFaceFromFigmaFontName, fontFaceRenderFamily, fontFallbackEntry, fontFallbackManifest, fontFallbackScriptForCharacter, fontManager, fontRemoteCoverageDemand, fontResolver, fontTableView, fontWeightMatchOrder, getStyleAt, getTextPathData, hasFamilyFace, hasNamedInstance, hasTrueTypeOutlines, hyperlinkInRange, hyperlinkSpanAt, hyperlinkSpans, insertRunsWithStyle, isDocumentFontFileName, isOpenableLinkURL, isVariableFont, isWOFF2, layoutPathTextFromAdvances, mergeArchiveFonts, missingGlyphCharacters, missingGlyphOccurrences, missingGlyphScripts, missingGlyphsByScript, missingGraphFontScripts, namedInstanceVariations, namedInstances, nearestArcPoint, nearestFamilyFace, normalizeLinkURL, normalizedCoverageText, pathTextCaret, pathTextIndexAt, pathTextSelectionQuads, pointAtArc, prepareDocumentFonts, prepareGraphFonts, probeGlyphOutlineCommands, reflowPathTextGlyphs, registerDocumentFonts, removeStyleFromRange, sampleTextPath, selectionHasStyle, setHarfBuzzSubsetLocator, sfntFamilyNames, sfntFont, sfntFontName, shownCharacters, shownText, shownTextSlice, standardFace, standardFaces, styleRunsWithHyperlink, textCaseSegments, textFaceName, textFallbackScriptsWithoutCoverage, textFontFace, textHasFallbackScript, textNeededFallbackScripts, textNeedsFallbackScript, textPathStartArc, textPathStartDistance, textStyleName, toggleBoldInRange, toggleDecorationInRange, toggleItalicInRange, transformTextCase, webFontSubsetsForText };
|
|
33
|
+
export { ARABIC_CHARACTER, ARABIC_LOCAL_FALLBACK_FAMILIES, ARABIC_REMOTE_FALLBACK_FAMILIES, type BundledFontLocator, DEFAULT_WEB_FONT_PROVIDER_SETTINGS, DEVANAGARI_CHARACTER, DocumentFontEntry, DocumentFontFaceStatus, DocumentFontInput, DocumentFontStatus, DownloadedFontCache, FaceWeight, FamilyFace, FontAxis, FontCandidateSource, FontFaceRef, FontFaceStatus, FontFallbackManifestEntry, FontFallbackScript, FontFamilyOption, FontFamilySource, FontInfo, FontLoadedSource, FontManager, FontResolutionCandidate, FontResolutionDemand, FontResolutionEvent, FontResolutionListener, FontResolutionLoader, FontResolutionSettled, FontResolutionSnapshot, FontResolutionState, FontResolver, FontUnavailableReason, type GlyphOutlineProbe, GraphFontRequirements, HANGUL_CHARACTER, HAN_CHARACTER, HEBREW_CHARACTER, type HarfBuzzSubsetLocator, type HostFontFamily, HostFontLoader, HyperlinkRunOptions, HyperlinkSpan, KANA_CHARACTER, LETTER_FALLBACK_SCRIPTS, LetterFallbackScript, LocalFontAccessState, MissingGlyphOccurrence, MissingGraphFontScriptsOptions, NamedInstance, ObservedShapedLine, type OutlineCommand, PathPoint, PathTextCaret, PathTextLayout, PathTextLineMetrics, ResolvedWebFont, SampledPath, THAI_CHARACTER, TRADITIONAL_HAN_CHARACTER, TextCaret, TextCaseSegment, TextEditor, TextEditorState, TextFace, UnsupportedFontFormatError, WEB_FONT_PROVIDER_IDS, WEB_FONT_PROVIDER_LABELS, WebFontFetch, WebFontProviderId, WebFontResolver, adjustRunsForDelete, adjustRunsForInsert, applyStyleToRange, calibratePathTextLayout, chooseLocalFontMatch, cjkFallbackScriptForLanguage, cjkLocalFallbackFamilies, collectGraphFontKeys, collectGraphFontRequirements, collectNamedNodeFontFaces, collectNodeFontFaces, documentFontData, documentFontStatus, documentFontsOf, faceForStyle, faceStyleName, facesFromStyles, fitTextPathBoxToGlyphs, fontAxes, fontCoverageDemand, fontFaceDemand, fontFaceFromFigmaFontName, fontFaceRenderFamily, fontFallbackEntry, fontFallbackManifest, fontFallbackScriptForCharacter, fontManager, fontRemoteCoverageDemand, fontResolver, fontTableView, fontWeightMatchOrder, getStyleAt, getTextPathData, hasFamilyFace, hasNamedInstance, hasTrueTypeOutlines, hyperlinkInRange, hyperlinkSpanAt, hyperlinkSpans, insertRunsWithStyle, isDocumentFontFileName, isOpenableLinkURL, isVariableFont, isWOFF2, layoutPathTextFromAdvances, mergeArchiveFonts, missingGlyphCharacters, missingGlyphOccurrences, missingGlyphScripts, missingGlyphsByScript, missingGraphFontScripts, namedInstanceVariations, namedInstances, nearestArcPoint, nearestFamilyFace, normalizeLinkURL, normalizedCoverageText, pathTextCaret, pathTextIndexAt, pathTextSelectionQuads, pointAtArc, prepareDocumentFonts, prepareGraphFonts, probeGlyphOutlineCommands, reflowPathTextGlyphs, registerDocumentFonts, removeStyleFromRange, sampleTextPath, selectionHasStyle, setHarfBuzzSubsetLocator, sfntFamilyNames, sfntFont, sfntFontName, shownCharacters, shownText, shownTextSlice, standardFace, standardFaces, styleRunsWithHyperlink, textCaseSegments, textFaceName, textFallbackScriptsWithoutCoverage, textFontFace, textHasFallbackScript, textNeededFallbackScripts, textNeedsFallbackScript, textPathStartArc, textPathStartDistance, textStyleName, toggleBoldInRange, toggleDecorationInRange, toggleItalicInRange, transformTextCase, webFontSubsetsForText };
|
package/dist/text/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ARABIC_CHARACTER, ARABIC_LOCAL_FALLBACK_FAMILIES, ARABIC_REMOTE_FALLBACK_FAMILIES, HANGUL_CHARACTER, HAN_CHARACTER, KANA_CHARACTER, TRADITIONAL_HAN_CHARACTER, cjkFallbackScriptForLanguage, cjkLocalFallbackFamilies, fontFallbackEntry, fontFallbackManifest, fontFallbackScriptForCharacter } from "./fallbacks.js";
|
|
1
|
+
import { ARABIC_CHARACTER, ARABIC_LOCAL_FALLBACK_FAMILIES, ARABIC_REMOTE_FALLBACK_FAMILIES, DEVANAGARI_CHARACTER, HANGUL_CHARACTER, HAN_CHARACTER, HEBREW_CHARACTER, KANA_CHARACTER, LETTER_FALLBACK_SCRIPTS, THAI_CHARACTER, TRADITIONAL_HAN_CHARACTER, cjkFallbackScriptForLanguage, cjkLocalFallbackFamilies, fontFallbackEntry, fontFallbackManifest, fontFallbackScriptForCharacter } from "./fallbacks.js";
|
|
2
2
|
import { facesFromStyles, fontFaceFromFigmaFontName, fontFaceRenderFamily, hasFamilyFace, nearestFamilyFace, standardFace, standardFaces } from "./font/faces.js";
|
|
3
3
|
import { fontAxes, fontTableView, hasNamedInstance, hasTrueTypeOutlines, isVariableFont, namedInstanceVariations, namedInstances, sfntFamilyNames, sfntFontName } from "./font/variation.js";
|
|
4
4
|
import { setHarfBuzzSubsetLocator } from "./font/harfbuzz.js";
|
|
@@ -27,4 +27,4 @@ import { documentFontData, documentFontsOf, isDocumentFontFileName, mergeArchive
|
|
|
27
27
|
import { TextEditor } from "./editor.js";
|
|
28
28
|
import { adjustRunsForDelete, adjustRunsForInsert, applyStyleToRange, getStyleAt, insertRunsWithStyle, removeStyleFromRange, selectionHasStyle, toggleBoldInRange, toggleDecorationInRange, toggleItalicInRange } from "./style-runs.js";
|
|
29
29
|
import { hyperlinkInRange, hyperlinkSpanAt, hyperlinkSpans, isOpenableLinkURL, normalizeLinkURL, styleRunsWithHyperlink } from "./hyperlink.js";
|
|
30
|
-
export { ARABIC_CHARACTER, ARABIC_LOCAL_FALLBACK_FAMILIES, ARABIC_REMOTE_FALLBACK_FAMILIES, DEFAULT_WEB_FONT_PROVIDER_SETTINGS, FontManager, FontResolver, HANGUL_CHARACTER, HAN_CHARACTER, KANA_CHARACTER, TRADITIONAL_HAN_CHARACTER, TextEditor, UnsupportedFontFormatError, WEB_FONT_PROVIDER_IDS, WEB_FONT_PROVIDER_LABELS, WebFontResolver, adjustRunsForDelete, adjustRunsForInsert, applyStyleToRange, calibratePathTextLayout, chooseLocalFontMatch, cjkFallbackScriptForLanguage, cjkLocalFallbackFamilies, collectGraphFontKeys, collectGraphFontRequirements, collectNamedNodeFontFaces, collectNodeFontFaces, documentFontData, documentFontStatus, documentFontsOf, faceForStyle, faceStyleName, facesFromStyles, fitTextPathBoxToGlyphs, fontAxes, fontCoverageDemand, fontFaceDemand, fontFaceFromFigmaFontName, fontFaceRenderFamily, fontFallbackEntry, fontFallbackManifest, fontFallbackScriptForCharacter, fontManager, fontRemoteCoverageDemand, fontResolver, fontTableView, fontWeightMatchOrder, getStyleAt, getTextPathData, hasFamilyFace, hasNamedInstance, hasTrueTypeOutlines, hyperlinkInRange, hyperlinkSpanAt, hyperlinkSpans, insertRunsWithStyle, isDocumentFontFileName, isOpenableLinkURL, isVariableFont, isWOFF2, layoutPathTextFromAdvances, mergeArchiveFonts, missingGlyphCharacters, missingGlyphOccurrences, missingGlyphScripts, missingGlyphsByScript, missingGraphFontScripts, namedInstanceVariations, namedInstances, nearestArcPoint, nearestFamilyFace, normalizeLinkURL, normalizedCoverageText, pathTextCaret, pathTextIndexAt, pathTextSelectionQuads, pointAtArc, prepareDocumentFonts, prepareGraphFonts, probeGlyphOutlineCommands, reflowPathTextGlyphs, registerDocumentFonts, removeStyleFromRange, sampleTextPath, selectionHasStyle, setHarfBuzzSubsetLocator, sfntFamilyNames, sfntFont, sfntFontName, shownCharacters, shownText, shownTextSlice, standardFace, standardFaces, styleRunsWithHyperlink, textCaseSegments, textFaceName, textFallbackScriptsWithoutCoverage, textFontFace, textHasFallbackScript, textNeededFallbackScripts, textNeedsFallbackScript, textPathStartArc, textPathStartDistance, textStyleName, toggleBoldInRange, toggleDecorationInRange, toggleItalicInRange, transformTextCase, webFontSubsetsForText };
|
|
30
|
+
export { ARABIC_CHARACTER, ARABIC_LOCAL_FALLBACK_FAMILIES, ARABIC_REMOTE_FALLBACK_FAMILIES, DEFAULT_WEB_FONT_PROVIDER_SETTINGS, DEVANAGARI_CHARACTER, FontManager, FontResolver, HANGUL_CHARACTER, HAN_CHARACTER, HEBREW_CHARACTER, KANA_CHARACTER, LETTER_FALLBACK_SCRIPTS, THAI_CHARACTER, TRADITIONAL_HAN_CHARACTER, TextEditor, UnsupportedFontFormatError, WEB_FONT_PROVIDER_IDS, WEB_FONT_PROVIDER_LABELS, WebFontResolver, adjustRunsForDelete, adjustRunsForInsert, applyStyleToRange, calibratePathTextLayout, chooseLocalFontMatch, cjkFallbackScriptForLanguage, cjkLocalFallbackFamilies, collectGraphFontKeys, collectGraphFontRequirements, collectNamedNodeFontFaces, collectNodeFontFaces, documentFontData, documentFontStatus, documentFontsOf, faceForStyle, faceStyleName, facesFromStyles, fitTextPathBoxToGlyphs, fontAxes, fontCoverageDemand, fontFaceDemand, fontFaceFromFigmaFontName, fontFaceRenderFamily, fontFallbackEntry, fontFallbackManifest, fontFallbackScriptForCharacter, fontManager, fontRemoteCoverageDemand, fontResolver, fontTableView, fontWeightMatchOrder, getStyleAt, getTextPathData, hasFamilyFace, hasNamedInstance, hasTrueTypeOutlines, hyperlinkInRange, hyperlinkSpanAt, hyperlinkSpans, insertRunsWithStyle, isDocumentFontFileName, isOpenableLinkURL, isVariableFont, isWOFF2, layoutPathTextFromAdvances, mergeArchiveFonts, missingGlyphCharacters, missingGlyphOccurrences, missingGlyphScripts, missingGlyphsByScript, missingGraphFontScripts, namedInstanceVariations, namedInstances, nearestArcPoint, nearestFamilyFace, normalizeLinkURL, normalizedCoverageText, pathTextCaret, pathTextIndexAt, pathTextSelectionQuads, pointAtArc, prepareDocumentFonts, prepareGraphFonts, probeGlyphOutlineCommands, reflowPathTextGlyphs, registerDocumentFonts, removeStyleFromRange, sampleTextPath, selectionHasStyle, setHarfBuzzSubsetLocator, sfntFamilyNames, sfntFont, sfntFontName, shownCharacters, shownText, shownTextSlice, standardFace, standardFaces, styleRunsWithHyperlink, textCaseSegments, textFaceName, textFallbackScriptsWithoutCoverage, textFontFace, textHasFallbackScript, textNeededFallbackScripts, textNeedsFallbackScript, textPathStartArc, textPathStartDistance, textStyleName, toggleBoldInRange, toggleDecorationInRange, toggleItalicInRange, transformTextCase, webFontSubsetsForText };
|
package/dist/text/outlines.js
CHANGED
|
@@ -42,7 +42,7 @@ function resolvedGlyphStyle(style, char) {
|
|
|
42
42
|
return family ? fallbackStyle(style, family) : null;
|
|
43
43
|
}
|
|
44
44
|
function fallbackFamilies() {
|
|
45
|
-
return [...fontManager.getCJKFallbackFamilies(), ...fontManager.
|
|
45
|
+
return [...fontManager.getCJKFallbackFamilies(), ...fontManager.getLetterFallbackFamilies()];
|
|
46
46
|
}
|
|
47
47
|
/** `style` in a script fallback family, which has none of the text family's named faces. */
|
|
48
48
|
function fallbackStyle(style, family) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outlines.js","names":[],"sources":["../../src/text/outlines.ts"],"sourcesContent":["import { prepareWithSegments, layoutWithLines } from '@chenglou/pretext'\n\nimport type { CharacterStyleOverride, SceneNode } from '@pairdraw/scene-graph'\nimport { faceStyleKey } from '@pairdraw/scene-graph/font-style'\nimport { rangeFontStyle } from '@pairdraw/scene-graph/shared-styles'\nimport { lineHeightPixels, textLengthPixels } from '@pairdraw/scene-graph/text'\n\nimport {\n fontHasGlyphSync,\n getGlyphOutlineMetricsSync,\n type OutlineCommand\n} from '#core/text/font/glyphs'\nimport { fontManager } from '#core/text/font/manager'\n\nexport type TextOutlineUnsupportedReason =\n | 'not-text'\n | 'empty-text'\n | 'missing-font'\n | 'missing-glyph'\n | 'complex-script'\n\nexport type TextOutlineSupport =\n | { supported: true }\n | { supported: false; reason: TextOutlineUnsupportedReason }\n\nexport interface TextOutlineGlyph {\n commands: OutlineCommand[]\n x: number\n y: number\n}\n\nexport interface TextOutlineLayout {\n glyphs: TextOutlineGlyph[]\n width: number\n height: number\n}\n\nconst COMPLEX_SCRIPT_PATTERN = /[\\u0590-\\u08ff\\u0900-\\u0dff\\ufb1d-\\ufdff\\ufe70-\\ufeff]/\n\ntype TextStyle = Required<\n Pick<\n CharacterStyleOverride,\n 'fontFamily' | 'fontSize' | 'fontWeight' | 'italic' | 'fontStyle' | 'letterSpacing'\n >\n>\n\nfunction baseTextStyle(node: SceneNode): TextStyle {\n return {\n fontFamily: node.fontFamily,\n fontSize: node.fontSize,\n fontWeight: node.fontWeight,\n italic: node.italic,\n fontStyle: node.fontStyle,\n letterSpacing: node.letterSpacing\n }\n}\n\nfunction styleKey(style: TextStyle): string {\n const spacing = textLengthPixels(style.letterSpacing, style.fontSize)\n return `${style.fontFamily}|${faceStyleKey(style)}|${style.fontSize}|${spacing}`\n}\n\nfunction textStyleAt(node: SceneNode, index: number): TextStyle {\n const base = baseTextStyle(node)\n const run = node.styleRuns.find((item) => index >= item.start && index < item.start + item.length)\n if (!run) return base\n return {\n fontFamily: run.style.fontFamily ?? base.fontFamily,\n fontSize: run.style.fontSize ?? base.fontSize,\n fontWeight: run.style.fontWeight ?? base.fontWeight,\n italic: run.style.italic ?? base.italic,\n fontStyle: rangeFontStyle(node, run.style),\n letterSpacing: run.style.letterSpacing ?? base.letterSpacing\n }\n}\n\nfunction resolvedGlyphStyle(style: TextStyle, char: string): TextStyle | null {\n if (fontHasGlyphSync(style.fontFamily, faceStyleKey(style), char)) return style\n const family = fallbackFamilies().find((candidate) => {\n const next = fallbackStyle(style, candidate)\n return (\n fontManager.loadedData(next.fontFamily, faceStyleKey(next)) &&\n fontHasGlyphSync(next.fontFamily, faceStyleKey(next), char)\n )\n })\n return family ? fallbackStyle(style, family) : null\n}\n\nfunction fallbackFamilies(): string[] {\n return [...fontManager.getCJKFallbackFamilies(), ...fontManager.getArabicFallbackFamilies()]\n}\n\n/** `style` in a script fallback family, which has none of the text family's named faces. */\nfunction fallbackStyle(style: TextStyle, family: string): TextStyle {\n return { ...style, fontFamily: family, fontStyle: null }\n}\n\nfunction textStyles(node: SceneNode): TextStyle[] {\n if (node.styleRuns.length === 0) return [baseTextStyle(node)]\n const styles = new Map<string, TextStyle>()\n for (let index = 0; index < node.text.length; index++) {\n const style = textStyleAt(node, index)\n styles.set(styleKey(style), style)\n }\n return [...styles.values()]\n}\n\nexport function getTextOutlineSupport(node: SceneNode): TextOutlineSupport {\n if (node.type !== 'TEXT') return { supported: false, reason: 'not-text' }\n if (!node.text) return { supported: false, reason: 'empty-text' }\n if (COMPLEX_SCRIPT_PATTERN.test(node.text)) return { supported: false, reason: 'complex-script' }\n for (const style of textStyles(node)) {\n if (!fontManager.loadedData(style.fontFamily, faceStyleKey(style))) {\n return { supported: false, reason: 'missing-font' }\n }\n }\n for (let index = 0; index < node.text.length; index++) {\n const char = node.text[index]\n if (char === '\\n') continue\n const style = textStyleAt(node, index)\n if (!resolvedGlyphStyle(style, char)) return { supported: false, reason: 'missing-glyph' }\n }\n return { supported: true }\n}\n\nfunction lineHeight(node: SceneNode): number {\n return lineHeightPixels(node.lineHeight, node.fontSize) ?? Math.ceil(node.fontSize * 1.2)\n}\n\ninterface TextLine {\n text: string\n start: number\n}\n\nfunction hardTextLines(text: string): TextLine[] {\n const lines: TextLine[] = []\n let start = 0\n for (const line of text.split('\\n')) {\n lines.push({ text: line, start })\n start += line.length + 1\n }\n return lines\n}\n\nfunction glyphAdvance(node: SceneNode, absoluteIndex: number): number | null {\n const char = node.text[absoluteIndex]\n const style = resolvedGlyphStyle(textStyleAt(node, absoluteIndex), char)\n if (!style) return null\n const metrics = getGlyphOutlineMetricsSync(\n style.fontFamily,\n faceStyleKey(style),\n char,\n style.fontSize\n )\n const glyph = metrics?.[0]\n return glyph ? glyph.advance + textLengthPixels(style.letterSpacing, style.fontSize) : null\n}\n\nfunction wrapStyledLine(node: SceneNode, line: TextLine): TextLine[] {\n if (!line.text || node.width <= 0) return [line]\n const result: TextLine[] = []\n let lineStart = 0\n let cursor = 0\n let lastBreak = -1\n\n for (let index = 0; index < line.text.length; index++) {\n const advance = glyphAdvance(node, line.start + index)\n if (advance == null) return [line]\n cursor += advance\n if (/\\s/.test(line.text[index])) {\n lastBreak = index + 1\n }\n if (cursor <= node.width || index === lineStart) continue\n\n const breakIndex = lastBreak > lineStart ? lastBreak : index\n result.push({ text: line.text.slice(lineStart, breakIndex), start: line.start + lineStart })\n lineStart = breakIndex\n index = breakIndex - 1\n cursor = 0\n lastBreak = -1\n }\n\n result.push({ text: line.text.slice(lineStart), start: line.start + lineStart })\n return result\n}\n\nfunction textLines(node: SceneNode): TextLine[] {\n const hardLines = hardTextLines(node.text)\n if (node.textAutoResize === 'WIDTH_AND_HEIGHT') return hardLines\n if (node.styleRuns.length > 0) return hardLines.flatMap((line) => wrapStyledLine(node, line))\n\n const result: TextLine[] = []\n for (const hardLine of hardLines) {\n if (!hardLine.text) {\n result.push(hardLine)\n continue\n }\n try {\n const prepared = prepareWithSegments(hardLine.text, `${node.fontSize}px ${node.fontFamily}`)\n const layout = layoutWithLines(prepared, node.width, lineHeight(node))\n let start = hardLine.start\n for (const line of layout.lines) {\n result.push({ text: line.text, start })\n start += line.text.length\n }\n } catch {\n result.push(hardLine)\n }\n }\n return result\n}\n\nfunction lineOffsetX(node: SceneNode, width: number): number {\n switch (node.textAlignHorizontal) {\n case 'CENTER':\n return Math.max(0, (node.width - width) / 2)\n case 'RIGHT':\n return Math.max(0, node.width - width)\n default:\n return 0\n }\n}\n\nfunction verticalOffset(node: SceneNode, contentHeight: number): number {\n switch (node.textAlignVertical) {\n case 'CENTER':\n return Math.max(0, (node.height - contentHeight) / 2)\n case 'BOTTOM':\n return Math.max(0, node.height - contentHeight)\n default:\n return 0\n }\n}\n\nfunction lineGlyphs(\n node: SceneNode,\n line: TextLine,\n baseline: number,\n xOffset: number\n): { glyphs: TextOutlineGlyph[]; width: number } | null {\n const glyphs: TextOutlineGlyph[] = []\n let cursorX = xOffset\n let index = 0\n\n while (index < line.text.length) {\n const absoluteIndex = line.start + index\n const style = resolvedGlyphStyle(textStyleAt(node, absoluteIndex), line.text[index])\n if (!style) return null\n const key = styleKey(style)\n let end = index + 1\n while (end < line.text.length) {\n const nextStyle = resolvedGlyphStyle(textStyleAt(node, line.start + end), line.text[end])\n if (!nextStyle || styleKey(nextStyle) !== key) break\n end++\n }\n\n const segment = line.text.slice(index, end)\n const metrics = getGlyphOutlineMetricsSync(\n style.fontFamily,\n faceStyleKey(style),\n segment,\n style.fontSize\n )\n if (!metrics) return null\n\n for (const glyph of metrics) {\n glyphs.push({ commands: glyph.commands, x: cursorX, y: baseline })\n cursorX += glyph.advance + textLengthPixels(style.letterSpacing, style.fontSize)\n }\n index = end\n }\n\n return { glyphs, width: cursorX - xOffset }\n}\n\nexport function textNodeToOutlineLayout(node: SceneNode): TextOutlineLayout | null {\n if (!getTextOutlineSupport(node).supported) return null\n\n const lines = textLines(node)\n const lineH = lineHeight(node)\n const contentHeight = lines.length * lineH\n const yOffset = verticalOffset(node, contentHeight)\n const glyphs: TextOutlineGlyph[] = []\n let maxWidth = 0\n\n for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {\n const baseline = yOffset + lineIndex * lineH + lineH\n const measured = lineGlyphs(node, lines[lineIndex], baseline, 0)\n if (!measured) return null\n const xOffset = lineOffsetX(node, measured.width)\n maxWidth = Math.max(maxWidth, measured.width)\n const placed =\n xOffset === 0\n ? measured.glyphs\n : measured.glyphs.map((glyph) => ({ ...glyph, x: gly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;EAC/D,IAAI,CAAC,UAAU,OAAO;EACtB,MAAM,UAAU,YAAY,MAAM,SAAS,KAAK;EAChD,WAAW,KAAK,IAAI,UAAU,SAAS,KAAK;EAC5C,MAAM,SACJ,YAAY,IACR,SAAS,SACT,SAAS,OAAO,KAAK,WAAW;GAAE,GAAG;GAAO,GAAG,MAAM,IAAI;EAAQ,EAAE;EACzE,OAAO,KAAK,GAAG,MAAM;CACvB;CAEA,OAAO;EAAE;EAAQ,OAAO;EAAU,QAAQ;CAAc;AAC1D"}
|
|
1
|
+
{"version":3,"file":"outlines.js","names":[],"sources":["../../src/text/outlines.ts"],"sourcesContent":["import { prepareWithSegments, layoutWithLines } from '@chenglou/pretext'\n\nimport type { CharacterStyleOverride, SceneNode } from '@pairdraw/scene-graph'\nimport { faceStyleKey } from '@pairdraw/scene-graph/font-style'\nimport { rangeFontStyle } from '@pairdraw/scene-graph/shared-styles'\nimport { lineHeightPixels, textLengthPixels } from '@pairdraw/scene-graph/text'\n\nimport {\n fontHasGlyphSync,\n getGlyphOutlineMetricsSync,\n type OutlineCommand\n} from '#core/text/font/glyphs'\nimport { fontManager } from '#core/text/font/manager'\n\nexport type TextOutlineUnsupportedReason =\n | 'not-text'\n | 'empty-text'\n | 'missing-font'\n | 'missing-glyph'\n | 'complex-script'\n\nexport type TextOutlineSupport =\n | { supported: true }\n | { supported: false; reason: TextOutlineUnsupportedReason }\n\nexport interface TextOutlineGlyph {\n commands: OutlineCommand[]\n x: number\n y: number\n}\n\nexport interface TextOutlineLayout {\n glyphs: TextOutlineGlyph[]\n width: number\n height: number\n}\n\nconst COMPLEX_SCRIPT_PATTERN = /[\\u0590-\\u08ff\\u0900-\\u0dff\\ufb1d-\\ufdff\\ufe70-\\ufeff]/\n\ntype TextStyle = Required<\n Pick<\n CharacterStyleOverride,\n 'fontFamily' | 'fontSize' | 'fontWeight' | 'italic' | 'fontStyle' | 'letterSpacing'\n >\n>\n\nfunction baseTextStyle(node: SceneNode): TextStyle {\n return {\n fontFamily: node.fontFamily,\n fontSize: node.fontSize,\n fontWeight: node.fontWeight,\n italic: node.italic,\n fontStyle: node.fontStyle,\n letterSpacing: node.letterSpacing\n }\n}\n\nfunction styleKey(style: TextStyle): string {\n const spacing = textLengthPixels(style.letterSpacing, style.fontSize)\n return `${style.fontFamily}|${faceStyleKey(style)}|${style.fontSize}|${spacing}`\n}\n\nfunction textStyleAt(node: SceneNode, index: number): TextStyle {\n const base = baseTextStyle(node)\n const run = node.styleRuns.find((item) => index >= item.start && index < item.start + item.length)\n if (!run) return base\n return {\n fontFamily: run.style.fontFamily ?? base.fontFamily,\n fontSize: run.style.fontSize ?? base.fontSize,\n fontWeight: run.style.fontWeight ?? base.fontWeight,\n italic: run.style.italic ?? base.italic,\n fontStyle: rangeFontStyle(node, run.style),\n letterSpacing: run.style.letterSpacing ?? base.letterSpacing\n }\n}\n\nfunction resolvedGlyphStyle(style: TextStyle, char: string): TextStyle | null {\n if (fontHasGlyphSync(style.fontFamily, faceStyleKey(style), char)) return style\n const family = fallbackFamilies().find((candidate) => {\n const next = fallbackStyle(style, candidate)\n return (\n fontManager.loadedData(next.fontFamily, faceStyleKey(next)) &&\n fontHasGlyphSync(next.fontFamily, faceStyleKey(next), char)\n )\n })\n return family ? fallbackStyle(style, family) : null\n}\n\nfunction fallbackFamilies(): string[] {\n return [...fontManager.getCJKFallbackFamilies(), ...fontManager.getLetterFallbackFamilies()]\n}\n\n/** `style` in a script fallback family, which has none of the text family's named faces. */\nfunction fallbackStyle(style: TextStyle, family: string): TextStyle {\n return { ...style, fontFamily: family, fontStyle: null }\n}\n\nfunction textStyles(node: SceneNode): TextStyle[] {\n if (node.styleRuns.length === 0) return [baseTextStyle(node)]\n const styles = new Map<string, TextStyle>()\n for (let index = 0; index < node.text.length; index++) {\n const style = textStyleAt(node, index)\n styles.set(styleKey(style), style)\n }\n return [...styles.values()]\n}\n\nexport function getTextOutlineSupport(node: SceneNode): TextOutlineSupport {\n if (node.type !== 'TEXT') return { supported: false, reason: 'not-text' }\n if (!node.text) return { supported: false, reason: 'empty-text' }\n if (COMPLEX_SCRIPT_PATTERN.test(node.text)) return { supported: false, reason: 'complex-script' }\n for (const style of textStyles(node)) {\n if (!fontManager.loadedData(style.fontFamily, faceStyleKey(style))) {\n return { supported: false, reason: 'missing-font' }\n }\n }\n for (let index = 0; index < node.text.length; index++) {\n const char = node.text[index]\n if (char === '\\n') continue\n const style = textStyleAt(node, index)\n if (!resolvedGlyphStyle(style, char)) return { supported: false, reason: 'missing-glyph' }\n }\n return { supported: true }\n}\n\nfunction lineHeight(node: SceneNode): number {\n return lineHeightPixels(node.lineHeight, node.fontSize) ?? Math.ceil(node.fontSize * 1.2)\n}\n\ninterface TextLine {\n text: string\n start: number\n}\n\nfunction hardTextLines(text: string): TextLine[] {\n const lines: TextLine[] = []\n let start = 0\n for (const line of text.split('\\n')) {\n lines.push({ text: line, start })\n start += line.length + 1\n }\n return lines\n}\n\nfunction glyphAdvance(node: SceneNode, absoluteIndex: number): number | null {\n const char = node.text[absoluteIndex]\n const style = resolvedGlyphStyle(textStyleAt(node, absoluteIndex), char)\n if (!style) return null\n const metrics = getGlyphOutlineMetricsSync(\n style.fontFamily,\n faceStyleKey(style),\n char,\n style.fontSize\n )\n const glyph = metrics?.[0]\n return glyph ? glyph.advance + textLengthPixels(style.letterSpacing, style.fontSize) : null\n}\n\nfunction wrapStyledLine(node: SceneNode, line: TextLine): TextLine[] {\n if (!line.text || node.width <= 0) return [line]\n const result: TextLine[] = []\n let lineStart = 0\n let cursor = 0\n let lastBreak = -1\n\n for (let index = 0; index < line.text.length; index++) {\n const advance = glyphAdvance(node, line.start + index)\n if (advance == null) return [line]\n cursor += advance\n if (/\\s/.test(line.text[index])) {\n lastBreak = index + 1\n }\n if (cursor <= node.width || index === lineStart) continue\n\n const breakIndex = lastBreak > lineStart ? lastBreak : index\n result.push({ text: line.text.slice(lineStart, breakIndex), start: line.start + lineStart })\n lineStart = breakIndex\n index = breakIndex - 1\n cursor = 0\n lastBreak = -1\n }\n\n result.push({ text: line.text.slice(lineStart), start: line.start + lineStart })\n return result\n}\n\nfunction textLines(node: SceneNode): TextLine[] {\n const hardLines = hardTextLines(node.text)\n if (node.textAutoResize === 'WIDTH_AND_HEIGHT') return hardLines\n if (node.styleRuns.length > 0) return hardLines.flatMap((line) => wrapStyledLine(node, line))\n\n const result: TextLine[] = []\n for (const hardLine of hardLines) {\n if (!hardLine.text) {\n result.push(hardLine)\n continue\n }\n try {\n const prepared = prepareWithSegments(hardLine.text, `${node.fontSize}px ${node.fontFamily}`)\n const layout = layoutWithLines(prepared, node.width, lineHeight(node))\n let start = hardLine.start\n for (const line of layout.lines) {\n result.push({ text: line.text, start })\n start += line.text.length\n }\n } catch {\n result.push(hardLine)\n }\n }\n return result\n}\n\nfunction lineOffsetX(node: SceneNode, width: number): number {\n switch (node.textAlignHorizontal) {\n case 'CENTER':\n return Math.max(0, (node.width - width) / 2)\n case 'RIGHT':\n return Math.max(0, node.width - width)\n default:\n return 0\n }\n}\n\nfunction verticalOffset(node: SceneNode, contentHeight: number): number {\n switch (node.textAlignVertical) {\n case 'CENTER':\n return Math.max(0, (node.height - contentHeight) / 2)\n case 'BOTTOM':\n return Math.max(0, node.height - contentHeight)\n default:\n return 0\n }\n}\n\nfunction lineGlyphs(\n node: SceneNode,\n line: TextLine,\n baseline: number,\n xOffset: number\n): { glyphs: TextOutlineGlyph[]; width: number } | null {\n const glyphs: TextOutlineGlyph[] = []\n let cursorX = xOffset\n let index = 0\n\n while (index < line.text.length) {\n const absoluteIndex = line.start + index\n const style = resolvedGlyphStyle(textStyleAt(node, absoluteIndex), line.text[index])\n if (!style) return null\n const key = styleKey(style)\n let end = index + 1\n while (end < line.text.length) {\n const nextStyle = resolvedGlyphStyle(textStyleAt(node, line.start + end), line.text[end])\n if (!nextStyle || styleKey(nextStyle) !== key) break\n end++\n }\n\n const segment = line.text.slice(index, end)\n const metrics = getGlyphOutlineMetricsSync(\n style.fontFamily,\n faceStyleKey(style),\n segment,\n style.fontSize\n )\n if (!metrics) return null\n\n for (const glyph of metrics) {\n glyphs.push({ commands: glyph.commands, x: cursorX, y: baseline })\n cursorX += glyph.advance + textLengthPixels(style.letterSpacing, style.fontSize)\n }\n index = end\n }\n\n return { glyphs, width: cursorX - xOffset }\n}\n\nexport function textNodeToOutlineLayout(node: SceneNode): TextOutlineLayout | null {\n if (!getTextOutlineSupport(node).supported) return null\n\n const lines = textLines(node)\n const lineH = lineHeight(node)\n const contentHeight = lines.length * lineH\n const yOffset = verticalOffset(node, contentHeight)\n const glyphs: TextOutlineGlyph[] = []\n let maxWidth = 0\n\n for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {\n const baseline = yOffset + lineIndex * lineH + lineH\n const measured = lineGlyphs(node, lines[lineIndex], baseline, 0)\n if (!measured) return null\n const xOffset = lineOffsetX(node, measured.width)\n maxWidth = Math.max(maxWidth, measured.width)\n const placed =\n xOffset === 0\n ? measured.glyphs\n : measured.glyphs.map((glyph) => ({ ...glyph, x: glyph.x + xOffset }))\n glyphs.push(...placed)\n }\n\n return { glyphs, width: maxWidth, height: contentHeight }\n}\n"],"mappings":";;;;;;;AAqCA,MAAM,yBAAyB;AAS/B,SAAS,cAAc,MAA4B;CACjD,OAAO;EACL,YAAY,KAAK;EACjB,UAAU,KAAK;EACf,YAAY,KAAK;EACjB,QAAQ,KAAK;EACb,WAAW,KAAK;EAChB,eAAe,KAAK;CACtB;AACF;AAEA,SAAS,SAAS,OAA0B;CAC1C,MAAM,UAAU,iBAAiB,MAAM,eAAe,MAAM,QAAQ;CACpE,OAAO,GAAG,MAAM,WAAW,GAAG,aAAa,KAAK,EAAE,GAAG,MAAM,SAAS,GAAG;AACzE;AAEA,SAAS,YAAY,MAAiB,OAA0B;CAC9D,MAAM,OAAO,cAAc,IAAI;CAC/B,MAAM,MAAM,KAAK,UAAU,MAAM,SAAS,SAAS,KAAK,SAAS,QAAQ,KAAK,QAAQ,KAAK,MAAM;CACjG,IAAI,CAA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AM,SAAS,SAAS;GAC3B,OAAO,KAAK;IAAE,UAAU,MAAM;IAAU,GAAG;IAAS,GAAG;GAAS,CAAC;GACjE,WAAW,MAAM,UAAU,iBAAiB,MAAM,eAAe,MAAM,QAAQ;EACjF;EACA,QAAQ;CACV;CAEA,OAAO;EAAE;EAAQ,OAAO,UAAU;CAAQ;AAC5C;AAEA,SAAgB,wBAAwB,MAA2C;CACjF,IAAI,CAAC,sBAAsB,IAAI,CAAC,CAAC,WAAW,OAAO;CAEnD,MAAM,QAAQ,UAAU,IAAI;CAC5B,MAAM,QAAQ,WAAW,IAAI;CAC7B,MAAM,gBAAgB,MAAM,SAAS;CACrC,MAAM,UAAU,eAAe,MAAM,aAAa;CAClD,MAAM,SAA6B,CAAC;CACpC,IAAI,WAAW;CAEf,KAAK,IAAI,YAAY,GAAG,YAAY,MAAM,QAAQ,aAAa;EAC7D,MAAM,WAAW,UAAU,YAAY,QAAQ;EAC/C,MAAM,WAAW,WAAW,MAAM,MAAM,YAAY,UAAU,CAAC;EAC/D,IAAI,CAAC,UAAU,OAAO;EACtB,MAAM,UAAU,YAAY,MAAM,SAAS,KAAK;EAChD,WAAW,KAAK,IAAI,UAAU,SAAS,KAAK;EAC5C,MAAM,SACJ,YAAY,IACR,SAAS,SACT,SAAS,OAAO,KAAK,WAAW;GAAE,GAAG;GAAO,GAAG,MAAM,IAAI;EAAQ,EAAE;EACzE,OAAO,KAAK,GAAG,MAAM;CACvB;CAEA,OAAO;EAAE;EAAQ,OAAO;EAAU,QAAQ;CAAc;AAC1D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LineSegment } from "../../geometry/types.js";
|
|
1
2
|
import { DerivedTextGlyph } from "@pairdraw/scene-graph";
|
|
2
3
|
import { Vector } from "@pairdraw/scene-graph/primitives";
|
|
3
4
|
//#region src/text/path/caret.d.ts
|
|
@@ -7,10 +8,7 @@ interface PathTextLineMetrics {
|
|
|
7
8
|
descent: number;
|
|
8
9
|
}
|
|
9
10
|
/** A caret: a line square to the baseline from the descent to the ascent. */
|
|
10
|
-
|
|
11
|
-
from: Vector;
|
|
12
|
-
to: Vector;
|
|
13
|
-
}
|
|
11
|
+
type PathTextCaret = LineSegment;
|
|
14
12
|
/**
|
|
15
13
|
* The caret before character `index`: at the start of the glyph drawing it, or after the last
|
|
16
14
|
* glyph when the characters from `index` on are past the end or not drawn.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caret.d.ts","names":[],"sources":["../../../src/text/path/caret.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"caret.d.ts","names":[],"sources":["../../../src/text/path/caret.ts"],"mappings":";;;;;UAMiB;EACf;EACA;;;KAmBU,gBAAgB;;;;;iBA6CZ,cACd,iBAAiB,oBACjB,oBACA,eACA,SAAS,sBACR;;;;;iBAYa,gBACd,iBAAiB,oBACjB,oBACA,OAAO,QACP,SAAS;;iBA2BK,uBACd,iBAAiB,oBACjB,oBACA,cACA,YACA,SAAS,sBACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caret.js","names":[],"sources":["../../../src/text/path/caret.ts"],"sourcesContent":["import type { DerivedTextGlyph } from '@pairdraw/scene-graph'\nimport type { Vector } from '@pairdraw/scene-graph/primitives'\n\n/** How far the font reaches above and below the baseline, in ems. */\nexport interface PathTextLineMetrics {\n ascent: number\n descent: number\n}\n\n/** A glyph on the path in its own frame: where its baseline starts, its directions and extent. */\ninterface PlacedGlyph {\n origin: Vector\n /** Unit baseline direction, the way the text runs. */\n along: Vector\n /** Unit direction from the baseline to the ascender. */\n up: Vector\n advance: number\n ascent: number\n descent: number\n /** Characters the glyph draws, [start, end). */\n start: number\n end: number\n}\n\n/** A caret: a line square to the baseline from the descent to the ascent. */\nexport
|
|
1
|
+
{"version":3,"file":"caret.js","names":[],"sources":["../../../src/text/path/caret.ts"],"sourcesContent":["import type { DerivedTextGlyph } from '@pairdraw/scene-graph'\nimport type { Vector } from '@pairdraw/scene-graph/primitives'\n\nimport type { LineSegment } from '#core/geometry/types'\n\n/** How far the font reaches above and below the baseline, in ems. */\nexport interface PathTextLineMetrics {\n ascent: number\n descent: number\n}\n\n/** A glyph on the path in its own frame: where its baseline starts, its directions and extent. */\ninterface PlacedGlyph {\n origin: Vector\n /** Unit baseline direction, the way the text runs. */\n along: Vector\n /** Unit direction from the baseline to the ascender. */\n up: Vector\n advance: number\n ascent: number\n descent: number\n /** Characters the glyph draws, [start, end). */\n start: number\n end: number\n}\n\n/** A caret: a line square to the baseline from the descent to the ascent. */\nexport type PathTextCaret = LineSegment\n\nfunction placedGlyphs(\n glyphs: readonly DerivedTextGlyph[],\n textLength: number,\n metrics: PathTextLineMetrics\n): PlacedGlyph[] {\n return glyphs.map((glyph, index) => {\n const rotation = glyph.rotation ?? 0\n const along = { x: Math.cos(rotation), y: -Math.sin(rotation) }\n const next = glyphs.at(index + 1)\n // Without a saved advance a glyph reaches the next one; the last one then has no width.\n const advance =\n glyph.advance ?? (next ? (next.x - glyph.x) * along.x + (next.y - glyph.y) * along.y : 0)\n const start = glyph.firstCharacter ?? index\n return {\n origin: { x: glyph.x, y: glyph.y },\n along,\n up: { x: -Math.sin(rotation), y: -Math.cos(rotation) },\n advance: Math.max(0, advance),\n ascent: metrics.ascent * glyph.fontSize,\n descent: metrics.descent * glyph.fontSize,\n start,\n // Characters past the last glyph, cut where the text ran out of path, have no glyph.\n end: Math.min(next ? (next.firstCharacter ?? index + 1) : start + 1, textLength)\n }\n })\n}\n\nconst at = (glyph: PlacedGlyph, distance: number, height: number): Vector => ({\n x: glyph.origin.x + glyph.along.x * distance + glyph.up.x * height,\n y: glyph.origin.y + glyph.along.y * distance + glyph.up.y * height\n})\n\n/** How far along a glyph its `index`th character starts, sharing a ligature's width evenly. */\nfunction distanceOf(glyph: PlacedGlyph, index: number): number {\n const count = glyph.end - glyph.start\n if (count <= 0) return 0\n return (glyph.advance * Math.min(Math.max(index - glyph.start, 0), count)) / count\n}\n\n/**\n * The caret before character `index`: at the start of the glyph drawing it, or after the last\n * glyph when the characters from `index` on are past the end or not drawn.\n */\nexport function pathTextCaret(\n glyphs: readonly DerivedTextGlyph[],\n textLength: number,\n index: number,\n metrics: PathTextLineMetrics\n): PathTextCaret | null {\n const placed = placedGlyphs(glyphs, textLength, metrics)\n const glyph = placed.find((candidate) => index < candidate.end) ?? placed.at(-1)\n if (!glyph) return null\n const distance = distanceOf(glyph, index)\n return { from: at(glyph, distance, -glyph.descent), to: at(glyph, distance, glyph.ascent) }\n}\n\n/**\n * The character boundary nearest a point: the glyph whose box, from the descent to the ascent,\n * the point is in or closest to, and the side of the character in it the point is on.\n */\nexport function pathTextIndexAt(\n glyphs: readonly DerivedTextGlyph[],\n textLength: number,\n point: Vector,\n metrics: PathTextLineMetrics\n): number {\n let best: { glyph: PlacedGlyph; distance: number } | null = null\n let bestGap = Infinity\n for (const glyph of placedGlyphs(glyphs, textLength, metrics)) {\n const dx = point.x - glyph.origin.x\n const dy = point.y - glyph.origin.y\n const distance = dx * glyph.along.x + dy * glyph.along.y\n const height = dx * glyph.up.x + dy * glyph.up.y\n const gap = Math.hypot(\n Math.max(0, -distance, distance - glyph.advance),\n Math.max(0, -glyph.descent - height, height - glyph.ascent)\n )\n if (gap < bestGap) {\n bestGap = gap\n best = { glyph, distance }\n }\n }\n if (!best) return textLength\n const { glyph, distance } = best\n const count = glyph.end - glyph.start\n if (count <= 0 || glyph.advance <= 0) return glyph.start\n const step = glyph.advance / count\n return glyph.start + Math.min(Math.max(Math.round(distance / step), 0), count)\n}\n\n/** The boxes covering the characters [from, to): one per glyph they touch, rotated with it. */\nexport function pathTextSelectionQuads(\n glyphs: readonly DerivedTextGlyph[],\n textLength: number,\n from: number,\n to: number,\n metrics: PathTextLineMetrics\n): Vector[][] {\n const quads: Vector[][] = []\n for (const glyph of placedGlyphs(glyphs, textLength, metrics)) {\n if (glyph.end <= from || glyph.start >= to) continue\n const start = distanceOf(glyph, from)\n const end = distanceOf(glyph, to)\n if (!(end > start)) continue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AAG,KAAK;AAC/E;;AAGA,SAAgB,uBACd,QACA,YACA,MACA,IACA,SACY;CACZ,MAAM,QAAoB,CAAC;CAC3B,KAAK,MAAM,SAAS,aAAa,QAAQ,YAAY,OAAO,GAAG;EAC7D,IAAI,MAAM,OAAO,QAAQ,MAAM,SAAS,IAAI;EAC5C,MAAM,QAAQ,WAAW,OAAO,IAAI;EACpC,MAAM,MAAM,WAAW,OAAO,EAAE;EAChC,IAAI,EAAE,MAAM,QAAQ;EACpB,MAAM,KAAK;GACT,GAAG,OAAO,OAAO,CAAC,MAAM,OAAO;GAC/B,GAAG,OAAO,KAAK,CAAC,MAAM,OAAO;GAC7B,GAAG,OAAO,KAAK,MAAM,MAAM;GAC3B,GAAG,OAAO,OAAO,MAAM,MAAM;EAC/B,CAAC;CACH;CACA,OAAO;AACT"}
|
package/dist/text/prepare.d.ts
CHANGED
|
@@ -3,7 +3,11 @@ import { SceneGraph } from "@pairdraw/scene-graph";
|
|
|
3
3
|
//#region src/text/prepare.d.ts
|
|
4
4
|
declare function prepareGraphFonts(graph: SceneGraph, nodeIds: readonly string[],
|
|
5
5
|
/** Characters a writer draws besides the text's own, which the fonts must map too. */
|
|
6
|
-
extraCharacters?: string
|
|
6
|
+
extraCharacters?: string,
|
|
7
|
+
/** An output that draws once and cannot wait for a face to arrive; see `settleUnavailableFonts`. */
|
|
8
|
+
{ settleUnavailable }?: {
|
|
9
|
+
settleUnavailable?: boolean;
|
|
10
|
+
}): Promise<DocumentFontStatus>;
|
|
7
11
|
//#endregion
|
|
8
12
|
export { prepareGraphFonts };
|
|
9
13
|
//# sourceMappingURL=prepare.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.d.ts","names":[],"sources":["../../src/text/prepare.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"prepare.d.ts","names":[],"sources":["../../src/text/prepare.ts"],"mappings":";;;iBA4DsB,kBACpB,OAAO,YACP,4BAEA;;AAAA;;EAEE;EAA+B;IAChC,QAAQ"}
|
package/dist/text/prepare.js
CHANGED
|
@@ -2,6 +2,7 @@ import { DEFAULT_FONT_FAMILY } from "../constants.js";
|
|
|
2
2
|
import { collectGraphFontRequirements, collectNodeFontFaces } from "./requirements/collect.js";
|
|
3
3
|
import { fontManager } from "./font/manager.js";
|
|
4
4
|
import { fontGlyphCoverageSync } from "./font/glyphs.js";
|
|
5
|
+
import { fontFaceDemand, fontResolver } from "./resolver/index.js";
|
|
5
6
|
import { NOTO_COLOR_EMOJI_FAMILY, canDrawPlatformEmoji, mayHoldEmoji, savedEmojiCharacters } from "./emoji.js";
|
|
6
7
|
import { missingGraphFontScripts } from "./requirements/resolved.js";
|
|
7
8
|
import { documentFontStatus } from "./font/status.js";
|
|
@@ -20,7 +21,7 @@ function laidOutEmojiCharacters(node) {
|
|
|
20
21
|
family: DEFAULT_FONT_FAMILY,
|
|
21
22
|
style: "Regular"
|
|
22
23
|
},
|
|
23
|
-
...[...fontManager.
|
|
24
|
+
...[...fontManager.getLetterFallbackFamilies(), ...fontManager.getCJKFallbackFamilies()].map((family) => ({
|
|
24
25
|
family,
|
|
25
26
|
style: "Regular"
|
|
26
27
|
}))
|
|
@@ -32,7 +33,17 @@ function laidOutEmojiCharacters(node) {
|
|
|
32
33
|
}
|
|
33
34
|
return characters;
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
+
/**
|
|
37
|
+
* A one-shot output cannot wait for a face no source has. Loading the substitute face and settling
|
|
38
|
+
* those demands is what lets the text draw in it instead of leaving the layer empty.
|
|
39
|
+
*/
|
|
40
|
+
async function settleUnavailableFonts(faces, characters) {
|
|
41
|
+
const unavailable = faces.filter(({ family, style }) => !fontManager.isStyleLoaded(family, style));
|
|
42
|
+
if (unavailable.length === 0) return;
|
|
43
|
+
await fontManager.loadFont(DEFAULT_FONT_FAMILY, "Regular", characters);
|
|
44
|
+
for (const { family, style } of unavailable) fontResolver.exhaust(fontFaceDemand(family, style, characters));
|
|
45
|
+
}
|
|
46
|
+
async function prepareGraphFonts(graph, nodeIds, extraCharacters = "", { settleUnavailable = false } = {}) {
|
|
36
47
|
const collected = collectGraphFontRequirements(graph, nodeIds);
|
|
37
48
|
const requirements = extraCharacters ? {
|
|
38
49
|
...collected,
|
|
@@ -41,6 +52,12 @@ async function prepareGraphFonts(graph, nodeIds, extraCharacters = "") {
|
|
|
41
52
|
const faces = requirements.nodes.flatMap(collectNodeFontFaces);
|
|
42
53
|
await Promise.all(faces.map(({ family, style }) => fontManager.loadFont(family, style, requirements.characters)));
|
|
43
54
|
await fontManager.ensureFallbackPack(missingGraphFontScripts(requirements), requirements.characters);
|
|
55
|
+
if (settleUnavailable) await settleUnavailableFonts(faces, requirements.characters);
|
|
56
|
+
const unavailable = faces.filter(({ family, style }) => !fontManager.isStyleLoaded(family, style));
|
|
57
|
+
if (unavailable.length > 0) {
|
|
58
|
+
await fontManager.loadFont(DEFAULT_FONT_FAMILY, "Regular", requirements.characters);
|
|
59
|
+
for (const { family, style } of unavailable) fontResolver.exhaust(fontFaceDemand(family, style, requirements.characters));
|
|
60
|
+
}
|
|
44
61
|
const emoji = requirements.nodes.map(savedEmojiCharacters).join("") + requirements.nodes.map(laidOutEmojiCharacters).join("");
|
|
45
62
|
if (emoji && !canDrawPlatformEmoji()) await fontManager.loadRemoteFont(NOTO_COLOR_EMOJI_FAMILY, "Regular", emoji);
|
|
46
63
|
return documentFontStatus(graph, nodeIds);
|
package/dist/text/prepare.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.js","names":[],"sources":["../../src/text/prepare.ts"],"sourcesContent":["import { uniq } from 'es-toolkit'\n\nimport type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\n\nimport { DEFAULT_FONT_FAMILY } from '#core/constants'\nimport {\n canDrawPlatformEmoji,\n mayHoldEmoji,\n NOTO_COLOR_EMOJI_FAMILY,\n savedEmojiCharacters\n} from '#core/text/emoji'\nimport { fontGlyphCoverageSync } from '#core/text/font/glyphs'\nimport { fontManager } from '#core/text/font/manager'\nimport { collectGraphFontRequirements, collectNodeFontFaces } from '#core/text/requirements/collect'\nimport { missingGraphFontScripts } from '#core/text/requirements/resolved'\n\nimport { documentFontStatus, type DocumentFontStatus } from './font/status'\n\n/**\n * The characters of a text its layout falls back to the emoji metrics font for: ones that may be\n * emoji and that none of the faces it draws in, nor the fallbacks after them, has. A face not\n * loaded cannot tell, and leaves the character to it.\n */\nfunction laidOutEmojiCharacters(node: SceneNode): string {\n if (node.type !== 'TEXT' || !mayHoldEmoji(node.text)) return ''\n const faces = [\n ...collectNodeFontFaces(node),\n { family: DEFAULT_FONT_FAMILY, style: 'Regular' },\n ...[...fontManager.
|
|
1
|
+
{"version":3,"file":"prepare.js","names":[],"sources":["../../src/text/prepare.ts"],"sourcesContent":["import { uniq } from 'es-toolkit'\n\nimport type { SceneGraph, SceneNode } from '@pairdraw/scene-graph'\n\nimport { DEFAULT_FONT_FAMILY } from '#core/constants'\nimport {\n canDrawPlatformEmoji,\n mayHoldEmoji,\n NOTO_COLOR_EMOJI_FAMILY,\n savedEmojiCharacters\n} from '#core/text/emoji'\nimport { fontGlyphCoverageSync } from '#core/text/font/glyphs'\nimport { fontManager } from '#core/text/font/manager'\nimport { collectGraphFontRequirements, collectNodeFontFaces } from '#core/text/requirements/collect'\nimport { missingGraphFontScripts } from '#core/text/requirements/resolved'\nimport { fontFaceDemand, fontResolver } from '#core/text/resolver'\n\nimport { documentFontStatus, type DocumentFontStatus } from './font/status'\n\n/**\n * The characters of a text its layout falls back to the emoji metrics font for: ones that may be\n * emoji and that none of the faces it draws in, nor the fallbacks after them, has. A face not\n * loaded cannot tell, and leaves the character to it.\n */\nfunction laidOutEmojiCharacters(node: SceneNode): string {\n if (node.type !== 'TEXT' || !mayHoldEmoji(node.text)) return ''\n const faces = [\n ...collectNodeFontFaces(node),\n { family: DEFAULT_FONT_FAMILY, style: 'Regular' },\n ...[...fontManager.getLetterFallbackFamilies(), ...fontManager.getCJKFallbackFamilies()].map(\n (family) => ({ family, style: 'Regular' })\n )\n ]\n let characters = ''\n for (const character of node.text) {\n if (!mayHoldEmoji(character)) continue\n const drawnByText = faces.some(\n ({ family, style }) => fontGlyphCoverageSync(family, style, character) !== 'missing'\n )\n if (!drawnByText) characters += character\n }\n return characters\n}\n\n/**\n * A one-shot output cannot wait for a face no source has. Loading the substitute face and settling\n * those demands is what lets the text draw in it instead of leaving the layer empty.\n */\nasync function settleUnavailableFonts(\n faces: readonly { family: string; style: string }[],\n characters: string\n): Promise<void> {\n const unavailable = faces.filter(({ family, style }) => !fontManager.isStyleLoaded(family, style))\n if (unavailable.length === 0) return\n await fontManager.loadFont(DEFAULT_FONT_FAMILY, 'Regular', characters)\n for (const { family, style } of unavailable) {\n fontResolver.exhaust(fontFaceDemand(family, style, characters))\n }\n}\n\nexport async function prepareGraphFonts(\n graph: SceneGraph,\n nodeIds: readonly string[],\n /** Characters a writer draws besides the text's own, which the fonts must map too. */\n extraCharacters = '',\n /** An output that draws once and cannot wait for a face to arrive; see `settleUnavailableFonts`. */\n { settleUnavailable = false }: { settleUnavailable?: boolean } = {}\n): Promise<DocumentFontStatus> {\n const collected = collectGraphFontRequirements(graph, nodeIds)\n const requirements = extraCharacters\n ? {\n ...collected,\n characters: uniq(Array.from(collected.characters + extraCharacters)).join('')\n }\n : collected\n const faces = requirements.nodes.flatMap(collectNodeFontFaces)\n await Promise.all(\n faces.map(({ family, style }) => fontManager.loadFont(family, style, requirements.characters))\n )\n await fontManager.ensureFallbackPack(\n missingGraphFontScripts(requirements),\n requirements.characters\n )\n if (settleUnavailable) await settleUnavailableFonts(faces, requirements.characters)\n // A face the document asks for and no source has cannot draw; the text is drawn in the default\n // face and the script fallbacks after it, so that face has to be loaded to keep the text\n // visible instead of leaving the layer blank.\n const unavailable = faces.filter(({ family, style }) => !fontManager.isStyleLoaded(family, style))\n if (unavailable.length > 0) {\n await fontManager.loadFont(DEFAULT_FONT_FAMILY, 'Regular', requirements.characters)\n // Nothing else will load these faces in this export, so the render must not wait for them:\n // settling them here is what turns the text into the substituted face it is drawn in.\n for (const { family, style } of unavailable) {\n fontResolver.exhaust(fontFaceDemand(family, style, requirements.characters))\n }\n }\n // Without a platform that draws emoji, emoji are drawn with Noto, loaded for just these: the\n // saved ones, and the ones the layout leaves to the emoji metrics font.\n const emoji =\n requirements.nodes.map(savedEmojiCharacters).join('') +\n requirements.nodes.map(laidOutEmojiCharacters).join('')\n if (emoji && !canDrawPlatformEmoji())\n await fontManager.loadRemoteFont(NOTO_COLOR_EMOJI_FAMILY, 'Regular', emoji)\n return documentFontStatus(graph, nodeIds)\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,SAAS,uBAAuB,MAAyB;CACvD,IAAI,KAAK,SAAS,UAAU,CAAC,aAAa,KAAK,IAAI,GAAG,OAAO;CAC7D,MAAM,QAAQ;EACZ,GAAG,qBAAqB,IAAI;EAC5B;GAAE,QAAQ;GAAqB,OAAO;EAAU;EAChD,GAAG,CAAC,GAAG,YAAY,0BAA0B,GAAG,GAAG,YAAY,uBAAuB,CAAC,CAAC,CAAC,KACtF,YAAY;GAAE;GAAQ,OAAO;EAAU,EAC1C;CACF;CACA,IAAI,aAAa;CACjB,KAAK,MAAM,aAAa,KAAK,MAAM;EACjC,IAAI,CAAC,aAAa,SAAS,GAAG;EAI9B,IAAI,CAHgB,MAAM,MACvB,EAAE,QAAQ,YAAY,sBAAsB,QAAQ,OAAO,SAAS,MAAM,SAE9D,GAAG,cAAc;CAClC;CACA,OAAO;AACT;;;;;AAMA,eAAe,uBACb,OACA,YACe;CACf,MAAM,cAAc,MAAM,QAAQ,EAAE,QAAQ,YAAY,CAAC,YAAY,cAAc,QAAQ,KAAK,CAAC;CACjG,IAAI,YAAY,WAAW,GAAG;CAC9B,MAAM,YAAY,SAAS,qBAAqB,WAAW,UAAU;CACrE,KAAK,MAAM,EAAE,QAAQ,WAAW,aAC9B,aAAa,QAAQ,eAAe,QAAQ,OAAO,UAAU,CAAC;AAElE;AAEA,eAAsB,kBACpB,OACA,SAEA,kBAAkB,IAElB,EAAE,oBAAoB,UAA2C,CAAC,GACrC;CAC7B,MAAM,YAAY,6BAA6B,OAAO,OAAO;CAC7D,MAAM,eAAe,kBACjB;EACE,GAAG;EACH,YAAY,KAAK,MAAM,KAAK,UAAU,aAAa,eAAe,CAAC,CAAC,CAAC,KAAK,EAAE;CAC9E,IACA;CACJ,MAAM,QAAQ,aAAa,MAAM,QAAQ,oBAAoB;CAC7D,MAAM,QAAQ,IACZ,MAAM,KAAK,EAAE,QAAQ,YAAY,YAAY,SAAS,QAAQ,OAAO,aAAa,UAAU,CAAC,CAC/F;CACA,MAAM,YAAY,mBAChB,wBAAwB,YAAY,GACpC,aAAa,UACf;CACA,IAAI,mBAAmB,MAAM,uBAAuB,OAAO,aAAa,UAAU;CAIlF,MAAM,cAAc,MAAM,QAAQ,EAAE,QAAQ,YAAY,CAAC,YAAY,cAAc,QAAQ,KAAK,CAAC;CACjG,IAAI,YAAY,SAAS,GAAG;EAC1B,MAAM,YAAY,SAAS,qBAAqB,WAAW,aAAa,UAAU;EAGlF,KAAK,MAAM,EAAE,QAAQ,WAAW,aAC9B,aAAa,QAAQ,eAAe,QAAQ,OAAO,aAAa,UAAU,CAAC;CAE/E;CAGA,MAAM,QACJ,aAAa,MAAM,IAAI,oBAAoB,CAAC,CAAC,KAAK,EAAE,IACpD,aAAa,MAAM,IAAI,sBAAsB,CAAC,CAAC,KAAK,EAAE;CACxD,IAAI,SAAS,CAAC,qBAAqB,GACjC,MAAM,YAAY,eAAe,yBAAyB,WAAW,KAAK;CAC5E,OAAO,mBAAmB,OAAO,OAAO;AAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","names":[],"sources":["../../../src/text/web-font/assets.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"assets.d.ts","names":[],"sources":["../../../src/text/web-font/assets.ts"],"mappings":";;;UA8DiB;EACf,OAAO;EACP,YAAY;EACZ;EACA,UAAU;;UAGK;EACf,QAAQ;;iBA2DY,0BACpB,OACA,WACA,eACA,WACC,iCAAiC,QAAQ"}
|