oasis-editor 0.0.1 → 0.0.2
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/README.md +388 -1
- package/dist/OasisEditorApp-DEnDLTaw.js +45893 -0
- package/dist/app/bootstrap/createOasisEditorApp.d.ts +2 -3
- package/dist/app/bootstrap/createOasisEditorContainer.d.ts +2 -3
- package/dist/app/client/OasisEditorClient.d.ts +97 -0
- package/dist/app/controllers/EditorCommandsController.d.ts +1 -1
- package/dist/app/controllers/createResizeSession.d.ts +43 -0
- package/dist/app/controllers/createRotateSession.d.ts +36 -0
- package/dist/app/controllers/documentIO/DocumentImporter.d.ts +1 -1
- package/dist/app/controllers/tableResize/tableResizeApply.d.ts +5 -0
- package/dist/app/controllers/tableResize/tableResizeConstraints.d.ts +17 -0
- package/dist/app/controllers/tableResize/tableResizeDom.d.ts +9 -0
- package/dist/app/controllers/tableResize/tableResizeGeometry.d.ts +5 -0
- package/dist/app/controllers/tableResize/tableResizeHitTest.d.ts +4 -0
- package/dist/app/controllers/tableResize/tableResizeTypes.d.ts +65 -0
- package/dist/app/controllers/tableResize/tableResizeUnits.d.ts +6 -0
- package/dist/app/controllers/useEditorDocumentIO.d.ts +3 -3
- package/dist/app/controllers/useEditorHistoryActions.d.ts +3 -1
- package/dist/app/controllers/useEditorImageOperations.d.ts +6 -14
- package/dist/app/controllers/useEditorLayout.d.ts +2 -2
- package/dist/app/controllers/useEditorStyle.d.ts +1 -1
- package/dist/app/controllers/useEditorSurfaceEvents.d.ts +1 -0
- package/dist/app/controllers/useEditorTableOperations.d.ts +2 -2
- package/dist/app/controllers/useEditorTableResize.d.ts +2 -24
- package/dist/app/controllers/useEditorTextBoxOperations.d.ts +24 -0
- package/dist/app/services/userPreferences.d.ts +4 -0
- package/dist/assets/importDocxWorker-R5rI6JIO.js +12 -0
- package/dist/branding/apple-touch-icon.png +0 -0
- package/dist/branding/brand-mark.webp +0 -0
- package/dist/branding/favicon-16x16.png +0 -0
- package/dist/branding/favicon-32x32.png +0 -0
- package/dist/branding/favicon.ico +0 -0
- package/dist/branding/github-pages-icon.png +0 -0
- package/dist/branding/icon-192.png +0 -0
- package/dist/branding/icon-512.png +0 -0
- package/dist/branding/logo-full.png +0 -0
- package/dist/branding/logo-mark-square.png +0 -0
- package/dist/branding/social-card.png +0 -0
- package/dist/core/Editor.d.ts +4 -5
- package/dist/core/cloneState.d.ts +3 -1
- package/dist/core/commands/CommandRegistry.d.ts +6 -1
- package/dist/core/commands/block.d.ts +1 -1
- package/dist/core/commands/builtinCommands.d.ts +2 -0
- package/dist/core/commands/floatingLayout.d.ts +29 -0
- package/dist/core/commands/image.d.ts +16 -8
- package/dist/core/commands/list.d.ts +1 -1
- package/dist/core/commands/publicCommandTypes.d.ts +110 -0
- package/dist/core/commands/selectedObjectRun.d.ts +20 -0
- package/dist/core/commands/table/insertTableCommand.d.ts +3 -0
- package/dist/core/commands/table/tableCellStyleCommands.d.ts +5 -0
- package/dist/core/commands/table/tableColumnCommands.d.ts +3 -0
- package/dist/core/commands/table/tableCommandUtils.d.ts +16 -0
- package/dist/core/commands/table/tableRowCommands.d.ts +5 -0
- package/dist/core/commands/table/tableStyleCommands.d.ts +4 -0
- package/dist/core/commands/table.d.ts +5 -10
- package/dist/core/commands/text.d.ts +1 -1
- package/dist/core/commands/textBox.d.ts +21 -0
- package/dist/core/document/blockReplacement.d.ts +7 -0
- package/dist/core/document/bookmarkAnchors.d.ts +8 -0
- package/dist/core/document/clone.d.ts +8 -0
- package/dist/core/document/paragraphRunBuild.d.ts +14 -0
- package/dist/core/document/paragraphRunEdit.d.ts +3 -0
- package/dist/core/document/paragraphRunQuery.d.ts +14 -0
- package/dist/core/document/paragraphRuns.d.ts +3 -0
- package/dist/core/editorCommands.d.ts +2 -0
- package/dist/core/editorState.d.ts +5 -3
- package/dist/core/endnotes.d.ts +41 -0
- package/dist/core/engine.d.ts +18 -3
- package/dist/core/html/htmlBlockWalker.d.ts +17 -0
- package/dist/core/html/htmlEscape.d.ts +1 -0
- package/dist/core/html/htmlStyleParser.d.ts +3 -0
- package/dist/core/html/htmlTextSerializer.d.ts +5 -0
- package/dist/core/html/inlineImageParser.d.ts +3 -0
- package/dist/core/html/inlineStyleParser.d.ts +3 -0
- package/dist/core/html/paragraphStyleParser.d.ts +3 -0
- package/dist/core/html/styleCss.d.ts +5 -0
- package/dist/core/model/assets.d.ts +7 -0
- package/dist/core/model/documentIndex.d.ts +58 -0
- package/dist/core/model/documentSections.d.ts +4 -0
- package/dist/core/model/editingZones.d.ts +26 -0
- package/dist/core/model/editorState.d.ts +18 -0
- package/dist/core/model/index.d.ts +31 -0
- package/dist/core/model/pageGeometry.d.ts +14 -0
- package/dist/core/model/paragraphWalker.d.ts +5 -0
- package/dist/core/model/queries.d.ts +2 -1
- package/dist/core/model/styleDefaults.d.ts +6 -0
- package/dist/core/model/styleResolution.d.ts +44 -0
- package/dist/core/model/types/document.d.ts +86 -0
- package/dist/core/model/types/documentBookmarks.d.ts +49 -0
- package/dist/core/model/types/documentEndnotes.d.ts +8 -0
- package/dist/core/model/types/documentFootnotes.d.ts +8 -0
- package/dist/core/model/types/layout.d.ts +93 -0
- package/dist/core/model/types/nodes.d.ts +192 -0
- package/dist/core/model/types/primitives.d.ts +140 -0
- package/dist/core/model/types/selection.d.ts +14 -0
- package/dist/core/model/types/styles.d.ts +149 -0
- package/dist/core/model.d.ts +7 -444
- package/dist/core/plugin.d.ts +59 -6
- package/dist/core/plugins/PluginCollection.d.ts +1 -0
- package/dist/core/plugins/PluginUiRegistry.d.ts +20 -0
- package/dist/core/selection/navigation.d.ts +5 -0
- package/dist/core/selection/rangeEditing.d.ts +13 -0
- package/dist/core/textStyle/textStyleKeys.d.ts +6 -0
- package/dist/core/textStyle/textStyleMutations.d.ts +8 -0
- package/dist/export/docx/bookmarksXml.d.ts +21 -0
- package/dist/export/docx/borders.d.ts +25 -0
- package/dist/export/docx/docxTypes.d.ts +35 -2
- package/dist/export/docx/endnotesXml.d.ts +24 -0
- package/dist/export/docx/stylesXml.d.ts +3 -0
- package/dist/export/docx/tableXml.d.ts +7 -1
- package/dist/export/docx/text/blocksXml.d.ts +7 -0
- package/dist/export/docx/text/constants.d.ts +6 -0
- package/dist/export/docx/text/drawingContainerXml.d.ts +16 -0
- package/dist/export/docx/text/dropCapXml.d.ts +9 -0
- package/dist/export/docx/text/endnoteRunXml.d.ts +5 -0
- package/dist/export/docx/text/fieldRunXml.d.ts +11 -0
- package/dist/export/docx/text/footnoteRunXml.d.ts +5 -0
- package/dist/export/docx/text/hyperlinkXml.d.ts +3 -0
- package/dist/export/docx/text/imageRunXml.d.ts +3 -0
- package/dist/export/docx/text/paragraphPropertiesXml.d.ts +16 -0
- package/dist/export/docx/text/runPropertiesXml.d.ts +3 -0
- package/dist/export/docx/text/runTextXml.d.ts +1 -0
- package/dist/export/docx/text/runXml.d.ts +5 -0
- package/dist/export/docx/text/styleMaterialization.d.ts +4 -0
- package/dist/export/docx/text/textBoxRunXml.d.ts +4 -0
- package/dist/export/docx/textXml.d.ts +1 -6
- package/dist/export/pdf/OasisPdfWriter.d.ts +1 -0
- package/dist/export/pdf/draw/borderDash.d.ts +11 -0
- package/dist/export/pdf/draw/drawFragment.d.ts +1 -0
- package/dist/export/pdf/draw/drawParagraph.d.ts +8 -1
- package/dist/export/pdf/fonts/TrueTypePdfFontSubsetter.d.ts +5 -0
- package/dist/export/pdf/fonts/officeFontAssets.d.ts +24 -0
- package/dist/export/pdf/units.d.ts +2 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/locales/en.d.ts +108 -0
- package/dist/i18n/locales/pt-BR.d.ts +108 -0
- package/dist/import/DocumentFormatImporter.d.ts +26 -0
- package/dist/import/documentImporterRegistry.d.ts +6 -0
- package/dist/import/docx/bookmarks.d.ts +8 -0
- package/dist/import/docx/borders.d.ts +37 -0
- package/dist/import/docx/docxImporter.d.ts +3 -0
- package/dist/import/docx/dropCap.d.ts +13 -0
- package/dist/import/docx/endnotes.d.ts +17 -0
- package/dist/import/docx/footnotes.d.ts +2 -2
- package/dist/import/docx/headerFooter.d.ts +2 -2
- package/dist/import/docx/nestedBlocks.d.ts +15 -0
- package/dist/import/docx/numbering.d.ts +16 -1
- package/dist/import/docx/{styles.d.ts → paragraphStyle.d.ts} +2 -8
- package/dist/import/docx/paragraphs.d.ts +5 -4
- package/dist/import/docx/runStyle.d.ts +6 -0
- package/dist/import/docx/runs/drawingImage.d.ts +13 -0
- package/dist/import/docx/runs/fields.d.ts +3 -0
- package/dist/import/docx/runs/relationships.d.ts +11 -0
- package/dist/import/docx/runs/textBox.d.ts +6 -0
- package/dist/import/docx/runs/types.d.ts +42 -0
- package/dist/import/docx/runs/units.d.ts +11 -0
- package/dist/import/docx/runs/vmlImage.d.ts +6 -0
- package/dist/import/docx/runs.d.ts +14 -34
- package/dist/import/docx/sectionProperties.d.ts +1 -1
- package/dist/import/docx/settings.d.ts +1 -0
- package/dist/import/docx/styleUtils.d.ts +6 -0
- package/dist/import/docx/stylesXml.d.ts +4 -0
- package/dist/import/docx/tables.d.ts +2 -2
- package/dist/import/docx/theme.d.ts +17 -0
- package/dist/import/docx/themeColors.d.ts +37 -0
- package/dist/import/docx/themeFonts.d.ts +5 -1
- package/dist/import/docx/xmlHelpers.d.ts +3 -1
- package/dist/import/html/htmlImporter.d.ts +3 -0
- package/dist/import/html/importHtmlToEditorDocument.d.ts +8 -0
- package/dist/index-DuS88s1l.js +36810 -0
- package/dist/index.d.ts +39 -14
- package/dist/layoutProjection/blockHeights.d.ts +1 -1
- package/dist/layoutProjection/blocksPagination.d.ts +1 -1
- package/dist/layoutProjection/constants.d.ts +9 -1
- package/dist/layoutProjection/documentLayout.d.ts +0 -1
- package/dist/layoutProjection/dropCapExclusion.d.ts +23 -0
- package/dist/layoutProjection/endnotePagination.d.ts +8 -0
- package/dist/layoutProjection/floatingObjects.d.ts +45 -0
- package/dist/layoutProjection/footnotePagination.d.ts +1 -2
- package/dist/layoutProjection/headerFooterFootnotes.d.ts +1 -1
- package/dist/layoutProjection/headerFooterProjection.d.ts +3 -3
- package/dist/layoutProjection/index.d.ts +9 -7
- package/dist/layoutProjection/paragraphBorders.d.ts +14 -0
- package/dist/layoutProjection/paragraphPagination.d.ts +23 -9
- package/dist/layoutProjection/paragraphProjection.d.ts +1 -1
- package/dist/layoutProjection/sectionPagination.d.ts +3 -2
- package/dist/layoutProjection/tablePagination.d.ts +3 -2
- package/dist/layoutProjection/tableProjection.d.ts +1 -1
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +52 -80462
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/plugins/internal/createEssentialsPlugin.d.ts +8 -1
- package/dist/react.d.ts +12 -0
- package/dist/react.js +24 -0
- package/dist/testing/wordLayoutParity.d.ts +0 -3
- package/dist/text/fonts/FontMetricsProvider.d.ts +38 -0
- package/dist/text/fonts/FontProgramFactory.d.ts +6 -0
- package/dist/text/fonts/core/types.d.ts +69 -0
- package/dist/text/fonts/decoders/Brotli.d.ts +4 -0
- package/dist/text/fonts/decoders/FontDecoderRegistry.d.ts +10 -0
- package/dist/text/fonts/decoders/TtfDecoder.d.ts +8 -0
- package/dist/text/fonts/decoders/Woff2Decoder.d.ts +45 -0
- package/dist/text/fonts/layout/SimpleTextLayouter.d.ts +7 -0
- package/dist/text/fonts/preciseFontMetrics.d.ts +16 -0
- package/dist/text/fonts/preciseFontMode.d.ts +7 -0
- package/dist/text/fonts/sfnt/SfntFontProgram.d.ts +29 -0
- package/dist/text/fonts/vendor/woff2/buffer.d.ts +24 -0
- package/dist/text/fonts/vendor/woff2/glyf-reconstructor.d.ts +55 -0
- package/dist/text/fonts/vendor/woff2/hmtx-reconstructor.d.ts +5 -0
- package/dist/text/fonts/vendor/woff2/sfnt-builder.d.ts +7 -0
- package/dist/text/fonts/vendor/woff2/utils.d.ts +12 -0
- package/dist/text/truetype/AdvanceWidthSource.d.ts +19 -0
- package/dist/text/truetype/BinaryReader.d.ts +28 -0
- package/dist/text/truetype/CmapParser.d.ts +15 -0
- package/dist/text/truetype/SfntTableDirectory.d.ts +26 -0
- package/dist/text/truetype/TrueTypeFont.d.ts +36 -0
- package/dist/text/truetype/TrueTypeParseError.d.ts +11 -0
- package/dist/text/truetype/tableParsers.d.ts +45 -0
- package/dist/ui/OasisEditorApp.d.ts +1 -1
- package/dist/ui/OasisEditorAppLazy.d.ts +16 -0
- package/dist/ui/OasisEditorAppProps.d.ts +10 -2
- package/dist/ui/OasisEditorEditor.d.ts +17 -8
- package/dist/ui/OasisEditorLoading.d.ts +25 -0
- package/dist/ui/app/EditorDialogsLayer.d.ts +4 -0
- package/dist/ui/app/EditorWorkspace.d.ts +6 -0
- package/dist/ui/app/buildEditorViewProps.d.ts +7 -3
- package/dist/ui/app/createRuntimeCommandHost.d.ts +2 -1
- package/dist/ui/app/localFontAccess.d.ts +33 -0
- package/dist/ui/app/useCanvasSurfaceHitResolver.d.ts +2 -2
- package/dist/ui/app/useEditorContextMenuClipboard.d.ts +18 -0
- package/dist/ui/app/useEditorDialogs.d.ts +18 -0
- package/dist/ui/app/useEditorRuntimeBootstrap.d.ts +3 -0
- package/dist/ui/app/useEditorRuntimePlugins.d.ts +3 -0
- package/dist/ui/app/useEditorUiOptions.d.ts +1 -1
- package/dist/ui/app/useParagraphDialogBridge.d.ts +29 -0
- package/dist/ui/app/useTablePropertiesDialogBridge.d.ts +30 -0
- package/dist/ui/canvas/CanvasHitTestService.d.ts +17 -0
- package/dist/ui/canvas/CanvasLayoutSnapshot.d.ts +57 -1
- package/dist/ui/canvas/CanvasSelectionGeometry.d.ts +16 -0
- package/dist/ui/canvas/CanvasTableLayout.d.ts +3 -1
- package/dist/ui/canvas/canvasBlockPainter.d.ts +2 -2
- package/dist/ui/canvas/canvasBorders.d.ts +17 -0
- package/dist/ui/canvas/canvasDropCapPainter.d.ts +16 -0
- package/dist/ui/canvas/canvasParagraphPainter.d.ts +24 -2
- package/dist/ui/canvas/canvasTextBoxPainter.d.ts +24 -0
- package/dist/ui/canvas/imageContour.d.ts +10 -0
- package/dist/ui/canvas/textBoxRenderHeight.d.ts +14 -0
- package/dist/ui/canvas/verticalText.d.ts +104 -0
- package/dist/ui/components/Dialogs/FontDialog.d.ts +2 -65
- package/dist/ui/components/Dialogs/FontDialogModel.d.ts +5 -0
- package/dist/ui/components/Dialogs/ParagraphDialog.d.ts +49 -0
- package/dist/ui/components/Dialogs/TablePropertiesDialog.d.ts +80 -0
- package/dist/ui/components/Dialogs/font-dialog/AdvancedFontTab.d.ts +6 -0
- package/dist/ui/components/Dialogs/font-dialog/FontDialogController.d.ts +21 -0
- package/dist/ui/components/Dialogs/font-dialog/FontDialogTypes.d.ts +112 -0
- package/dist/ui/components/Dialogs/font-dialog/FontPreview.d.ts +6 -0
- package/dist/ui/components/Dialogs/font-dialog/FontTab.d.ts +6 -0
- package/dist/ui/components/Dialogs/font-dialog/useFontDialogController.d.ts +4 -0
- package/dist/ui/components/FloatingToolbar/FloatingLayoutOptions.d.ts +17 -0
- package/dist/ui/components/Menubar/Menubar.d.ts +2 -1
- package/dist/ui/components/Menubar/builtinMenuIds.d.ts +36 -0
- package/dist/ui/components/OasisBrandMark.d.ts +7 -0
- package/dist/ui/components/PluginUi/PluginUiHost.d.ts +8 -0
- package/dist/ui/components/Ruler/HorizontalRuler.d.ts +11 -0
- package/dist/ui/components/Ruler/rulerGeometry.d.ts +63 -0
- package/dist/ui/components/Toolbar/Toolbar.d.ts +2 -0
- package/dist/ui/components/Toolbar/presets/builtinToolbarIds.d.ts +40 -0
- package/dist/ui/components/Toolbar/primitives/ColorPicker.d.ts +1 -1
- package/dist/ui/components/Toolbar/primitives/Separator.d.ts +4 -3
- package/dist/ui/components/Toolbar/registry/ToolbarRegistry.d.ts +7 -2
- package/dist/ui/components/Toolbar/schema/items.d.ts +1 -1
- package/dist/ui/components/WelcomeOverlay.d.ts +13 -0
- package/dist/ui/editorLayoutConstants.d.ts +12 -0
- package/dist/ui/editorUiTypes.d.ts +35 -4
- package/dist/ui/fontSizeUnits.d.ts +15 -0
- package/dist/ui/mount.d.ts +2 -1
- package/dist/ui/overlays/ResizeHandlesOverlay.d.ts +34 -0
- package/dist/ui/public/Button.d.ts +10 -0
- package/dist/ui/public/Checkbox.d.ts +9 -0
- package/dist/ui/public/DialogFooter.d.ts +6 -0
- package/dist/ui/public/FloatingActionButton.d.ts +8 -0
- package/dist/ui/public/IconButton.d.ts +10 -0
- package/dist/ui/public/SelectField.d.ts +15 -0
- package/dist/ui/public/SidePanel.d.ts +12 -0
- package/dist/ui/public/TextField.d.ts +9 -0
- package/dist/ui/public/index.d.ts +36 -0
- package/dist/ui/resizeGeometry.d.ts +28 -0
- package/dist/ui/shells/DocumentShell.d.ts +6 -0
- package/dist/ui/textMeasurement/alignment.d.ts +3 -0
- package/dist/ui/textMeasurement/characterWidth.d.ts +9 -0
- package/dist/ui/textMeasurement/composer.d.ts +5 -0
- package/dist/ui/textMeasurement/constants.d.ts +4 -0
- package/dist/ui/textMeasurement/fontMetrics.d.ts +12 -0
- package/dist/ui/textMeasurement/indentation.d.ts +12 -0
- package/dist/ui/textMeasurement/layoutLine.d.ts +4 -0
- package/dist/ui/textMeasurement/paragraphLineHeight.d.ts +22 -0
- package/dist/ui/textMeasurement/tabStops.d.ts +4 -0
- package/dist/ui/textMeasurement/tokenizer.d.ts +6 -0
- package/dist/ui/textMeasurement/types.d.ts +27 -0
- package/dist/ui/textMeasurement.d.ts +5 -11
- package/dist/ui/toolbarStyleState.d.ts +15 -2
- package/dist/ui/utils/customIcons.d.ts +20 -0
- package/dist/ui.d.ts +42 -0
- package/dist/ui.js +19 -0
- package/dist/utils/imageFormats.d.ts +14 -0
- package/dist/utils/throttle.d.ts +1 -1
- package/dist/vue.d.ts +9 -0
- package/dist/vue.js +33 -0
- package/package.json +90 -62
- package/dist/__tests__/app/PersistenceService.test.d.ts +0 -1
- package/dist/__tests__/app/footnoteUiCommands.test.d.ts +0 -1
- package/dist/__tests__/commands/text.test.d.ts +0 -1
- package/dist/__tests__/core/editorPluginIntegration.test.d.ts +0 -1
- package/dist/__tests__/core/editorState.test.d.ts +0 -1
- package/dist/__tests__/core/footnotes.test.d.ts +0 -1
- package/dist/__tests__/core/model.test.d.ts +0 -1
- package/dist/__tests__/core/pluginCollection.test.d.ts +0 -1
- package/dist/__tests__/core/tableCommands.test.d.ts +0 -1
- package/dist/__tests__/export/docxExport.test.d.ts +0 -1
- package/dist/__tests__/export/footnotesExport.test.d.ts +0 -1
- package/dist/__tests__/export/pdfWriter.test.d.ts +0 -1
- package/dist/__tests__/export/underlineStyle.test.d.ts +0 -1
- package/dist/__tests__/import/docxComplexSmoke.test.d.ts +0 -1
- package/dist/__tests__/import/docxImport.test.d.ts +0 -1
- package/dist/__tests__/import/footnotesImport.test.d.ts +0 -1
- package/dist/__tests__/integration/documentFlow.test.d.ts +0 -1
- package/dist/__tests__/ui/CanvasTableLayout.test.d.ts +0 -1
- package/dist/__tests__/ui/canvasHitTestService.test.d.ts +0 -1
- package/dist/__tests__/ui/canvasLayoutSnapshot.test.d.ts +0 -1
- package/dist/__tests__/ui/canvasSelectionGeometry.test.d.ts +0 -1
- package/dist/__tests__/ui/canvasTextRendering.test.d.ts +0 -1
- package/dist/__tests__/ui/composeMeasuredParagraphLines.test.d.ts +0 -1
- package/dist/__tests__/ui/dialog.test.d.ts +0 -1
- package/dist/__tests__/ui/fontDialog.test.d.ts +0 -1
- package/dist/__tests__/ui/footnotesLayout.test.d.ts +0 -1
- package/dist/__tests__/ui/layoutIdentity.test.d.ts +0 -1
- package/dist/__tests__/ui/layoutProjection.test.d.ts +0 -1
- package/dist/__tests__/ui/registry.test.d.ts +0 -1
- package/dist/__tests__/ui/tabs.test.d.ts +0 -1
- package/dist/__tests__/ui/textMeasurementAlignment.test.d.ts +0 -1
- package/dist/__tests__/word-parity/fixtures/corpus.d.ts +0 -10
- package/dist/__tests__/word-parity/fixtures/loremFixtures.d.ts +0 -8
- package/dist/__tests__/word-parity/wordLayout.word-parity.d.ts +0 -1
- package/dist/assets/Arimo-Bold.ttf +0 -0
- package/dist/assets/Arimo-BoldItalic.ttf +0 -0
- package/dist/assets/Arimo-Italic.ttf +0 -0
- package/dist/assets/Arimo-Regular.ttf +0 -0
- package/dist/assets/Carlito-Bold.ttf +0 -0
- package/dist/assets/Carlito-BoldItalic.ttf +0 -0
- package/dist/assets/Carlito-Italic.ttf +0 -0
- package/dist/assets/Carlito-Regular.ttf +0 -0
- package/dist/assets/Roboto-Italic.ttf +0 -0
- package/dist/assets/Roboto-Medium.ttf +0 -0
- package/dist/assets/Roboto-MediumItalic.ttf +0 -0
- package/dist/assets/Roboto-Regular.ttf +0 -0
- package/dist/assets/Tinos-Bold.ttf +0 -0
- package/dist/assets/Tinos-BoldItalic.ttf +0 -0
- package/dist/assets/Tinos-Italic.ttf +0 -0
- package/dist/assets/Tinos-Regular.ttf +0 -0
- package/dist/assets/importDocxWorker-DIQ28Lka.js +0 -12
- package/dist/core/commands/utils.d.ts +0 -69
- package/dist/demo/OasisSiteApp.d.ts +0 -1
- package/dist/main.d.ts +0 -1
|
@@ -36,6 +36,7 @@ export interface EssentialsFormattingCapability {
|
|
|
36
36
|
rejectRevisions: () => boolean;
|
|
37
37
|
toggleShowMargins: () => boolean;
|
|
38
38
|
toggleShowParagraphMarks: () => boolean;
|
|
39
|
+
togglePreciseFonts: () => boolean;
|
|
39
40
|
pageBreak: () => boolean;
|
|
40
41
|
lineBreak: () => boolean;
|
|
41
42
|
splitBlock: () => boolean;
|
|
@@ -43,6 +44,7 @@ export interface EssentialsFormattingCapability {
|
|
|
43
44
|
setFontSize: (value: number | null) => boolean;
|
|
44
45
|
setColor: (value: string | null) => boolean;
|
|
45
46
|
setHighlight: (value: string | null) => boolean;
|
|
47
|
+
setTextShading: (value: string | null) => boolean;
|
|
46
48
|
setStyleId: (value: string) => boolean;
|
|
47
49
|
setUnderlineStyle: (value: string | null) => void;
|
|
48
50
|
}
|
|
@@ -56,7 +58,7 @@ export interface EssentialsDocumentCapability {
|
|
|
56
58
|
documentStyles: () => EssentialsDocumentStyleDescriptor[];
|
|
57
59
|
exportDocx: () => void;
|
|
58
60
|
exportPdf: () => void;
|
|
59
|
-
|
|
61
|
+
importDocument: () => void;
|
|
60
62
|
insertImage: () => void;
|
|
61
63
|
}
|
|
62
64
|
export interface EssentialsLinkCapability {
|
|
@@ -78,6 +80,7 @@ export interface EssentialsParagraphCapability {
|
|
|
78
80
|
setSpacingAfter: (value: number | null) => void;
|
|
79
81
|
setSpacingBefore: (value: number | null) => void;
|
|
80
82
|
setIndentLeft: (value: number | null) => void;
|
|
83
|
+
setIndentRight: (value: number | null) => void;
|
|
81
84
|
setIndentFirstLine: (value: number | null) => void;
|
|
82
85
|
setIndentHanging: (value: number | null) => void;
|
|
83
86
|
setShading: (value: string | null) => void;
|
|
@@ -93,6 +96,10 @@ export interface EssentialsSectionCapability {
|
|
|
93
96
|
toggleOrientation: () => void;
|
|
94
97
|
breakNextPage: () => void;
|
|
95
98
|
breakContinuous: () => void;
|
|
99
|
+
setPageMargins: (margins: {
|
|
100
|
+
left?: number;
|
|
101
|
+
right?: number;
|
|
102
|
+
}) => void;
|
|
96
103
|
}
|
|
97
104
|
export interface EssentialsTableCapability {
|
|
98
105
|
insideTable: () => boolean;
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { OasisEditorAppProps, OasisEditorClient } from "oasis-editor";
|
|
3
|
+
|
|
4
|
+
export type ReactOasisEditorProps = OasisEditorAppProps & {
|
|
5
|
+
/**
|
|
6
|
+
* Receives the mounted Oasis client. Props are mount-only for this adapter;
|
|
7
|
+
* remount the component to apply a new editor configuration.
|
|
8
|
+
*/
|
|
9
|
+
onClient?: (client: OasisEditorClient) => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export declare const OasisEditor: React.FC<ReactOasisEditorProps>;
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { mount } from "oasis-editor";
|
|
3
|
+
|
|
4
|
+
export function OasisEditor(props) {
|
|
5
|
+
const containerRef = useRef(null);
|
|
6
|
+
const instanceRef = useRef(null);
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (containerRef.current) {
|
|
10
|
+
instanceRef.current = mount(containerRef.current, props);
|
|
11
|
+
props.onClient?.(instanceRef.current);
|
|
12
|
+
}
|
|
13
|
+
return () => {
|
|
14
|
+
instanceRef.current?.unmount();
|
|
15
|
+
instanceRef.current = null;
|
|
16
|
+
};
|
|
17
|
+
}, []);
|
|
18
|
+
|
|
19
|
+
return React.createElement("div", {
|
|
20
|
+
ref: containerRef,
|
|
21
|
+
className: props.ui?.class,
|
|
22
|
+
style: props.ui?.style,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -4,8 +4,6 @@ export interface WordLayoutSupportStatus {
|
|
|
4
4
|
supported: boolean;
|
|
5
5
|
reason?: string;
|
|
6
6
|
wordPath?: string;
|
|
7
|
-
pythonCommand?: string;
|
|
8
|
-
pythonArgs?: string[];
|
|
9
7
|
}
|
|
10
8
|
interface WordPdfLine {
|
|
11
9
|
text: string;
|
|
@@ -54,7 +52,6 @@ export interface WordLayoutParityResult {
|
|
|
54
52
|
export interface WordLayoutParityOptions {
|
|
55
53
|
geometryTolerancePoints?: number;
|
|
56
54
|
strictTextAndGeometry?: boolean;
|
|
57
|
-
layoutMode?: "fast" | "wordParity";
|
|
58
55
|
}
|
|
59
56
|
export declare function detectWordLayoutParitySupport(): WordLayoutSupportStatus;
|
|
60
57
|
export declare function verifyWordLayoutParity(document: EditorDocument, options?: WordLayoutParityOptions): Promise<WordLayoutParityResult>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Synchronous source of glyph advance widths for the layout engine, backed by
|
|
3
|
+
* the bundled metric-compatible fonts (Carlito≈Calibri, Arimo≈Arial,
|
|
4
|
+
* Tinos≈Times New Roman, Roboto as the universal fallback).
|
|
5
|
+
*
|
|
6
|
+
* Because these fonts are metric-compatible with the Office fonts they stand in
|
|
7
|
+
* for, advance widths match Microsoft Word — and, being parsed from the same
|
|
8
|
+
* bytes everywhere, they are identical in Node and the browser, which makes
|
|
9
|
+
* text layout deterministic across environments.
|
|
10
|
+
*/
|
|
11
|
+
export interface FontMetricsProvider {
|
|
12
|
+
/**
|
|
13
|
+
* Advance width in CSS pixels for a code point in the resolved face, or
|
|
14
|
+
* `null` when no metric face can supply it (font bytes not yet available, or
|
|
15
|
+
* the resolved face has no glyph for the code point — e.g. CJK/emoji). The
|
|
16
|
+
* caller then falls back to a heuristic.
|
|
17
|
+
*/
|
|
18
|
+
getAdvanceWidthPx(family: string | null | undefined, bold: boolean, italic: boolean, codePoint: number, fontSizePx: number): number | null;
|
|
19
|
+
/**
|
|
20
|
+
* The face's natural single-spacing line height in CSS pixels (`ascender −
|
|
21
|
+
* descender + lineGap`), or `null` when no metric face is available. Used to
|
|
22
|
+
* locate the top of rendered text within a spaced line box.
|
|
23
|
+
*/
|
|
24
|
+
getNaturalLineHeightPx(family: string | null | undefined, bold: boolean, italic: boolean, fontSizePx: number): number | null;
|
|
25
|
+
/**
|
|
26
|
+
* Word/PDF text-top offset in CSS pixels for the resolved face, or `null`
|
|
27
|
+
* when no metric face is available.
|
|
28
|
+
*/
|
|
29
|
+
getWordTextTopOffsetPx(family: string | null | undefined, bold: boolean, italic: boolean, fontSizePx: number): number | null;
|
|
30
|
+
}
|
|
31
|
+
export declare function getFontMetricsProvider(): FontMetricsProvider;
|
|
32
|
+
/**
|
|
33
|
+
* Loads (and parses) the bundled faces for the given families so that
|
|
34
|
+
* {@link FontMetricsProvider.getAdvanceWidthPx} resolves synchronously in the
|
|
35
|
+
* browser. Call this before the first layout/mount. In Node it is unnecessary
|
|
36
|
+
* (synchronous `fs` loading covers it) but harmless.
|
|
37
|
+
*/
|
|
38
|
+
export declare function preloadLayoutFonts(families?: Iterable<string | null | undefined>): Promise<void>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PdfEmbeddableFont } from '../../core/types.js';
|
|
2
|
+
import { SfntFontProgram } from '../../sfnt/SfntFontProgram.js';
|
|
3
|
+
|
|
4
|
+
export declare function parseEmbeddedFont(sourceBytes: Uint8Array): Promise<SfntFontProgram>;
|
|
5
|
+
export declare function parseEmbeddedFontSync(sourceBytes: Uint8Array): SfntFontProgram;
|
|
6
|
+
export declare function createPdfEmbeddableFont(program: SfntFontProgram): PdfEmbeddableFont;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Os2VerticalMetrics, VerticalMetrics } from '../../../../../truetype/tableParsers.js';
|
|
2
|
+
|
|
3
|
+
export type FontFormat = "ttf" | "woff2";
|
|
4
|
+
export interface FontDecoder {
|
|
5
|
+
readonly format: FontFormat;
|
|
6
|
+
canDecode(bytes: Uint8Array): boolean;
|
|
7
|
+
decode(bytes: Uint8Array): Promise<Uint8Array>;
|
|
8
|
+
decodeSync?(bytes: Uint8Array): Uint8Array;
|
|
9
|
+
}
|
|
10
|
+
export interface GlyphInfo {
|
|
11
|
+
readonly id: number;
|
|
12
|
+
readonly codePoints: number[];
|
|
13
|
+
readonly advanceWidth: number;
|
|
14
|
+
}
|
|
15
|
+
export interface GlyphPosition {
|
|
16
|
+
readonly xAdvance: number;
|
|
17
|
+
}
|
|
18
|
+
export interface GlyphRun {
|
|
19
|
+
readonly glyphs: GlyphInfo[];
|
|
20
|
+
readonly positions: GlyphPosition[];
|
|
21
|
+
readonly advanceWidth: number;
|
|
22
|
+
}
|
|
23
|
+
export interface FontMetadata {
|
|
24
|
+
readonly postscriptName: string;
|
|
25
|
+
readonly bbox: {
|
|
26
|
+
readonly minX: number;
|
|
27
|
+
readonly minY: number;
|
|
28
|
+
readonly maxX: number;
|
|
29
|
+
readonly maxY: number;
|
|
30
|
+
};
|
|
31
|
+
readonly ascent: number;
|
|
32
|
+
readonly descent: number;
|
|
33
|
+
readonly capHeight: number;
|
|
34
|
+
readonly xHeight: number;
|
|
35
|
+
readonly italicAngle: number;
|
|
36
|
+
readonly isFixedPitch: boolean;
|
|
37
|
+
readonly macStyleBold: boolean;
|
|
38
|
+
readonly macStyleItalic: boolean;
|
|
39
|
+
readonly familyClass: number;
|
|
40
|
+
}
|
|
41
|
+
export interface ParsedFontProgram {
|
|
42
|
+
readonly sfntBytes: Uint8Array;
|
|
43
|
+
readonly unitsPerEm: number;
|
|
44
|
+
readonly verticalMetrics: VerticalMetrics;
|
|
45
|
+
readonly os2VerticalMetrics: Os2VerticalMetrics | null;
|
|
46
|
+
readonly metadata: FontMetadata;
|
|
47
|
+
readonly glyphCount: number;
|
|
48
|
+
glyphForCodePoint(codePoint: number): number;
|
|
49
|
+
hasGlyphForCodePoint(codePoint: number): boolean;
|
|
50
|
+
advanceWidthForGlyph(glyphId: number): number;
|
|
51
|
+
getRawTableData(tag: string): Uint8Array | null;
|
|
52
|
+
}
|
|
53
|
+
export interface TextLayouter {
|
|
54
|
+
layout(text: string): GlyphRun;
|
|
55
|
+
}
|
|
56
|
+
export interface FontSubset {
|
|
57
|
+
readonly fontFile: Uint8Array;
|
|
58
|
+
readonly widths: number[];
|
|
59
|
+
readonly unicode: number[][];
|
|
60
|
+
encodeGlyph(glyphId: number): number;
|
|
61
|
+
}
|
|
62
|
+
export interface FontSubsetter {
|
|
63
|
+
createSubset(font: ParsedFontProgram, glyphs: Iterable<GlyphInfo>): FontSubset;
|
|
64
|
+
}
|
|
65
|
+
export interface PdfEmbeddableFont {
|
|
66
|
+
readonly program: ParsedFontProgram;
|
|
67
|
+
readonly layouter: TextLayouter;
|
|
68
|
+
readonly subsetter: FontSubsetter;
|
|
69
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FontDecoder } from '../../../../core/types.js';
|
|
2
|
+
|
|
3
|
+
export declare class FontDecoderRegistry {
|
|
4
|
+
private readonly decoders;
|
|
5
|
+
constructor(decoders: FontDecoder[]);
|
|
6
|
+
decode(bytes: Uint8Array): Promise<Uint8Array>;
|
|
7
|
+
decodeSync(bytes: Uint8Array): Uint8Array;
|
|
8
|
+
private resolve;
|
|
9
|
+
}
|
|
10
|
+
export declare const defaultFontDecoderRegistry: FontDecoderRegistry;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FontDecoder } from '../../../../core/types.js';
|
|
2
|
+
|
|
3
|
+
export declare class TtfDecoder implements FontDecoder {
|
|
4
|
+
readonly format: "ttf";
|
|
5
|
+
canDecode(bytes: Uint8Array): boolean;
|
|
6
|
+
decode(bytes: Uint8Array): Promise<Uint8Array>;
|
|
7
|
+
decodeSync(bytes: Uint8Array): Uint8Array;
|
|
8
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { FontDecoder } from '../../../../core/types.js';
|
|
2
|
+
import { BrotliDecompress, BrotliDecompressSync } from '../../../Brotli.js';
|
|
3
|
+
import { GlyfReconstruction } from '../../../../vendor/woff2/glyf-reconstructor.js';
|
|
4
|
+
|
|
5
|
+
export interface Woff2Dependencies {
|
|
6
|
+
decompress?: BrotliDecompress;
|
|
7
|
+
decompressSync?: BrotliDecompressSync;
|
|
8
|
+
transformers?: Map<number, Woff2Transform>;
|
|
9
|
+
}
|
|
10
|
+
interface Woff2Table {
|
|
11
|
+
tag: number;
|
|
12
|
+
flags: number;
|
|
13
|
+
srcOffset: number;
|
|
14
|
+
srcLength: number;
|
|
15
|
+
transformLength: number;
|
|
16
|
+
dstLength: number;
|
|
17
|
+
}
|
|
18
|
+
interface Woff2Header {
|
|
19
|
+
flavor: number;
|
|
20
|
+
numTables: number;
|
|
21
|
+
compressedOffset: number;
|
|
22
|
+
compressedLength: number;
|
|
23
|
+
uncompressedSize: number;
|
|
24
|
+
tables: Woff2Table[];
|
|
25
|
+
}
|
|
26
|
+
interface TransformState {
|
|
27
|
+
glyfInfo: GlyfReconstruction | null;
|
|
28
|
+
numHMetrics: number;
|
|
29
|
+
}
|
|
30
|
+
interface TransformContext {
|
|
31
|
+
header: Woff2Header;
|
|
32
|
+
tableMap: Map<number, Uint8Array>;
|
|
33
|
+
tablesByTag: Map<number, Woff2Table>;
|
|
34
|
+
state: TransformState;
|
|
35
|
+
}
|
|
36
|
+
type Woff2Transform = (table: Woff2Table, srcData: Uint8Array, context: TransformContext) => void;
|
|
37
|
+
export declare function decodeWoff2(fontData: Uint8Array, deps?: Partial<Woff2Dependencies>): Promise<Uint8Array>;
|
|
38
|
+
export declare function decodeWoff2Sync(fontData: Uint8Array, deps?: Partial<Woff2Dependencies>): Uint8Array;
|
|
39
|
+
export declare class Woff2Decoder implements FontDecoder {
|
|
40
|
+
readonly format: "woff2";
|
|
41
|
+
canDecode(bytes: Uint8Array): boolean;
|
|
42
|
+
decode(bytes: Uint8Array): Promise<Uint8Array>;
|
|
43
|
+
decodeSync(bytes: Uint8Array): Uint8Array;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SfntFontProgram } from '../../sfnt/SfntFontProgram.js';
|
|
2
|
+
|
|
3
|
+
export declare function registerPreciseFont(family: string, bold: boolean, italic: boolean, program: SfntFontProgram): void;
|
|
4
|
+
export declare function clearPreciseFonts(): void;
|
|
5
|
+
/** Whether any real face is loaded for the family (ignores the mode flag). */
|
|
6
|
+
export declare function hasPreciseFont(family: string | null | undefined): boolean;
|
|
7
|
+
/** Whether a specific face has already been registered (used to skip reloads). */
|
|
8
|
+
export declare function hasPreciseFontFace(family: string, bold: boolean, italic: boolean): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The real font program for the requested face when precise mode is active and it
|
|
11
|
+
* was loaded, else `null`. Falls back to the regular face of the same family when
|
|
12
|
+
* the exact bold/italic face is not installed, so a paragraph never mixes real
|
|
13
|
+
* and substitute metrics within one family. Returns `null` when precise mode is
|
|
14
|
+
* off so callers transparently revert to the bundled substitute.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getPreciseFontProgram(family: string | null | undefined, bold: boolean, italic: boolean): SfntFontProgram | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Reactive accessor that bumps whenever precise-mode state changes. */
|
|
2
|
+
export declare const preciseFontModeVersion: import('../../solid-js').Accessor<number>;
|
|
3
|
+
export declare function isPreciseFontModeEnabled(): boolean;
|
|
4
|
+
export declare function setPreciseFontModeEnabled(value: boolean): void;
|
|
5
|
+
export declare function setAvailableLocalFontFamilies(families: Iterable<string>): void;
|
|
6
|
+
/** True when the given (document-requested) family is installed locally. */
|
|
7
|
+
export declare function isLocalFontFamilyAvailable(fontFamily: string | null | undefined): boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FontMetadata, ParsedFontProgram } from '../../../../core/types.js';
|
|
2
|
+
|
|
3
|
+
export declare class SfntFontProgram implements ParsedFontProgram {
|
|
4
|
+
readonly sfntBytes: Uint8Array;
|
|
5
|
+
private readonly directory;
|
|
6
|
+
readonly unitsPerEm: number;
|
|
7
|
+
readonly verticalMetrics: import('../../../../../truetype/tableParsers.js').VerticalMetrics;
|
|
8
|
+
readonly os2VerticalMetrics: import('../../../../../truetype/tableParsers.js').Os2VerticalMetrics | null;
|
|
9
|
+
readonly metadata: FontMetadata;
|
|
10
|
+
readonly glyphCount: number;
|
|
11
|
+
private readonly cmap;
|
|
12
|
+
private readonly advanceForGlyph;
|
|
13
|
+
private constructor();
|
|
14
|
+
static parse(sfntBytes: Uint8Array): SfntFontProgram;
|
|
15
|
+
/**
|
|
16
|
+
* Every face in the bytes: one program for a plain sfnt, or one per sub-font
|
|
17
|
+
* for a TrueType Collection (`ttcf`). Lets the caller select the exact
|
|
18
|
+
* bold/italic face by its name/macStyle instead of taking the first font.
|
|
19
|
+
*/
|
|
20
|
+
static parseCollection(sfntBytes: Uint8Array): SfntFontProgram[];
|
|
21
|
+
glyphForCodePoint(codePoint: number): number;
|
|
22
|
+
hasGlyphForCodePoint(codePoint: number): boolean;
|
|
23
|
+
advanceWidthForGlyph(glyphId: number): number;
|
|
24
|
+
advanceWidthForCodePoint(codePoint: number): number;
|
|
25
|
+
getRawTableData(tag: string): Uint8Array | null;
|
|
26
|
+
naturalLineHeightPx(fontSizePx: number): number;
|
|
27
|
+
wordTextTopOffsetPx(fontSizePx: number): number;
|
|
28
|
+
private parseMetadata;
|
|
29
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lightweight byte reader with bounds checks used by the WOFF2 decoder.
|
|
3
|
+
*/
|
|
4
|
+
export declare class Buf {
|
|
5
|
+
private readonly data;
|
|
6
|
+
offset: number;
|
|
7
|
+
constructor(data: Uint8Array, offset?: number);
|
|
8
|
+
get length(): number;
|
|
9
|
+
peekRemaining(): Uint8Array;
|
|
10
|
+
readU8(): number;
|
|
11
|
+
readU16(): number;
|
|
12
|
+
readS16(): number;
|
|
13
|
+
readU32(): number;
|
|
14
|
+
readBytes(n: number): Uint8Array;
|
|
15
|
+
skip(n: number): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Read a Base128 variable-length integer.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readBase128(buf: Buf): number;
|
|
21
|
+
/**
|
|
22
|
+
* Read a 255UInt16 as defined in the WOFF2 spec.
|
|
23
|
+
*/
|
|
24
|
+
export declare function read255UShort(buf: Buf): number;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Buf } from '../../../../buffer.js';
|
|
2
|
+
|
|
3
|
+
export declare const GLYF_FLAGS: {
|
|
4
|
+
ON_CURVE: number;
|
|
5
|
+
X_SHORT: number;
|
|
6
|
+
Y_SHORT: number;
|
|
7
|
+
REPEAT: number;
|
|
8
|
+
X_SAME: number;
|
|
9
|
+
Y_SAME: number;
|
|
10
|
+
OVERLAP_SIMPLE: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const COMPOSITE_FLAGS: {
|
|
13
|
+
ARG_WORDS: number;
|
|
14
|
+
WE_HAVE_A_SCALE: number;
|
|
15
|
+
MORE_COMPONENTS: number;
|
|
16
|
+
WE_HAVE_AN_XY_SCALE: number;
|
|
17
|
+
WE_HAVE_A_TWO_BY_TWO: number;
|
|
18
|
+
WE_HAVE_INSTRUCTIONS: number;
|
|
19
|
+
};
|
|
20
|
+
export interface GlyfReconstruction {
|
|
21
|
+
glyfData: Uint8Array;
|
|
22
|
+
locaData: Uint8Array;
|
|
23
|
+
glyfChecksum: number;
|
|
24
|
+
locaChecksum: number;
|
|
25
|
+
numGlyphs: number;
|
|
26
|
+
indexFormat: number;
|
|
27
|
+
xMins: Int16Array;
|
|
28
|
+
}
|
|
29
|
+
export declare function withSign(flag: number, base: number): number;
|
|
30
|
+
export declare function tripletDecode(flagsIn: Uint8Array, data: Uint8Array, nPoints: number): {
|
|
31
|
+
points: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
onCurve: boolean;
|
|
35
|
+
}[];
|
|
36
|
+
consumed: number;
|
|
37
|
+
};
|
|
38
|
+
export declare function storePoints(points: {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
onCurve: boolean;
|
|
42
|
+
}[], nContours: number, instructionLength: number, hasOverlap: boolean): Uint8Array;
|
|
43
|
+
export declare function computeBBox(points: {
|
|
44
|
+
x: number;
|
|
45
|
+
y: number;
|
|
46
|
+
}[]): [number, number, number, number];
|
|
47
|
+
export declare function sizeOfComposite(stream: Buf): {
|
|
48
|
+
size: number;
|
|
49
|
+
haveInstructions: boolean;
|
|
50
|
+
};
|
|
51
|
+
export declare function storeLoca(locaValues: number[], indexFormat: number): {
|
|
52
|
+
data: Uint8Array;
|
|
53
|
+
checksum: number;
|
|
54
|
+
};
|
|
55
|
+
export declare function reconstructGlyfTable(transformed: Uint8Array, locaDstLength: number): GlyfReconstruction;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const SFNT_HEADER_SIZE = 12;
|
|
2
|
+
export declare const SFNT_ENTRY_SIZE = 16;
|
|
3
|
+
export declare const CHECKSUM_ADJUSTMENT_OFFSET = 8;
|
|
4
|
+
export declare function buildSfnt(flavor: number, tableData: Map<number, Uint8Array>): {
|
|
5
|
+
ttf: Uint8Array;
|
|
6
|
+
tables: Record<string, Uint8Array>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const TAG: (text: string) => number;
|
|
2
|
+
export declare const TAG_GLYF: number;
|
|
3
|
+
export declare const TAG_LOCA: number;
|
|
4
|
+
export declare const TAG_HMTX: number;
|
|
5
|
+
export declare const TAG_HHEA: number;
|
|
6
|
+
export declare const TAG_HEAD: number;
|
|
7
|
+
export declare const KNOWN_TAGS: number[];
|
|
8
|
+
export declare function tagToString(tag: number): string;
|
|
9
|
+
export declare const round4: (v: number) => number;
|
|
10
|
+
export declare function computeULongSum(data: Uint8Array): number;
|
|
11
|
+
export declare function store16(value: number, out: Uint8Array, offset: number): number;
|
|
12
|
+
export declare function store32(value: number, out: Uint8Array, offset: number): number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract for a source of horizontal glyph advance widths.
|
|
3
|
+
*
|
|
4
|
+
* Implementations expose just enough of a font's metrics to drive text layout:
|
|
5
|
+
* the design grid (`unitsPerEm`) and the advance width of any Unicode code
|
|
6
|
+
* point. Consumers depend on this interface rather than a concrete parser, so
|
|
7
|
+
* the layout engine stays decoupled from the TrueType binary format.
|
|
8
|
+
*/
|
|
9
|
+
export interface AdvanceWidthSource {
|
|
10
|
+
/** Font design units per em (from the `head` table), e.g. 2048 or 1000. */
|
|
11
|
+
readonly unitsPerEm: number;
|
|
12
|
+
/**
|
|
13
|
+
* Advance width, in font design units, for a Unicode code point. Returns the
|
|
14
|
+
* `.notdef` (glyph 0) advance when the code point is not mapped by the font.
|
|
15
|
+
*/
|
|
16
|
+
advanceWidthForCodePoint(codePoint: number): number;
|
|
17
|
+
/** True when the font's `cmap` maps this code point to a non-zero glyph id. */
|
|
18
|
+
hasGlyphForCodePoint(codePoint: number): boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A forward/seekable cursor over a byte buffer that reads big-endian integers.
|
|
3
|
+
*
|
|
4
|
+
* The sfnt container (TrueType/OpenType) is always big-endian, so every
|
|
5
|
+
* multi-byte read goes through `DataView`, whose getters are big-endian by
|
|
6
|
+
* default. Reading multi-byte values via typed-array views over the raw buffer
|
|
7
|
+
* would adopt the host's endianness — the single most common font-parsing bug —
|
|
8
|
+
* so this reader never does that.
|
|
9
|
+
*/
|
|
10
|
+
export declare class BinaryReader {
|
|
11
|
+
private readonly bytes;
|
|
12
|
+
private readonly view;
|
|
13
|
+
private cursor;
|
|
14
|
+
constructor(bytes: Uint8Array);
|
|
15
|
+
get length(): number;
|
|
16
|
+
tell(): number;
|
|
17
|
+
seek(offset: number): void;
|
|
18
|
+
skip(byteCount: number): void;
|
|
19
|
+
private ensure;
|
|
20
|
+
u8(): number;
|
|
21
|
+
u16(): number;
|
|
22
|
+
i16(): number;
|
|
23
|
+
u32(): number;
|
|
24
|
+
/** Reads a 4-byte sfnt tag as an ASCII string (e.g. "cmap", "head"). */
|
|
25
|
+
tag(): string;
|
|
26
|
+
/** Absolute (non-advancing) big-endian uint16 read. */
|
|
27
|
+
u16At(offset: number): number;
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BinaryReader } from '../../BinaryReader.js';
|
|
2
|
+
|
|
3
|
+
/** Maps Unicode code points to glyph ids. Returns 0 (.notdef) when unmapped. */
|
|
4
|
+
export interface CmapSubtable {
|
|
5
|
+
glyphForCodePoint(codePoint: number): number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Parses the `cmap` table and selects the best Unicode subtable.
|
|
9
|
+
*
|
|
10
|
+
* Preference order favours the Windows platform with the widest coverage:
|
|
11
|
+
* (3,10) format 12 full Unicode → (3,1) format 4 BMP → (0,*) Unicode → first.
|
|
12
|
+
* Only formats 4 and 12 are supported; they cover essentially all modern
|
|
13
|
+
* TrueType/OpenType text fonts.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseCmap(reader: BinaryReader, cmapOffset: number): CmapSubtable;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BinaryReader } from '../../BinaryReader.js';
|
|
2
|
+
|
|
3
|
+
export interface SfntTableRecord {
|
|
4
|
+
offset: number;
|
|
5
|
+
length: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The sfnt table directory: the 12-byte offset table plus the 16-byte table
|
|
9
|
+
* records that locate every table (`head`, `hhea`, `cmap`, ...) within the
|
|
10
|
+
* font. TrueType Collections (`ttcf`) are unwrapped to their first font.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SfntTableDirectory {
|
|
13
|
+
private readonly tables;
|
|
14
|
+
private constructor();
|
|
15
|
+
static parse(reader: BinaryReader): SfntTableDirectory;
|
|
16
|
+
/**
|
|
17
|
+
* Sub-font sfnt offsets when the bytes are a TrueType Collection (`ttcf`), or
|
|
18
|
+
* `null` for a plain single-face sfnt. Lets callers pick a specific face
|
|
19
|
+
* (regular/bold/italic) rather than always unwrapping to the first font.
|
|
20
|
+
*/
|
|
21
|
+
static collectionOffsets(reader: BinaryReader): number[] | null;
|
|
22
|
+
/** Parses the table directory whose offset table begins at `sfntOffset`. */
|
|
23
|
+
static parseAt(reader: BinaryReader, sfntOffset: number): SfntTableDirectory;
|
|
24
|
+
getTable(tag: string): SfntTableRecord | undefined;
|
|
25
|
+
requireTable(tag: string): SfntTableRecord;
|
|
26
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AdvanceWidthSource } from '../../AdvanceWidthSource.js';
|
|
2
|
+
import { VerticalMetrics } from '../../tableParsers.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A minimal TrueType/OpenType font parser that exposes horizontal advance
|
|
6
|
+
* widths. It reads only the tables needed for text measurement
|
|
7
|
+
* (`head`, `hhea`, `maxp`, `hmtx`, `cmap`) — no glyph outlines, no kerning.
|
|
8
|
+
*
|
|
9
|
+
* Construct via {@link TrueTypeFont.parse}; it throws {@link TrueTypeParseError}
|
|
10
|
+
* on malformed or unsupported fonts so callers can fall back gracefully.
|
|
11
|
+
*/
|
|
12
|
+
export declare class TrueTypeFont implements AdvanceWidthSource {
|
|
13
|
+
readonly unitsPerEm: number;
|
|
14
|
+
readonly verticalMetrics: VerticalMetrics;
|
|
15
|
+
private readonly os2VerticalMetrics;
|
|
16
|
+
private readonly cmap;
|
|
17
|
+
private readonly advanceForGlyph;
|
|
18
|
+
private constructor();
|
|
19
|
+
static parse(bytes: Uint8Array): TrueTypeFont;
|
|
20
|
+
/**
|
|
21
|
+
* The font's natural (single-spacing) line height in px — `ascender −
|
|
22
|
+
* descender + lineGap` scaled to the font size. This is the em box Word lays
|
|
23
|
+
* a line of text into before any line-spacing multiple is applied.
|
|
24
|
+
*/
|
|
25
|
+
naturalLineHeightPx(fontSizePx: number): number;
|
|
26
|
+
/**
|
|
27
|
+
* Distance from the line-box top to the top of the rendered text in Word's
|
|
28
|
+
* PDF output. Word places the baseline at `usWinAscent`; the parity PDF
|
|
29
|
+
* extractor reports the typographic text top from the font descriptor
|
|
30
|
+
* ascender, so the delta is stable regardless of paragraph line spacing or
|
|
31
|
+
* docGrid snapping.
|
|
32
|
+
*/
|
|
33
|
+
wordTextTopOffsetPx(fontSizePx: number): number;
|
|
34
|
+
advanceWidthForCodePoint(codePoint: number): number;
|
|
35
|
+
hasGlyphForCodePoint(codePoint: number): boolean;
|
|
36
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raised when a font buffer cannot be parsed as a usable sfnt/TrueType font
|
|
3
|
+
* (missing required tables, truncated data, or an unsupported `cmap` layout).
|
|
4
|
+
*
|
|
5
|
+
* Callers that load fonts opportunistically (e.g. a metrics registry falling
|
|
6
|
+
* back to a heuristic) can catch this to degrade gracefully instead of failing
|
|
7
|
+
* the whole layout pass.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TrueTypeParseError extends Error {
|
|
10
|
+
constructor(message: string);
|
|
11
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BinaryReader } from '../../BinaryReader.js';
|
|
2
|
+
|
|
3
|
+
/** Reads `unitsPerEm` from the `head` table (located at byte offset 18). */
|
|
4
|
+
export declare function parseHeadUnitsPerEm(reader: BinaryReader, offset: number): number;
|
|
5
|
+
/**
|
|
6
|
+
* Reads `numberOfHMetrics` (the count of long horizontal metrics) from the
|
|
7
|
+
* `hhea` table (located at byte offset 34).
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseHheaNumberOfHMetrics(reader: BinaryReader, offset: number): number;
|
|
10
|
+
/** The font's vertical metrics, in font design units. */
|
|
11
|
+
export interface VerticalMetrics {
|
|
12
|
+
/** Distance from the baseline to the top of the em box (`hhea.ascender`). */
|
|
13
|
+
ascent: number;
|
|
14
|
+
/** Distance from the baseline to the bottom (`hhea.descender`, negative). */
|
|
15
|
+
descent: number;
|
|
16
|
+
/** Recommended extra spacing between lines (`hhea.lineGap`). */
|
|
17
|
+
lineGap: number;
|
|
18
|
+
}
|
|
19
|
+
/** OS/2 metrics Word uses to position text within a line box. */
|
|
20
|
+
export interface Os2VerticalMetrics {
|
|
21
|
+
/** Typographic ascender (`OS/2.sTypoAscender`). */
|
|
22
|
+
typoAscender: number;
|
|
23
|
+
/** Windows ascender (`OS/2.usWinAscent`). */
|
|
24
|
+
winAscent: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Reads the vertical metrics from the `hhea` table: `ascender` (offset 4),
|
|
28
|
+
* `descender` (offset 6) and `lineGap` (offset 8), all signed font units.
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseHheaVerticalMetrics(reader: BinaryReader, offset: number): VerticalMetrics;
|
|
31
|
+
/**
|
|
32
|
+
* Reads the OS/2 vertical metrics needed to locate the rendered text top.
|
|
33
|
+
* Returns `null` for very old/incomplete fonts that do not expose these fields.
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseOs2VerticalMetrics(reader: BinaryReader, offset: number, length: number): Os2VerticalMetrics | null;
|
|
36
|
+
/** Reads `numGlyphs` from the `maxp` table (located at byte offset 4). */
|
|
37
|
+
export declare function parseMaxpNumGlyphs(reader: BinaryReader, offset: number): number;
|
|
38
|
+
/**
|
|
39
|
+
* Builds a glyph-id → advance-width lookup from the `hmtx` table.
|
|
40
|
+
*
|
|
41
|
+
* `hmtx` stores `numberOfHMetrics` `longHorMetric` records (advanceWidth:u16,
|
|
42
|
+
* lsb:i16). Glyph ids at or beyond that count reuse the *last* record's advance
|
|
43
|
+
* — the trailing-run convention used by fonts with a monospaced glyph tail.
|
|
44
|
+
*/
|
|
45
|
+
export declare function parseHmtxAdvances(reader: BinaryReader, offset: number, numberOfHMetrics: number): (glyphId: number) => number;
|