@wordpress/global-styles-ui 1.1.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/LICENSE.md +788 -0
- package/README.md +48 -0
- package/build/background-panel.js +62 -0
- package/build/background-panel.js.map +7 -0
- package/build/block-preview-panel.js +90 -0
- package/build/block-preview-panel.js.map +7 -0
- package/build/color-indicator-wrapper.js +55 -0
- package/build/color-indicator-wrapper.js.map +7 -0
- package/build/color-palette-panel.js +123 -0
- package/build/color-palette-panel.js.map +7 -0
- package/build/color-preview.js +94 -0
- package/build/color-preview.js.map +7 -0
- package/build/color-variations.js +41 -0
- package/build/color-variations.js.map +7 -0
- package/build/confirm-reset-shadow-dialog.js +55 -0
- package/build/confirm-reset-shadow-dialog.js.map +7 -0
- package/build/context.js +37 -0
- package/build/context.js.map +7 -0
- package/build/dimensions-panel.js +89 -0
- package/build/dimensions-panel.js.map +7 -0
- package/build/font-families.js +114 -0
- package/build/font-families.js.map +7 -0
- package/build/font-family-item.js +48 -0
- package/build/font-family-item.js.map +7 -0
- package/build/font-library-modal/collection-font-variant.js +75 -0
- package/build/font-library-modal/collection-font-variant.js.map +7 -0
- package/build/font-library-modal/context.js +386 -0
- package/build/font-library-modal/context.js.map +7 -0
- package/build/font-library-modal/font-card.js +81 -0
- package/build/font-library-modal/font-card.js.map +7 -0
- package/build/font-library-modal/font-collection.js +510 -0
- package/build/font-library-modal/font-collection.js.map +7 -0
- package/build/font-library-modal/font-demo.js +111 -0
- package/build/font-library-modal/font-demo.js.map +7 -0
- package/build/font-library-modal/google-fonts-confirm-dialog.js +58 -0
- package/build/font-library-modal/google-fonts-confirm-dialog.js.map +7 -0
- package/build/font-library-modal/index.js +110 -0
- package/build/font-library-modal/index.js.map +7 -0
- package/build/font-library-modal/installed-fonts.js +453 -0
- package/build/font-library-modal/installed-fonts.js.map +7 -0
- package/build/font-library-modal/lib/inflate.js +2628 -0
- package/build/font-library-modal/lib/inflate.js.map +7 -0
- package/build/font-library-modal/lib/lib-font.browser.d.js +33 -0
- package/build/font-library-modal/lib/lib-font.browser.d.js.map +7 -0
- package/build/font-library-modal/lib/lib-font.browser.js +3788 -0
- package/build/font-library-modal/lib/lib-font.browser.js.map +7 -0
- package/build/font-library-modal/lib/unbrotli.js +3678 -0
- package/build/font-library-modal/lib/unbrotli.js.map +7 -0
- package/build/font-library-modal/library-font-details.js +63 -0
- package/build/font-library-modal/library-font-details.js.map +7 -0
- package/build/font-library-modal/library-font-variant.js +81 -0
- package/build/font-library-modal/library-font-variant.js.map +7 -0
- package/build/font-library-modal/resolvers.js +115 -0
- package/build/font-library-modal/resolvers.js.map +7 -0
- package/build/font-library-modal/types.js +17 -0
- package/build/font-library-modal/types.js.map +7 -0
- package/build/font-library-modal/upload-fonts.js +207 -0
- package/build/font-library-modal/upload-fonts.js.map +7 -0
- package/build/font-library-modal/utils/constants.js +49 -0
- package/build/font-library-modal/utils/constants.js.map +7 -0
- package/build/font-library-modal/utils/filter-fonts.js +39 -0
- package/build/font-library-modal/utils/filter-fonts.js.map +7 -0
- package/build/font-library-modal/utils/fonts-outline.js +51 -0
- package/build/font-library-modal/utils/fonts-outline.js.map +7 -0
- package/build/font-library-modal/utils/index.js +274 -0
- package/build/font-library-modal/utils/index.js.map +7 -0
- package/build/font-library-modal/utils/make-families-from-faces.js +45 -0
- package/build/font-library-modal/utils/make-families-from-faces.js.map +7 -0
- package/build/font-library-modal/utils/preview-styles.js +119 -0
- package/build/font-library-modal/utils/preview-styles.js.map +7 -0
- package/build/font-library-modal/utils/set-immutably.js +40 -0
- package/build/font-library-modal/utils/set-immutably.js.map +7 -0
- package/build/font-library-modal/utils/sort-font-faces.js +59 -0
- package/build/font-library-modal/utils/sort-font-faces.js.map +7 -0
- package/build/font-library-modal/utils/toggleFont.js +67 -0
- package/build/font-library-modal/utils/toggleFont.js.map +7 -0
- package/build/font-sizes/confirm-delete-font-size-dialog.js +60 -0
- package/build/font-sizes/confirm-delete-font-size-dialog.js.map +7 -0
- package/build/font-sizes/confirm-reset-font-sizes-dialog.js +55 -0
- package/build/font-sizes/confirm-reset-font-sizes-dialog.js.map +7 -0
- package/build/font-sizes/font-size-preview.js +50 -0
- package/build/font-sizes/font-size-preview.js.map +7 -0
- package/build/font-sizes/font-size.js +261 -0
- package/build/font-sizes/font-size.js.map +7 -0
- package/build/font-sizes/font-sizes-count.js +40 -0
- package/build/font-sizes/font-sizes-count.js.map +7 -0
- package/build/font-sizes/font-sizes.js +215 -0
- package/build/font-sizes/font-sizes.js.map +7 -0
- package/build/font-sizes/rename-font-size-dialog.js +96 -0
- package/build/font-sizes/rename-font-size-dialog.js.map +7 -0
- package/build/global-styles-ui.js +213 -0
- package/build/global-styles-ui.js.map +7 -0
- package/build/gradients-palette-panel.js +133 -0
- package/build/gradients-palette-panel.js.map +7 -0
- package/build/highlighted-colors.js +57 -0
- package/build/highlighted-colors.js.map +7 -0
- package/build/hooks.js +176 -0
- package/build/hooks.js.map +7 -0
- package/build/icon-with-current-color.js +56 -0
- package/build/icon-with-current-color.js.map +7 -0
- package/build/index.js +51 -0
- package/build/index.js.map +7 -0
- package/build/lock-unlock.js +35 -0
- package/build/lock-unlock.js.map +7 -0
- package/build/navigation-button.js +52 -0
- package/build/navigation-button.js.map +7 -0
- package/build/pagination/index.js +133 -0
- package/build/pagination/index.js.map +7 -0
- package/build/palette.js +93 -0
- package/build/palette.js.map +7 -0
- package/build/preset-colors.js +40 -0
- package/build/preset-colors.js.map +7 -0
- package/build/preview-colors.js +86 -0
- package/build/preview-colors.js.map +7 -0
- package/build/preview-hooks.js +60 -0
- package/build/preview-hooks.js.map +7 -0
- package/build/preview-styles.js +219 -0
- package/build/preview-styles.js.map +7 -0
- package/build/preview-typography.js +72 -0
- package/build/preview-typography.js.map +7 -0
- package/build/preview-wrapper.js +102 -0
- package/build/preview-wrapper.js.map +7 -0
- package/build/provider.js +54 -0
- package/build/provider.js.map +7 -0
- package/build/root-menu.js +72 -0
- package/build/root-menu.js.map +7 -0
- package/build/screen-background.js +58 -0
- package/build/screen-background.js.map +7 -0
- package/build/screen-block-list.js +160 -0
- package/build/screen-block-list.js.map +7 -0
- package/build/screen-block.js +316 -0
- package/build/screen-block.js.map +7 -0
- package/build/screen-color-palette.js +64 -0
- package/build/screen-color-palette.js.map +7 -0
- package/build/screen-colors.js +85 -0
- package/build/screen-colors.js.map +7 -0
- package/build/screen-css.js +68 -0
- package/build/screen-css.js.map +7 -0
- package/build/screen-header.js +61 -0
- package/build/screen-header.js.map +7 -0
- package/build/screen-layout.js +54 -0
- package/build/screen-layout.js.map +7 -0
- package/build/screen-revisions/index.js +147 -0
- package/build/screen-revisions/index.js.map +7 -0
- package/build/screen-revisions/revisions-buttons.js +198 -0
- package/build/screen-revisions/revisions-buttons.js.map +7 -0
- package/build/screen-revisions/types.js +17 -0
- package/build/screen-revisions/types.js.map +7 -0
- package/build/screen-revisions/use-global-styles-revisions.js +163 -0
- package/build/screen-revisions/use-global-styles-revisions.js.map +7 -0
- package/build/screen-root.js +134 -0
- package/build/screen-root.js.map +7 -0
- package/build/screen-shadows.js +49 -0
- package/build/screen-shadows.js.map +7 -0
- package/build/screen-style-variations.js +52 -0
- package/build/screen-style-variations.js.map +7 -0
- package/build/screen-typography-element.js +167 -0
- package/build/screen-typography-element.js.map +7 -0
- package/build/screen-typography.js +65 -0
- package/build/screen-typography.js.map +7 -0
- package/build/shadow-utils.js +125 -0
- package/build/shadow-utils.js.map +7 -0
- package/build/shadows-edit-panel.js +503 -0
- package/build/shadows-edit-panel.js.map +7 -0
- package/build/shadows-panel.js +203 -0
- package/build/shadows-panel.js.map +7 -0
- package/build/size-control/index.js +86 -0
- package/build/size-control/index.js.map +7 -0
- package/build/style-variations-container.js +130 -0
- package/build/style-variations-container.js.map +7 -0
- package/build/style-variations-content.js +52 -0
- package/build/style-variations-content.js.map +7 -0
- package/build/style-variations.js +41 -0
- package/build/style-variations.js.map +7 -0
- package/build/subtitle.js +33 -0
- package/build/subtitle.js.map +7 -0
- package/build/typography-elements.js +117 -0
- package/build/typography-elements.js.map +7 -0
- package/build/typography-example.js +79 -0
- package/build/typography-example.js.map +7 -0
- package/build/typography-panel.js +64 -0
- package/build/typography-panel.js.map +7 -0
- package/build/typography-preview.js +70 -0
- package/build/typography-preview.js.map +7 -0
- package/build/typography-variations.js +41 -0
- package/build/typography-variations.js.map +7 -0
- package/build/utils.js +210 -0
- package/build/utils.js.map +7 -0
- package/build/variations/variation.js +116 -0
- package/build/variations/variation.js.map +7 -0
- package/build/variations/variations-color.js +64 -0
- package/build/variations/variations-color.js.map +7 -0
- package/build/variations/variations-panel.js +69 -0
- package/build/variations/variations-panel.js.map +7 -0
- package/build/variations/variations-typography.js +80 -0
- package/build/variations/variations-typography.js.map +7 -0
- package/build/with-global-styles-provider.js +48 -0
- package/build/with-global-styles-provider.js.map +7 -0
- package/build-module/background-panel.js +38 -0
- package/build-module/background-panel.js.map +7 -0
- package/build-module/block-preview-panel.js +70 -0
- package/build-module/block-preview-panel.js.map +7 -0
- package/build-module/color-indicator-wrapper.js +25 -0
- package/build-module/color-indicator-wrapper.js.map +7 -0
- package/build-module/color-palette-panel.js +97 -0
- package/build-module/color-palette-panel.js.map +7 -0
- package/build-module/color-preview.js +70 -0
- package/build-module/color-preview.js.map +7 -0
- package/build-module/color-variations.js +7 -0
- package/build-module/color-variations.js.map +7 -0
- package/build-module/confirm-reset-shadow-dialog.js +35 -0
- package/build-module/confirm-reset-shadow-dialog.js.map +7 -0
- package/build-module/context.js +13 -0
- package/build-module/context.js.map +7 -0
- package/build-module/dimensions-panel.js +69 -0
- package/build-module/dimensions-panel.js.map +7 -0
- package/build-module/font-families.js +92 -0
- package/build-module/font-families.js.map +7 -0
- package/build-module/font-family-item.js +32 -0
- package/build-module/font-family-item.js.map +7 -0
- package/build-module/font-library-modal/collection-font-variant.js +45 -0
- package/build-module/font-library-modal/collection-font-variant.js.map +7 -0
- package/build-module/font-library-modal/context.js +382 -0
- package/build-module/font-library-modal/context.js.map +7 -0
- package/build-module/font-library-modal/font-card.js +57 -0
- package/build-module/font-library-modal/font-card.js.map +7 -0
- package/build-module/font-library-modal/font-collection.js +510 -0
- package/build-module/font-library-modal/font-collection.js.map +7 -0
- package/build-module/font-library-modal/font-demo.js +94 -0
- package/build-module/font-library-modal/font-demo.js.map +7 -0
- package/build-module/font-library-modal/google-fonts-confirm-dialog.js +45 -0
- package/build-module/font-library-modal/google-fonts-confirm-dialog.js.map +7 -0
- package/build-module/font-library-modal/index.js +83 -0
- package/build-module/font-library-modal/index.js.map +7 -0
- package/build-module/font-library-modal/installed-fonts.js +442 -0
- package/build-module/font-library-modal/installed-fonts.js.map +7 -0
- package/build-module/font-library-modal/lib/inflate.js +2636 -0
- package/build-module/font-library-modal/lib/inflate.js.map +7 -0
- package/build-module/font-library-modal/lib/lib-font.browser.d.js +9 -0
- package/build-module/font-library-modal/lib/lib-font.browser.d.js.map +7 -0
- package/build-module/font-library-modal/lib/lib-font.browser.js +3754 -0
- package/build-module/font-library-modal/lib/lib-font.browser.js.map +7 -0
- package/build-module/font-library-modal/lib/unbrotli.js +3686 -0
- package/build-module/font-library-modal/lib/unbrotli.js.map +7 -0
- package/build-module/font-library-modal/library-font-details.js +36 -0
- package/build-module/font-library-modal/library-font-details.js.map +7 -0
- package/build-module/font-library-modal/library-font-variant.js +51 -0
- package/build-module/font-library-modal/library-font-variant.js.map +7 -0
- package/build-module/font-library-modal/resolvers.js +76 -0
- package/build-module/font-library-modal/resolvers.js.map +7 -0
- package/build-module/font-library-modal/types.js +1 -0
- package/build-module/font-library-modal/types.js.map +7 -0
- package/build-module/font-library-modal/upload-fonts.js +187 -0
- package/build-module/font-library-modal/upload-fonts.js.map +7 -0
- package/build-module/font-library-modal/utils/constants.js +23 -0
- package/build-module/font-library-modal/utils/constants.js.map +7 -0
- package/build-module/font-library-modal/utils/filter-fonts.js +19 -0
- package/build-module/font-library-modal/utils/filter-fonts.js.map +7 -0
- package/build-module/font-library-modal/utils/fonts-outline.js +26 -0
- package/build-module/font-library-modal/utils/fonts-outline.js.map +7 -0
- package/build-module/font-library-modal/utils/index.js +238 -0
- package/build-module/font-library-modal/utils/index.js.map +7 -0
- package/build-module/font-library-modal/utils/make-families-from-faces.js +25 -0
- package/build-module/font-library-modal/utils/make-families-from-faces.js.map +7 -0
- package/build-module/font-library-modal/utils/preview-styles.js +92 -0
- package/build-module/font-library-modal/utils/preview-styles.js.map +7 -0
- package/build-module/font-library-modal/utils/set-immutably.js +16 -0
- package/build-module/font-library-modal/utils/set-immutably.js.map +7 -0
- package/build-module/font-library-modal/utils/sort-font-faces.js +35 -0
- package/build-module/font-library-modal/utils/sort-font-faces.js.map +7 -0
- package/build-module/font-library-modal/utils/toggleFont.js +43 -0
- package/build-module/font-library-modal/utils/toggleFont.js.map +7 -0
- package/build-module/font-sizes/confirm-delete-font-size-dialog.js +40 -0
- package/build-module/font-sizes/confirm-delete-font-size-dialog.js.map +7 -0
- package/build-module/font-sizes/confirm-reset-font-sizes-dialog.js +35 -0
- package/build-module/font-sizes/confirm-reset-font-sizes-dialog.js.map +7 -0
- package/build-module/font-sizes/font-size-preview.js +30 -0
- package/build-module/font-sizes/font-size-preview.js.map +7 -0
- package/build-module/font-sizes/font-size.js +241 -0
- package/build-module/font-sizes/font-size.js.map +7 -0
- package/build-module/font-sizes/font-sizes-count.js +25 -0
- package/build-module/font-sizes/font-sizes-count.js.map +7 -0
- package/build-module/font-sizes/font-sizes.js +200 -0
- package/build-module/font-sizes/font-sizes.js.map +7 -0
- package/build-module/font-sizes/rename-font-size-dialog.js +82 -0
- package/build-module/font-sizes/rename-font-size-dialog.js.map +7 -0
- package/build-module/global-styles-ui.js +182 -0
- package/build-module/global-styles-ui.js.map +7 -0
- package/build-module/gradients-palette-panel.js +118 -0
- package/build-module/gradients-palette-panel.js.map +7 -0
- package/build-module/highlighted-colors.js +37 -0
- package/build-module/highlighted-colors.js.map +7 -0
- package/build-module/hooks.js +144 -0
- package/build-module/hooks.js.map +7 -0
- package/build-module/icon-with-current-color.js +22 -0
- package/build-module/icon-with-current-color.js.map +7 -0
- package/build-module/index.js +13 -0
- package/build-module/index.js.map +7 -0
- package/build-module/lock-unlock.js +10 -0
- package/build-module/lock-unlock.js.map +7 -0
- package/build-module/navigation-button.js +32 -0
- package/build-module/navigation-button.js.map +7 -0
- package/build-module/pagination/index.js +107 -0
- package/build-module/pagination/index.js.map +7 -0
- package/build-module/palette.js +70 -0
- package/build-module/palette.js.map +7 -0
- package/build-module/preset-colors.js +20 -0
- package/build-module/preset-colors.js.map +7 -0
- package/build-module/preview-colors.js +59 -0
- package/build-module/preview-colors.js.map +7 -0
- package/build-module/preview-hooks.js +36 -0
- package/build-module/preview-hooks.js.map +7 -0
- package/build-module/preview-styles.js +193 -0
- package/build-module/preview-styles.js.map +7 -0
- package/build-module/preview-typography.js +42 -0
- package/build-module/preview-typography.js.map +7 -0
- package/build-module/preview-wrapper.js +86 -0
- package/build-module/preview-wrapper.js.map +7 -0
- package/build-module/provider.js +30 -0
- package/build-module/provider.js.map +7 -0
- package/build-module/root-menu.js +58 -0
- package/build-module/root-menu.js.map +7 -0
- package/build-module/screen-background.js +28 -0
- package/build-module/screen-background.js.map +7 -0
- package/build-module/screen-block-list.js +150 -0
- package/build-module/screen-block-list.js.map +7 -0
- package/build-module/screen-block.js +293 -0
- package/build-module/screen-block.js.map +7 -0
- package/build-module/screen-color-palette.js +34 -0
- package/build-module/screen-color-palette.js.map +7 -0
- package/build-module/screen-colors.js +55 -0
- package/build-module/screen-colors.js.map +7 -0
- package/build-module/screen-css.js +48 -0
- package/build-module/screen-css.js.map +7 -0
- package/build-module/screen-header.js +44 -0
- package/build-module/screen-header.js.map +7 -0
- package/build-module/screen-layout.js +24 -0
- package/build-module/screen-layout.js.map +7 -0
- package/build-module/screen-revisions/index.js +121 -0
- package/build-module/screen-revisions/index.js.map +7 -0
- package/build-module/screen-revisions/revisions-buttons.js +178 -0
- package/build-module/screen-revisions/revisions-buttons.js.map +7 -0
- package/build-module/screen-revisions/types.js +1 -0
- package/build-module/screen-revisions/types.js.map +7 -0
- package/build-module/screen-revisions/use-global-styles-revisions.js +145 -0
- package/build-module/screen-revisions/use-global-styles-revisions.js.map +7 -0
- package/build-module/screen-root.js +114 -0
- package/build-module/screen-root.js.map +7 -0
- package/build-module/screen-shadows.js +14 -0
- package/build-module/screen-shadows.js.map +7 -0
- package/build-module/screen-style-variations.js +32 -0
- package/build-module/screen-style-variations.js.map +7 -0
- package/build-module/screen-typography-element.js +141 -0
- package/build-module/screen-typography-element.js.map +7 -0
- package/build-module/screen-typography.js +35 -0
- package/build-module/screen-typography.js.map +7 -0
- package/build-module/shadow-utils.js +98 -0
- package/build-module/shadow-utils.js.map +7 -0
- package/build-module/shadows-edit-panel.js +502 -0
- package/build-module/shadows-edit-panel.js.map +7 -0
- package/build-module/shadows-panel.js +182 -0
- package/build-module/shadows-panel.js.map +7 -0
- package/build-module/size-control/index.js +72 -0
- package/build-module/size-control/index.js.map +7 -0
- package/build-module/style-variations-container.js +100 -0
- package/build-module/style-variations-container.js.map +7 -0
- package/build-module/style-variations-content.js +18 -0
- package/build-module/style-variations-content.js.map +7 -0
- package/build-module/style-variations.js +7 -0
- package/build-module/style-variations.js.map +7 -0
- package/build-module/subtitle.js +9 -0
- package/build-module/subtitle.js.map +7 -0
- package/build-module/typography-elements.js +102 -0
- package/build-module/typography-elements.js.map +7 -0
- package/build-module/typography-example.js +59 -0
- package/build-module/typography-example.js.map +7 -0
- package/build-module/typography-panel.js +44 -0
- package/build-module/typography-panel.js.map +7 -0
- package/build-module/typography-preview.js +50 -0
- package/build-module/typography-preview.js.map +7 -0
- package/build-module/typography-variations.js +7 -0
- package/build-module/typography-variations.js.map +7 -0
- package/build-module/utils.js +179 -0
- package/build-module/utils.js.map +7 -0
- package/build-module/variations/variation.js +86 -0
- package/build-module/variations/variation.js.map +7 -0
- package/build-module/variations/variations-color.js +37 -0
- package/build-module/variations/variations-color.js.map +7 -0
- package/build-module/variations/variations-panel.js +44 -0
- package/build-module/variations/variations-panel.js.map +7 -0
- package/build-module/variations/variations-typography.js +53 -0
- package/build-module/variations/variations-typography.js.map +7 -0
- package/build-module/with-global-styles-provider.js +24 -0
- package/build-module/with-global-styles-provider.js.map +7 -0
- package/build-style/style-rtl.css +717 -0
- package/build-style/style.css +718 -0
- package/build-types/background-panel.d.ts +10 -0
- package/build-types/background-panel.d.ts.map +1 -0
- package/build-types/block-preview-panel.d.ts +7 -0
- package/build-types/block-preview-panel.d.ts.map +1 -0
- package/build-types/color-indicator-wrapper.d.ts +7 -0
- package/build-types/color-indicator-wrapper.d.ts.map +1 -0
- package/build-types/color-palette-panel.d.ts +6 -0
- package/build-types/color-palette-panel.d.ts.map +1 -0
- package/build-types/color-preview.d.ts +2 -0
- package/build-types/color-preview.d.ts.map +1 -0
- package/build-types/color-variations.d.ts +27 -0
- package/build-types/color-variations.d.ts.map +1 -0
- package/build-types/confirm-reset-shadow-dialog.d.ts +10 -0
- package/build-types/confirm-reset-shadow-dialog.d.ts.map +1 -0
- package/build-types/context.d.ts +10 -0
- package/build-types/context.d.ts.map +1 -0
- package/build-types/dimensions-panel.d.ts +2 -0
- package/build-types/dimensions-panel.d.ts.map +1 -0
- package/build-types/font-families.d.ts +4 -0
- package/build-types/font-families.d.ts.map +1 -0
- package/build-types/font-family-item.d.ts +7 -0
- package/build-types/font-family-item.d.ts.map +1 -0
- package/build-types/font-library-modal/collection-font-variant.d.ts +4 -0
- package/build-types/font-library-modal/collection-font-variant.d.ts.map +1 -0
- package/build-types/font-library-modal/context.d.ts +7 -0
- package/build-types/font-library-modal/context.d.ts.map +1 -0
- package/build-types/font-library-modal/font-card.d.ts +9 -0
- package/build-types/font-library-modal/font-card.d.ts.map +1 -0
- package/build-types/font-library-modal/font-collection.d.ts +5 -0
- package/build-types/font-library-modal/font-collection.d.ts.map +1 -0
- package/build-types/font-library-modal/font-demo.d.ts +4 -0
- package/build-types/font-library-modal/font-demo.d.ts.map +1 -0
- package/build-types/font-library-modal/google-fonts-confirm-dialog.d.ts +3 -0
- package/build-types/font-library-modal/google-fonts-confirm-dialog.d.ts.map +1 -0
- package/build-types/font-library-modal/index.d.ts +6 -0
- package/build-types/font-library-modal/index.d.ts.map +1 -0
- package/build-types/font-library-modal/installed-fonts.d.ts +3 -0
- package/build-types/font-library-modal/installed-fonts.d.ts.map +1 -0
- package/build-types/font-library-modal/library-font-details.d.ts +6 -0
- package/build-types/font-library-modal/library-font-details.d.ts.map +1 -0
- package/build-types/font-library-modal/library-font-variant.d.ts +7 -0
- package/build-types/font-library-modal/library-font-variant.d.ts.map +1 -0
- package/build-types/font-library-modal/resolvers.d.ts +43 -0
- package/build-types/font-library-modal/resolvers.d.ts.map +1 -0
- package/build-types/font-library-modal/types.d.ts +133 -0
- package/build-types/font-library-modal/types.d.ts.map +1 -0
- package/build-types/font-library-modal/upload-fonts.d.ts +3 -0
- package/build-types/font-library-modal/upload-fonts.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/constants.d.ts +4 -0
- package/build-types/font-library-modal/utils/constants.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/filter-fonts.d.ts +25 -0
- package/build-types/font-library-modal/utils/filter-fonts.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/fonts-outline.d.ts +7 -0
- package/build-types/font-library-modal/utils/fonts-outline.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/index.d.ts +21 -0
- package/build-types/font-library-modal/utils/index.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/make-families-from-faces.d.ts +6 -0
- package/build-types/font-library-modal/utils/make-families-from-faces.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/preview-styles.d.ts +13 -0
- package/build-types/font-library-modal/utils/preview-styles.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/set-immutably.d.ts +13 -0
- package/build-types/font-library-modal/utils/set-immutably.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/sort-font-faces.d.ts +6 -0
- package/build-types/font-library-modal/utils/sort-font-faces.d.ts.map +1 -0
- package/build-types/font-library-modal/utils/toggleFont.d.ts +38 -0
- package/build-types/font-library-modal/utils/toggleFont.d.ts.map +1 -0
- package/build-types/font-sizes/confirm-delete-font-size-dialog.d.ts +10 -0
- package/build-types/font-sizes/confirm-delete-font-size-dialog.d.ts.map +1 -0
- package/build-types/font-sizes/confirm-reset-font-sizes-dialog.d.ts +10 -0
- package/build-types/font-sizes/confirm-reset-font-sizes-dialog.d.ts.map +1 -0
- package/build-types/font-sizes/font-size-preview.d.ts +7 -0
- package/build-types/font-sizes/font-size-preview.d.ts.map +1 -0
- package/build-types/font-sizes/font-size.d.ts +4 -0
- package/build-types/font-sizes/font-size.d.ts.map +1 -0
- package/build-types/font-sizes/font-sizes-count.d.ts +3 -0
- package/build-types/font-sizes/font-sizes-count.d.ts.map +1 -0
- package/build-types/font-sizes/font-sizes.d.ts +3 -0
- package/build-types/font-sizes/font-sizes.d.ts.map +1 -0
- package/build-types/font-sizes/rename-font-size-dialog.d.ts +9 -0
- package/build-types/font-sizes/rename-font-size-dialog.d.ts.map +1 -0
- package/build-types/global-styles-ui.d.ts +26 -0
- package/build-types/global-styles-ui.d.ts.map +1 -0
- package/build-types/gradients-palette-panel.d.ts +6 -0
- package/build-types/gradients-palette-panel.d.ts.map +1 -0
- package/build-types/highlighted-colors.d.ts +7 -0
- package/build-types/highlighted-colors.d.ts.map +1 -0
- package/build-types/hooks.d.ts +46 -0
- package/build-types/hooks.d.ts.map +1 -0
- package/build-types/icon-with-current-color.d.ts +9 -0
- package/build-types/icon-with-current-color.d.ts.map +1 -0
- package/build-types/index.d.ts +6 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/lock-unlock.d.ts +2 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/build-types/navigation-button.d.ts +10 -0
- package/build-types/navigation-button.d.ts.map +1 -0
- package/build-types/pagination/index.d.ts +13 -0
- package/build-types/pagination/index.d.ts.map +1 -0
- package/build-types/palette.d.ts +6 -0
- package/build-types/palette.d.ts.map +1 -0
- package/build-types/preset-colors.d.ts +2 -0
- package/build-types/preset-colors.d.ts.map +1 -0
- package/build-types/preview-colors.d.ts +8 -0
- package/build-types/preview-colors.d.ts.map +1 -0
- package/build-types/preview-hooks.d.ts +9 -0
- package/build-types/preview-hooks.d.ts.map +1 -0
- package/build-types/preview-styles.d.ts +9 -0
- package/build-types/preview-styles.d.ts.map +1 -0
- package/build-types/preview-typography.d.ts +8 -0
- package/build-types/preview-typography.d.ts.map +1 -0
- package/build-types/preview-wrapper.d.ts +15 -0
- package/build-types/preview-wrapper.d.ts.map +1 -0
- package/build-types/provider.d.ts +15 -0
- package/build-types/provider.d.ts.map +1 -0
- package/build-types/root-menu.d.ts +3 -0
- package/build-types/root-menu.d.ts.map +1 -0
- package/build-types/screen-background.d.ts +3 -0
- package/build-types/screen-background.d.ts.map +1 -0
- package/build-types/screen-block-list.d.ts +4 -0
- package/build-types/screen-block-list.d.ts.map +1 -0
- package/build-types/screen-block.d.ts +7 -0
- package/build-types/screen-block.d.ts.map +1 -0
- package/build-types/screen-color-palette.d.ts +5 -0
- package/build-types/screen-color-palette.d.ts.map +1 -0
- package/build-types/screen-colors.d.ts +3 -0
- package/build-types/screen-colors.d.ts.map +1 -0
- package/build-types/screen-css.d.ts +3 -0
- package/build-types/screen-css.d.ts.map +1 -0
- package/build-types/screen-header.d.ts +8 -0
- package/build-types/screen-header.d.ts.map +1 -0
- package/build-types/screen-layout.d.ts +3 -0
- package/build-types/screen-layout.d.ts.map +1 -0
- package/build-types/screen-revisions/index.d.ts +6 -0
- package/build-types/screen-revisions/index.d.ts.map +1 -0
- package/build-types/screen-revisions/revisions-buttons.d.ts +23 -0
- package/build-types/screen-revisions/revisions-buttons.d.ts.map +1 -0
- package/build-types/screen-revisions/types.d.ts +17 -0
- package/build-types/screen-revisions/types.d.ts.map +1 -0
- package/build-types/screen-revisions/use-global-styles-revisions.d.ts +17 -0
- package/build-types/screen-revisions/use-global-styles-revisions.d.ts.map +1 -0
- package/build-types/screen-root.d.ts +3 -0
- package/build-types/screen-root.d.ts.map +1 -0
- package/build-types/screen-shadows.d.ts +3 -0
- package/build-types/screen-shadows.d.ts.map +1 -0
- package/build-types/screen-style-variations.d.ts +3 -0
- package/build-types/screen-style-variations.d.ts.map +1 -0
- package/build-types/screen-typography-element.d.ts +28 -0
- package/build-types/screen-typography-element.d.ts.map +1 -0
- package/build-types/screen-typography.d.ts +3 -0
- package/build-types/screen-typography.d.ts.map +1 -0
- package/build-types/shadow-utils.d.ts +126 -0
- package/build-types/shadow-utils.d.ts.map +1 -0
- package/build-types/shadows-edit-panel.d.ts +2 -0
- package/build-types/shadows-edit-panel.d.ts.map +1 -0
- package/build-types/shadows-panel.d.ts +3 -0
- package/build-types/shadows-panel.d.ts.map +1 -0
- package/build-types/size-control/index.d.ts +11 -0
- package/build-types/size-control/index.d.ts.map +1 -0
- package/build-types/stories/index.story.d.ts +6 -0
- package/build-types/stories/index.story.d.ts.map +1 -0
- package/build-types/style-variations-container.d.ts +6 -0
- package/build-types/style-variations-container.d.ts.map +1 -0
- package/build-types/style-variations-content.d.ts +2 -0
- package/build-types/style-variations-content.d.ts.map +1 -0
- package/build-types/style-variations.d.ts +25 -0
- package/build-types/style-variations.d.ts.map +1 -0
- package/build-types/subtitle.d.ts +7 -0
- package/build-types/subtitle.d.ts.map +1 -0
- package/build-types/test/shadow-utils.spec.d.ts +2 -0
- package/build-types/test/shadow-utils.spec.d.ts.map +1 -0
- package/build-types/test/utils.spec.d.ts +2 -0
- package/build-types/test/utils.spec.d.ts.map +1 -0
- package/build-types/typography-elements.d.ts +3 -0
- package/build-types/typography-elements.d.ts.map +1 -0
- package/build-types/typography-example.d.ts +7 -0
- package/build-types/typography-example.d.ts.map +1 -0
- package/build-types/typography-panel.d.ts +7 -0
- package/build-types/typography-panel.d.ts.map +1 -0
- package/build-types/typography-preview.d.ts +8 -0
- package/build-types/typography-preview.d.ts.map +1 -0
- package/build-types/typography-variations.d.ts +27 -0
- package/build-types/typography-variations.d.ts.map +1 -0
- package/build-types/utils.d.ts +63 -0
- package/build-types/utils.d.ts.map +1 -0
- package/build-types/variations/variation.d.ts +10 -0
- package/build-types/variations/variation.d.ts.map +1 -0
- package/build-types/variations/variations-color.d.ts +7 -0
- package/build-types/variations/variations-color.d.ts.map +1 -0
- package/build-types/variations/variations-panel.d.ts +13 -0
- package/build-types/variations/variations-panel.d.ts.map +1 -0
- package/build-types/variations/variations-typography.d.ts +7 -0
- package/build-types/variations/variations-typography.d.ts.map +1 -0
- package/build-types/with-global-styles-provider.d.ts +20 -0
- package/build-types/with-global-styles-provider.d.ts.map +1 -0
- package/package.json +67 -0
- package/src/README.md +99 -0
- package/src/background-panel.tsx +56 -0
- package/src/block-preview-panel.tsx +91 -0
- package/src/color-indicator-wrapper.tsx +34 -0
- package/src/color-palette-panel.tsx +111 -0
- package/src/color-preview.tsx +78 -0
- package/src/color-variations.tsx +35 -0
- package/src/confirm-reset-shadow-dialog.tsx +45 -0
- package/src/context.ts +21 -0
- package/src/dimensions-panel.tsx +85 -0
- package/src/font-families.tsx +127 -0
- package/src/font-family-item.tsx +52 -0
- package/src/font-library-modal/collection-font-variant.tsx +52 -0
- package/src/font-library-modal/context.tsx +591 -0
- package/src/font-library-modal/font-card.tsx +77 -0
- package/src/font-library-modal/font-collection.tsx +592 -0
- package/src/font-library-modal/font-demo.tsx +123 -0
- package/src/font-library-modal/google-fonts-confirm-dialog.tsx +57 -0
- package/src/font-library-modal/index.tsx +110 -0
- package/src/font-library-modal/installed-fonts.tsx +547 -0
- package/src/font-library-modal/lib/inflate.js +4112 -0
- package/src/font-library-modal/lib/lib-font.browser.d.ts +11 -0
- package/src/font-library-modal/lib/lib-font.browser.js +3861 -0
- package/src/font-library-modal/lib/unbrotli.js +2706 -0
- package/src/font-library-modal/library-font-details.tsx +46 -0
- package/src/font-library-modal/library-font-variant.tsx +67 -0
- package/src/font-library-modal/resolvers.tsx +100 -0
- package/src/font-library-modal/style.scss +222 -0
- package/src/font-library-modal/types.ts +176 -0
- package/src/font-library-modal/upload-fonts.tsx +269 -0
- package/src/font-library-modal/utils/constants.ts +23 -0
- package/src/font-library-modal/utils/filter-fonts.ts +47 -0
- package/src/font-library-modal/utils/fonts-outline.ts +33 -0
- package/src/font-library-modal/utils/index.ts +368 -0
- package/src/font-library-modal/utils/make-families-from-faces.ts +34 -0
- package/src/font-library-modal/utils/preview-styles.ts +167 -0
- package/src/font-library-modal/utils/set-immutably.ts +37 -0
- package/src/font-library-modal/utils/sort-font-faces.ts +46 -0
- package/src/font-library-modal/utils/toggleFont.ts +109 -0
- package/src/font-sizes/confirm-delete-font-size-dialog.tsx +51 -0
- package/src/font-sizes/confirm-reset-font-sizes-dialog.tsx +45 -0
- package/src/font-sizes/font-size-preview.tsx +47 -0
- package/src/font-sizes/font-size.tsx +289 -0
- package/src/font-sizes/font-sizes-count.tsx +37 -0
- package/src/font-sizes/font-sizes.tsx +265 -0
- package/src/font-sizes/rename-font-size-dialog.tsx +83 -0
- package/src/global-styles-ui.tsx +292 -0
- package/src/gradients-palette-panel.tsx +126 -0
- package/src/highlighted-colors.tsx +44 -0
- package/src/hooks.ts +251 -0
- package/src/icon-with-current-color.tsx +31 -0
- package/src/index.ts +7 -0
- package/src/lock-unlock.ts +10 -0
- package/src/navigation-button.tsx +53 -0
- package/src/pagination/index.tsx +107 -0
- package/src/pagination/style.scss +7 -0
- package/src/palette.tsx +101 -0
- package/src/preset-colors.tsx +18 -0
- package/src/preview-colors.tsx +68 -0
- package/src/preview-hooks.tsx +58 -0
- package/src/preview-styles.tsx +196 -0
- package/src/preview-typography.tsx +49 -0
- package/src/preview-wrapper.tsx +137 -0
- package/src/provider.tsx +54 -0
- package/src/root-menu.tsx +87 -0
- package/src/screen-background.tsx +37 -0
- package/src/screen-block-list.tsx +198 -0
- package/src/screen-block.tsx +370 -0
- package/src/screen-color-palette.tsx +47 -0
- package/src/screen-colors.tsx +67 -0
- package/src/screen-css.tsx +56 -0
- package/src/screen-header.tsx +56 -0
- package/src/screen-layout.tsx +34 -0
- package/src/screen-revisions/index.tsx +158 -0
- package/src/screen-revisions/revisions-buttons.tsx +259 -0
- package/src/screen-revisions/style.scss +194 -0
- package/src/screen-revisions/types.ts +18 -0
- package/src/screen-revisions/use-global-styles-revisions.tsx +204 -0
- package/src/screen-root.tsx +146 -0
- package/src/screen-shadows.tsx +13 -0
- package/src/screen-style-variations.tsx +36 -0
- package/src/screen-typography-element.tsx +127 -0
- package/src/screen-typography.tsx +41 -0
- package/src/shadow-utils.ts +167 -0
- package/src/shadows-edit-panel.tsx +559 -0
- package/src/shadows-panel.tsx +207 -0
- package/src/size-control/index.tsx +97 -0
- package/src/size-control/style.scss +7 -0
- package/src/stories/index.story.js +410 -0
- package/src/style-variations-container.tsx +153 -0
- package/src/style-variations-content.tsx +24 -0
- package/src/style-variations.tsx +33 -0
- package/src/style.scss +287 -0
- package/src/subtitle.tsx +17 -0
- package/src/test/shadow-utils.spec.js +251 -0
- package/src/test/utils.spec.js +59 -0
- package/src/typography-elements.tsx +113 -0
- package/src/typography-example.tsx +78 -0
- package/src/typography-panel.tsx +56 -0
- package/src/typography-preview.tsx +61 -0
- package/src/typography-variations.tsx +35 -0
- package/src/utils.ts +301 -0
- package/src/variations/style.scss +43 -0
- package/src/variations/variation.tsx +113 -0
- package/src/variations/variations-color.tsx +54 -0
- package/src/variations/variations-panel.tsx +79 -0
- package/src/variations/variations-typography.tsx +65 -0
- package/src/with-global-styles-provider.tsx +44 -0
- package/tsconfig.json +26 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,3788 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name2 in all)
|
|
10
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var lib_font_browser_exports = {};
|
|
30
|
+
__export(lib_font_browser_exports, {
|
|
31
|
+
Font: () => Font
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(lib_font_browser_exports);
|
|
34
|
+
var import_unbrotli = __toESM(require("./unbrotli"));
|
|
35
|
+
var import_inflate = __toESM(require("./inflate"));
|
|
36
|
+
let fetchFunction = globalThis.fetch;
|
|
37
|
+
class Event {
|
|
38
|
+
constructor(type, detail = {}, msg) {
|
|
39
|
+
this.type = type;
|
|
40
|
+
this.detail = detail;
|
|
41
|
+
this.msg = msg;
|
|
42
|
+
Object.defineProperty(this, `__mayPropagate`, {
|
|
43
|
+
enumerable: false,
|
|
44
|
+
writable: true
|
|
45
|
+
});
|
|
46
|
+
this.__mayPropagate = true;
|
|
47
|
+
}
|
|
48
|
+
preventDefault() {
|
|
49
|
+
}
|
|
50
|
+
stopPropagation() {
|
|
51
|
+
this.__mayPropagate = false;
|
|
52
|
+
}
|
|
53
|
+
valueOf() {
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
toString() {
|
|
57
|
+
return this.msg ? `[${this.type} event]: ${this.msg}` : `[${this.type} event]`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
class EventManager {
|
|
61
|
+
constructor() {
|
|
62
|
+
this.listeners = {};
|
|
63
|
+
}
|
|
64
|
+
addEventListener(type, listener, useCapture) {
|
|
65
|
+
let bin = this.listeners[type] || [];
|
|
66
|
+
if (useCapture) bin.unshift(listener);
|
|
67
|
+
else bin.push(listener);
|
|
68
|
+
this.listeners[type] = bin;
|
|
69
|
+
}
|
|
70
|
+
removeEventListener(type, listener) {
|
|
71
|
+
let bin = this.listeners[type] || [];
|
|
72
|
+
let pos = bin.findIndex((e) => e === listener);
|
|
73
|
+
if (pos > -1) {
|
|
74
|
+
bin.splice(pos, 1);
|
|
75
|
+
this.listeners[type] = bin;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
dispatch(event) {
|
|
79
|
+
let bin = this.listeners[event.type];
|
|
80
|
+
if (bin) {
|
|
81
|
+
for (let l = 0, e = bin.length; l < e; l++) {
|
|
82
|
+
if (!event.__mayPropagate) break;
|
|
83
|
+
bin[l](event);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const startDate = (/* @__PURE__ */ new Date(`1904-01-01T00:00:00+0000`)).getTime();
|
|
89
|
+
function asText(data) {
|
|
90
|
+
return Array.from(data).map((v) => String.fromCharCode(v)).join(``);
|
|
91
|
+
}
|
|
92
|
+
class Parser {
|
|
93
|
+
constructor(dict, dataview, name2) {
|
|
94
|
+
this.name = (name2 || dict.tag || ``).trim();
|
|
95
|
+
this.length = dict.length;
|
|
96
|
+
this.start = dict.offset;
|
|
97
|
+
this.offset = 0;
|
|
98
|
+
this.data = dataview;
|
|
99
|
+
[
|
|
100
|
+
`getInt8`,
|
|
101
|
+
`getUint8`,
|
|
102
|
+
`getInt16`,
|
|
103
|
+
`getUint16`,
|
|
104
|
+
`getInt32`,
|
|
105
|
+
`getUint32`,
|
|
106
|
+
`getBigInt64`,
|
|
107
|
+
`getBigUint64`
|
|
108
|
+
].forEach((name3) => {
|
|
109
|
+
let fn = name3.replace(/get(Big)?/, "").toLowerCase();
|
|
110
|
+
let increment = parseInt(name3.replace(/[^\d]/g, "")) / 8;
|
|
111
|
+
Object.defineProperty(this, fn, {
|
|
112
|
+
get: () => this.getValue(name3, increment)
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
get currentPosition() {
|
|
117
|
+
return this.start + this.offset;
|
|
118
|
+
}
|
|
119
|
+
set currentPosition(position) {
|
|
120
|
+
this.start = position;
|
|
121
|
+
this.offset = 0;
|
|
122
|
+
}
|
|
123
|
+
skip(n = 0, bits = 8) {
|
|
124
|
+
this.offset += n * bits / 8;
|
|
125
|
+
}
|
|
126
|
+
getValue(type, increment) {
|
|
127
|
+
let pos = this.start + this.offset;
|
|
128
|
+
this.offset += increment;
|
|
129
|
+
try {
|
|
130
|
+
return this.data[type](pos);
|
|
131
|
+
} catch (e) {
|
|
132
|
+
console.error(`parser`, type, increment, this);
|
|
133
|
+
console.error(`parser`, this.start, this.offset);
|
|
134
|
+
throw e;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
flags(n) {
|
|
138
|
+
if (n === 8 || n === 16 || n === 32 || n === 64) {
|
|
139
|
+
return this[`uint${n}`].toString(2).padStart(n, 0).split(``).map((v) => v === "1");
|
|
140
|
+
}
|
|
141
|
+
console.error(
|
|
142
|
+
`Error parsing flags: flag types can only be 1, 2, 4, or 8 bytes long`
|
|
143
|
+
);
|
|
144
|
+
console.trace();
|
|
145
|
+
}
|
|
146
|
+
get tag() {
|
|
147
|
+
const t = this.uint32;
|
|
148
|
+
return asText([
|
|
149
|
+
t >> 24 & 255,
|
|
150
|
+
t >> 16 & 255,
|
|
151
|
+
t >> 8 & 255,
|
|
152
|
+
t & 255
|
|
153
|
+
]);
|
|
154
|
+
}
|
|
155
|
+
get fixed() {
|
|
156
|
+
let major = this.int16;
|
|
157
|
+
let minor = Math.round(1e3 * this.uint16 / 65356);
|
|
158
|
+
return major + minor / 1e3;
|
|
159
|
+
}
|
|
160
|
+
get legacyFixed() {
|
|
161
|
+
let major = this.uint16;
|
|
162
|
+
let minor = this.uint16.toString(16).padStart(4, 0);
|
|
163
|
+
return parseFloat(`${major}.${minor}`);
|
|
164
|
+
}
|
|
165
|
+
get uint24() {
|
|
166
|
+
return (this.uint8 << 16) + (this.uint8 << 8) + this.uint8;
|
|
167
|
+
}
|
|
168
|
+
get uint128() {
|
|
169
|
+
let value = 0;
|
|
170
|
+
for (let i = 0; i < 5; i++) {
|
|
171
|
+
let byte = this.uint8;
|
|
172
|
+
value = value * 128 + (byte & 127);
|
|
173
|
+
if (byte < 128) break;
|
|
174
|
+
}
|
|
175
|
+
return value;
|
|
176
|
+
}
|
|
177
|
+
get longdatetime() {
|
|
178
|
+
return new Date(startDate + 1e3 * parseInt(this.int64.toString()));
|
|
179
|
+
}
|
|
180
|
+
get fword() {
|
|
181
|
+
return this.int16;
|
|
182
|
+
}
|
|
183
|
+
get ufword() {
|
|
184
|
+
return this.uint16;
|
|
185
|
+
}
|
|
186
|
+
get Offset16() {
|
|
187
|
+
return this.uint16;
|
|
188
|
+
}
|
|
189
|
+
get Offset32() {
|
|
190
|
+
return this.uint32;
|
|
191
|
+
}
|
|
192
|
+
get F2DOT14() {
|
|
193
|
+
const bits = p.uint16;
|
|
194
|
+
const integer = [0, 1, -2, -1][bits >> 14];
|
|
195
|
+
const fraction = bits & 16383;
|
|
196
|
+
return integer + fraction / 16384;
|
|
197
|
+
}
|
|
198
|
+
verifyLength() {
|
|
199
|
+
if (this.offset != this.length) {
|
|
200
|
+
console.error(
|
|
201
|
+
`unexpected parsed table size (${this.offset}) for "${this.name}" (expected ${this.length})`
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
readBytes(n = 0, position = 0, bits = 8, signed = false) {
|
|
206
|
+
n = n || this.length;
|
|
207
|
+
if (n === 0) return [];
|
|
208
|
+
if (position) this.currentPosition = position;
|
|
209
|
+
const fn = `${signed ? `` : `u`}int${bits}`, slice = [];
|
|
210
|
+
while (n--) slice.push(this[fn]);
|
|
211
|
+
return slice;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
class ParsedData {
|
|
215
|
+
constructor(parser) {
|
|
216
|
+
const pGetter = { enumerable: false, get: () => parser };
|
|
217
|
+
Object.defineProperty(this, `parser`, pGetter);
|
|
218
|
+
const start = parser.currentPosition;
|
|
219
|
+
const startGetter = { enumerable: false, get: () => start };
|
|
220
|
+
Object.defineProperty(this, `start`, startGetter);
|
|
221
|
+
}
|
|
222
|
+
load(struct) {
|
|
223
|
+
Object.keys(struct).forEach((p2) => {
|
|
224
|
+
let props = Object.getOwnPropertyDescriptor(struct, p2);
|
|
225
|
+
if (props.get) {
|
|
226
|
+
this[p2] = props.get.bind(this);
|
|
227
|
+
} else if (props.value !== void 0) {
|
|
228
|
+
this[p2] = props.value;
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
if (this.parser.length) {
|
|
232
|
+
this.parser.verifyLength();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
class SimpleTable extends ParsedData {
|
|
237
|
+
constructor(dict, dataview, name2) {
|
|
238
|
+
const { parser, start } = super(
|
|
239
|
+
new Parser(dict, dataview, name2)
|
|
240
|
+
);
|
|
241
|
+
const pGetter = { enumerable: false, get: () => parser };
|
|
242
|
+
Object.defineProperty(this, `p`, pGetter);
|
|
243
|
+
const startGetter = { enumerable: false, get: () => start };
|
|
244
|
+
Object.defineProperty(this, `tableStart`, startGetter);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
function lazy$1(object, property, getter) {
|
|
248
|
+
let val;
|
|
249
|
+
Object.defineProperty(object, property, {
|
|
250
|
+
get: () => {
|
|
251
|
+
if (val) return val;
|
|
252
|
+
val = getter();
|
|
253
|
+
return val;
|
|
254
|
+
},
|
|
255
|
+
enumerable: true
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
class SFNT extends SimpleTable {
|
|
259
|
+
constructor(font2, dataview, createTable2) {
|
|
260
|
+
const { p: p2 } = super({ offset: 0, length: 12 }, dataview, `sfnt`);
|
|
261
|
+
this.version = p2.uint32;
|
|
262
|
+
this.numTables = p2.uint16;
|
|
263
|
+
this.searchRange = p2.uint16;
|
|
264
|
+
this.entrySelector = p2.uint16;
|
|
265
|
+
this.rangeShift = p2.uint16;
|
|
266
|
+
p2.verifyLength();
|
|
267
|
+
this.directory = [...new Array(this.numTables)].map(
|
|
268
|
+
(_) => new TableRecord(p2)
|
|
269
|
+
);
|
|
270
|
+
this.tables = {};
|
|
271
|
+
this.directory.forEach((entry) => {
|
|
272
|
+
const getter = () => createTable2(
|
|
273
|
+
this.tables,
|
|
274
|
+
{
|
|
275
|
+
tag: entry.tag,
|
|
276
|
+
offset: entry.offset,
|
|
277
|
+
length: entry.length
|
|
278
|
+
},
|
|
279
|
+
dataview
|
|
280
|
+
);
|
|
281
|
+
lazy$1(this.tables, entry.tag.trim(), getter);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
class TableRecord {
|
|
286
|
+
constructor(p2) {
|
|
287
|
+
this.tag = p2.tag;
|
|
288
|
+
this.checksum = p2.uint32;
|
|
289
|
+
this.offset = p2.uint32;
|
|
290
|
+
this.length = p2.uint32;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const gzipDecode = import_inflate.default.inflate || void 0;
|
|
294
|
+
let nativeGzipDecode = void 0;
|
|
295
|
+
class WOFF$1 extends SimpleTable {
|
|
296
|
+
constructor(font2, dataview, createTable2) {
|
|
297
|
+
const { p: p2 } = super({ offset: 0, length: 44 }, dataview, `woff`);
|
|
298
|
+
this.signature = p2.tag;
|
|
299
|
+
this.flavor = p2.uint32;
|
|
300
|
+
this.length = p2.uint32;
|
|
301
|
+
this.numTables = p2.uint16;
|
|
302
|
+
p2.uint16;
|
|
303
|
+
this.totalSfntSize = p2.uint32;
|
|
304
|
+
this.majorVersion = p2.uint16;
|
|
305
|
+
this.minorVersion = p2.uint16;
|
|
306
|
+
this.metaOffset = p2.uint32;
|
|
307
|
+
this.metaLength = p2.uint32;
|
|
308
|
+
this.metaOrigLength = p2.uint32;
|
|
309
|
+
this.privOffset = p2.uint32;
|
|
310
|
+
this.privLength = p2.uint32;
|
|
311
|
+
p2.verifyLength();
|
|
312
|
+
this.directory = [...new Array(this.numTables)].map(
|
|
313
|
+
(_) => new WoffTableDirectoryEntry(p2)
|
|
314
|
+
);
|
|
315
|
+
buildWoffLazyLookups(this, dataview, createTable2);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
class WoffTableDirectoryEntry {
|
|
319
|
+
constructor(p2) {
|
|
320
|
+
this.tag = p2.tag;
|
|
321
|
+
this.offset = p2.uint32;
|
|
322
|
+
this.compLength = p2.uint32;
|
|
323
|
+
this.origLength = p2.uint32;
|
|
324
|
+
this.origChecksum = p2.uint32;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
function buildWoffLazyLookups(woff, dataview, createTable2) {
|
|
328
|
+
woff.tables = {};
|
|
329
|
+
woff.directory.forEach((entry) => {
|
|
330
|
+
lazy$1(woff.tables, entry.tag.trim(), () => {
|
|
331
|
+
let offset = 0;
|
|
332
|
+
let view = dataview;
|
|
333
|
+
if (entry.compLength !== entry.origLength) {
|
|
334
|
+
const data = dataview.buffer.slice(
|
|
335
|
+
entry.offset,
|
|
336
|
+
entry.offset + entry.compLength
|
|
337
|
+
);
|
|
338
|
+
let unpacked;
|
|
339
|
+
if (gzipDecode) {
|
|
340
|
+
unpacked = gzipDecode(new Uint8Array(data));
|
|
341
|
+
} else if (nativeGzipDecode) {
|
|
342
|
+
unpacked = nativeGzipDecode(new Uint8Array(data));
|
|
343
|
+
} else {
|
|
344
|
+
const msg = `no brotli decoder available to decode WOFF2 font`;
|
|
345
|
+
if (font.onerror) font.onerror(msg);
|
|
346
|
+
throw new Error(msg);
|
|
347
|
+
}
|
|
348
|
+
view = new DataView(unpacked.buffer);
|
|
349
|
+
} else {
|
|
350
|
+
offset = entry.offset;
|
|
351
|
+
}
|
|
352
|
+
return createTable2(
|
|
353
|
+
woff.tables,
|
|
354
|
+
{ tag: entry.tag, offset, length: entry.origLength },
|
|
355
|
+
view
|
|
356
|
+
);
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
const brotliDecode = import_unbrotli.default;
|
|
361
|
+
let nativeBrotliDecode = void 0;
|
|
362
|
+
class WOFF2$1 extends SimpleTable {
|
|
363
|
+
constructor(font2, dataview, createTable2) {
|
|
364
|
+
const { p: p2 } = super({ offset: 0, length: 48 }, dataview, `woff2`);
|
|
365
|
+
this.signature = p2.tag;
|
|
366
|
+
this.flavor = p2.uint32;
|
|
367
|
+
this.length = p2.uint32;
|
|
368
|
+
this.numTables = p2.uint16;
|
|
369
|
+
p2.uint16;
|
|
370
|
+
this.totalSfntSize = p2.uint32;
|
|
371
|
+
this.totalCompressedSize = p2.uint32;
|
|
372
|
+
this.majorVersion = p2.uint16;
|
|
373
|
+
this.minorVersion = p2.uint16;
|
|
374
|
+
this.metaOffset = p2.uint32;
|
|
375
|
+
this.metaLength = p2.uint32;
|
|
376
|
+
this.metaOrigLength = p2.uint32;
|
|
377
|
+
this.privOffset = p2.uint32;
|
|
378
|
+
this.privLength = p2.uint32;
|
|
379
|
+
p2.verifyLength();
|
|
380
|
+
this.directory = [...new Array(this.numTables)].map(
|
|
381
|
+
(_) => new Woff2TableDirectoryEntry(p2)
|
|
382
|
+
);
|
|
383
|
+
let dictOffset = p2.currentPosition;
|
|
384
|
+
this.directory[0].offset = 0;
|
|
385
|
+
this.directory.forEach((e, i) => {
|
|
386
|
+
let next = this.directory[i + 1];
|
|
387
|
+
if (next) {
|
|
388
|
+
next.offset = e.offset + (e.transformLength !== void 0 ? e.transformLength : e.origLength);
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
let decoded;
|
|
392
|
+
let buffer = dataview.buffer.slice(dictOffset);
|
|
393
|
+
if (brotliDecode) {
|
|
394
|
+
decoded = brotliDecode(new Uint8Array(buffer));
|
|
395
|
+
} else if (nativeBrotliDecode) {
|
|
396
|
+
decoded = new Uint8Array(nativeBrotliDecode(buffer));
|
|
397
|
+
} else {
|
|
398
|
+
const msg = `no brotli decoder available to decode WOFF2 font`;
|
|
399
|
+
if (font2.onerror) font2.onerror(msg);
|
|
400
|
+
throw new Error(msg);
|
|
401
|
+
}
|
|
402
|
+
buildWoff2LazyLookups(this, decoded, createTable2);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
class Woff2TableDirectoryEntry {
|
|
406
|
+
constructor(p2) {
|
|
407
|
+
this.flags = p2.uint8;
|
|
408
|
+
const tagNumber = this.tagNumber = this.flags & 63;
|
|
409
|
+
if (tagNumber === 63) {
|
|
410
|
+
this.tag = p2.tag;
|
|
411
|
+
} else {
|
|
412
|
+
this.tag = getWOFF2Tag(tagNumber);
|
|
413
|
+
}
|
|
414
|
+
const transformVersion = this.transformVersion = (this.flags & 192) >> 6;
|
|
415
|
+
let hasTransforms = transformVersion !== 0;
|
|
416
|
+
if (this.tag === `glyf` || this.tag === `loca`) {
|
|
417
|
+
hasTransforms = this.transformVersion !== 3;
|
|
418
|
+
}
|
|
419
|
+
this.origLength = p2.uint128;
|
|
420
|
+
if (hasTransforms) {
|
|
421
|
+
this.transformLength = p2.uint128;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
function buildWoff2LazyLookups(woff2, decoded, createTable2) {
|
|
426
|
+
woff2.tables = {};
|
|
427
|
+
woff2.directory.forEach((entry) => {
|
|
428
|
+
lazy$1(woff2.tables, entry.tag.trim(), () => {
|
|
429
|
+
const start = entry.offset;
|
|
430
|
+
const end = start + (entry.transformLength ? entry.transformLength : entry.origLength);
|
|
431
|
+
const data = new DataView(decoded.slice(start, end).buffer);
|
|
432
|
+
try {
|
|
433
|
+
return createTable2(
|
|
434
|
+
woff2.tables,
|
|
435
|
+
{ tag: entry.tag, offset: 0, length: entry.origLength },
|
|
436
|
+
data
|
|
437
|
+
);
|
|
438
|
+
} catch (e) {
|
|
439
|
+
console.error(e);
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
function getWOFF2Tag(flag) {
|
|
445
|
+
return [
|
|
446
|
+
`cmap`,
|
|
447
|
+
`head`,
|
|
448
|
+
`hhea`,
|
|
449
|
+
`hmtx`,
|
|
450
|
+
`maxp`,
|
|
451
|
+
`name`,
|
|
452
|
+
`OS/2`,
|
|
453
|
+
`post`,
|
|
454
|
+
`cvt `,
|
|
455
|
+
`fpgm`,
|
|
456
|
+
`glyf`,
|
|
457
|
+
`loca`,
|
|
458
|
+
`prep`,
|
|
459
|
+
`CFF `,
|
|
460
|
+
`VORG`,
|
|
461
|
+
`EBDT`,
|
|
462
|
+
`EBLC`,
|
|
463
|
+
`gasp`,
|
|
464
|
+
`hdmx`,
|
|
465
|
+
`kern`,
|
|
466
|
+
`LTSH`,
|
|
467
|
+
`PCLT`,
|
|
468
|
+
`VDMX`,
|
|
469
|
+
`vhea`,
|
|
470
|
+
`vmtx`,
|
|
471
|
+
`BASE`,
|
|
472
|
+
`GDEF`,
|
|
473
|
+
`GPOS`,
|
|
474
|
+
`GSUB`,
|
|
475
|
+
`EBSC`,
|
|
476
|
+
`JSTF`,
|
|
477
|
+
`MATH`,
|
|
478
|
+
`CBDT`,
|
|
479
|
+
`CBLC`,
|
|
480
|
+
`COLR`,
|
|
481
|
+
`CPAL`,
|
|
482
|
+
`SVG `,
|
|
483
|
+
`sbix`,
|
|
484
|
+
`acnt`,
|
|
485
|
+
`avar`,
|
|
486
|
+
`bdat`,
|
|
487
|
+
`bloc`,
|
|
488
|
+
`bsln`,
|
|
489
|
+
`cvar`,
|
|
490
|
+
`fdsc`,
|
|
491
|
+
`feat`,
|
|
492
|
+
`fmtx`,
|
|
493
|
+
`fvar`,
|
|
494
|
+
`gvar`,
|
|
495
|
+
`hsty`,
|
|
496
|
+
`just`,
|
|
497
|
+
`lcar`,
|
|
498
|
+
`mort`,
|
|
499
|
+
`morx`,
|
|
500
|
+
`opbd`,
|
|
501
|
+
`prop`,
|
|
502
|
+
`trak`,
|
|
503
|
+
`Zapf`,
|
|
504
|
+
`Silf`,
|
|
505
|
+
`Glat`,
|
|
506
|
+
`Gloc`,
|
|
507
|
+
`Feat`,
|
|
508
|
+
`Sill`
|
|
509
|
+
][flag & 63];
|
|
510
|
+
}
|
|
511
|
+
const tableClasses = {};
|
|
512
|
+
let tableClassesLoaded = false;
|
|
513
|
+
Promise.all([
|
|
514
|
+
Promise.resolve().then(function() {
|
|
515
|
+
return cmap$1;
|
|
516
|
+
}),
|
|
517
|
+
Promise.resolve().then(function() {
|
|
518
|
+
return head$1;
|
|
519
|
+
}),
|
|
520
|
+
Promise.resolve().then(function() {
|
|
521
|
+
return hhea$1;
|
|
522
|
+
}),
|
|
523
|
+
Promise.resolve().then(function() {
|
|
524
|
+
return hmtx$1;
|
|
525
|
+
}),
|
|
526
|
+
Promise.resolve().then(function() {
|
|
527
|
+
return maxp$1;
|
|
528
|
+
}),
|
|
529
|
+
Promise.resolve().then(function() {
|
|
530
|
+
return name$1;
|
|
531
|
+
}),
|
|
532
|
+
Promise.resolve().then(function() {
|
|
533
|
+
return OS2$1;
|
|
534
|
+
}),
|
|
535
|
+
Promise.resolve().then(function() {
|
|
536
|
+
return post$1;
|
|
537
|
+
}),
|
|
538
|
+
Promise.resolve().then(function() {
|
|
539
|
+
return BASE$1;
|
|
540
|
+
}),
|
|
541
|
+
Promise.resolve().then(function() {
|
|
542
|
+
return GDEF$1;
|
|
543
|
+
}),
|
|
544
|
+
Promise.resolve().then(function() {
|
|
545
|
+
return GSUB$1;
|
|
546
|
+
}),
|
|
547
|
+
Promise.resolve().then(function() {
|
|
548
|
+
return GPOS$1;
|
|
549
|
+
}),
|
|
550
|
+
Promise.resolve().then(function() {
|
|
551
|
+
return SVG$1;
|
|
552
|
+
}),
|
|
553
|
+
Promise.resolve().then(function() {
|
|
554
|
+
return fvar$1;
|
|
555
|
+
}),
|
|
556
|
+
Promise.resolve().then(function() {
|
|
557
|
+
return cvt$1;
|
|
558
|
+
}),
|
|
559
|
+
Promise.resolve().then(function() {
|
|
560
|
+
return fpgm$1;
|
|
561
|
+
}),
|
|
562
|
+
Promise.resolve().then(function() {
|
|
563
|
+
return gasp$1;
|
|
564
|
+
}),
|
|
565
|
+
Promise.resolve().then(function() {
|
|
566
|
+
return glyf$1;
|
|
567
|
+
}),
|
|
568
|
+
Promise.resolve().then(function() {
|
|
569
|
+
return loca$1;
|
|
570
|
+
}),
|
|
571
|
+
Promise.resolve().then(function() {
|
|
572
|
+
return prep$1;
|
|
573
|
+
}),
|
|
574
|
+
Promise.resolve().then(function() {
|
|
575
|
+
return CFF$1;
|
|
576
|
+
}),
|
|
577
|
+
Promise.resolve().then(function() {
|
|
578
|
+
return CFF2$1;
|
|
579
|
+
}),
|
|
580
|
+
Promise.resolve().then(function() {
|
|
581
|
+
return VORG$1;
|
|
582
|
+
}),
|
|
583
|
+
Promise.resolve().then(function() {
|
|
584
|
+
return EBLC$1;
|
|
585
|
+
}),
|
|
586
|
+
Promise.resolve().then(function() {
|
|
587
|
+
return EBDT$1;
|
|
588
|
+
}),
|
|
589
|
+
Promise.resolve().then(function() {
|
|
590
|
+
return EBSC$1;
|
|
591
|
+
}),
|
|
592
|
+
Promise.resolve().then(function() {
|
|
593
|
+
return CBLC$1;
|
|
594
|
+
}),
|
|
595
|
+
Promise.resolve().then(function() {
|
|
596
|
+
return CBDT$1;
|
|
597
|
+
}),
|
|
598
|
+
Promise.resolve().then(function() {
|
|
599
|
+
return sbix$1;
|
|
600
|
+
}),
|
|
601
|
+
Promise.resolve().then(function() {
|
|
602
|
+
return COLR$1;
|
|
603
|
+
}),
|
|
604
|
+
Promise.resolve().then(function() {
|
|
605
|
+
return CPAL$1;
|
|
606
|
+
}),
|
|
607
|
+
Promise.resolve().then(function() {
|
|
608
|
+
return DSIG$1;
|
|
609
|
+
}),
|
|
610
|
+
Promise.resolve().then(function() {
|
|
611
|
+
return hdmx$1;
|
|
612
|
+
}),
|
|
613
|
+
Promise.resolve().then(function() {
|
|
614
|
+
return kern$1;
|
|
615
|
+
}),
|
|
616
|
+
Promise.resolve().then(function() {
|
|
617
|
+
return LTSH$1;
|
|
618
|
+
}),
|
|
619
|
+
Promise.resolve().then(function() {
|
|
620
|
+
return MERG$1;
|
|
621
|
+
}),
|
|
622
|
+
Promise.resolve().then(function() {
|
|
623
|
+
return meta$1;
|
|
624
|
+
}),
|
|
625
|
+
Promise.resolve().then(function() {
|
|
626
|
+
return PCLT$1;
|
|
627
|
+
}),
|
|
628
|
+
Promise.resolve().then(function() {
|
|
629
|
+
return VDMX$1;
|
|
630
|
+
}),
|
|
631
|
+
Promise.resolve().then(function() {
|
|
632
|
+
return vhea$1;
|
|
633
|
+
}),
|
|
634
|
+
Promise.resolve().then(function() {
|
|
635
|
+
return vmtx$1;
|
|
636
|
+
})
|
|
637
|
+
]).then((data) => {
|
|
638
|
+
data.forEach((e) => {
|
|
639
|
+
let name2 = Object.keys(e)[0];
|
|
640
|
+
tableClasses[name2] = e[name2];
|
|
641
|
+
});
|
|
642
|
+
tableClassesLoaded = true;
|
|
643
|
+
});
|
|
644
|
+
function createTable(tables, dict, dataview) {
|
|
645
|
+
let name2 = dict.tag.replace(/[^\w\d]/g, ``);
|
|
646
|
+
let Type = tableClasses[name2];
|
|
647
|
+
if (Type) return new Type(dict, dataview, tables);
|
|
648
|
+
console.warn(
|
|
649
|
+
`lib-font has no definition for ${name2}. The table was skipped.`
|
|
650
|
+
);
|
|
651
|
+
return {};
|
|
652
|
+
}
|
|
653
|
+
function loadTableClasses() {
|
|
654
|
+
let count = 0;
|
|
655
|
+
function checkLoaded(resolve, reject) {
|
|
656
|
+
if (!tableClassesLoaded) {
|
|
657
|
+
if (count > 10) {
|
|
658
|
+
return reject(new Error(`loading took too long`));
|
|
659
|
+
}
|
|
660
|
+
count++;
|
|
661
|
+
return setTimeout(() => checkLoaded(resolve), 250);
|
|
662
|
+
}
|
|
663
|
+
resolve(createTable);
|
|
664
|
+
}
|
|
665
|
+
return new Promise((resolve, reject) => checkLoaded(resolve));
|
|
666
|
+
}
|
|
667
|
+
function getFontCSSFormat(path, errorOnStyle) {
|
|
668
|
+
let pos = path.lastIndexOf(`.`);
|
|
669
|
+
let ext = (path.substring(pos + 1) || ``).toLowerCase();
|
|
670
|
+
let format = {
|
|
671
|
+
ttf: `truetype`,
|
|
672
|
+
otf: `opentype`,
|
|
673
|
+
woff: `woff`,
|
|
674
|
+
woff2: `woff2`
|
|
675
|
+
}[ext];
|
|
676
|
+
if (format) return format;
|
|
677
|
+
let msg = {
|
|
678
|
+
eot: `The .eot format is not supported: it died in January 12, 2016, when Microsoft retired all versions of IE that didn't already support WOFF.`,
|
|
679
|
+
svg: `The .svg format is not supported: SVG fonts (not to be confused with OpenType with embedded SVG) were so bad we took the entire fonts chapter out of the SVG specification again.`,
|
|
680
|
+
fon: `The .fon format is not supported: this is an ancient Windows bitmap font format.`,
|
|
681
|
+
ttc: `Based on the current CSS specification, font collections are not (yet?) supported.`
|
|
682
|
+
}[ext];
|
|
683
|
+
if (!msg) msg = `${path} is not a known webfont format.`;
|
|
684
|
+
if (errorOnStyle) {
|
|
685
|
+
throw new Error(msg);
|
|
686
|
+
} else {
|
|
687
|
+
console.warn(`Could not load font: ${msg}`);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
async function setupFontFace(name2, url, options = {}) {
|
|
691
|
+
if (!globalThis.document) return;
|
|
692
|
+
let format = getFontCSSFormat(url, options.errorOnStyle);
|
|
693
|
+
if (!format) return;
|
|
694
|
+
let style = document.createElement(`style`);
|
|
695
|
+
style.className = `injected-by-Font-js`;
|
|
696
|
+
let rules = [];
|
|
697
|
+
if (options.styleRules) {
|
|
698
|
+
rules = Object.entries(options.styleRules).map(
|
|
699
|
+
([key, value]) => `${key}: ${value};`
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
style.textContent = `
|
|
703
|
+
@font-face {
|
|
704
|
+
font-family: "${name2}";
|
|
705
|
+
${rules.join(
|
|
706
|
+
`
|
|
707
|
+
`
|
|
708
|
+
)}
|
|
709
|
+
src: url("${url}") format("${format}");
|
|
710
|
+
}`;
|
|
711
|
+
globalThis.document.head.appendChild(style);
|
|
712
|
+
return style;
|
|
713
|
+
}
|
|
714
|
+
const TTF = [0, 1, 0, 0];
|
|
715
|
+
const OTF = [79, 84, 84, 79];
|
|
716
|
+
const WOFF = [119, 79, 70, 70];
|
|
717
|
+
const WOFF2 = [119, 79, 70, 50];
|
|
718
|
+
function match(ar1, ar2) {
|
|
719
|
+
if (ar1.length !== ar2.length) return;
|
|
720
|
+
for (let i = 0; i < ar1.length; i++) {
|
|
721
|
+
if (ar1[i] !== ar2[i]) return;
|
|
722
|
+
}
|
|
723
|
+
return true;
|
|
724
|
+
}
|
|
725
|
+
function validFontFormat(dataview) {
|
|
726
|
+
const LEAD_BYTES = [
|
|
727
|
+
dataview.getUint8(0),
|
|
728
|
+
dataview.getUint8(1),
|
|
729
|
+
dataview.getUint8(2),
|
|
730
|
+
dataview.getUint8(3)
|
|
731
|
+
];
|
|
732
|
+
if (match(LEAD_BYTES, TTF) || match(LEAD_BYTES, OTF)) return `SFNT`;
|
|
733
|
+
if (match(LEAD_BYTES, WOFF)) return `WOFF`;
|
|
734
|
+
if (match(LEAD_BYTES, WOFF2)) return `WOFF2`;
|
|
735
|
+
}
|
|
736
|
+
function checkFetchResponseStatus(response) {
|
|
737
|
+
if (!response.ok) {
|
|
738
|
+
throw new Error(
|
|
739
|
+
`HTTP ${response.status} - ${response.statusText}`
|
|
740
|
+
);
|
|
741
|
+
}
|
|
742
|
+
return response;
|
|
743
|
+
}
|
|
744
|
+
class Font extends EventManager {
|
|
745
|
+
constructor(name2, options = {}) {
|
|
746
|
+
super();
|
|
747
|
+
this.name = name2;
|
|
748
|
+
this.options = options;
|
|
749
|
+
this.metrics = false;
|
|
750
|
+
}
|
|
751
|
+
get src() {
|
|
752
|
+
return this.__src;
|
|
753
|
+
}
|
|
754
|
+
set src(src) {
|
|
755
|
+
this.__src = src;
|
|
756
|
+
(async () => {
|
|
757
|
+
if (globalThis.document && !this.options.skipStyleSheet) {
|
|
758
|
+
await setupFontFace(this.name, src, this.options);
|
|
759
|
+
}
|
|
760
|
+
this.loadFont(src);
|
|
761
|
+
})();
|
|
762
|
+
}
|
|
763
|
+
async loadFont(url, filename) {
|
|
764
|
+
fetch(url).then(
|
|
765
|
+
(response) => checkFetchResponseStatus(response) && response.arrayBuffer()
|
|
766
|
+
).then(
|
|
767
|
+
(buffer) => this.fromDataBuffer(buffer, filename || url)
|
|
768
|
+
).catch((err) => {
|
|
769
|
+
const evt = new Event(
|
|
770
|
+
`error`,
|
|
771
|
+
err,
|
|
772
|
+
`Failed to load font at ${filename || url}`
|
|
773
|
+
);
|
|
774
|
+
this.dispatch(evt);
|
|
775
|
+
if (this.onerror) this.onerror(evt);
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
async fromDataBuffer(buffer, filenameOrUrL) {
|
|
779
|
+
this.fontData = new DataView(buffer);
|
|
780
|
+
let type = validFontFormat(this.fontData);
|
|
781
|
+
if (!type) {
|
|
782
|
+
throw new Error(
|
|
783
|
+
`${filenameOrUrL} is either an unsupported font format, or not a font at all.`
|
|
784
|
+
);
|
|
785
|
+
}
|
|
786
|
+
await this.parseBasicData(type);
|
|
787
|
+
const evt = new Event("load", { font: this });
|
|
788
|
+
this.dispatch(evt);
|
|
789
|
+
if (this.onload) this.onload(evt);
|
|
790
|
+
}
|
|
791
|
+
async parseBasicData(type) {
|
|
792
|
+
return loadTableClasses().then((createTable2) => {
|
|
793
|
+
if (type === `SFNT`) {
|
|
794
|
+
this.opentype = new SFNT(this, this.fontData, createTable2);
|
|
795
|
+
}
|
|
796
|
+
if (type === `WOFF`) {
|
|
797
|
+
this.opentype = new WOFF$1(this, this.fontData, createTable2);
|
|
798
|
+
}
|
|
799
|
+
if (type === `WOFF2`) {
|
|
800
|
+
this.opentype = new WOFF2$1(this, this.fontData, createTable2);
|
|
801
|
+
}
|
|
802
|
+
return this.opentype;
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
getGlyphId(char) {
|
|
806
|
+
return this.opentype.tables.cmap.getGlyphId(char);
|
|
807
|
+
}
|
|
808
|
+
reverse(glyphid) {
|
|
809
|
+
return this.opentype.tables.cmap.reverse(glyphid);
|
|
810
|
+
}
|
|
811
|
+
supports(char) {
|
|
812
|
+
return this.getGlyphId(char) !== 0;
|
|
813
|
+
}
|
|
814
|
+
supportsVariation(variation) {
|
|
815
|
+
return this.opentype.tables.cmap.supportsVariation(variation) !== false;
|
|
816
|
+
}
|
|
817
|
+
measureText(text, size = 16) {
|
|
818
|
+
if (this.__unloaded)
|
|
819
|
+
throw new Error(
|
|
820
|
+
"Cannot measure text: font was unloaded. Please reload before calling measureText()"
|
|
821
|
+
);
|
|
822
|
+
let d = document.createElement("div");
|
|
823
|
+
d.textContent = text;
|
|
824
|
+
d.style.fontFamily = this.name;
|
|
825
|
+
d.style.fontSize = `${size}px`;
|
|
826
|
+
d.style.color = `transparent`;
|
|
827
|
+
d.style.background = `transparent`;
|
|
828
|
+
d.style.top = `0`;
|
|
829
|
+
d.style.left = `0`;
|
|
830
|
+
d.style.position = `absolute`;
|
|
831
|
+
document.body.appendChild(d);
|
|
832
|
+
let bbox = d.getBoundingClientRect();
|
|
833
|
+
document.body.removeChild(d);
|
|
834
|
+
const OS22 = this.opentype.tables["OS/2"];
|
|
835
|
+
bbox.fontSize = size;
|
|
836
|
+
bbox.ascender = OS22.sTypoAscender;
|
|
837
|
+
bbox.descender = OS22.sTypoDescender;
|
|
838
|
+
return bbox;
|
|
839
|
+
}
|
|
840
|
+
unload() {
|
|
841
|
+
if (this.styleElement.parentNode) {
|
|
842
|
+
this.styleElement.parentNode.removeElement(this.styleElement);
|
|
843
|
+
const evt = new Event("unload", { font: this });
|
|
844
|
+
this.dispatch(evt);
|
|
845
|
+
if (this.onunload) this.onunload(evt);
|
|
846
|
+
}
|
|
847
|
+
this._unloaded = true;
|
|
848
|
+
}
|
|
849
|
+
load() {
|
|
850
|
+
if (this.__unloaded) {
|
|
851
|
+
delete this.__unloaded;
|
|
852
|
+
document.head.appendChild(this.styleElement);
|
|
853
|
+
const evt = new Event("load", { font: this });
|
|
854
|
+
this.dispatch(evt);
|
|
855
|
+
if (this.onload) this.onload(evt);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
globalThis.Font = Font;
|
|
860
|
+
class Subtable extends ParsedData {
|
|
861
|
+
constructor(p2, plaformID, encodingID) {
|
|
862
|
+
super(p2);
|
|
863
|
+
this.plaformID = plaformID;
|
|
864
|
+
this.encodingID = encodingID;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
class Format0 extends Subtable {
|
|
868
|
+
constructor(p2, platformID, encodingID) {
|
|
869
|
+
super(p2, platformID, encodingID);
|
|
870
|
+
this.format = 0;
|
|
871
|
+
this.length = p2.uint16;
|
|
872
|
+
this.language = p2.uint16;
|
|
873
|
+
this.glyphIdArray = [...new Array(256)].map((_) => p2.uint8);
|
|
874
|
+
}
|
|
875
|
+
supports(charCode) {
|
|
876
|
+
if (charCode.charCodeAt) {
|
|
877
|
+
charCode = -1;
|
|
878
|
+
console.warn(
|
|
879
|
+
`supports(character) not implemented for cmap subtable format 0. only supports(id) is implemented.`
|
|
880
|
+
);
|
|
881
|
+
}
|
|
882
|
+
return 0 <= charCode && charCode <= 255;
|
|
883
|
+
}
|
|
884
|
+
reverse(glyphID) {
|
|
885
|
+
console.warn(`reverse not implemented for cmap subtable format 0`);
|
|
886
|
+
return {};
|
|
887
|
+
}
|
|
888
|
+
getSupportedCharCodes() {
|
|
889
|
+
return [{ start: 1, end: 256 }];
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
class Format2 extends Subtable {
|
|
893
|
+
constructor(p2, platformID, encodingID) {
|
|
894
|
+
super(p2, platformID, encodingID);
|
|
895
|
+
this.format = 2;
|
|
896
|
+
this.length = p2.uint16;
|
|
897
|
+
this.language = p2.uint16;
|
|
898
|
+
this.subHeaderKeys = [...new Array(256)].map((_) => p2.uint16);
|
|
899
|
+
const subHeaderCount = Math.max(...this.subHeaderKeys);
|
|
900
|
+
const subHeaderOffset = p2.currentPosition;
|
|
901
|
+
lazy$1(this, `subHeaders`, () => {
|
|
902
|
+
p2.currentPosition = subHeaderOffset;
|
|
903
|
+
return [...new Array(subHeaderCount)].map(
|
|
904
|
+
(_) => new SubHeader(p2)
|
|
905
|
+
);
|
|
906
|
+
});
|
|
907
|
+
const glyphIndexOffset = subHeaderOffset + subHeaderCount * 8;
|
|
908
|
+
lazy$1(this, `glyphIndexArray`, () => {
|
|
909
|
+
p2.currentPosition = glyphIndexOffset;
|
|
910
|
+
return [...new Array(subHeaderCount)].map((_) => p2.uint16);
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
supports(charCode) {
|
|
914
|
+
if (charCode.charCodeAt) {
|
|
915
|
+
charCode = -1;
|
|
916
|
+
console.warn(
|
|
917
|
+
`supports(character) not implemented for cmap subtable format 2. only supports(id) is implemented.`
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
const low = charCode && 255;
|
|
921
|
+
const high = charCode && 65280;
|
|
922
|
+
const subHeaderKey = this.subHeaders[high];
|
|
923
|
+
const subheader = this.subHeaders[subHeaderKey];
|
|
924
|
+
const first = subheader.firstCode;
|
|
925
|
+
const last = first + subheader.entryCount;
|
|
926
|
+
return first <= low && low <= last;
|
|
927
|
+
}
|
|
928
|
+
reverse(glyphID) {
|
|
929
|
+
console.warn(`reverse not implemented for cmap subtable format 2`);
|
|
930
|
+
return {};
|
|
931
|
+
}
|
|
932
|
+
getSupportedCharCodes(preservePropNames = false) {
|
|
933
|
+
if (preservePropNames) {
|
|
934
|
+
return this.subHeaders.map((h) => ({
|
|
935
|
+
firstCode: h.firstCode,
|
|
936
|
+
lastCode: h.lastCode
|
|
937
|
+
}));
|
|
938
|
+
}
|
|
939
|
+
return this.subHeaders.map((h) => ({
|
|
940
|
+
start: h.firstCode,
|
|
941
|
+
end: h.lastCode
|
|
942
|
+
}));
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
class SubHeader {
|
|
946
|
+
constructor(p2) {
|
|
947
|
+
this.firstCode = p2.uint16;
|
|
948
|
+
this.entryCount = p2.uint16;
|
|
949
|
+
this.lastCode = this.first + this.entryCount;
|
|
950
|
+
this.idDelta = p2.int16;
|
|
951
|
+
this.idRangeOffset = p2.uint16;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
class Format4 extends Subtable {
|
|
955
|
+
constructor(p2, platformID, encodingID) {
|
|
956
|
+
super(p2, platformID, encodingID);
|
|
957
|
+
this.format = 4;
|
|
958
|
+
this.length = p2.uint16;
|
|
959
|
+
this.language = p2.uint16;
|
|
960
|
+
this.segCountX2 = p2.uint16;
|
|
961
|
+
this.segCount = this.segCountX2 / 2;
|
|
962
|
+
this.searchRange = p2.uint16;
|
|
963
|
+
this.entrySelector = p2.uint16;
|
|
964
|
+
this.rangeShift = p2.uint16;
|
|
965
|
+
const endCodePosition = p2.currentPosition;
|
|
966
|
+
lazy$1(
|
|
967
|
+
this,
|
|
968
|
+
`endCode`,
|
|
969
|
+
() => p2.readBytes(this.segCount, endCodePosition, 16)
|
|
970
|
+
);
|
|
971
|
+
const startCodePosition = endCodePosition + 2 + this.segCountX2;
|
|
972
|
+
lazy$1(
|
|
973
|
+
this,
|
|
974
|
+
`startCode`,
|
|
975
|
+
() => p2.readBytes(this.segCount, startCodePosition, 16)
|
|
976
|
+
);
|
|
977
|
+
const idDeltaPosition = startCodePosition + this.segCountX2;
|
|
978
|
+
lazy$1(
|
|
979
|
+
this,
|
|
980
|
+
`idDelta`,
|
|
981
|
+
() => p2.readBytes(this.segCount, idDeltaPosition, 16, true)
|
|
982
|
+
);
|
|
983
|
+
const idRangePosition = idDeltaPosition + this.segCountX2;
|
|
984
|
+
lazy$1(
|
|
985
|
+
this,
|
|
986
|
+
`idRangeOffset`,
|
|
987
|
+
() => p2.readBytes(this.segCount, idRangePosition, 16)
|
|
988
|
+
);
|
|
989
|
+
const glyphIdArrayPosition = idRangePosition + this.segCountX2;
|
|
990
|
+
const glyphIdArrayLength = this.length - (glyphIdArrayPosition - this.tableStart);
|
|
991
|
+
lazy$1(
|
|
992
|
+
this,
|
|
993
|
+
`glyphIdArray`,
|
|
994
|
+
() => p2.readBytes(glyphIdArrayLength, glyphIdArrayPosition, 16)
|
|
995
|
+
);
|
|
996
|
+
lazy$1(
|
|
997
|
+
this,
|
|
998
|
+
`segments`,
|
|
999
|
+
() => this.buildSegments(idRangePosition, glyphIdArrayPosition, p2)
|
|
1000
|
+
);
|
|
1001
|
+
}
|
|
1002
|
+
buildSegments(idRangePosition, glyphIdArrayPosition, p2) {
|
|
1003
|
+
const build = (_, i) => {
|
|
1004
|
+
let startCode = this.startCode[i], endCode = this.endCode[i], idDelta = this.idDelta[i], idRangeOffset = this.idRangeOffset[i], idRangeOffsetPointer = idRangePosition + 2 * i, glyphIDs = [];
|
|
1005
|
+
if (idRangeOffset === 0) {
|
|
1006
|
+
for (let i2 = startCode + idDelta, e = endCode + idDelta; i2 <= e; i2++) {
|
|
1007
|
+
glyphIDs.push(i2);
|
|
1008
|
+
}
|
|
1009
|
+
} else {
|
|
1010
|
+
for (let i2 = 0, e = endCode - startCode; i2 <= e; i2++) {
|
|
1011
|
+
p2.currentPosition = idRangeOffsetPointer + idRangeOffset + i2 * 2;
|
|
1012
|
+
glyphIDs.push(p2.uint16);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
return {
|
|
1016
|
+
startCode,
|
|
1017
|
+
endCode,
|
|
1018
|
+
idDelta,
|
|
1019
|
+
idRangeOffset,
|
|
1020
|
+
glyphIDs
|
|
1021
|
+
};
|
|
1022
|
+
};
|
|
1023
|
+
return [...new Array(this.segCount)].map(build);
|
|
1024
|
+
}
|
|
1025
|
+
reverse(glyphID) {
|
|
1026
|
+
let s = this.segments.find((v) => v.glyphIDs.includes(glyphID));
|
|
1027
|
+
if (!s) return {};
|
|
1028
|
+
const code = s.startCode + s.glyphIDs.indexOf(glyphID);
|
|
1029
|
+
return { code, unicode: String.fromCodePoint(code) };
|
|
1030
|
+
}
|
|
1031
|
+
getGlyphId(charCode) {
|
|
1032
|
+
if (charCode.charCodeAt) charCode = charCode.charCodeAt(0);
|
|
1033
|
+
if (55296 <= charCode && charCode <= 57343) return 0;
|
|
1034
|
+
if ((charCode & 65534) === 65534 || (charCode & 65535) === 65535)
|
|
1035
|
+
return 0;
|
|
1036
|
+
let segment = this.segments.find(
|
|
1037
|
+
(s) => s.startCode <= charCode && charCode <= s.endCode
|
|
1038
|
+
);
|
|
1039
|
+
if (!segment) return 0;
|
|
1040
|
+
return segment.glyphIDs[charCode - segment.startCode];
|
|
1041
|
+
}
|
|
1042
|
+
supports(charCode) {
|
|
1043
|
+
return this.getGlyphId(charCode) !== 0;
|
|
1044
|
+
}
|
|
1045
|
+
getSupportedCharCodes(preservePropNames = false) {
|
|
1046
|
+
if (preservePropNames) return this.segments;
|
|
1047
|
+
return this.segments.map((v) => ({
|
|
1048
|
+
start: v.startCode,
|
|
1049
|
+
end: v.endCode
|
|
1050
|
+
}));
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
class Format6 extends Subtable {
|
|
1054
|
+
constructor(p2, platformID, encodingID) {
|
|
1055
|
+
super(p2, platformID, encodingID);
|
|
1056
|
+
this.format = 6;
|
|
1057
|
+
this.length = p2.uint16;
|
|
1058
|
+
this.language = p2.uint16;
|
|
1059
|
+
this.firstCode = p2.uint16;
|
|
1060
|
+
this.entryCount = p2.uint16;
|
|
1061
|
+
this.lastCode = this.firstCode + this.entryCount - 1;
|
|
1062
|
+
const getter = () => [...new Array(this.entryCount)].map((_) => p2.uint16);
|
|
1063
|
+
lazy$1(this, `glyphIdArray`, getter);
|
|
1064
|
+
}
|
|
1065
|
+
supports(charCode) {
|
|
1066
|
+
if (charCode.charCodeAt) {
|
|
1067
|
+
charCode = -1;
|
|
1068
|
+
console.warn(
|
|
1069
|
+
`supports(character) not implemented for cmap subtable format 6. only supports(id) is implemented.`
|
|
1070
|
+
);
|
|
1071
|
+
}
|
|
1072
|
+
if (charCode < this.firstCode) return {};
|
|
1073
|
+
if (charCode > this.firstCode + this.entryCount) return {};
|
|
1074
|
+
const code = charCode - this.firstCode;
|
|
1075
|
+
return { code, unicode: String.fromCodePoint(code) };
|
|
1076
|
+
}
|
|
1077
|
+
reverse(glyphID) {
|
|
1078
|
+
let pos = this.glyphIdArray.indexOf(glyphID);
|
|
1079
|
+
if (pos > -1) return this.firstCode + pos;
|
|
1080
|
+
}
|
|
1081
|
+
getSupportedCharCodes(preservePropNames = false) {
|
|
1082
|
+
if (preservePropNames) {
|
|
1083
|
+
return [{ firstCode: this.firstCode, lastCode: this.lastCode }];
|
|
1084
|
+
}
|
|
1085
|
+
return [{ start: this.firstCode, end: this.lastCode }];
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
class Format8 extends Subtable {
|
|
1089
|
+
constructor(p2, platformID, encodingID) {
|
|
1090
|
+
super(p2, platformID, encodingID);
|
|
1091
|
+
this.format = 8;
|
|
1092
|
+
p2.uint16;
|
|
1093
|
+
this.length = p2.uint32;
|
|
1094
|
+
this.language = p2.uint32;
|
|
1095
|
+
this.is32 = [...new Array(8192)].map((_) => p2.uint8);
|
|
1096
|
+
this.numGroups = p2.uint32;
|
|
1097
|
+
const getter = () => [...new Array(this.numGroups)].map(
|
|
1098
|
+
(_) => new SequentialMapGroup$1(p2)
|
|
1099
|
+
);
|
|
1100
|
+
lazy$1(this, `groups`, getter);
|
|
1101
|
+
}
|
|
1102
|
+
supports(charCode) {
|
|
1103
|
+
if (charCode.charCodeAt) {
|
|
1104
|
+
charCode = -1;
|
|
1105
|
+
console.warn(
|
|
1106
|
+
`supports(character) not implemented for cmap subtable format 8. only supports(id) is implemented.`
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
return this.groups.findIndex(
|
|
1110
|
+
(s) => s.startcharCode <= charCode && charCode <= s.endcharCode
|
|
1111
|
+
) !== -1;
|
|
1112
|
+
}
|
|
1113
|
+
reverse(glyphID) {
|
|
1114
|
+
console.warn(`reverse not implemented for cmap subtable format 8`);
|
|
1115
|
+
return {};
|
|
1116
|
+
}
|
|
1117
|
+
getSupportedCharCodes(preservePropNames = false) {
|
|
1118
|
+
if (preservePropNames) return this.groups;
|
|
1119
|
+
return this.groups.map((v) => ({
|
|
1120
|
+
start: v.startcharCode,
|
|
1121
|
+
end: v.endcharCode
|
|
1122
|
+
}));
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
class SequentialMapGroup$1 {
|
|
1126
|
+
constructor(p2) {
|
|
1127
|
+
this.startcharCode = p2.uint32;
|
|
1128
|
+
this.endcharCode = p2.uint32;
|
|
1129
|
+
this.startGlyphID = p2.uint32;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
class Format10 extends Subtable {
|
|
1133
|
+
constructor(p2, platformID, encodingID) {
|
|
1134
|
+
super(p2, platformID, encodingID);
|
|
1135
|
+
this.format = 10;
|
|
1136
|
+
p2.uint16;
|
|
1137
|
+
this.length = p2.uint32;
|
|
1138
|
+
this.language = p2.uint32;
|
|
1139
|
+
this.startCharCode = p2.uint32;
|
|
1140
|
+
this.numChars = p2.uint32;
|
|
1141
|
+
this.endCharCode = this.startCharCode + this.numChars;
|
|
1142
|
+
const getter = () => [...new Array(this.numChars)].map((_) => p2.uint16);
|
|
1143
|
+
lazy$1(this, `glyphs`, getter);
|
|
1144
|
+
}
|
|
1145
|
+
supports(charCode) {
|
|
1146
|
+
if (charCode.charCodeAt) {
|
|
1147
|
+
charCode = -1;
|
|
1148
|
+
console.warn(
|
|
1149
|
+
`supports(character) not implemented for cmap subtable format 10. only supports(id) is implemented.`
|
|
1150
|
+
);
|
|
1151
|
+
}
|
|
1152
|
+
if (charCode < this.startCharCode) return false;
|
|
1153
|
+
if (charCode > this.startCharCode + this.numChars) return false;
|
|
1154
|
+
return charCode - this.startCharCode;
|
|
1155
|
+
}
|
|
1156
|
+
reverse(glyphID) {
|
|
1157
|
+
console.warn(`reverse not implemented for cmap subtable format 10`);
|
|
1158
|
+
return {};
|
|
1159
|
+
}
|
|
1160
|
+
getSupportedCharCodes(preservePropNames = false) {
|
|
1161
|
+
if (preservePropNames) {
|
|
1162
|
+
return [
|
|
1163
|
+
{
|
|
1164
|
+
startCharCode: this.startCharCode,
|
|
1165
|
+
endCharCode: this.endCharCode
|
|
1166
|
+
}
|
|
1167
|
+
];
|
|
1168
|
+
}
|
|
1169
|
+
return [{ start: this.startCharCode, end: this.endCharCode }];
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
class Format12 extends Subtable {
|
|
1173
|
+
constructor(p2, platformID, encodingID) {
|
|
1174
|
+
super(p2, platformID, encodingID);
|
|
1175
|
+
this.format = 12;
|
|
1176
|
+
p2.uint16;
|
|
1177
|
+
this.length = p2.uint32;
|
|
1178
|
+
this.language = p2.uint32;
|
|
1179
|
+
this.numGroups = p2.uint32;
|
|
1180
|
+
const getter = () => [...new Array(this.numGroups)].map(
|
|
1181
|
+
(_) => new SequentialMapGroup(p2)
|
|
1182
|
+
);
|
|
1183
|
+
lazy$1(this, `groups`, getter);
|
|
1184
|
+
}
|
|
1185
|
+
supports(charCode) {
|
|
1186
|
+
if (charCode.charCodeAt) charCode = charCode.charCodeAt(0);
|
|
1187
|
+
if (55296 <= charCode && charCode <= 57343) return 0;
|
|
1188
|
+
if ((charCode & 65534) === 65534 || (charCode & 65535) === 65535)
|
|
1189
|
+
return 0;
|
|
1190
|
+
return this.groups.findIndex(
|
|
1191
|
+
(s) => s.startCharCode <= charCode && charCode <= s.endCharCode
|
|
1192
|
+
) !== -1;
|
|
1193
|
+
}
|
|
1194
|
+
reverse(glyphID) {
|
|
1195
|
+
for (let group of this.groups) {
|
|
1196
|
+
let start = group.startGlyphID;
|
|
1197
|
+
if (start > glyphID) continue;
|
|
1198
|
+
if (start === glyphID) return group.startCharCode;
|
|
1199
|
+
let end = start + (group.endCharCode - group.startCharCode);
|
|
1200
|
+
if (end < glyphID) continue;
|
|
1201
|
+
const code = group.startCharCode + (glyphID - start);
|
|
1202
|
+
return { code, unicode: String.fromCodePoint(code) };
|
|
1203
|
+
}
|
|
1204
|
+
return {};
|
|
1205
|
+
}
|
|
1206
|
+
getSupportedCharCodes(preservePropNames = false) {
|
|
1207
|
+
if (preservePropNames) return this.groups;
|
|
1208
|
+
return this.groups.map((v) => ({
|
|
1209
|
+
start: v.startCharCode,
|
|
1210
|
+
end: v.endCharCode
|
|
1211
|
+
}));
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
class SequentialMapGroup {
|
|
1215
|
+
constructor(p2) {
|
|
1216
|
+
this.startCharCode = p2.uint32;
|
|
1217
|
+
this.endCharCode = p2.uint32;
|
|
1218
|
+
this.startGlyphID = p2.uint32;
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
class Format13 extends Subtable {
|
|
1222
|
+
constructor(p2, platformID, encodingID) {
|
|
1223
|
+
super(p2, platformID, encodingID);
|
|
1224
|
+
this.format = 13;
|
|
1225
|
+
p2.uint16;
|
|
1226
|
+
this.length = p2.uint32;
|
|
1227
|
+
this.language = p2.uint32;
|
|
1228
|
+
this.numGroups = p2.uint32;
|
|
1229
|
+
const getter = [...new Array(this.numGroups)].map(
|
|
1230
|
+
(_) => new ConstantMapGroup(p2)
|
|
1231
|
+
);
|
|
1232
|
+
lazy$1(this, `groups`, getter);
|
|
1233
|
+
}
|
|
1234
|
+
supports(charCode) {
|
|
1235
|
+
if (charCode.charCodeAt) charCode = charCode.charCodeAt(0);
|
|
1236
|
+
return this.groups.findIndex(
|
|
1237
|
+
(s) => s.startCharCode <= charCode && charCode <= s.endCharCode
|
|
1238
|
+
) !== -1;
|
|
1239
|
+
}
|
|
1240
|
+
reverse(glyphID) {
|
|
1241
|
+
console.warn(`reverse not implemented for cmap subtable format 13`);
|
|
1242
|
+
return {};
|
|
1243
|
+
}
|
|
1244
|
+
getSupportedCharCodes(preservePropNames = false) {
|
|
1245
|
+
if (preservePropNames) return this.groups;
|
|
1246
|
+
return this.groups.map((v) => ({
|
|
1247
|
+
start: v.startCharCode,
|
|
1248
|
+
end: v.endCharCode
|
|
1249
|
+
}));
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
class ConstantMapGroup {
|
|
1253
|
+
constructor(p2) {
|
|
1254
|
+
this.startCharCode = p2.uint32;
|
|
1255
|
+
this.endCharCode = p2.uint32;
|
|
1256
|
+
this.glyphID = p2.uint32;
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
class Format14 extends Subtable {
|
|
1260
|
+
constructor(p2, platformID, encodingID) {
|
|
1261
|
+
super(p2, platformID, encodingID);
|
|
1262
|
+
this.subTableStart = p2.currentPosition;
|
|
1263
|
+
this.format = 14;
|
|
1264
|
+
this.length = p2.uint32;
|
|
1265
|
+
this.numVarSelectorRecords = p2.uint32;
|
|
1266
|
+
lazy$1(
|
|
1267
|
+
this,
|
|
1268
|
+
`varSelectors`,
|
|
1269
|
+
() => [...new Array(this.numVarSelectorRecords)].map(
|
|
1270
|
+
(_) => new VariationSelector(p2)
|
|
1271
|
+
)
|
|
1272
|
+
);
|
|
1273
|
+
}
|
|
1274
|
+
supports() {
|
|
1275
|
+
console.warn(`supports not implemented for cmap subtable format 14`);
|
|
1276
|
+
return 0;
|
|
1277
|
+
}
|
|
1278
|
+
getSupportedCharCodes() {
|
|
1279
|
+
console.warn(
|
|
1280
|
+
`getSupportedCharCodes not implemented for cmap subtable format 14`
|
|
1281
|
+
);
|
|
1282
|
+
return [];
|
|
1283
|
+
}
|
|
1284
|
+
reverse(glyphID) {
|
|
1285
|
+
console.warn(`reverse not implemented for cmap subtable format 14`);
|
|
1286
|
+
return {};
|
|
1287
|
+
}
|
|
1288
|
+
supportsVariation(variation) {
|
|
1289
|
+
let v = this.varSelector.find(
|
|
1290
|
+
(uvs) => uvs.varSelector === variation
|
|
1291
|
+
);
|
|
1292
|
+
return v ? v : false;
|
|
1293
|
+
}
|
|
1294
|
+
getSupportedVariations() {
|
|
1295
|
+
return this.varSelectors.map((v) => v.varSelector);
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
class VariationSelector {
|
|
1299
|
+
constructor(p2) {
|
|
1300
|
+
this.varSelector = p2.uint24;
|
|
1301
|
+
this.defaultUVSOffset = p2.Offset32;
|
|
1302
|
+
this.nonDefaultUVSOffset = p2.Offset32;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
function createSubTable(parser, platformID, encodingID) {
|
|
1306
|
+
const format = parser.uint16;
|
|
1307
|
+
if (format === 0) return new Format0(parser, platformID, encodingID);
|
|
1308
|
+
if (format === 2) return new Format2(parser, platformID, encodingID);
|
|
1309
|
+
if (format === 4) return new Format4(parser, platformID, encodingID);
|
|
1310
|
+
if (format === 6) return new Format6(parser, platformID, encodingID);
|
|
1311
|
+
if (format === 8) return new Format8(parser, platformID, encodingID);
|
|
1312
|
+
if (format === 10) return new Format10(parser, platformID, encodingID);
|
|
1313
|
+
if (format === 12) return new Format12(parser, platformID, encodingID);
|
|
1314
|
+
if (format === 13) return new Format13(parser, platformID, encodingID);
|
|
1315
|
+
if (format === 14) return new Format14(parser, platformID, encodingID);
|
|
1316
|
+
return {};
|
|
1317
|
+
}
|
|
1318
|
+
class cmap extends SimpleTable {
|
|
1319
|
+
constructor(dict, dataview) {
|
|
1320
|
+
const { p: p2 } = super(dict, dataview);
|
|
1321
|
+
this.version = p2.uint16;
|
|
1322
|
+
this.numTables = p2.uint16;
|
|
1323
|
+
this.encodingRecords = [...new Array(this.numTables)].map(
|
|
1324
|
+
(_) => new EncodingRecord(p2, this.tableStart)
|
|
1325
|
+
);
|
|
1326
|
+
}
|
|
1327
|
+
getSubTable(tableID) {
|
|
1328
|
+
return this.encodingRecords[tableID].table;
|
|
1329
|
+
}
|
|
1330
|
+
getSupportedEncodings() {
|
|
1331
|
+
return this.encodingRecords.map((r) => ({
|
|
1332
|
+
platformID: r.platformID,
|
|
1333
|
+
encodingId: r.encodingID
|
|
1334
|
+
}));
|
|
1335
|
+
}
|
|
1336
|
+
getSupportedCharCodes(platformID, encodingID) {
|
|
1337
|
+
const recordID = this.encodingRecords.findIndex(
|
|
1338
|
+
(r) => r.platformID === platformID && r.encodingID === encodingID
|
|
1339
|
+
);
|
|
1340
|
+
if (recordID === -1) return false;
|
|
1341
|
+
const subtable = this.getSubTable(recordID);
|
|
1342
|
+
return subtable.getSupportedCharCodes();
|
|
1343
|
+
}
|
|
1344
|
+
reverse(glyphid) {
|
|
1345
|
+
for (let i = 0; i < this.numTables; i++) {
|
|
1346
|
+
let code = this.getSubTable(i).reverse(glyphid);
|
|
1347
|
+
if (code) return code;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
getGlyphId(char) {
|
|
1351
|
+
let last = 0;
|
|
1352
|
+
this.encodingRecords.some((_, tableID) => {
|
|
1353
|
+
let t = this.getSubTable(tableID);
|
|
1354
|
+
if (!t.getGlyphId) return false;
|
|
1355
|
+
last = t.getGlyphId(char);
|
|
1356
|
+
return last !== 0;
|
|
1357
|
+
});
|
|
1358
|
+
return last;
|
|
1359
|
+
}
|
|
1360
|
+
supports(char) {
|
|
1361
|
+
return this.encodingRecords.some((_, tableID) => {
|
|
1362
|
+
const t = this.getSubTable(tableID);
|
|
1363
|
+
return t.supports && t.supports(char) !== false;
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
supportsVariation(variation) {
|
|
1367
|
+
return this.encodingRecords.some((_, tableID) => {
|
|
1368
|
+
const t = this.getSubTable(tableID);
|
|
1369
|
+
return t.supportsVariation && t.supportsVariation(variation) !== false;
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
class EncodingRecord {
|
|
1374
|
+
constructor(p2, tableStart) {
|
|
1375
|
+
const platformID = this.platformID = p2.uint16;
|
|
1376
|
+
const encodingID = this.encodingID = p2.uint16;
|
|
1377
|
+
const offset = this.offset = p2.Offset32;
|
|
1378
|
+
lazy$1(this, `table`, () => {
|
|
1379
|
+
p2.currentPosition = tableStart + offset;
|
|
1380
|
+
return createSubTable(p2, platformID, encodingID);
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
var cmap$1 = Object.freeze({ __proto__: null, cmap });
|
|
1385
|
+
class head extends SimpleTable {
|
|
1386
|
+
constructor(dict, dataview) {
|
|
1387
|
+
const { p: p2 } = super(dict, dataview);
|
|
1388
|
+
this.load({
|
|
1389
|
+
majorVersion: p2.uint16,
|
|
1390
|
+
minorVersion: p2.uint16,
|
|
1391
|
+
fontRevision: p2.fixed,
|
|
1392
|
+
checkSumAdjustment: p2.uint32,
|
|
1393
|
+
magicNumber: p2.uint32,
|
|
1394
|
+
flags: p2.flags(16),
|
|
1395
|
+
unitsPerEm: p2.uint16,
|
|
1396
|
+
created: p2.longdatetime,
|
|
1397
|
+
modified: p2.longdatetime,
|
|
1398
|
+
xMin: p2.int16,
|
|
1399
|
+
yMin: p2.int16,
|
|
1400
|
+
xMax: p2.int16,
|
|
1401
|
+
yMax: p2.int16,
|
|
1402
|
+
macStyle: p2.flags(16),
|
|
1403
|
+
lowestRecPPEM: p2.uint16,
|
|
1404
|
+
fontDirectionHint: p2.uint16,
|
|
1405
|
+
indexToLocFormat: p2.uint16,
|
|
1406
|
+
glyphDataFormat: p2.uint16
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
var head$1 = Object.freeze({ __proto__: null, head });
|
|
1411
|
+
class hhea extends SimpleTable {
|
|
1412
|
+
constructor(dict, dataview) {
|
|
1413
|
+
const { p: p2 } = super(dict, dataview);
|
|
1414
|
+
this.majorVersion = p2.uint16;
|
|
1415
|
+
this.minorVersion = p2.uint16;
|
|
1416
|
+
this.ascender = p2.fword;
|
|
1417
|
+
this.descender = p2.fword;
|
|
1418
|
+
this.lineGap = p2.fword;
|
|
1419
|
+
this.advanceWidthMax = p2.ufword;
|
|
1420
|
+
this.minLeftSideBearing = p2.fword;
|
|
1421
|
+
this.minRightSideBearing = p2.fword;
|
|
1422
|
+
this.xMaxExtent = p2.fword;
|
|
1423
|
+
this.caretSlopeRise = p2.int16;
|
|
1424
|
+
this.caretSlopeRun = p2.int16;
|
|
1425
|
+
this.caretOffset = p2.int16;
|
|
1426
|
+
p2.int16;
|
|
1427
|
+
p2.int16;
|
|
1428
|
+
p2.int16;
|
|
1429
|
+
p2.int16;
|
|
1430
|
+
this.metricDataFormat = p2.int16;
|
|
1431
|
+
this.numberOfHMetrics = p2.uint16;
|
|
1432
|
+
p2.verifyLength();
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
var hhea$1 = Object.freeze({ __proto__: null, hhea });
|
|
1436
|
+
class hmtx extends SimpleTable {
|
|
1437
|
+
constructor(dict, dataview, tables) {
|
|
1438
|
+
const { p: p2 } = super(dict, dataview);
|
|
1439
|
+
const numberOfHMetrics = tables.hhea.numberOfHMetrics;
|
|
1440
|
+
const numGlyphs = tables.maxp.numGlyphs;
|
|
1441
|
+
const metricsStart = p2.currentPosition;
|
|
1442
|
+
lazy$1(this, `hMetrics`, () => {
|
|
1443
|
+
p2.currentPosition = metricsStart;
|
|
1444
|
+
return [...new Array(numberOfHMetrics)].map(
|
|
1445
|
+
(_) => new LongHorMetric(p2.uint16, p2.int16)
|
|
1446
|
+
);
|
|
1447
|
+
});
|
|
1448
|
+
if (numberOfHMetrics < numGlyphs) {
|
|
1449
|
+
const lsbStart = metricsStart + numberOfHMetrics * 4;
|
|
1450
|
+
lazy$1(this, `leftSideBearings`, () => {
|
|
1451
|
+
p2.currentPosition = lsbStart;
|
|
1452
|
+
return [...new Array(numGlyphs - numberOfHMetrics)].map(
|
|
1453
|
+
(_) => p2.int16
|
|
1454
|
+
);
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
class LongHorMetric {
|
|
1460
|
+
constructor(w, b) {
|
|
1461
|
+
this.advanceWidth = w;
|
|
1462
|
+
this.lsb = b;
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
var hmtx$1 = Object.freeze({ __proto__: null, hmtx });
|
|
1466
|
+
class maxp extends SimpleTable {
|
|
1467
|
+
constructor(dict, dataview) {
|
|
1468
|
+
const { p: p2 } = super(dict, dataview);
|
|
1469
|
+
this.version = p2.legacyFixed;
|
|
1470
|
+
this.numGlyphs = p2.uint16;
|
|
1471
|
+
if (this.version === 1) {
|
|
1472
|
+
this.maxPoints = p2.uint16;
|
|
1473
|
+
this.maxContours = p2.uint16;
|
|
1474
|
+
this.maxCompositePoints = p2.uint16;
|
|
1475
|
+
this.maxCompositeContours = p2.uint16;
|
|
1476
|
+
this.maxZones = p2.uint16;
|
|
1477
|
+
this.maxTwilightPoints = p2.uint16;
|
|
1478
|
+
this.maxStorage = p2.uint16;
|
|
1479
|
+
this.maxFunctionDefs = p2.uint16;
|
|
1480
|
+
this.maxInstructionDefs = p2.uint16;
|
|
1481
|
+
this.maxStackElements = p2.uint16;
|
|
1482
|
+
this.maxSizeOfInstructions = p2.uint16;
|
|
1483
|
+
this.maxComponentElements = p2.uint16;
|
|
1484
|
+
this.maxComponentDepth = p2.uint16;
|
|
1485
|
+
}
|
|
1486
|
+
p2.verifyLength();
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
var maxp$1 = Object.freeze({ __proto__: null, maxp });
|
|
1490
|
+
class name extends SimpleTable {
|
|
1491
|
+
constructor(dict, dataview) {
|
|
1492
|
+
const { p: p2 } = super(dict, dataview);
|
|
1493
|
+
this.format = p2.uint16;
|
|
1494
|
+
this.count = p2.uint16;
|
|
1495
|
+
this.stringOffset = p2.Offset16;
|
|
1496
|
+
this.nameRecords = [...new Array(this.count)].map(
|
|
1497
|
+
(_) => new NameRecord(p2, this)
|
|
1498
|
+
);
|
|
1499
|
+
if (this.format === 1) {
|
|
1500
|
+
this.langTagCount = p2.uint16;
|
|
1501
|
+
this.langTagRecords = [...new Array(this.langTagCount)].map(
|
|
1502
|
+
(_) => new LangTagRecord(p2.uint16, p2.Offset16)
|
|
1503
|
+
);
|
|
1504
|
+
}
|
|
1505
|
+
this.stringStart = this.tableStart + this.stringOffset;
|
|
1506
|
+
}
|
|
1507
|
+
get(nameID) {
|
|
1508
|
+
let record = this.nameRecords.find(
|
|
1509
|
+
(record2) => record2.nameID === nameID
|
|
1510
|
+
);
|
|
1511
|
+
if (record) return record.string;
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
class LangTagRecord {
|
|
1515
|
+
constructor(length, offset) {
|
|
1516
|
+
this.length = length;
|
|
1517
|
+
this.offset = offset;
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
class NameRecord {
|
|
1521
|
+
constructor(p2, nameTable) {
|
|
1522
|
+
this.platformID = p2.uint16;
|
|
1523
|
+
this.encodingID = p2.uint16;
|
|
1524
|
+
this.languageID = p2.uint16;
|
|
1525
|
+
this.nameID = p2.uint16;
|
|
1526
|
+
this.length = p2.uint16;
|
|
1527
|
+
this.offset = p2.Offset16;
|
|
1528
|
+
lazy$1(this, `string`, () => {
|
|
1529
|
+
p2.currentPosition = nameTable.stringStart + this.offset;
|
|
1530
|
+
return decodeString(p2, this);
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
function decodeString(p2, record) {
|
|
1535
|
+
const { platformID, length } = record;
|
|
1536
|
+
if (length === 0) return ``;
|
|
1537
|
+
if (platformID === 0 || platformID === 3) {
|
|
1538
|
+
const str2 = [];
|
|
1539
|
+
for (let i = 0, e = length / 2; i < e; i++)
|
|
1540
|
+
str2[i] = String.fromCharCode(p2.uint16);
|
|
1541
|
+
return str2.join(``);
|
|
1542
|
+
}
|
|
1543
|
+
const bytes = p2.readBytes(length);
|
|
1544
|
+
const str = [];
|
|
1545
|
+
bytes.forEach(function(b, i) {
|
|
1546
|
+
str[i] = String.fromCharCode(b);
|
|
1547
|
+
});
|
|
1548
|
+
return str.join(``);
|
|
1549
|
+
}
|
|
1550
|
+
var name$1 = Object.freeze({ __proto__: null, name });
|
|
1551
|
+
class OS2 extends SimpleTable {
|
|
1552
|
+
constructor(dict, dataview) {
|
|
1553
|
+
const { p: p2 } = super(dict, dataview);
|
|
1554
|
+
this.version = p2.uint16;
|
|
1555
|
+
this.xAvgCharWidth = p2.int16;
|
|
1556
|
+
this.usWeightClass = p2.uint16;
|
|
1557
|
+
this.usWidthClass = p2.uint16;
|
|
1558
|
+
this.fsType = p2.uint16;
|
|
1559
|
+
this.ySubscriptXSize = p2.int16;
|
|
1560
|
+
this.ySubscriptYSize = p2.int16;
|
|
1561
|
+
this.ySubscriptXOffset = p2.int16;
|
|
1562
|
+
this.ySubscriptYOffset = p2.int16;
|
|
1563
|
+
this.ySuperscriptXSize = p2.int16;
|
|
1564
|
+
this.ySuperscriptYSize = p2.int16;
|
|
1565
|
+
this.ySuperscriptXOffset = p2.int16;
|
|
1566
|
+
this.ySuperscriptYOffset = p2.int16;
|
|
1567
|
+
this.yStrikeoutSize = p2.int16;
|
|
1568
|
+
this.yStrikeoutPosition = p2.int16;
|
|
1569
|
+
this.sFamilyClass = p2.int16;
|
|
1570
|
+
this.panose = [...new Array(10)].map((_) => p2.uint8);
|
|
1571
|
+
this.ulUnicodeRange1 = p2.flags(32);
|
|
1572
|
+
this.ulUnicodeRange2 = p2.flags(32);
|
|
1573
|
+
this.ulUnicodeRange3 = p2.flags(32);
|
|
1574
|
+
this.ulUnicodeRange4 = p2.flags(32);
|
|
1575
|
+
this.achVendID = p2.tag;
|
|
1576
|
+
this.fsSelection = p2.uint16;
|
|
1577
|
+
this.usFirstCharIndex = p2.uint16;
|
|
1578
|
+
this.usLastCharIndex = p2.uint16;
|
|
1579
|
+
this.sTypoAscender = p2.int16;
|
|
1580
|
+
this.sTypoDescender = p2.int16;
|
|
1581
|
+
this.sTypoLineGap = p2.int16;
|
|
1582
|
+
this.usWinAscent = p2.uint16;
|
|
1583
|
+
this.usWinDescent = p2.uint16;
|
|
1584
|
+
if (this.version === 0) return p2.verifyLength();
|
|
1585
|
+
this.ulCodePageRange1 = p2.flags(32);
|
|
1586
|
+
this.ulCodePageRange2 = p2.flags(32);
|
|
1587
|
+
if (this.version === 1) return p2.verifyLength();
|
|
1588
|
+
this.sxHeight = p2.int16;
|
|
1589
|
+
this.sCapHeight = p2.int16;
|
|
1590
|
+
this.usDefaultChar = p2.uint16;
|
|
1591
|
+
this.usBreakChar = p2.uint16;
|
|
1592
|
+
this.usMaxContext = p2.uint16;
|
|
1593
|
+
if (this.version <= 4) return p2.verifyLength();
|
|
1594
|
+
this.usLowerOpticalPointSize = p2.uint16;
|
|
1595
|
+
this.usUpperOpticalPointSize = p2.uint16;
|
|
1596
|
+
if (this.version === 5) return p2.verifyLength();
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
var OS2$1 = Object.freeze({ __proto__: null, OS2 });
|
|
1600
|
+
class post extends SimpleTable {
|
|
1601
|
+
constructor(dict, dataview) {
|
|
1602
|
+
const { p: p2 } = super(dict, dataview);
|
|
1603
|
+
this.version = p2.legacyFixed;
|
|
1604
|
+
this.italicAngle = p2.fixed;
|
|
1605
|
+
this.underlinePosition = p2.fword;
|
|
1606
|
+
this.underlineThickness = p2.fword;
|
|
1607
|
+
this.isFixedPitch = p2.uint32;
|
|
1608
|
+
this.minMemType42 = p2.uint32;
|
|
1609
|
+
this.maxMemType42 = p2.uint32;
|
|
1610
|
+
this.minMemType1 = p2.uint32;
|
|
1611
|
+
this.maxMemType1 = p2.uint32;
|
|
1612
|
+
if (this.version === 1 || this.version === 3) return p2.verifyLength();
|
|
1613
|
+
this.numGlyphs = p2.uint16;
|
|
1614
|
+
if (this.version === 2) {
|
|
1615
|
+
this.glyphNameIndex = [...new Array(this.numGlyphs)].map(
|
|
1616
|
+
(_) => p2.uint16
|
|
1617
|
+
);
|
|
1618
|
+
this.namesOffset = p2.currentPosition;
|
|
1619
|
+
this.glyphNameOffsets = [1];
|
|
1620
|
+
for (let i = 0; i < this.numGlyphs; i++) {
|
|
1621
|
+
let index = this.glyphNameIndex[i];
|
|
1622
|
+
if (index < macStrings.length) {
|
|
1623
|
+
this.glyphNameOffsets.push(this.glyphNameOffsets[i]);
|
|
1624
|
+
continue;
|
|
1625
|
+
}
|
|
1626
|
+
let bytelength = p2.int8;
|
|
1627
|
+
p2.skip(bytelength);
|
|
1628
|
+
this.glyphNameOffsets.push(
|
|
1629
|
+
this.glyphNameOffsets[i] + bytelength + 1
|
|
1630
|
+
);
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
if (this.version === 2.5) {
|
|
1634
|
+
this.offset = [...new Array(this.numGlyphs)].map(
|
|
1635
|
+
(_) => p2.int8
|
|
1636
|
+
);
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
getGlyphName(glyphid) {
|
|
1640
|
+
if (this.version !== 2) {
|
|
1641
|
+
console.warn(
|
|
1642
|
+
`post table version ${this.version} does not support glyph name lookups`
|
|
1643
|
+
);
|
|
1644
|
+
return ``;
|
|
1645
|
+
}
|
|
1646
|
+
let index = this.glyphNameIndex[glyphid];
|
|
1647
|
+
if (index < 258) return macStrings[index];
|
|
1648
|
+
let offset = this.glyphNameOffsets[glyphid];
|
|
1649
|
+
let next = this.glyphNameOffsets[glyphid + 1];
|
|
1650
|
+
let len = next - offset - 1;
|
|
1651
|
+
if (len === 0) return `.notdef.`;
|
|
1652
|
+
this.parser.currentPosition = this.namesOffset + offset;
|
|
1653
|
+
const data = this.parser.readBytes(
|
|
1654
|
+
len,
|
|
1655
|
+
this.namesOffset + offset,
|
|
1656
|
+
8,
|
|
1657
|
+
true
|
|
1658
|
+
);
|
|
1659
|
+
return data.map((b) => String.fromCharCode(b)).join(``);
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
const macStrings = [
|
|
1663
|
+
`.notdef`,
|
|
1664
|
+
`.null`,
|
|
1665
|
+
`nonmarkingreturn`,
|
|
1666
|
+
`space`,
|
|
1667
|
+
`exclam`,
|
|
1668
|
+
`quotedbl`,
|
|
1669
|
+
`numbersign`,
|
|
1670
|
+
`dollar`,
|
|
1671
|
+
`percent`,
|
|
1672
|
+
`ampersand`,
|
|
1673
|
+
`quotesingle`,
|
|
1674
|
+
`parenleft`,
|
|
1675
|
+
`parenright`,
|
|
1676
|
+
`asterisk`,
|
|
1677
|
+
`plus`,
|
|
1678
|
+
`comma`,
|
|
1679
|
+
`hyphen`,
|
|
1680
|
+
`period`,
|
|
1681
|
+
`slash`,
|
|
1682
|
+
`zero`,
|
|
1683
|
+
`one`,
|
|
1684
|
+
`two`,
|
|
1685
|
+
`three`,
|
|
1686
|
+
`four`,
|
|
1687
|
+
`five`,
|
|
1688
|
+
`six`,
|
|
1689
|
+
`seven`,
|
|
1690
|
+
`eight`,
|
|
1691
|
+
`nine`,
|
|
1692
|
+
`colon`,
|
|
1693
|
+
`semicolon`,
|
|
1694
|
+
`less`,
|
|
1695
|
+
`equal`,
|
|
1696
|
+
`greater`,
|
|
1697
|
+
`question`,
|
|
1698
|
+
`at`,
|
|
1699
|
+
`A`,
|
|
1700
|
+
`B`,
|
|
1701
|
+
`C`,
|
|
1702
|
+
`D`,
|
|
1703
|
+
`E`,
|
|
1704
|
+
`F`,
|
|
1705
|
+
`G`,
|
|
1706
|
+
`H`,
|
|
1707
|
+
`I`,
|
|
1708
|
+
`J`,
|
|
1709
|
+
`K`,
|
|
1710
|
+
`L`,
|
|
1711
|
+
`M`,
|
|
1712
|
+
`N`,
|
|
1713
|
+
`O`,
|
|
1714
|
+
`P`,
|
|
1715
|
+
`Q`,
|
|
1716
|
+
`R`,
|
|
1717
|
+
`S`,
|
|
1718
|
+
`T`,
|
|
1719
|
+
`U`,
|
|
1720
|
+
`V`,
|
|
1721
|
+
`W`,
|
|
1722
|
+
`X`,
|
|
1723
|
+
`Y`,
|
|
1724
|
+
`Z`,
|
|
1725
|
+
`bracketleft`,
|
|
1726
|
+
`backslash`,
|
|
1727
|
+
`bracketright`,
|
|
1728
|
+
`asciicircum`,
|
|
1729
|
+
`underscore`,
|
|
1730
|
+
`grave`,
|
|
1731
|
+
`a`,
|
|
1732
|
+
`b`,
|
|
1733
|
+
`c`,
|
|
1734
|
+
`d`,
|
|
1735
|
+
`e`,
|
|
1736
|
+
`f`,
|
|
1737
|
+
`g`,
|
|
1738
|
+
`h`,
|
|
1739
|
+
`i`,
|
|
1740
|
+
`j`,
|
|
1741
|
+
`k`,
|
|
1742
|
+
`l`,
|
|
1743
|
+
`m`,
|
|
1744
|
+
`n`,
|
|
1745
|
+
`o`,
|
|
1746
|
+
`p`,
|
|
1747
|
+
`q`,
|
|
1748
|
+
`r`,
|
|
1749
|
+
`s`,
|
|
1750
|
+
`t`,
|
|
1751
|
+
`u`,
|
|
1752
|
+
`v`,
|
|
1753
|
+
`w`,
|
|
1754
|
+
`x`,
|
|
1755
|
+
`y`,
|
|
1756
|
+
`z`,
|
|
1757
|
+
`braceleft`,
|
|
1758
|
+
`bar`,
|
|
1759
|
+
`braceright`,
|
|
1760
|
+
`asciitilde`,
|
|
1761
|
+
`Adieresis`,
|
|
1762
|
+
`Aring`,
|
|
1763
|
+
`Ccedilla`,
|
|
1764
|
+
`Eacute`,
|
|
1765
|
+
`Ntilde`,
|
|
1766
|
+
`Odieresis`,
|
|
1767
|
+
`Udieresis`,
|
|
1768
|
+
`aacute`,
|
|
1769
|
+
`agrave`,
|
|
1770
|
+
`acircumflex`,
|
|
1771
|
+
`adieresis`,
|
|
1772
|
+
`atilde`,
|
|
1773
|
+
`aring`,
|
|
1774
|
+
`ccedilla`,
|
|
1775
|
+
`eacute`,
|
|
1776
|
+
`egrave`,
|
|
1777
|
+
`ecircumflex`,
|
|
1778
|
+
`edieresis`,
|
|
1779
|
+
`iacute`,
|
|
1780
|
+
`igrave`,
|
|
1781
|
+
`icircumflex`,
|
|
1782
|
+
`idieresis`,
|
|
1783
|
+
`ntilde`,
|
|
1784
|
+
`oacute`,
|
|
1785
|
+
`ograve`,
|
|
1786
|
+
`ocircumflex`,
|
|
1787
|
+
`odieresis`,
|
|
1788
|
+
`otilde`,
|
|
1789
|
+
`uacute`,
|
|
1790
|
+
`ugrave`,
|
|
1791
|
+
`ucircumflex`,
|
|
1792
|
+
`udieresis`,
|
|
1793
|
+
`dagger`,
|
|
1794
|
+
`degree`,
|
|
1795
|
+
`cent`,
|
|
1796
|
+
`sterling`,
|
|
1797
|
+
`section`,
|
|
1798
|
+
`bullet`,
|
|
1799
|
+
`paragraph`,
|
|
1800
|
+
`germandbls`,
|
|
1801
|
+
`registered`,
|
|
1802
|
+
`copyright`,
|
|
1803
|
+
`trademark`,
|
|
1804
|
+
`acute`,
|
|
1805
|
+
`dieresis`,
|
|
1806
|
+
`notequal`,
|
|
1807
|
+
`AE`,
|
|
1808
|
+
`Oslash`,
|
|
1809
|
+
`infinity`,
|
|
1810
|
+
`plusminus`,
|
|
1811
|
+
`lessequal`,
|
|
1812
|
+
`greaterequal`,
|
|
1813
|
+
`yen`,
|
|
1814
|
+
`mu`,
|
|
1815
|
+
`partialdiff`,
|
|
1816
|
+
`summation`,
|
|
1817
|
+
`product`,
|
|
1818
|
+
`pi`,
|
|
1819
|
+
`integral`,
|
|
1820
|
+
`ordfeminine`,
|
|
1821
|
+
`ordmasculine`,
|
|
1822
|
+
`Omega`,
|
|
1823
|
+
`ae`,
|
|
1824
|
+
`oslash`,
|
|
1825
|
+
`questiondown`,
|
|
1826
|
+
`exclamdown`,
|
|
1827
|
+
`logicalnot`,
|
|
1828
|
+
`radical`,
|
|
1829
|
+
`florin`,
|
|
1830
|
+
`approxequal`,
|
|
1831
|
+
`Delta`,
|
|
1832
|
+
`guillemotleft`,
|
|
1833
|
+
`guillemotright`,
|
|
1834
|
+
`ellipsis`,
|
|
1835
|
+
`nonbreakingspace`,
|
|
1836
|
+
`Agrave`,
|
|
1837
|
+
`Atilde`,
|
|
1838
|
+
`Otilde`,
|
|
1839
|
+
`OE`,
|
|
1840
|
+
`oe`,
|
|
1841
|
+
`endash`,
|
|
1842
|
+
`emdash`,
|
|
1843
|
+
`quotedblleft`,
|
|
1844
|
+
`quotedblright`,
|
|
1845
|
+
`quoteleft`,
|
|
1846
|
+
`quoteright`,
|
|
1847
|
+
`divide`,
|
|
1848
|
+
`lozenge`,
|
|
1849
|
+
`ydieresis`,
|
|
1850
|
+
`Ydieresis`,
|
|
1851
|
+
`fraction`,
|
|
1852
|
+
`currency`,
|
|
1853
|
+
`guilsinglleft`,
|
|
1854
|
+
`guilsinglright`,
|
|
1855
|
+
`fi`,
|
|
1856
|
+
`fl`,
|
|
1857
|
+
`daggerdbl`,
|
|
1858
|
+
`periodcentered`,
|
|
1859
|
+
`quotesinglbase`,
|
|
1860
|
+
`quotedblbase`,
|
|
1861
|
+
`perthousand`,
|
|
1862
|
+
`Acircumflex`,
|
|
1863
|
+
`Ecircumflex`,
|
|
1864
|
+
`Aacute`,
|
|
1865
|
+
`Edieresis`,
|
|
1866
|
+
`Egrave`,
|
|
1867
|
+
`Iacute`,
|
|
1868
|
+
`Icircumflex`,
|
|
1869
|
+
`Idieresis`,
|
|
1870
|
+
`Igrave`,
|
|
1871
|
+
`Oacute`,
|
|
1872
|
+
`Ocircumflex`,
|
|
1873
|
+
`apple`,
|
|
1874
|
+
`Ograve`,
|
|
1875
|
+
`Uacute`,
|
|
1876
|
+
`Ucircumflex`,
|
|
1877
|
+
`Ugrave`,
|
|
1878
|
+
`dotlessi`,
|
|
1879
|
+
`circumflex`,
|
|
1880
|
+
`tilde`,
|
|
1881
|
+
`macron`,
|
|
1882
|
+
`breve`,
|
|
1883
|
+
`dotaccent`,
|
|
1884
|
+
`ring`,
|
|
1885
|
+
`cedilla`,
|
|
1886
|
+
`hungarumlaut`,
|
|
1887
|
+
`ogonek`,
|
|
1888
|
+
`caron`,
|
|
1889
|
+
`Lslash`,
|
|
1890
|
+
`lslash`,
|
|
1891
|
+
`Scaron`,
|
|
1892
|
+
`scaron`,
|
|
1893
|
+
`Zcaron`,
|
|
1894
|
+
`zcaron`,
|
|
1895
|
+
`brokenbar`,
|
|
1896
|
+
`Eth`,
|
|
1897
|
+
`eth`,
|
|
1898
|
+
`Yacute`,
|
|
1899
|
+
`yacute`,
|
|
1900
|
+
`Thorn`,
|
|
1901
|
+
`thorn`,
|
|
1902
|
+
`minus`,
|
|
1903
|
+
`multiply`,
|
|
1904
|
+
`onesuperior`,
|
|
1905
|
+
`twosuperior`,
|
|
1906
|
+
`threesuperior`,
|
|
1907
|
+
`onehalf`,
|
|
1908
|
+
`onequarter`,
|
|
1909
|
+
`threequarters`,
|
|
1910
|
+
`franc`,
|
|
1911
|
+
`Gbreve`,
|
|
1912
|
+
`gbreve`,
|
|
1913
|
+
`Idotaccent`,
|
|
1914
|
+
`Scedilla`,
|
|
1915
|
+
`scedilla`,
|
|
1916
|
+
`Cacute`,
|
|
1917
|
+
`cacute`,
|
|
1918
|
+
`Ccaron`,
|
|
1919
|
+
`ccaron`,
|
|
1920
|
+
`dcroat`
|
|
1921
|
+
];
|
|
1922
|
+
var post$1 = Object.freeze({ __proto__: null, post });
|
|
1923
|
+
class BASE extends SimpleTable {
|
|
1924
|
+
constructor(dict, dataview) {
|
|
1925
|
+
const { p: p2 } = super(dict, dataview);
|
|
1926
|
+
this.majorVersion = p2.uint16;
|
|
1927
|
+
this.minorVersion = p2.uint16;
|
|
1928
|
+
this.horizAxisOffset = p2.Offset16;
|
|
1929
|
+
this.vertAxisOffset = p2.Offset16;
|
|
1930
|
+
lazy$1(
|
|
1931
|
+
this,
|
|
1932
|
+
`horizAxis`,
|
|
1933
|
+
() => new AxisTable(
|
|
1934
|
+
{ offset: dict.offset + this.horizAxisOffset },
|
|
1935
|
+
dataview
|
|
1936
|
+
)
|
|
1937
|
+
);
|
|
1938
|
+
lazy$1(
|
|
1939
|
+
this,
|
|
1940
|
+
`vertAxis`,
|
|
1941
|
+
() => new AxisTable(
|
|
1942
|
+
{ offset: dict.offset + this.vertAxisOffset },
|
|
1943
|
+
dataview
|
|
1944
|
+
)
|
|
1945
|
+
);
|
|
1946
|
+
if (this.majorVersion === 1 && this.minorVersion === 1) {
|
|
1947
|
+
this.itemVarStoreOffset = p2.Offset32;
|
|
1948
|
+
lazy$1(
|
|
1949
|
+
this,
|
|
1950
|
+
`itemVarStore`,
|
|
1951
|
+
() => new AxisTable(
|
|
1952
|
+
{ offset: dict.offset + this.itemVarStoreOffset },
|
|
1953
|
+
dataview
|
|
1954
|
+
)
|
|
1955
|
+
);
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
class AxisTable extends SimpleTable {
|
|
1960
|
+
constructor(dict, dataview) {
|
|
1961
|
+
const { p: p2 } = super(dict, dataview, `AxisTable`);
|
|
1962
|
+
this.baseTagListOffset = p2.Offset16;
|
|
1963
|
+
this.baseScriptListOffset = p2.Offset16;
|
|
1964
|
+
lazy$1(
|
|
1965
|
+
this,
|
|
1966
|
+
`baseTagList`,
|
|
1967
|
+
() => new BaseTagListTable(
|
|
1968
|
+
{ offset: dict.offset + this.baseTagListOffset },
|
|
1969
|
+
dataview
|
|
1970
|
+
)
|
|
1971
|
+
);
|
|
1972
|
+
lazy$1(
|
|
1973
|
+
this,
|
|
1974
|
+
`baseScriptList`,
|
|
1975
|
+
() => new BaseScriptListTable(
|
|
1976
|
+
{ offset: dict.offset + this.baseScriptListOffset },
|
|
1977
|
+
dataview
|
|
1978
|
+
)
|
|
1979
|
+
);
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
class BaseTagListTable extends SimpleTable {
|
|
1983
|
+
constructor(dict, dataview) {
|
|
1984
|
+
const { p: p2 } = super(dict, dataview, `BaseTagListTable`);
|
|
1985
|
+
this.baseTagCount = p2.uint16;
|
|
1986
|
+
this.baselineTags = [...new Array(this.baseTagCount)].map(
|
|
1987
|
+
(_) => p2.tag
|
|
1988
|
+
);
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
class BaseScriptListTable extends SimpleTable {
|
|
1992
|
+
constructor(dict, dataview) {
|
|
1993
|
+
const { p: p2 } = super(dict, dataview, `BaseScriptListTable`);
|
|
1994
|
+
this.baseScriptCount = p2.uint16;
|
|
1995
|
+
const recordStart = p2.currentPosition;
|
|
1996
|
+
lazy$1(this, `baseScriptRecords`, () => {
|
|
1997
|
+
p2.currentPosition = recordStart;
|
|
1998
|
+
return [...new Array(this.baseScriptCount)].map(
|
|
1999
|
+
(_) => new BaseScriptRecord(this.start, p2)
|
|
2000
|
+
);
|
|
2001
|
+
});
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
class BaseScriptRecord {
|
|
2005
|
+
constructor(baseScriptListTableStart, p2) {
|
|
2006
|
+
this.baseScriptTag = p2.tag;
|
|
2007
|
+
this.baseScriptOffset = p2.Offset16;
|
|
2008
|
+
lazy$1(this, `baseScriptTable`, () => {
|
|
2009
|
+
p2.currentPosition = baseScriptListTableStart + this.baseScriptOffset;
|
|
2010
|
+
return new BaseScriptTable(p2);
|
|
2011
|
+
});
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
class BaseScriptTable {
|
|
2015
|
+
constructor(p2) {
|
|
2016
|
+
this.start = p2.currentPosition;
|
|
2017
|
+
this.baseValuesOffset = p2.Offset16;
|
|
2018
|
+
this.defaultMinMaxOffset = p2.Offset16;
|
|
2019
|
+
this.baseLangSysCount = p2.uint16;
|
|
2020
|
+
this.baseLangSysRecords = [...new Array(this.baseLangSysCount)].map(
|
|
2021
|
+
(_) => new BaseLangSysRecord(this.start, p2)
|
|
2022
|
+
);
|
|
2023
|
+
lazy$1(this, `baseValues`, () => {
|
|
2024
|
+
p2.currentPosition = this.start + this.baseValuesOffset;
|
|
2025
|
+
return new BaseValuesTable(p2);
|
|
2026
|
+
});
|
|
2027
|
+
lazy$1(this, `defaultMinMax`, () => {
|
|
2028
|
+
p2.currentPosition = this.start + this.defaultMinMaxOffset;
|
|
2029
|
+
return new MinMaxTable(p2);
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
class BaseLangSysRecord {
|
|
2034
|
+
constructor(baseScriptTableStart, p2) {
|
|
2035
|
+
this.baseLangSysTag = p2.tag;
|
|
2036
|
+
this.minMaxOffset = p2.Offset16;
|
|
2037
|
+
lazy$1(this, `minMax`, () => {
|
|
2038
|
+
p2.currentPosition = baseScriptTableStart + this.minMaxOffset;
|
|
2039
|
+
return new MinMaxTable(p2);
|
|
2040
|
+
});
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
class BaseValuesTable {
|
|
2044
|
+
constructor(p2) {
|
|
2045
|
+
this.parser = p2;
|
|
2046
|
+
this.start = p2.currentPosition;
|
|
2047
|
+
this.defaultBaselineIndex = p2.uint16;
|
|
2048
|
+
this.baseCoordCount = p2.uint16;
|
|
2049
|
+
this.baseCoords = [...new Array(this.baseCoordCount)].map(
|
|
2050
|
+
(_) => p2.Offset16
|
|
2051
|
+
);
|
|
2052
|
+
}
|
|
2053
|
+
getTable(id) {
|
|
2054
|
+
this.parser.currentPosition = this.start + this.baseCoords[id];
|
|
2055
|
+
return new BaseCoordTable(this.parser);
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
class MinMaxTable {
|
|
2059
|
+
constructor(p2) {
|
|
2060
|
+
this.minCoord = p2.Offset16;
|
|
2061
|
+
this.maxCoord = p2.Offset16;
|
|
2062
|
+
this.featMinMaxCount = p2.uint16;
|
|
2063
|
+
const recordStart = p2.currentPosition;
|
|
2064
|
+
lazy$1(this, `featMinMaxRecords`, () => {
|
|
2065
|
+
p2.currentPosition = recordStart;
|
|
2066
|
+
return [...new Array(this.featMinMaxCount)].map(
|
|
2067
|
+
(_) => new FeatMinMaxRecord(p2)
|
|
2068
|
+
);
|
|
2069
|
+
});
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
class FeatMinMaxRecord {
|
|
2073
|
+
constructor(p2) {
|
|
2074
|
+
this.featureTableTag = p2.tag;
|
|
2075
|
+
this.minCoord = p2.Offset16;
|
|
2076
|
+
this.maxCoord = p2.Offset16;
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
class BaseCoordTable {
|
|
2080
|
+
constructor(p2) {
|
|
2081
|
+
this.baseCoordFormat = p2.uint16;
|
|
2082
|
+
this.coordinate = p2.int16;
|
|
2083
|
+
if (this.baseCoordFormat === 2) {
|
|
2084
|
+
this.referenceGlyph = p2.uint16;
|
|
2085
|
+
this.baseCoordPoint = p2.uint16;
|
|
2086
|
+
}
|
|
2087
|
+
if (this.baseCoordFormat === 3) {
|
|
2088
|
+
this.deviceTable = p2.Offset16;
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
var BASE$1 = Object.freeze({ __proto__: null, BASE });
|
|
2093
|
+
class ClassDefinition {
|
|
2094
|
+
constructor(p2) {
|
|
2095
|
+
this.classFormat = p2.uint16;
|
|
2096
|
+
if (this.classFormat === 1) {
|
|
2097
|
+
this.startGlyphID = p2.uint16;
|
|
2098
|
+
this.glyphCount = p2.uint16;
|
|
2099
|
+
this.classValueArray = [...new Array(this.glyphCount)].map(
|
|
2100
|
+
(_) => p2.uint16
|
|
2101
|
+
);
|
|
2102
|
+
}
|
|
2103
|
+
if (this.classFormat === 2) {
|
|
2104
|
+
this.classRangeCount = p2.uint16;
|
|
2105
|
+
this.classRangeRecords = [
|
|
2106
|
+
...new Array(this.classRangeCount)
|
|
2107
|
+
].map((_) => new ClassRangeRecord(p2));
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
class ClassRangeRecord {
|
|
2112
|
+
constructor(p2) {
|
|
2113
|
+
this.startGlyphID = p2.uint16;
|
|
2114
|
+
this.endGlyphID = p2.uint16;
|
|
2115
|
+
this.class = p2.uint16;
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
class CoverageTable extends ParsedData {
|
|
2119
|
+
constructor(p2) {
|
|
2120
|
+
super(p2);
|
|
2121
|
+
this.coverageFormat = p2.uint16;
|
|
2122
|
+
if (this.coverageFormat === 1) {
|
|
2123
|
+
this.glyphCount = p2.uint16;
|
|
2124
|
+
this.glyphArray = [...new Array(this.glyphCount)].map(
|
|
2125
|
+
(_) => p2.uint16
|
|
2126
|
+
);
|
|
2127
|
+
}
|
|
2128
|
+
if (this.coverageFormat === 2) {
|
|
2129
|
+
this.rangeCount = p2.uint16;
|
|
2130
|
+
this.rangeRecords = [...new Array(this.rangeCount)].map(
|
|
2131
|
+
(_) => new CoverageRangeRecord(p2)
|
|
2132
|
+
);
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
class CoverageRangeRecord {
|
|
2137
|
+
constructor(p2) {
|
|
2138
|
+
this.startGlyphID = p2.uint16;
|
|
2139
|
+
this.endGlyphID = p2.uint16;
|
|
2140
|
+
this.startCoverageIndex = p2.uint16;
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
class ItemVariationStoreTable {
|
|
2144
|
+
constructor(table, p2) {
|
|
2145
|
+
this.table = table;
|
|
2146
|
+
this.parser = p2;
|
|
2147
|
+
this.start = p2.currentPosition;
|
|
2148
|
+
this.format = p2.uint16;
|
|
2149
|
+
this.variationRegionListOffset = p2.Offset32;
|
|
2150
|
+
this.itemVariationDataCount = p2.uint16;
|
|
2151
|
+
this.itemVariationDataOffsets = [
|
|
2152
|
+
...new Array(this.itemVariationDataCount)
|
|
2153
|
+
].map((_) => p2.Offset32);
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
class GDEF extends SimpleTable {
|
|
2157
|
+
constructor(dict, dataview) {
|
|
2158
|
+
const { p: p2 } = super(dict, dataview);
|
|
2159
|
+
this.majorVersion = p2.uint16;
|
|
2160
|
+
this.minorVersion = p2.uint16;
|
|
2161
|
+
this.glyphClassDefOffset = p2.Offset16;
|
|
2162
|
+
lazy$1(this, `glyphClassDefs`, () => {
|
|
2163
|
+
if (this.glyphClassDefOffset === 0) return void 0;
|
|
2164
|
+
p2.currentPosition = this.tableStart + this.glyphClassDefOffset;
|
|
2165
|
+
return new ClassDefinition(p2);
|
|
2166
|
+
});
|
|
2167
|
+
this.attachListOffset = p2.Offset16;
|
|
2168
|
+
lazy$1(this, `attachList`, () => {
|
|
2169
|
+
if (this.attachListOffset === 0) return void 0;
|
|
2170
|
+
p2.currentPosition = this.tableStart + this.attachListOffset;
|
|
2171
|
+
return new AttachList(p2);
|
|
2172
|
+
});
|
|
2173
|
+
this.ligCaretListOffset = p2.Offset16;
|
|
2174
|
+
lazy$1(this, `ligCaretList`, () => {
|
|
2175
|
+
if (this.ligCaretListOffset === 0) return void 0;
|
|
2176
|
+
p2.currentPosition = this.tableStart + this.ligCaretListOffset;
|
|
2177
|
+
return new LigCaretList(p2);
|
|
2178
|
+
});
|
|
2179
|
+
this.markAttachClassDefOffset = p2.Offset16;
|
|
2180
|
+
lazy$1(this, `markAttachClassDef`, () => {
|
|
2181
|
+
if (this.markAttachClassDefOffset === 0) return void 0;
|
|
2182
|
+
p2.currentPosition = this.tableStart + this.markAttachClassDefOffset;
|
|
2183
|
+
return new ClassDefinition(p2);
|
|
2184
|
+
});
|
|
2185
|
+
if (this.minorVersion >= 2) {
|
|
2186
|
+
this.markGlyphSetsDefOffset = p2.Offset16;
|
|
2187
|
+
lazy$1(this, `markGlyphSetsDef`, () => {
|
|
2188
|
+
if (this.markGlyphSetsDefOffset === 0) return void 0;
|
|
2189
|
+
p2.currentPosition = this.tableStart + this.markGlyphSetsDefOffset;
|
|
2190
|
+
return new MarkGlyphSetsTable(p2);
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2193
|
+
if (this.minorVersion === 3) {
|
|
2194
|
+
this.itemVarStoreOffset = p2.Offset32;
|
|
2195
|
+
lazy$1(this, `itemVarStore`, () => {
|
|
2196
|
+
if (this.itemVarStoreOffset === 0) return void 0;
|
|
2197
|
+
p2.currentPosition = this.tableStart + this.itemVarStoreOffset;
|
|
2198
|
+
return new ItemVariationStoreTable(p2);
|
|
2199
|
+
});
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
class AttachList extends ParsedData {
|
|
2204
|
+
constructor(p2) {
|
|
2205
|
+
super(p2);
|
|
2206
|
+
this.coverageOffset = p2.Offset16;
|
|
2207
|
+
this.glyphCount = p2.uint16;
|
|
2208
|
+
this.attachPointOffsets = [...new Array(this.glyphCount)].map(
|
|
2209
|
+
(_) => p2.Offset16
|
|
2210
|
+
);
|
|
2211
|
+
}
|
|
2212
|
+
getPoint(pointID) {
|
|
2213
|
+
this.parser.currentPosition = this.start + this.attachPointOffsets[pointID];
|
|
2214
|
+
return new AttachPoint(this.parser);
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
class AttachPoint {
|
|
2218
|
+
constructor(p2) {
|
|
2219
|
+
this.pointCount = p2.uint16;
|
|
2220
|
+
this.pointIndices = [...new Array(this.pointCount)].map(
|
|
2221
|
+
(_) => p2.uint16
|
|
2222
|
+
);
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
class LigCaretList extends ParsedData {
|
|
2226
|
+
constructor(p2) {
|
|
2227
|
+
super(p2);
|
|
2228
|
+
this.coverageOffset = p2.Offset16;
|
|
2229
|
+
lazy$1(this, `coverage`, () => {
|
|
2230
|
+
p2.currentPosition = this.start + this.coverageOffset;
|
|
2231
|
+
return new CoverageTable(p2);
|
|
2232
|
+
});
|
|
2233
|
+
this.ligGlyphCount = p2.uint16;
|
|
2234
|
+
this.ligGlyphOffsets = [...new Array(this.ligGlyphCount)].map(
|
|
2235
|
+
(_) => p2.Offset16
|
|
2236
|
+
);
|
|
2237
|
+
}
|
|
2238
|
+
getLigGlyph(ligGlyphID) {
|
|
2239
|
+
this.parser.currentPosition = this.start + this.ligGlyphOffsets[ligGlyphID];
|
|
2240
|
+
return new LigGlyph(this.parser);
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
class LigGlyph extends ParsedData {
|
|
2244
|
+
constructor(p2) {
|
|
2245
|
+
super(p2);
|
|
2246
|
+
this.caretCount = p2.uint16;
|
|
2247
|
+
this.caretValueOffsets = [...new Array(this.caretCount)].map(
|
|
2248
|
+
(_) => p2.Offset16
|
|
2249
|
+
);
|
|
2250
|
+
}
|
|
2251
|
+
getCaretValue(caretID) {
|
|
2252
|
+
this.parser.currentPosition = this.start + this.caretValueOffsets[caretID];
|
|
2253
|
+
return new CaretValue(this.parser);
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
class CaretValue {
|
|
2257
|
+
constructor(p2) {
|
|
2258
|
+
this.caretValueFormat = p2.uint16;
|
|
2259
|
+
if (this.caretValueFormat === 1) {
|
|
2260
|
+
this.coordinate = p2.int16;
|
|
2261
|
+
}
|
|
2262
|
+
if (this.caretValueFormat === 2) {
|
|
2263
|
+
this.caretValuePointIndex = p2.uint16;
|
|
2264
|
+
}
|
|
2265
|
+
if (this.caretValueFormat === 3) {
|
|
2266
|
+
this.coordinate = p2.int16;
|
|
2267
|
+
this.deviceOffset = p2.Offset16;
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
class MarkGlyphSetsTable extends ParsedData {
|
|
2272
|
+
constructor(p2) {
|
|
2273
|
+
super(p2);
|
|
2274
|
+
this.markGlyphSetTableFormat = p2.uint16;
|
|
2275
|
+
this.markGlyphSetCount = p2.uint16;
|
|
2276
|
+
this.coverageOffsets = [...new Array(this.markGlyphSetCount)].map(
|
|
2277
|
+
(_) => p2.Offset32
|
|
2278
|
+
);
|
|
2279
|
+
}
|
|
2280
|
+
getMarkGlyphSet(markGlyphSetID) {
|
|
2281
|
+
this.parser.currentPosition = this.start + this.coverageOffsets[markGlyphSetID];
|
|
2282
|
+
return new CoverageTable(this.parser);
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
var GDEF$1 = Object.freeze({ __proto__: null, GDEF });
|
|
2286
|
+
class ScriptList extends ParsedData {
|
|
2287
|
+
static EMPTY = { scriptCount: 0, scriptRecords: [] };
|
|
2288
|
+
constructor(p2) {
|
|
2289
|
+
super(p2);
|
|
2290
|
+
this.scriptCount = p2.uint16;
|
|
2291
|
+
this.scriptRecords = [...new Array(this.scriptCount)].map(
|
|
2292
|
+
(_) => new ScriptRecord(p2)
|
|
2293
|
+
);
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
class ScriptRecord {
|
|
2297
|
+
constructor(p2) {
|
|
2298
|
+
this.scriptTag = p2.tag;
|
|
2299
|
+
this.scriptOffset = p2.Offset16;
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
class ScriptTable extends ParsedData {
|
|
2303
|
+
constructor(p2) {
|
|
2304
|
+
super(p2);
|
|
2305
|
+
this.defaultLangSys = p2.Offset16;
|
|
2306
|
+
this.langSysCount = p2.uint16;
|
|
2307
|
+
this.langSysRecords = [...new Array(this.langSysCount)].map(
|
|
2308
|
+
(_) => new LangSysRecord(p2)
|
|
2309
|
+
);
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
class LangSysRecord {
|
|
2313
|
+
constructor(p2) {
|
|
2314
|
+
this.langSysTag = p2.tag;
|
|
2315
|
+
this.langSysOffset = p2.Offset16;
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
class LangSysTable {
|
|
2319
|
+
constructor(p2) {
|
|
2320
|
+
this.lookupOrder = p2.Offset16;
|
|
2321
|
+
this.requiredFeatureIndex = p2.uint16;
|
|
2322
|
+
this.featureIndexCount = p2.uint16;
|
|
2323
|
+
this.featureIndices = [...new Array(this.featureIndexCount)].map(
|
|
2324
|
+
(_) => p2.uint16
|
|
2325
|
+
);
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
class FeatureList extends ParsedData {
|
|
2329
|
+
static EMPTY = { featureCount: 0, featureRecords: [] };
|
|
2330
|
+
constructor(p2) {
|
|
2331
|
+
super(p2);
|
|
2332
|
+
this.featureCount = p2.uint16;
|
|
2333
|
+
this.featureRecords = [...new Array(this.featureCount)].map(
|
|
2334
|
+
(_) => new FeatureRecord(p2)
|
|
2335
|
+
);
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
class FeatureRecord {
|
|
2339
|
+
constructor(p2) {
|
|
2340
|
+
this.featureTag = p2.tag;
|
|
2341
|
+
this.featureOffset = p2.Offset16;
|
|
2342
|
+
}
|
|
2343
|
+
}
|
|
2344
|
+
class FeatureTable extends ParsedData {
|
|
2345
|
+
constructor(p2) {
|
|
2346
|
+
super(p2);
|
|
2347
|
+
this.featureParams = p2.Offset16;
|
|
2348
|
+
this.lookupIndexCount = p2.uint16;
|
|
2349
|
+
this.lookupListIndices = [...new Array(this.lookupIndexCount)].map(
|
|
2350
|
+
(_) => p2.uint16
|
|
2351
|
+
);
|
|
2352
|
+
}
|
|
2353
|
+
getFeatureParams() {
|
|
2354
|
+
if (this.featureParams > 0) {
|
|
2355
|
+
const p2 = this.parser;
|
|
2356
|
+
p2.currentPosition = this.start + this.featureParams;
|
|
2357
|
+
const tag = this.featureTag;
|
|
2358
|
+
if (tag === `size`) return new Size(p2);
|
|
2359
|
+
if (tag.startsWith(`cc`)) return new CharacterVariant(p2);
|
|
2360
|
+
if (tag.startsWith(`ss`)) return new StylisticSet(p2);
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
class CharacterVariant {
|
|
2365
|
+
constructor(p2) {
|
|
2366
|
+
this.format = p2.uint16;
|
|
2367
|
+
this.featUiLabelNameId = p2.uint16;
|
|
2368
|
+
this.featUiTooltipTextNameId = p2.uint16;
|
|
2369
|
+
this.sampleTextNameId = p2.uint16;
|
|
2370
|
+
this.numNamedParameters = p2.uint16;
|
|
2371
|
+
this.firstParamUiLabelNameId = p2.uint16;
|
|
2372
|
+
this.charCount = p2.uint16;
|
|
2373
|
+
this.character = [...new Array(this.charCount)].map(
|
|
2374
|
+
(_) => p2.uint24
|
|
2375
|
+
);
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
class Size {
|
|
2379
|
+
constructor(p2) {
|
|
2380
|
+
this.designSize = p2.uint16;
|
|
2381
|
+
this.subfamilyIdentifier = p2.uint16;
|
|
2382
|
+
this.subfamilyNameID = p2.uint16;
|
|
2383
|
+
this.smallEnd = p2.uint16;
|
|
2384
|
+
this.largeEnd = p2.uint16;
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
class StylisticSet {
|
|
2388
|
+
constructor(p2) {
|
|
2389
|
+
this.version = p2.uint16;
|
|
2390
|
+
this.UINameID = p2.uint16;
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
function undoCoverageOffsetParsing(instance) {
|
|
2394
|
+
instance.parser.currentPosition -= 2;
|
|
2395
|
+
delete instance.coverageOffset;
|
|
2396
|
+
delete instance.getCoverageTable;
|
|
2397
|
+
}
|
|
2398
|
+
class LookupType$1 extends ParsedData {
|
|
2399
|
+
constructor(p2) {
|
|
2400
|
+
super(p2);
|
|
2401
|
+
this.substFormat = p2.uint16;
|
|
2402
|
+
this.coverageOffset = p2.Offset16;
|
|
2403
|
+
}
|
|
2404
|
+
getCoverageTable() {
|
|
2405
|
+
let p2 = this.parser;
|
|
2406
|
+
p2.currentPosition = this.start + this.coverageOffset;
|
|
2407
|
+
return new CoverageTable(p2);
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
class SubstLookupRecord {
|
|
2411
|
+
constructor(p2) {
|
|
2412
|
+
this.glyphSequenceIndex = p2.uint16;
|
|
2413
|
+
this.lookupListIndex = p2.uint16;
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
class LookupType1$1 extends LookupType$1 {
|
|
2417
|
+
constructor(p2) {
|
|
2418
|
+
super(p2);
|
|
2419
|
+
this.deltaGlyphID = p2.int16;
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
class LookupType2$1 extends LookupType$1 {
|
|
2423
|
+
constructor(p2) {
|
|
2424
|
+
super(p2);
|
|
2425
|
+
this.sequenceCount = p2.uint16;
|
|
2426
|
+
this.sequenceOffsets = [...new Array(this.sequenceCount)].map(
|
|
2427
|
+
(_) => p2.Offset16
|
|
2428
|
+
);
|
|
2429
|
+
}
|
|
2430
|
+
getSequence(index) {
|
|
2431
|
+
let p2 = this.parser;
|
|
2432
|
+
p2.currentPosition = this.start + this.sequenceOffsets[index];
|
|
2433
|
+
return new SequenceTable(p2);
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
class SequenceTable {
|
|
2437
|
+
constructor(p2) {
|
|
2438
|
+
this.glyphCount = p2.uint16;
|
|
2439
|
+
this.substituteGlyphIDs = [...new Array(this.glyphCount)].map(
|
|
2440
|
+
(_) => p2.uint16
|
|
2441
|
+
);
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
class LookupType3$1 extends LookupType$1 {
|
|
2445
|
+
constructor(p2) {
|
|
2446
|
+
super(p2);
|
|
2447
|
+
this.alternateSetCount = p2.uint16;
|
|
2448
|
+
this.alternateSetOffsets = [
|
|
2449
|
+
...new Array(this.alternateSetCount)
|
|
2450
|
+
].map((_) => p2.Offset16);
|
|
2451
|
+
}
|
|
2452
|
+
getAlternateSet(index) {
|
|
2453
|
+
let p2 = this.parser;
|
|
2454
|
+
p2.currentPosition = this.start + this.alternateSetOffsets[index];
|
|
2455
|
+
return new AlternateSetTable(p2);
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
class AlternateSetTable {
|
|
2459
|
+
constructor(p2) {
|
|
2460
|
+
this.glyphCount = p2.uint16;
|
|
2461
|
+
this.alternateGlyphIDs = [...new Array(this.glyphCount)].map(
|
|
2462
|
+
(_) => p2.uint16
|
|
2463
|
+
);
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
class LookupType4$1 extends LookupType$1 {
|
|
2467
|
+
constructor(p2) {
|
|
2468
|
+
super(p2);
|
|
2469
|
+
this.ligatureSetCount = p2.uint16;
|
|
2470
|
+
this.ligatureSetOffsets = [...new Array(this.ligatureSetCount)].map(
|
|
2471
|
+
(_) => p2.Offset16
|
|
2472
|
+
);
|
|
2473
|
+
}
|
|
2474
|
+
getLigatureSet(index) {
|
|
2475
|
+
let p2 = this.parser;
|
|
2476
|
+
p2.currentPosition = this.start + this.ligatureSetOffsets[index];
|
|
2477
|
+
return new LigatureSetTable(p2);
|
|
2478
|
+
}
|
|
2479
|
+
}
|
|
2480
|
+
class LigatureSetTable extends ParsedData {
|
|
2481
|
+
constructor(p2) {
|
|
2482
|
+
super(p2);
|
|
2483
|
+
this.ligatureCount = p2.uint16;
|
|
2484
|
+
this.ligatureOffsets = [...new Array(this.ligatureCount)].map(
|
|
2485
|
+
(_) => p2.Offset16
|
|
2486
|
+
);
|
|
2487
|
+
}
|
|
2488
|
+
getLigature(index) {
|
|
2489
|
+
let p2 = this.parser;
|
|
2490
|
+
p2.currentPosition = this.start + this.ligatureOffsets[index];
|
|
2491
|
+
return new LigatureTable(p2);
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
class LigatureTable {
|
|
2495
|
+
constructor(p2) {
|
|
2496
|
+
this.ligatureGlyph = p2.uint16;
|
|
2497
|
+
this.componentCount = p2.uint16;
|
|
2498
|
+
this.componentGlyphIDs = [
|
|
2499
|
+
...new Array(this.componentCount - 1)
|
|
2500
|
+
].map((_) => p2.uint16);
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
class LookupType5$1 extends LookupType$1 {
|
|
2504
|
+
constructor(p2) {
|
|
2505
|
+
super(p2);
|
|
2506
|
+
if (this.substFormat === 1) {
|
|
2507
|
+
this.subRuleSetCount = p2.uint16;
|
|
2508
|
+
this.subRuleSetOffsets = [
|
|
2509
|
+
...new Array(this.subRuleSetCount)
|
|
2510
|
+
].map((_) => p2.Offset16);
|
|
2511
|
+
}
|
|
2512
|
+
if (this.substFormat === 2) {
|
|
2513
|
+
this.classDefOffset = p2.Offset16;
|
|
2514
|
+
this.subClassSetCount = p2.uint16;
|
|
2515
|
+
this.subClassSetOffsets = [
|
|
2516
|
+
...new Array(this.subClassSetCount)
|
|
2517
|
+
].map((_) => p2.Offset16);
|
|
2518
|
+
}
|
|
2519
|
+
if (this.substFormat === 3) {
|
|
2520
|
+
undoCoverageOffsetParsing(this);
|
|
2521
|
+
this.glyphCount = p2.uint16;
|
|
2522
|
+
this.substitutionCount = p2.uint16;
|
|
2523
|
+
this.coverageOffsets = [...new Array(this.glyphCount)].map(
|
|
2524
|
+
(_) => p2.Offset16
|
|
2525
|
+
);
|
|
2526
|
+
this.substLookupRecords = [
|
|
2527
|
+
...new Array(this.substitutionCount)
|
|
2528
|
+
].map((_) => new SubstLookupRecord(p2));
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
getSubRuleSet(index) {
|
|
2532
|
+
if (this.substFormat !== 1)
|
|
2533
|
+
throw new Error(
|
|
2534
|
+
`lookup type 5.${this.substFormat} has no subrule sets.`
|
|
2535
|
+
);
|
|
2536
|
+
let p2 = this.parser;
|
|
2537
|
+
p2.currentPosition = this.start + this.subRuleSetOffsets[index];
|
|
2538
|
+
return new SubRuleSetTable(p2);
|
|
2539
|
+
}
|
|
2540
|
+
getSubClassSet(index) {
|
|
2541
|
+
if (this.substFormat !== 2)
|
|
2542
|
+
throw new Error(
|
|
2543
|
+
`lookup type 5.${this.substFormat} has no subclass sets.`
|
|
2544
|
+
);
|
|
2545
|
+
let p2 = this.parser;
|
|
2546
|
+
p2.currentPosition = this.start + this.subClassSetOffsets[index];
|
|
2547
|
+
return new SubClassSetTable(p2);
|
|
2548
|
+
}
|
|
2549
|
+
getCoverageTable(index) {
|
|
2550
|
+
if (this.substFormat !== 3 && !index)
|
|
2551
|
+
return super.getCoverageTable();
|
|
2552
|
+
if (!index)
|
|
2553
|
+
throw new Error(
|
|
2554
|
+
`lookup type 5.${this.substFormat} requires an coverage table index.`
|
|
2555
|
+
);
|
|
2556
|
+
let p2 = this.parser;
|
|
2557
|
+
p2.currentPosition = this.start + this.coverageOffsets[index];
|
|
2558
|
+
return new CoverageTable(p2);
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
class SubRuleSetTable extends ParsedData {
|
|
2562
|
+
constructor(p2) {
|
|
2563
|
+
super(p2);
|
|
2564
|
+
this.subRuleCount = p2.uint16;
|
|
2565
|
+
this.subRuleOffsets = [...new Array(this.subRuleCount)].map(
|
|
2566
|
+
(_) => p2.Offset16
|
|
2567
|
+
);
|
|
2568
|
+
}
|
|
2569
|
+
getSubRule(index) {
|
|
2570
|
+
let p2 = this.parser;
|
|
2571
|
+
p2.currentPosition = this.start + this.subRuleOffsets[index];
|
|
2572
|
+
return new SubRuleTable(p2);
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
class SubRuleTable {
|
|
2576
|
+
constructor(p2) {
|
|
2577
|
+
this.glyphCount = p2.uint16;
|
|
2578
|
+
this.substitutionCount = p2.uint16;
|
|
2579
|
+
this.inputSequence = [...new Array(this.glyphCount - 1)].map(
|
|
2580
|
+
(_) => p2.uint16
|
|
2581
|
+
);
|
|
2582
|
+
this.substLookupRecords = [
|
|
2583
|
+
...new Array(this.substitutionCount)
|
|
2584
|
+
].map((_) => new SubstLookupRecord(p2));
|
|
2585
|
+
}
|
|
2586
|
+
}
|
|
2587
|
+
class SubClassSetTable extends ParsedData {
|
|
2588
|
+
constructor(p2) {
|
|
2589
|
+
super(p2);
|
|
2590
|
+
this.subClassRuleCount = p2.uint16;
|
|
2591
|
+
this.subClassRuleOffsets = [
|
|
2592
|
+
...new Array(this.subClassRuleCount)
|
|
2593
|
+
].map((_) => p2.Offset16);
|
|
2594
|
+
}
|
|
2595
|
+
getSubClass(index) {
|
|
2596
|
+
let p2 = this.parser;
|
|
2597
|
+
p2.currentPosition = this.start + this.subClassRuleOffsets[index];
|
|
2598
|
+
return new SubClassRuleTable(p2);
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
class SubClassRuleTable extends SubRuleTable {
|
|
2602
|
+
constructor(p2) {
|
|
2603
|
+
super(p2);
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
class LookupType6$1 extends LookupType$1 {
|
|
2607
|
+
constructor(p2) {
|
|
2608
|
+
super(p2);
|
|
2609
|
+
if (this.substFormat === 1) {
|
|
2610
|
+
this.chainSubRuleSetCount = p2.uint16;
|
|
2611
|
+
this.chainSubRuleSetOffsets = [
|
|
2612
|
+
...new Array(this.chainSubRuleSetCount)
|
|
2613
|
+
].map((_) => p2.Offset16);
|
|
2614
|
+
}
|
|
2615
|
+
if (this.substFormat === 2) {
|
|
2616
|
+
this.backtrackClassDefOffset = p2.Offset16;
|
|
2617
|
+
this.inputClassDefOffset = p2.Offset16;
|
|
2618
|
+
this.lookaheadClassDefOffset = p2.Offset16;
|
|
2619
|
+
this.chainSubClassSetCount = p2.uint16;
|
|
2620
|
+
this.chainSubClassSetOffsets = [
|
|
2621
|
+
...new Array(this.chainSubClassSetCount)
|
|
2622
|
+
].map((_) => p2.Offset16);
|
|
2623
|
+
}
|
|
2624
|
+
if (this.substFormat === 3) {
|
|
2625
|
+
undoCoverageOffsetParsing(this);
|
|
2626
|
+
this.backtrackGlyphCount = p2.uint16;
|
|
2627
|
+
this.backtrackCoverageOffsets = [
|
|
2628
|
+
...new Array(this.backtrackGlyphCount)
|
|
2629
|
+
].map((_) => p2.Offset16);
|
|
2630
|
+
this.inputGlyphCount = p2.uint16;
|
|
2631
|
+
this.inputCoverageOffsets = [
|
|
2632
|
+
...new Array(this.inputGlyphCount)
|
|
2633
|
+
].map((_) => p2.Offset16);
|
|
2634
|
+
this.lookaheadGlyphCount = p2.uint16;
|
|
2635
|
+
this.lookaheadCoverageOffsets = [
|
|
2636
|
+
...new Array(this.lookaheadGlyphCount)
|
|
2637
|
+
].map((_) => p2.Offset16);
|
|
2638
|
+
this.seqLookupCount = p2.uint16;
|
|
2639
|
+
this.seqLookupRecords = [
|
|
2640
|
+
...new Array(this.substitutionCount)
|
|
2641
|
+
].map((_) => new SequenceLookupRecord(p2));
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
getChainSubRuleSet(index) {
|
|
2645
|
+
if (this.substFormat !== 1)
|
|
2646
|
+
throw new Error(
|
|
2647
|
+
`lookup type 6.${this.substFormat} has no chainsubrule sets.`
|
|
2648
|
+
);
|
|
2649
|
+
let p2 = this.parser;
|
|
2650
|
+
p2.currentPosition = this.start + this.chainSubRuleSetOffsets[index];
|
|
2651
|
+
return new ChainSubRuleSetTable(p2);
|
|
2652
|
+
}
|
|
2653
|
+
getChainSubClassSet(index) {
|
|
2654
|
+
if (this.substFormat !== 2)
|
|
2655
|
+
throw new Error(
|
|
2656
|
+
`lookup type 6.${this.substFormat} has no chainsubclass sets.`
|
|
2657
|
+
);
|
|
2658
|
+
let p2 = this.parser;
|
|
2659
|
+
p2.currentPosition = this.start + this.chainSubClassSetOffsets[index];
|
|
2660
|
+
return new ChainSubClassSetTable(p2);
|
|
2661
|
+
}
|
|
2662
|
+
getCoverageFromOffset(offset) {
|
|
2663
|
+
if (this.substFormat !== 3)
|
|
2664
|
+
throw new Error(
|
|
2665
|
+
`lookup type 6.${this.substFormat} does not use contextual coverage offsets.`
|
|
2666
|
+
);
|
|
2667
|
+
let p2 = this.parser;
|
|
2668
|
+
p2.currentPosition = this.start + offset;
|
|
2669
|
+
return new CoverageTable(p2);
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
class ChainSubRuleSetTable extends ParsedData {
|
|
2673
|
+
constructor(p2) {
|
|
2674
|
+
super(p2);
|
|
2675
|
+
this.chainSubRuleCount = p2.uint16;
|
|
2676
|
+
this.chainSubRuleOffsets = [
|
|
2677
|
+
...new Array(this.chainSubRuleCount)
|
|
2678
|
+
].map((_) => p2.Offset16);
|
|
2679
|
+
}
|
|
2680
|
+
getSubRule(index) {
|
|
2681
|
+
let p2 = this.parser;
|
|
2682
|
+
p2.currentPosition = this.start + this.chainSubRuleOffsets[index];
|
|
2683
|
+
return new ChainSubRuleTable(p2);
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
class ChainSubRuleTable {
|
|
2687
|
+
constructor(p2) {
|
|
2688
|
+
this.backtrackGlyphCount = p2.uint16;
|
|
2689
|
+
this.backtrackSequence = [
|
|
2690
|
+
...new Array(this.backtrackGlyphCount)
|
|
2691
|
+
].map((_) => p2.uint16);
|
|
2692
|
+
this.inputGlyphCount = p2.uint16;
|
|
2693
|
+
this.inputSequence = [...new Array(this.inputGlyphCount - 1)].map(
|
|
2694
|
+
(_) => p2.uint16
|
|
2695
|
+
);
|
|
2696
|
+
this.lookaheadGlyphCount = p2.uint16;
|
|
2697
|
+
this.lookAheadSequence = [
|
|
2698
|
+
...new Array(this.lookAheadGlyphCount)
|
|
2699
|
+
].map((_) => p2.uint16);
|
|
2700
|
+
this.substitutionCount = p2.uint16;
|
|
2701
|
+
this.substLookupRecords = [...new Array(this.SubstCount)].map(
|
|
2702
|
+
(_) => new SubstLookupRecord(p2)
|
|
2703
|
+
);
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
class ChainSubClassSetTable extends ParsedData {
|
|
2707
|
+
constructor(p2) {
|
|
2708
|
+
super(p2);
|
|
2709
|
+
this.chainSubClassRuleCount = p2.uint16;
|
|
2710
|
+
this.chainSubClassRuleOffsets = [
|
|
2711
|
+
...new Array(this.chainSubClassRuleCount)
|
|
2712
|
+
].map((_) => p2.Offset16);
|
|
2713
|
+
}
|
|
2714
|
+
getSubClass(index) {
|
|
2715
|
+
let p2 = this.parser;
|
|
2716
|
+
p2.currentPosition = this.start + this.chainSubRuleOffsets[index];
|
|
2717
|
+
return new ChainSubClassRuleTable(p2);
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
class ChainSubClassRuleTable {
|
|
2721
|
+
constructor(p2) {
|
|
2722
|
+
this.backtrackGlyphCount = p2.uint16;
|
|
2723
|
+
this.backtrackSequence = [
|
|
2724
|
+
...new Array(this.backtrackGlyphCount)
|
|
2725
|
+
].map((_) => p2.uint16);
|
|
2726
|
+
this.inputGlyphCount = p2.uint16;
|
|
2727
|
+
this.inputSequence = [...new Array(this.inputGlyphCount - 1)].map(
|
|
2728
|
+
(_) => p2.uint16
|
|
2729
|
+
);
|
|
2730
|
+
this.lookaheadGlyphCount = p2.uint16;
|
|
2731
|
+
this.lookAheadSequence = [
|
|
2732
|
+
...new Array(this.lookAheadGlyphCount)
|
|
2733
|
+
].map((_) => p2.uint16);
|
|
2734
|
+
this.substitutionCount = p2.uint16;
|
|
2735
|
+
this.substLookupRecords = [
|
|
2736
|
+
...new Array(this.substitutionCount)
|
|
2737
|
+
].map((_) => new SequenceLookupRecord(p2));
|
|
2738
|
+
}
|
|
2739
|
+
}
|
|
2740
|
+
class SequenceLookupRecord extends ParsedData {
|
|
2741
|
+
constructor(p2) {
|
|
2742
|
+
super(p2);
|
|
2743
|
+
this.sequenceIndex = p2.uint16;
|
|
2744
|
+
this.lookupListIndex = p2.uint16;
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
class LookupType7$1 extends ParsedData {
|
|
2748
|
+
constructor(p2) {
|
|
2749
|
+
super(p2);
|
|
2750
|
+
this.substFormat = p2.uint16;
|
|
2751
|
+
this.extensionLookupType = p2.uint16;
|
|
2752
|
+
this.extensionOffset = p2.Offset32;
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2755
|
+
class LookupType8$1 extends LookupType$1 {
|
|
2756
|
+
constructor(p2) {
|
|
2757
|
+
super(p2);
|
|
2758
|
+
this.backtrackGlyphCount = p2.uint16;
|
|
2759
|
+
this.backtrackCoverageOffsets = [
|
|
2760
|
+
...new Array(this.backtrackGlyphCount)
|
|
2761
|
+
].map((_) => p2.Offset16);
|
|
2762
|
+
this.lookaheadGlyphCount = p2.uint16;
|
|
2763
|
+
this.lookaheadCoverageOffsets = [
|
|
2764
|
+
new Array(this.lookaheadGlyphCount)
|
|
2765
|
+
].map((_) => p2.Offset16);
|
|
2766
|
+
this.glyphCount = p2.uint16;
|
|
2767
|
+
this.substituteGlyphIDs = [...new Array(this.glyphCount)].map(
|
|
2768
|
+
(_) => p2.uint16
|
|
2769
|
+
);
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
var GSUBtables = {
|
|
2773
|
+
buildSubtable: function(type, p2) {
|
|
2774
|
+
const subtable = new [
|
|
2775
|
+
void 0,
|
|
2776
|
+
LookupType1$1,
|
|
2777
|
+
LookupType2$1,
|
|
2778
|
+
LookupType3$1,
|
|
2779
|
+
LookupType4$1,
|
|
2780
|
+
LookupType5$1,
|
|
2781
|
+
LookupType6$1,
|
|
2782
|
+
LookupType7$1,
|
|
2783
|
+
LookupType8$1
|
|
2784
|
+
][type](p2);
|
|
2785
|
+
subtable.type = type;
|
|
2786
|
+
return subtable;
|
|
2787
|
+
}
|
|
2788
|
+
};
|
|
2789
|
+
class LookupType extends ParsedData {
|
|
2790
|
+
constructor(p2) {
|
|
2791
|
+
super(p2);
|
|
2792
|
+
}
|
|
2793
|
+
}
|
|
2794
|
+
class LookupType1 extends LookupType {
|
|
2795
|
+
constructor(p2) {
|
|
2796
|
+
super(p2);
|
|
2797
|
+
console.log(`lookup type 1`);
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
class LookupType2 extends LookupType {
|
|
2801
|
+
constructor(p2) {
|
|
2802
|
+
super(p2);
|
|
2803
|
+
console.log(`lookup type 2`);
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
class LookupType3 extends LookupType {
|
|
2807
|
+
constructor(p2) {
|
|
2808
|
+
super(p2);
|
|
2809
|
+
console.log(`lookup type 3`);
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
class LookupType4 extends LookupType {
|
|
2813
|
+
constructor(p2) {
|
|
2814
|
+
super(p2);
|
|
2815
|
+
console.log(`lookup type 4`);
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
class LookupType5 extends LookupType {
|
|
2819
|
+
constructor(p2) {
|
|
2820
|
+
super(p2);
|
|
2821
|
+
console.log(`lookup type 5`);
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
class LookupType6 extends LookupType {
|
|
2825
|
+
constructor(p2) {
|
|
2826
|
+
super(p2);
|
|
2827
|
+
console.log(`lookup type 6`);
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
class LookupType7 extends LookupType {
|
|
2831
|
+
constructor(p2) {
|
|
2832
|
+
super(p2);
|
|
2833
|
+
console.log(`lookup type 7`);
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
class LookupType8 extends LookupType {
|
|
2837
|
+
constructor(p2) {
|
|
2838
|
+
super(p2);
|
|
2839
|
+
console.log(`lookup type 8`);
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
class LookupType9 extends LookupType {
|
|
2843
|
+
constructor(p2) {
|
|
2844
|
+
super(p2);
|
|
2845
|
+
console.log(`lookup type 9`);
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
var GPOStables = {
|
|
2849
|
+
buildSubtable: function(type, p2) {
|
|
2850
|
+
const subtable = new [
|
|
2851
|
+
void 0,
|
|
2852
|
+
LookupType1,
|
|
2853
|
+
LookupType2,
|
|
2854
|
+
LookupType3,
|
|
2855
|
+
LookupType4,
|
|
2856
|
+
LookupType5,
|
|
2857
|
+
LookupType6,
|
|
2858
|
+
LookupType7,
|
|
2859
|
+
LookupType8,
|
|
2860
|
+
LookupType9
|
|
2861
|
+
][type](p2);
|
|
2862
|
+
subtable.type = type;
|
|
2863
|
+
return subtable;
|
|
2864
|
+
}
|
|
2865
|
+
};
|
|
2866
|
+
class LookupList extends ParsedData {
|
|
2867
|
+
static EMPTY = { lookupCount: 0, lookups: [] };
|
|
2868
|
+
constructor(p2) {
|
|
2869
|
+
super(p2);
|
|
2870
|
+
this.lookupCount = p2.uint16;
|
|
2871
|
+
this.lookups = [...new Array(this.lookupCount)].map(
|
|
2872
|
+
(_) => p2.Offset16
|
|
2873
|
+
);
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
class LookupTable extends ParsedData {
|
|
2877
|
+
constructor(p2, type) {
|
|
2878
|
+
super(p2);
|
|
2879
|
+
this.ctType = type;
|
|
2880
|
+
this.lookupType = p2.uint16;
|
|
2881
|
+
this.lookupFlag = p2.uint16;
|
|
2882
|
+
this.subTableCount = p2.uint16;
|
|
2883
|
+
this.subtableOffsets = [...new Array(this.subTableCount)].map(
|
|
2884
|
+
(_) => p2.Offset16
|
|
2885
|
+
);
|
|
2886
|
+
this.markFilteringSet = p2.uint16;
|
|
2887
|
+
}
|
|
2888
|
+
get rightToLeft() {
|
|
2889
|
+
return this.lookupFlag & true;
|
|
2890
|
+
}
|
|
2891
|
+
get ignoreBaseGlyphs() {
|
|
2892
|
+
return this.lookupFlag & true;
|
|
2893
|
+
}
|
|
2894
|
+
get ignoreLigatures() {
|
|
2895
|
+
return this.lookupFlag & true;
|
|
2896
|
+
}
|
|
2897
|
+
get ignoreMarks() {
|
|
2898
|
+
return this.lookupFlag & true;
|
|
2899
|
+
}
|
|
2900
|
+
get useMarkFilteringSet() {
|
|
2901
|
+
return this.lookupFlag & true;
|
|
2902
|
+
}
|
|
2903
|
+
get markAttachmentType() {
|
|
2904
|
+
return this.lookupFlag & true;
|
|
2905
|
+
}
|
|
2906
|
+
getSubTable(index) {
|
|
2907
|
+
const builder = this.ctType === `GSUB` ? GSUBtables : GPOStables;
|
|
2908
|
+
this.parser.currentPosition = this.start + this.subtableOffsets[index];
|
|
2909
|
+
return builder.buildSubtable(this.lookupType, this.parser);
|
|
2910
|
+
}
|
|
2911
|
+
}
|
|
2912
|
+
class CommonLayoutTable extends SimpleTable {
|
|
2913
|
+
constructor(dict, dataview, name2) {
|
|
2914
|
+
const { p: p2, tableStart } = super(dict, dataview, name2);
|
|
2915
|
+
this.majorVersion = p2.uint16;
|
|
2916
|
+
this.minorVersion = p2.uint16;
|
|
2917
|
+
this.scriptListOffset = p2.Offset16;
|
|
2918
|
+
this.featureListOffset = p2.Offset16;
|
|
2919
|
+
this.lookupListOffset = p2.Offset16;
|
|
2920
|
+
if (this.majorVersion === 1 && this.minorVersion === 1) {
|
|
2921
|
+
this.featureVariationsOffset = p2.Offset32;
|
|
2922
|
+
}
|
|
2923
|
+
const no_content = !(this.scriptListOffset || this.featureListOffset || this.lookupListOffset);
|
|
2924
|
+
lazy$1(this, `scriptList`, () => {
|
|
2925
|
+
if (no_content) return ScriptList.EMPTY;
|
|
2926
|
+
p2.currentPosition = tableStart + this.scriptListOffset;
|
|
2927
|
+
return new ScriptList(p2);
|
|
2928
|
+
});
|
|
2929
|
+
lazy$1(this, `featureList`, () => {
|
|
2930
|
+
if (no_content) return FeatureList.EMPTY;
|
|
2931
|
+
p2.currentPosition = tableStart + this.featureListOffset;
|
|
2932
|
+
return new FeatureList(p2);
|
|
2933
|
+
});
|
|
2934
|
+
lazy$1(this, `lookupList`, () => {
|
|
2935
|
+
if (no_content) return LookupList.EMPTY;
|
|
2936
|
+
p2.currentPosition = tableStart + this.lookupListOffset;
|
|
2937
|
+
return new LookupList(p2);
|
|
2938
|
+
});
|
|
2939
|
+
if (this.featureVariationsOffset) {
|
|
2940
|
+
lazy$1(this, `featureVariations`, () => {
|
|
2941
|
+
if (no_content) return FeatureVariations.EMPTY;
|
|
2942
|
+
p2.currentPosition = tableStart + this.featureVariationsOffset;
|
|
2943
|
+
return new FeatureVariations(p2);
|
|
2944
|
+
});
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
getSupportedScripts() {
|
|
2948
|
+
return this.scriptList.scriptRecords.map((r) => r.scriptTag);
|
|
2949
|
+
}
|
|
2950
|
+
getScriptTable(scriptTag) {
|
|
2951
|
+
let record = this.scriptList.scriptRecords.find(
|
|
2952
|
+
(r) => r.scriptTag === scriptTag
|
|
2953
|
+
);
|
|
2954
|
+
this.parser.currentPosition = this.scriptList.start + record.scriptOffset;
|
|
2955
|
+
let table = new ScriptTable(this.parser);
|
|
2956
|
+
table.scriptTag = scriptTag;
|
|
2957
|
+
return table;
|
|
2958
|
+
}
|
|
2959
|
+
ensureScriptTable(arg) {
|
|
2960
|
+
if (typeof arg === "string") {
|
|
2961
|
+
return this.getScriptTable(arg);
|
|
2962
|
+
}
|
|
2963
|
+
return arg;
|
|
2964
|
+
}
|
|
2965
|
+
getSupportedLangSys(scriptTable) {
|
|
2966
|
+
scriptTable = this.ensureScriptTable(scriptTable);
|
|
2967
|
+
const hasDefault = scriptTable.defaultLangSys !== 0;
|
|
2968
|
+
const supported = scriptTable.langSysRecords.map(
|
|
2969
|
+
(l) => l.langSysTag
|
|
2970
|
+
);
|
|
2971
|
+
if (hasDefault) supported.unshift(`dflt`);
|
|
2972
|
+
return supported;
|
|
2973
|
+
}
|
|
2974
|
+
getDefaultLangSysTable(scriptTable) {
|
|
2975
|
+
scriptTable = this.ensureScriptTable(scriptTable);
|
|
2976
|
+
let offset = scriptTable.defaultLangSys;
|
|
2977
|
+
if (offset !== 0) {
|
|
2978
|
+
this.parser.currentPosition = scriptTable.start + offset;
|
|
2979
|
+
let table = new LangSysTable(this.parser);
|
|
2980
|
+
table.langSysTag = ``;
|
|
2981
|
+
table.defaultForScript = scriptTable.scriptTag;
|
|
2982
|
+
return table;
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2985
|
+
getLangSysTable(scriptTable, langSysTag = `dflt`) {
|
|
2986
|
+
if (langSysTag === `dflt`)
|
|
2987
|
+
return this.getDefaultLangSysTable(scriptTable);
|
|
2988
|
+
scriptTable = this.ensureScriptTable(scriptTable);
|
|
2989
|
+
let record = scriptTable.langSysRecords.find(
|
|
2990
|
+
(l) => l.langSysTag === langSysTag
|
|
2991
|
+
);
|
|
2992
|
+
this.parser.currentPosition = scriptTable.start + record.langSysOffset;
|
|
2993
|
+
let table = new LangSysTable(this.parser);
|
|
2994
|
+
table.langSysTag = langSysTag;
|
|
2995
|
+
return table;
|
|
2996
|
+
}
|
|
2997
|
+
getFeatures(langSysTable) {
|
|
2998
|
+
return langSysTable.featureIndices.map(
|
|
2999
|
+
(index) => this.getFeature(index)
|
|
3000
|
+
);
|
|
3001
|
+
}
|
|
3002
|
+
getFeature(indexOrTag) {
|
|
3003
|
+
let record;
|
|
3004
|
+
if (parseInt(indexOrTag) == indexOrTag) {
|
|
3005
|
+
record = this.featureList.featureRecords[indexOrTag];
|
|
3006
|
+
} else {
|
|
3007
|
+
record = this.featureList.featureRecords.find(
|
|
3008
|
+
(f) => f.featureTag === indexOrTag
|
|
3009
|
+
);
|
|
3010
|
+
}
|
|
3011
|
+
if (!record) return;
|
|
3012
|
+
this.parser.currentPosition = this.featureList.start + record.featureOffset;
|
|
3013
|
+
let table = new FeatureTable(this.parser);
|
|
3014
|
+
table.featureTag = record.featureTag;
|
|
3015
|
+
return table;
|
|
3016
|
+
}
|
|
3017
|
+
getLookups(featureTable) {
|
|
3018
|
+
return featureTable.lookupListIndices.map(
|
|
3019
|
+
(index) => this.getLookup(index)
|
|
3020
|
+
);
|
|
3021
|
+
}
|
|
3022
|
+
getLookup(lookupIndex, type) {
|
|
3023
|
+
let lookupOffset = this.lookupList.lookups[lookupIndex];
|
|
3024
|
+
this.parser.currentPosition = this.lookupList.start + lookupOffset;
|
|
3025
|
+
return new LookupTable(this.parser, type);
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
class GSUB extends CommonLayoutTable {
|
|
3029
|
+
constructor(dict, dataview) {
|
|
3030
|
+
super(dict, dataview, `GSUB`);
|
|
3031
|
+
}
|
|
3032
|
+
getLookup(lookupIndex) {
|
|
3033
|
+
return super.getLookup(lookupIndex, `GSUB`);
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
var GSUB$1 = Object.freeze({ __proto__: null, GSUB });
|
|
3037
|
+
class GPOS extends CommonLayoutTable {
|
|
3038
|
+
constructor(dict, dataview) {
|
|
3039
|
+
super(dict, dataview, `GPOS`);
|
|
3040
|
+
}
|
|
3041
|
+
getLookup(lookupIndex) {
|
|
3042
|
+
return super.getLookup(lookupIndex, `GPOS`);
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
var GPOS$1 = Object.freeze({ __proto__: null, GPOS });
|
|
3046
|
+
class SVG extends SimpleTable {
|
|
3047
|
+
constructor(dict, dataview) {
|
|
3048
|
+
const { p: p2 } = super(dict, dataview);
|
|
3049
|
+
this.version = p2.uint16;
|
|
3050
|
+
this.offsetToSVGDocumentList = p2.Offset32;
|
|
3051
|
+
p2.currentPosition = this.tableStart + this.offsetToSVGDocumentList;
|
|
3052
|
+
this.documentList = new SVGDocumentList(p2);
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
class SVGDocumentList extends ParsedData {
|
|
3056
|
+
constructor(p2) {
|
|
3057
|
+
super(p2);
|
|
3058
|
+
this.numEntries = p2.uint16;
|
|
3059
|
+
this.documentRecords = [...new Array(this.numEntries)].map(
|
|
3060
|
+
(_) => new SVGDocumentRecord(p2)
|
|
3061
|
+
);
|
|
3062
|
+
}
|
|
3063
|
+
getDocument(documentID) {
|
|
3064
|
+
let record = this.documentRecords[documentID];
|
|
3065
|
+
if (!record) return "";
|
|
3066
|
+
let offset = this.start + record.svgDocOffset;
|
|
3067
|
+
this.parser.currentPosition = offset;
|
|
3068
|
+
return this.parser.readBytes(record.svgDocLength);
|
|
3069
|
+
}
|
|
3070
|
+
getDocumentForGlyph(glyphID) {
|
|
3071
|
+
let id = this.documentRecords.findIndex(
|
|
3072
|
+
(d) => d.startGlyphID <= glyphID && glyphID <= d.endGlyphID
|
|
3073
|
+
);
|
|
3074
|
+
if (id === -1) return "";
|
|
3075
|
+
return this.getDocument(id);
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
class SVGDocumentRecord {
|
|
3079
|
+
constructor(p2) {
|
|
3080
|
+
this.startGlyphID = p2.uint16;
|
|
3081
|
+
this.endGlyphID = p2.uint16;
|
|
3082
|
+
this.svgDocOffset = p2.Offset32;
|
|
3083
|
+
this.svgDocLength = p2.uint32;
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
var SVG$1 = Object.freeze({ __proto__: null, SVG });
|
|
3087
|
+
class fvar extends SimpleTable {
|
|
3088
|
+
constructor(dict, dataview) {
|
|
3089
|
+
const { p: p2 } = super(dict, dataview);
|
|
3090
|
+
this.majorVersion = p2.uint16;
|
|
3091
|
+
this.minorVersion = p2.uint16;
|
|
3092
|
+
this.axesArrayOffset = p2.Offset16;
|
|
3093
|
+
p2.uint16;
|
|
3094
|
+
this.axisCount = p2.uint16;
|
|
3095
|
+
this.axisSize = p2.uint16;
|
|
3096
|
+
this.instanceCount = p2.uint16;
|
|
3097
|
+
this.instanceSize = p2.uint16;
|
|
3098
|
+
const axisStart = this.tableStart + this.axesArrayOffset;
|
|
3099
|
+
lazy$1(this, `axes`, () => {
|
|
3100
|
+
p2.currentPosition = axisStart;
|
|
3101
|
+
return [...new Array(this.axisCount)].map(
|
|
3102
|
+
(_) => new VariationAxisRecord(p2)
|
|
3103
|
+
);
|
|
3104
|
+
});
|
|
3105
|
+
const instanceStart = axisStart + this.axisCount * this.axisSize;
|
|
3106
|
+
lazy$1(this, `instances`, () => {
|
|
3107
|
+
let instances = [];
|
|
3108
|
+
for (let i = 0; i < this.instanceCount; i++) {
|
|
3109
|
+
p2.currentPosition = instanceStart + i * this.instanceSize;
|
|
3110
|
+
instances.push(
|
|
3111
|
+
new InstanceRecord(p2, this.axisCount, this.instanceSize)
|
|
3112
|
+
);
|
|
3113
|
+
}
|
|
3114
|
+
return instances;
|
|
3115
|
+
});
|
|
3116
|
+
}
|
|
3117
|
+
getSupportedAxes() {
|
|
3118
|
+
return this.axes.map((a) => a.tag);
|
|
3119
|
+
}
|
|
3120
|
+
getAxis(name2) {
|
|
3121
|
+
return this.axes.find((a) => a.tag === name2);
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
class VariationAxisRecord {
|
|
3125
|
+
constructor(p2) {
|
|
3126
|
+
this.tag = p2.tag;
|
|
3127
|
+
this.minValue = p2.fixed;
|
|
3128
|
+
this.defaultValue = p2.fixed;
|
|
3129
|
+
this.maxValue = p2.fixed;
|
|
3130
|
+
this.flags = p2.flags(16);
|
|
3131
|
+
this.axisNameID = p2.uint16;
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3134
|
+
class InstanceRecord {
|
|
3135
|
+
constructor(p2, axisCount, size) {
|
|
3136
|
+
let start = p2.currentPosition;
|
|
3137
|
+
this.subfamilyNameID = p2.uint16;
|
|
3138
|
+
p2.uint16;
|
|
3139
|
+
this.coordinates = [...new Array(axisCount)].map(
|
|
3140
|
+
(_) => p2.fixed
|
|
3141
|
+
);
|
|
3142
|
+
if (p2.currentPosition - start < size) {
|
|
3143
|
+
this.postScriptNameID = p2.uint16;
|
|
3144
|
+
}
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
var fvar$1 = Object.freeze({ __proto__: null, fvar });
|
|
3148
|
+
class cvt extends SimpleTable {
|
|
3149
|
+
constructor(dict, dataview) {
|
|
3150
|
+
const { p: p2 } = super(dict, dataview);
|
|
3151
|
+
const n = dict.length / 2;
|
|
3152
|
+
lazy$1(
|
|
3153
|
+
this,
|
|
3154
|
+
`items`,
|
|
3155
|
+
() => [...new Array(n)].map((_) => p2.fword)
|
|
3156
|
+
);
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
var cvt$1 = Object.freeze({ __proto__: null, cvt });
|
|
3160
|
+
class fpgm extends SimpleTable {
|
|
3161
|
+
constructor(dict, dataview) {
|
|
3162
|
+
const { p: p2 } = super(dict, dataview);
|
|
3163
|
+
lazy$1(
|
|
3164
|
+
this,
|
|
3165
|
+
`instructions`,
|
|
3166
|
+
() => [...new Array(dict.length)].map((_) => p2.uint8)
|
|
3167
|
+
);
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
var fpgm$1 = Object.freeze({ __proto__: null, fpgm });
|
|
3171
|
+
class gasp extends SimpleTable {
|
|
3172
|
+
constructor(dict, dataview) {
|
|
3173
|
+
const { p: p2 } = super(dict, dataview);
|
|
3174
|
+
this.version = p2.uint16;
|
|
3175
|
+
this.numRanges = p2.uint16;
|
|
3176
|
+
const getter = () => [...new Array(this.numRanges)].map(
|
|
3177
|
+
(_) => new GASPRange(p2)
|
|
3178
|
+
);
|
|
3179
|
+
lazy$1(this, `gaspRanges`, getter);
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3182
|
+
class GASPRange {
|
|
3183
|
+
constructor(p2) {
|
|
3184
|
+
this.rangeMaxPPEM = p2.uint16;
|
|
3185
|
+
this.rangeGaspBehavior = p2.uint16;
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
var gasp$1 = Object.freeze({ __proto__: null, gasp });
|
|
3189
|
+
class glyf extends SimpleTable {
|
|
3190
|
+
constructor(dict, dataview) {
|
|
3191
|
+
super(dict, dataview);
|
|
3192
|
+
}
|
|
3193
|
+
getGlyphData(offset, length) {
|
|
3194
|
+
this.parser.currentPosition = this.tableStart + offset;
|
|
3195
|
+
return this.parser.readBytes(length);
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3198
|
+
var glyf$1 = Object.freeze({ __proto__: null, glyf });
|
|
3199
|
+
class loca extends SimpleTable {
|
|
3200
|
+
constructor(dict, dataview, tables) {
|
|
3201
|
+
const { p: p2 } = super(dict, dataview);
|
|
3202
|
+
const n = tables.maxp.numGlyphs + 1;
|
|
3203
|
+
if (tables.head.indexToLocFormat === 0) {
|
|
3204
|
+
this.x2 = true;
|
|
3205
|
+
lazy$1(
|
|
3206
|
+
this,
|
|
3207
|
+
`offsets`,
|
|
3208
|
+
() => [...new Array(n)].map((_) => p2.Offset16)
|
|
3209
|
+
);
|
|
3210
|
+
} else {
|
|
3211
|
+
lazy$1(
|
|
3212
|
+
this,
|
|
3213
|
+
`offsets`,
|
|
3214
|
+
() => [...new Array(n)].map((_) => p2.Offset32)
|
|
3215
|
+
);
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
getGlyphDataOffsetAndLength(glyphID) {
|
|
3219
|
+
let offset = this.offsets[glyphID] * this.x2 ? 2 : 1;
|
|
3220
|
+
let nextOffset = this.offsets[glyphID + 1] * this.x2 ? 2 : 1;
|
|
3221
|
+
return { offset, length: nextOffset - offset };
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
3224
|
+
var loca$1 = Object.freeze({ __proto__: null, loca });
|
|
3225
|
+
class prep extends SimpleTable {
|
|
3226
|
+
constructor(dict, dataview) {
|
|
3227
|
+
const { p: p2 } = super(dict, dataview);
|
|
3228
|
+
lazy$1(
|
|
3229
|
+
this,
|
|
3230
|
+
`instructions`,
|
|
3231
|
+
() => [...new Array(dict.length)].map((_) => p2.uint8)
|
|
3232
|
+
);
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
var prep$1 = Object.freeze({ __proto__: null, prep });
|
|
3236
|
+
class CFF extends SimpleTable {
|
|
3237
|
+
constructor(dict, dataview) {
|
|
3238
|
+
const { p: p2 } = super(dict, dataview);
|
|
3239
|
+
lazy$1(this, `data`, () => p2.readBytes());
|
|
3240
|
+
}
|
|
3241
|
+
}
|
|
3242
|
+
var CFF$1 = Object.freeze({ __proto__: null, CFF });
|
|
3243
|
+
class CFF2 extends SimpleTable {
|
|
3244
|
+
constructor(dict, dataview) {
|
|
3245
|
+
const { p: p2 } = super(dict, dataview);
|
|
3246
|
+
lazy$1(this, `data`, () => p2.readBytes());
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
var CFF2$1 = Object.freeze({ __proto__: null, CFF2 });
|
|
3250
|
+
class VORG extends SimpleTable {
|
|
3251
|
+
constructor(dict, dataview) {
|
|
3252
|
+
const { p: p2 } = super(dict, dataview);
|
|
3253
|
+
this.majorVersion = p2.uint16;
|
|
3254
|
+
this.minorVersion = p2.uint16;
|
|
3255
|
+
this.defaultVertOriginY = p2.int16;
|
|
3256
|
+
this.numVertOriginYMetrics = p2.uint16;
|
|
3257
|
+
lazy$1(
|
|
3258
|
+
this,
|
|
3259
|
+
`vertORiginYMetrics`,
|
|
3260
|
+
() => [...new Array(this.numVertOriginYMetrics)].map(
|
|
3261
|
+
(_) => new VertOriginYMetric(p2)
|
|
3262
|
+
)
|
|
3263
|
+
);
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
class VertOriginYMetric {
|
|
3267
|
+
constructor(p2) {
|
|
3268
|
+
this.glyphIndex = p2.uint16;
|
|
3269
|
+
this.vertOriginY = p2.int16;
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3272
|
+
var VORG$1 = Object.freeze({ __proto__: null, VORG });
|
|
3273
|
+
class BitmapSize {
|
|
3274
|
+
constructor(p2) {
|
|
3275
|
+
this.indexSubTableArrayOffset = p2.Offset32;
|
|
3276
|
+
this.indexTablesSize = p2.uint32;
|
|
3277
|
+
this.numberofIndexSubTables = p2.uint32;
|
|
3278
|
+
this.colorRef = p2.uint32;
|
|
3279
|
+
this.hori = new SbitLineMetrics(p2);
|
|
3280
|
+
this.vert = new SbitLineMetrics(p2);
|
|
3281
|
+
this.startGlyphIndex = p2.uint16;
|
|
3282
|
+
this.endGlyphIndex = p2.uint16;
|
|
3283
|
+
this.ppemX = p2.uint8;
|
|
3284
|
+
this.ppemY = p2.uint8;
|
|
3285
|
+
this.bitDepth = p2.uint8;
|
|
3286
|
+
this.flags = p2.int8;
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3289
|
+
class BitmapScale {
|
|
3290
|
+
constructor(p2) {
|
|
3291
|
+
this.hori = new SbitLineMetrics(p2);
|
|
3292
|
+
this.vert = new SbitLineMetrics(p2);
|
|
3293
|
+
this.ppemX = p2.uint8;
|
|
3294
|
+
this.ppemY = p2.uint8;
|
|
3295
|
+
this.substitutePpemX = p2.uint8;
|
|
3296
|
+
this.substitutePpemY = p2.uint8;
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
class SbitLineMetrics {
|
|
3300
|
+
constructor(p2) {
|
|
3301
|
+
this.ascender = p2.int8;
|
|
3302
|
+
this.descender = p2.int8;
|
|
3303
|
+
this.widthMax = p2.uint8;
|
|
3304
|
+
this.caretSlopeNumerator = p2.int8;
|
|
3305
|
+
this.caretSlopeDenominator = p2.int8;
|
|
3306
|
+
this.caretOffset = p2.int8;
|
|
3307
|
+
this.minOriginSB = p2.int8;
|
|
3308
|
+
this.minAdvanceSB = p2.int8;
|
|
3309
|
+
this.maxBeforeBL = p2.int8;
|
|
3310
|
+
this.minAfterBL = p2.int8;
|
|
3311
|
+
this.pad1 = p2.int8;
|
|
3312
|
+
this.pad2 = p2.int8;
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
class EBLC extends SimpleTable {
|
|
3316
|
+
constructor(dict, dataview, name2) {
|
|
3317
|
+
const { p: p2 } = super(dict, dataview, name2);
|
|
3318
|
+
this.majorVersion = p2.uint16;
|
|
3319
|
+
this.minorVersion = p2.uint16;
|
|
3320
|
+
this.numSizes = p2.uint32;
|
|
3321
|
+
lazy$1(
|
|
3322
|
+
this,
|
|
3323
|
+
`bitMapSizes`,
|
|
3324
|
+
() => [...new Array(this.numSizes)].map(
|
|
3325
|
+
(_) => new BitmapSize(p2)
|
|
3326
|
+
)
|
|
3327
|
+
);
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
var EBLC$1 = Object.freeze({ __proto__: null, EBLC });
|
|
3331
|
+
class EBDT extends SimpleTable {
|
|
3332
|
+
constructor(dict, dataview, name2) {
|
|
3333
|
+
const { p: p2 } = super(dict, dataview, name2);
|
|
3334
|
+
this.majorVersion = p2.uint16;
|
|
3335
|
+
this.minorVersion = p2.uint16;
|
|
3336
|
+
}
|
|
3337
|
+
}
|
|
3338
|
+
var EBDT$1 = Object.freeze({ __proto__: null, EBDT });
|
|
3339
|
+
class EBSC extends SimpleTable {
|
|
3340
|
+
constructor(dict, dataview) {
|
|
3341
|
+
const { p: p2 } = super(dict, dataview);
|
|
3342
|
+
this.majorVersion = p2.uint16;
|
|
3343
|
+
this.minorVersion = p2.uint16;
|
|
3344
|
+
this.numSizes = p2.uint32;
|
|
3345
|
+
lazy$1(
|
|
3346
|
+
this,
|
|
3347
|
+
`bitmapScales`,
|
|
3348
|
+
() => [...new Array(this.numSizes)].map(
|
|
3349
|
+
(_) => new BitmapScale(p2)
|
|
3350
|
+
)
|
|
3351
|
+
);
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
var EBSC$1 = Object.freeze({ __proto__: null, EBSC });
|
|
3355
|
+
class CBLC extends EBLC {
|
|
3356
|
+
constructor(dict, dataview) {
|
|
3357
|
+
super(dict, dataview, `CBLC`);
|
|
3358
|
+
}
|
|
3359
|
+
}
|
|
3360
|
+
var CBLC$1 = Object.freeze({ __proto__: null, CBLC });
|
|
3361
|
+
class CBDT extends EBDT {
|
|
3362
|
+
constructor(dict, dataview) {
|
|
3363
|
+
super(dict, dataview, `CBDT`);
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
var CBDT$1 = Object.freeze({ __proto__: null, CBDT });
|
|
3367
|
+
class sbix extends SimpleTable {
|
|
3368
|
+
constructor(dict, dataview) {
|
|
3369
|
+
const { p: p2 } = super(dict, dataview);
|
|
3370
|
+
this.version = p2.uint16;
|
|
3371
|
+
this.flags = p2.flags(16);
|
|
3372
|
+
this.numStrikes = p2.uint32;
|
|
3373
|
+
lazy$1(
|
|
3374
|
+
this,
|
|
3375
|
+
`strikeOffsets`,
|
|
3376
|
+
() => [...new Array(this.numStrikes)].map((_) => p2.Offset32)
|
|
3377
|
+
);
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
var sbix$1 = Object.freeze({ __proto__: null, sbix });
|
|
3381
|
+
class COLR extends SimpleTable {
|
|
3382
|
+
constructor(dict, dataview) {
|
|
3383
|
+
const { p: p2 } = super(dict, dataview);
|
|
3384
|
+
this.version = p2.uint16;
|
|
3385
|
+
this.numBaseGlyphRecords = p2.uint16;
|
|
3386
|
+
this.baseGlyphRecordsOffset = p2.Offset32;
|
|
3387
|
+
this.layerRecordsOffset = p2.Offset32;
|
|
3388
|
+
this.numLayerRecords = p2.uint16;
|
|
3389
|
+
}
|
|
3390
|
+
getBaseGlyphRecord(glyphID) {
|
|
3391
|
+
let start = this.tableStart + this.baseGlyphRecordsOffset;
|
|
3392
|
+
this.parser.currentPosition = start;
|
|
3393
|
+
let first = new BaseGlyphRecord(this.parser);
|
|
3394
|
+
let firstID = first.gID;
|
|
3395
|
+
let end = this.tableStart + this.layerRecordsOffset - 6;
|
|
3396
|
+
this.parser.currentPosition = end;
|
|
3397
|
+
let last = new BaseGlyphRecord(this.parser);
|
|
3398
|
+
let lastID = last.gID;
|
|
3399
|
+
if (firstID === glyphID) return first;
|
|
3400
|
+
if (lastID === glyphID) return last;
|
|
3401
|
+
while (true) {
|
|
3402
|
+
if (start === end) break;
|
|
3403
|
+
let mid = start + (end - start) / 12;
|
|
3404
|
+
this.parser.currentPosition = mid;
|
|
3405
|
+
let middle = new BaseGlyphRecord(this.parser);
|
|
3406
|
+
let midID = middle.gID;
|
|
3407
|
+
if (midID === glyphID) return middle;
|
|
3408
|
+
else if (midID > glyphID) {
|
|
3409
|
+
end = mid;
|
|
3410
|
+
} else if (midID < glyphID) {
|
|
3411
|
+
start = mid;
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3414
|
+
return false;
|
|
3415
|
+
}
|
|
3416
|
+
getLayers(glyphID) {
|
|
3417
|
+
let record = this.getBaseGlyphRecord(glyphID);
|
|
3418
|
+
this.parser.currentPosition = this.tableStart + this.layerRecordsOffset + 4 * record.firstLayerIndex;
|
|
3419
|
+
return [...new Array(record.numLayers)].map(
|
|
3420
|
+
(_) => new LayerRecord(p)
|
|
3421
|
+
);
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
class BaseGlyphRecord {
|
|
3425
|
+
constructor(p2) {
|
|
3426
|
+
this.gID = p2.uint16;
|
|
3427
|
+
this.firstLayerIndex = p2.uint16;
|
|
3428
|
+
this.numLayers = p2.uint16;
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
class LayerRecord {
|
|
3432
|
+
constructor(p2) {
|
|
3433
|
+
this.gID = p2.uint16;
|
|
3434
|
+
this.paletteIndex = p2.uint16;
|
|
3435
|
+
}
|
|
3436
|
+
}
|
|
3437
|
+
var COLR$1 = Object.freeze({ __proto__: null, COLR });
|
|
3438
|
+
class CPAL extends SimpleTable {
|
|
3439
|
+
constructor(dict, dataview) {
|
|
3440
|
+
const { p: p2 } = super(dict, dataview);
|
|
3441
|
+
this.version = p2.uint16;
|
|
3442
|
+
this.numPaletteEntries = p2.uint16;
|
|
3443
|
+
const numPalettes = this.numPalettes = p2.uint16;
|
|
3444
|
+
this.numColorRecords = p2.uint16;
|
|
3445
|
+
this.offsetFirstColorRecord = p2.Offset32;
|
|
3446
|
+
this.colorRecordIndices = [...new Array(this.numPalettes)].map(
|
|
3447
|
+
(_) => p2.uint16
|
|
3448
|
+
);
|
|
3449
|
+
lazy$1(this, `colorRecords`, () => {
|
|
3450
|
+
p2.currentPosition = this.tableStart + this.offsetFirstColorRecord;
|
|
3451
|
+
return [...new Array(this.numColorRecords)].map(
|
|
3452
|
+
(_) => new ColorRecord(p2)
|
|
3453
|
+
);
|
|
3454
|
+
});
|
|
3455
|
+
if (this.version === 1) {
|
|
3456
|
+
this.offsetPaletteTypeArray = p2.Offset32;
|
|
3457
|
+
this.offsetPaletteLabelArray = p2.Offset32;
|
|
3458
|
+
this.offsetPaletteEntryLabelArray = p2.Offset32;
|
|
3459
|
+
lazy$1(this, `paletteTypeArray`, () => {
|
|
3460
|
+
p2.currentPosition = this.tableStart + this.offsetPaletteTypeArray;
|
|
3461
|
+
return new PaletteTypeArray(p2, numPalettes);
|
|
3462
|
+
});
|
|
3463
|
+
lazy$1(this, `paletteLabelArray`, () => {
|
|
3464
|
+
p2.currentPosition = this.tableStart + this.offsetPaletteLabelArray;
|
|
3465
|
+
return new PaletteLabelsArray(p2, numPalettes);
|
|
3466
|
+
});
|
|
3467
|
+
lazy$1(this, `paletteEntryLabelArray`, () => {
|
|
3468
|
+
p2.currentPosition = this.tableStart + this.offsetPaletteEntryLabelArray;
|
|
3469
|
+
return new PaletteEntryLabelArray(p2, numPalettes);
|
|
3470
|
+
});
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
}
|
|
3474
|
+
class ColorRecord {
|
|
3475
|
+
constructor(p2) {
|
|
3476
|
+
this.blue = p2.uint8;
|
|
3477
|
+
this.green = p2.uint8;
|
|
3478
|
+
this.red = p2.uint8;
|
|
3479
|
+
this.alpha = p2.uint8;
|
|
3480
|
+
}
|
|
3481
|
+
}
|
|
3482
|
+
class PaletteTypeArray {
|
|
3483
|
+
constructor(p2, numPalettes) {
|
|
3484
|
+
this.paletteTypes = [...new Array(numPalettes)].map(
|
|
3485
|
+
(_) => p2.uint32
|
|
3486
|
+
);
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
class PaletteLabelsArray {
|
|
3490
|
+
constructor(p2, numPalettes) {
|
|
3491
|
+
this.paletteLabels = [...new Array(numPalettes)].map(
|
|
3492
|
+
(_) => p2.uint16
|
|
3493
|
+
);
|
|
3494
|
+
}
|
|
3495
|
+
}
|
|
3496
|
+
class PaletteEntryLabelArray {
|
|
3497
|
+
constructor(p2, numPalettes) {
|
|
3498
|
+
this.paletteEntryLabels = [...new Array(numPalettes)].map(
|
|
3499
|
+
(_) => p2.uint16
|
|
3500
|
+
);
|
|
3501
|
+
}
|
|
3502
|
+
}
|
|
3503
|
+
var CPAL$1 = Object.freeze({ __proto__: null, CPAL });
|
|
3504
|
+
class DSIG extends SimpleTable {
|
|
3505
|
+
constructor(dict, dataview) {
|
|
3506
|
+
const { p: p2 } = super(dict, dataview);
|
|
3507
|
+
this.version = p2.uint32;
|
|
3508
|
+
this.numSignatures = p2.uint16;
|
|
3509
|
+
this.flags = p2.uint16;
|
|
3510
|
+
this.signatureRecords = [...new Array(this.numSignatures)].map(
|
|
3511
|
+
(_) => new SignatureRecord(p2)
|
|
3512
|
+
);
|
|
3513
|
+
}
|
|
3514
|
+
getData(signatureID) {
|
|
3515
|
+
const record = this.signatureRecords[signatureID];
|
|
3516
|
+
this.parser.currentPosition = this.tableStart + record.offset;
|
|
3517
|
+
return new SignatureBlockFormat1(this.parser);
|
|
3518
|
+
}
|
|
3519
|
+
}
|
|
3520
|
+
class SignatureRecord {
|
|
3521
|
+
constructor(p2) {
|
|
3522
|
+
this.format = p2.uint32;
|
|
3523
|
+
this.length = p2.uint32;
|
|
3524
|
+
this.offset = p2.Offset32;
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3527
|
+
class SignatureBlockFormat1 {
|
|
3528
|
+
constructor(p2) {
|
|
3529
|
+
p2.uint16;
|
|
3530
|
+
p2.uint16;
|
|
3531
|
+
this.signatureLength = p2.uint32;
|
|
3532
|
+
this.signature = p2.readBytes(this.signatureLength);
|
|
3533
|
+
}
|
|
3534
|
+
}
|
|
3535
|
+
var DSIG$1 = Object.freeze({ __proto__: null, DSIG });
|
|
3536
|
+
class hdmx extends SimpleTable {
|
|
3537
|
+
constructor(dict, dataview, tables) {
|
|
3538
|
+
const { p: p2 } = super(dict, dataview);
|
|
3539
|
+
const numGlyphs = tables.hmtx.numGlyphs;
|
|
3540
|
+
this.version = p2.uint16;
|
|
3541
|
+
this.numRecords = p2.int16;
|
|
3542
|
+
this.sizeDeviceRecord = p2.int32;
|
|
3543
|
+
this.records = [...new Array(numRecords)].map(
|
|
3544
|
+
(_) => new DeviceRecord(p2, numGlyphs)
|
|
3545
|
+
);
|
|
3546
|
+
}
|
|
3547
|
+
}
|
|
3548
|
+
class DeviceRecord {
|
|
3549
|
+
constructor(p2, numGlyphs) {
|
|
3550
|
+
this.pixelSize = p2.uint8;
|
|
3551
|
+
this.maxWidth = p2.uint8;
|
|
3552
|
+
this.widths = p2.readBytes(numGlyphs);
|
|
3553
|
+
}
|
|
3554
|
+
}
|
|
3555
|
+
var hdmx$1 = Object.freeze({ __proto__: null, hdmx });
|
|
3556
|
+
class kern extends SimpleTable {
|
|
3557
|
+
constructor(dict, dataview) {
|
|
3558
|
+
const { p: p2 } = super(dict, dataview);
|
|
3559
|
+
this.version = p2.uint16;
|
|
3560
|
+
this.nTables = p2.uint16;
|
|
3561
|
+
lazy$1(this, `tables`, () => {
|
|
3562
|
+
let offset = this.tableStart + 4;
|
|
3563
|
+
const tables = [];
|
|
3564
|
+
for (let i = 0; i < this.nTables; i++) {
|
|
3565
|
+
p2.currentPosition = offset;
|
|
3566
|
+
let subtable = new KernSubTable(p2);
|
|
3567
|
+
tables.push(subtable);
|
|
3568
|
+
offset += subtable;
|
|
3569
|
+
}
|
|
3570
|
+
return tables;
|
|
3571
|
+
});
|
|
3572
|
+
}
|
|
3573
|
+
}
|
|
3574
|
+
class KernSubTable {
|
|
3575
|
+
constructor(p2) {
|
|
3576
|
+
this.version = p2.uint16;
|
|
3577
|
+
this.length = p2.uint16;
|
|
3578
|
+
this.coverage = p2.flags(8);
|
|
3579
|
+
this.format = p2.uint8;
|
|
3580
|
+
if (this.format === 0) {
|
|
3581
|
+
this.nPairs = p2.uint16;
|
|
3582
|
+
this.searchRange = p2.uint16;
|
|
3583
|
+
this.entrySelector = p2.uint16;
|
|
3584
|
+
this.rangeShift = p2.uint16;
|
|
3585
|
+
lazy$1(
|
|
3586
|
+
this,
|
|
3587
|
+
`pairs`,
|
|
3588
|
+
() => [...new Array(this.nPairs)].map((_) => new Pair(p2))
|
|
3589
|
+
);
|
|
3590
|
+
}
|
|
3591
|
+
if (this.format === 2) {
|
|
3592
|
+
console.warn(
|
|
3593
|
+
`Kern subtable format 2 is not supported: this parser currently only parses universal table data.`
|
|
3594
|
+
);
|
|
3595
|
+
}
|
|
3596
|
+
}
|
|
3597
|
+
get horizontal() {
|
|
3598
|
+
return this.coverage[0];
|
|
3599
|
+
}
|
|
3600
|
+
get minimum() {
|
|
3601
|
+
return this.coverage[1];
|
|
3602
|
+
}
|
|
3603
|
+
get crossstream() {
|
|
3604
|
+
return this.coverage[2];
|
|
3605
|
+
}
|
|
3606
|
+
get override() {
|
|
3607
|
+
return this.coverage[3];
|
|
3608
|
+
}
|
|
3609
|
+
}
|
|
3610
|
+
class Pair {
|
|
3611
|
+
constructor(p2) {
|
|
3612
|
+
this.left = p2.uint16;
|
|
3613
|
+
this.right = p2.uint16;
|
|
3614
|
+
this.value = p2.fword;
|
|
3615
|
+
}
|
|
3616
|
+
}
|
|
3617
|
+
var kern$1 = Object.freeze({ __proto__: null, kern });
|
|
3618
|
+
class LTSH extends SimpleTable {
|
|
3619
|
+
constructor(dict, dataview) {
|
|
3620
|
+
const { p: p2 } = super(dict, dataview);
|
|
3621
|
+
this.version = p2.uint16;
|
|
3622
|
+
this.numGlyphs = p2.uint16;
|
|
3623
|
+
this.yPels = p2.readBytes(this.numGlyphs);
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
var LTSH$1 = Object.freeze({ __proto__: null, LTSH });
|
|
3627
|
+
class MERG extends SimpleTable {
|
|
3628
|
+
constructor(dict, dataview) {
|
|
3629
|
+
const { p: p2 } = super(dict, dataview);
|
|
3630
|
+
this.version = p2.uint16;
|
|
3631
|
+
this.mergeClassCount = p2.uint16;
|
|
3632
|
+
this.mergeDataOffset = p2.Offset16;
|
|
3633
|
+
this.classDefCount = p2.uint16;
|
|
3634
|
+
this.offsetToClassDefOffsets = p2.Offset16;
|
|
3635
|
+
lazy$1(
|
|
3636
|
+
this,
|
|
3637
|
+
`mergeEntryMatrix`,
|
|
3638
|
+
() => [...new Array(this.mergeClassCount)].map(
|
|
3639
|
+
(_) => p2.readBytes(this.mergeClassCount)
|
|
3640
|
+
)
|
|
3641
|
+
);
|
|
3642
|
+
console.warn(`Full MERG parsing is currently not supported.`);
|
|
3643
|
+
console.warn(
|
|
3644
|
+
`If you need this table parsed, please file an issue, or better yet, a PR.`
|
|
3645
|
+
);
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
var MERG$1 = Object.freeze({ __proto__: null, MERG });
|
|
3649
|
+
class meta extends SimpleTable {
|
|
3650
|
+
constructor(dict, dataview) {
|
|
3651
|
+
const { p: p2 } = super(dict, dataview);
|
|
3652
|
+
this.version = p2.uint32;
|
|
3653
|
+
this.flags = p2.uint32;
|
|
3654
|
+
p2.uint32;
|
|
3655
|
+
this.dataMapsCount = p2.uint32;
|
|
3656
|
+
this.dataMaps = [...new Array(this.dataMapsCount)].map(
|
|
3657
|
+
(_) => new DataMap(this.tableStart, p2)
|
|
3658
|
+
);
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
class DataMap {
|
|
3662
|
+
constructor(tableStart, p2) {
|
|
3663
|
+
this.tableStart = tableStart;
|
|
3664
|
+
this.parser = p2;
|
|
3665
|
+
this.tag = p2.tag;
|
|
3666
|
+
this.dataOffset = p2.Offset32;
|
|
3667
|
+
this.dataLength = p2.uint32;
|
|
3668
|
+
}
|
|
3669
|
+
getData() {
|
|
3670
|
+
this.parser.currentField = this.tableStart + this.dataOffset;
|
|
3671
|
+
return this.parser.readBytes(this.dataLength);
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
3674
|
+
var meta$1 = Object.freeze({ __proto__: null, meta });
|
|
3675
|
+
class PCLT extends SimpleTable {
|
|
3676
|
+
constructor(dict, dataview) {
|
|
3677
|
+
super(dict, dataview);
|
|
3678
|
+
console.warn(
|
|
3679
|
+
`This font uses a PCLT table, which is currently not supported by this parser.`
|
|
3680
|
+
);
|
|
3681
|
+
console.warn(
|
|
3682
|
+
`If you need this table parsed, please file an issue, or better yet, a PR.`
|
|
3683
|
+
);
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
var PCLT$1 = Object.freeze({ __proto__: null, PCLT });
|
|
3687
|
+
class VDMX extends SimpleTable {
|
|
3688
|
+
constructor(dict, dataview) {
|
|
3689
|
+
const { p: p2 } = super(dict, dataview);
|
|
3690
|
+
this.version = p2.uint16;
|
|
3691
|
+
this.numRecs = p2.uint16;
|
|
3692
|
+
this.numRatios = p2.uint16;
|
|
3693
|
+
this.ratRanges = [...new Array(this.numRatios)].map(
|
|
3694
|
+
(_) => new RatioRange(p2)
|
|
3695
|
+
);
|
|
3696
|
+
this.offsets = [...new Array(this.numRatios)].map(
|
|
3697
|
+
(_) => p2.Offset16
|
|
3698
|
+
);
|
|
3699
|
+
this.VDMXGroups = [...new Array(this.numRecs)].map(
|
|
3700
|
+
(_) => new VDMXGroup(p2)
|
|
3701
|
+
);
|
|
3702
|
+
}
|
|
3703
|
+
}
|
|
3704
|
+
class RatioRange {
|
|
3705
|
+
constructor(p2) {
|
|
3706
|
+
this.bCharSet = p2.uint8;
|
|
3707
|
+
this.xRatio = p2.uint8;
|
|
3708
|
+
this.yStartRatio = p2.uint8;
|
|
3709
|
+
this.yEndRatio = p2.uint8;
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
class VDMXGroup {
|
|
3713
|
+
constructor(p2) {
|
|
3714
|
+
this.recs = p2.uint16;
|
|
3715
|
+
this.startsz = p2.uint8;
|
|
3716
|
+
this.endsz = p2.uint8;
|
|
3717
|
+
this.records = [...new Array(this.recs)].map(
|
|
3718
|
+
(_) => new vTable(p2)
|
|
3719
|
+
);
|
|
3720
|
+
}
|
|
3721
|
+
}
|
|
3722
|
+
class vTable {
|
|
3723
|
+
constructor(p2) {
|
|
3724
|
+
this.yPelHeight = p2.uint16;
|
|
3725
|
+
this.yMax = p2.int16;
|
|
3726
|
+
this.yMin = p2.int16;
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3729
|
+
var VDMX$1 = Object.freeze({ __proto__: null, VDMX });
|
|
3730
|
+
class vhea extends SimpleTable {
|
|
3731
|
+
constructor(dict, dataview) {
|
|
3732
|
+
const { p: p2 } = super(dict, dataview);
|
|
3733
|
+
this.version = p2.fixed;
|
|
3734
|
+
this.ascent = this.vertTypoAscender = p2.int16;
|
|
3735
|
+
this.descent = this.vertTypoDescender = p2.int16;
|
|
3736
|
+
this.lineGap = this.vertTypoLineGap = p2.int16;
|
|
3737
|
+
this.advanceHeightMax = p2.int16;
|
|
3738
|
+
this.minTopSideBearing = p2.int16;
|
|
3739
|
+
this.minBottomSideBearing = p2.int16;
|
|
3740
|
+
this.yMaxExtent = p2.int16;
|
|
3741
|
+
this.caretSlopeRise = p2.int16;
|
|
3742
|
+
this.caretSlopeRun = p2.int16;
|
|
3743
|
+
this.caretOffset = p2.int16;
|
|
3744
|
+
this.reserved = p2.int16;
|
|
3745
|
+
this.reserved = p2.int16;
|
|
3746
|
+
this.reserved = p2.int16;
|
|
3747
|
+
this.reserved = p2.int16;
|
|
3748
|
+
this.metricDataFormat = p2.int16;
|
|
3749
|
+
this.numOfLongVerMetrics = p2.uint16;
|
|
3750
|
+
p2.verifyLength();
|
|
3751
|
+
}
|
|
3752
|
+
}
|
|
3753
|
+
var vhea$1 = Object.freeze({ __proto__: null, vhea });
|
|
3754
|
+
class vmtx extends SimpleTable {
|
|
3755
|
+
constructor(dict, dataview, tables) {
|
|
3756
|
+
super(dict, dataview);
|
|
3757
|
+
const numOfLongVerMetrics = tables.vhea.numOfLongVerMetrics;
|
|
3758
|
+
const numGlyphs = tables.maxp.numGlyphs;
|
|
3759
|
+
const metricsStart = p.currentPosition;
|
|
3760
|
+
lazy(this, `vMetrics`, () => {
|
|
3761
|
+
p.currentPosition = metricsStart;
|
|
3762
|
+
return [...new Array(numOfLongVerMetrics)].map(
|
|
3763
|
+
(_) => new LongVertMetric(p.uint16, p.int16)
|
|
3764
|
+
);
|
|
3765
|
+
});
|
|
3766
|
+
if (numOfLongVerMetrics < numGlyphs) {
|
|
3767
|
+
const tsbStart = metricsStart + numOfLongVerMetrics * 4;
|
|
3768
|
+
lazy(this, `topSideBearings`, () => {
|
|
3769
|
+
p.currentPosition = tsbStart;
|
|
3770
|
+
return [...new Array(numGlyphs - numOfLongVerMetrics)].map(
|
|
3771
|
+
(_) => p.int16
|
|
3772
|
+
);
|
|
3773
|
+
});
|
|
3774
|
+
}
|
|
3775
|
+
}
|
|
3776
|
+
}
|
|
3777
|
+
class LongVertMetric {
|
|
3778
|
+
constructor(h, b) {
|
|
3779
|
+
this.advanceHeight = h;
|
|
3780
|
+
this.topSideBearing = b;
|
|
3781
|
+
}
|
|
3782
|
+
}
|
|
3783
|
+
var vmtx$1 = Object.freeze({ __proto__: null, vmtx });
|
|
3784
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
3785
|
+
0 && (module.exports = {
|
|
3786
|
+
Font
|
|
3787
|
+
});
|
|
3788
|
+
//# sourceMappingURL=lib-font.browser.js.map
|