decocms 4.161.2 → 4.162.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-DkjWcZD-.js → AlertCircle-LCxBCJ8n.js} +1 -1
- package/dist/client/assets/{AreaChart-BhkonnRg.js → AreaChart-CVlhdmdg.js} +1 -1
- package/dist/client/assets/{ArrowUp-DAA8boPY.js → ArrowUp-LFRKHLuQ.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-D8TPuRuJ.js → ArrowUpRight-CXMFqfGp.js} +1 -1
- package/dist/client/assets/{Check-De5xpJ0K.js → Check-BCFAcmIa.js} +1 -1
- package/dist/client/assets/{CheckCircle-DeJIdYYq.js → CheckCircle-DpOD9rH0.js} +1 -1
- package/dist/client/assets/{ChevronDown-grOM3xSX.js → ChevronDown-BOvaCVzg.js} +1 -1
- package/dist/client/assets/{ChevronRight-Cyogjxfm.js → ChevronRight-liTksB2U.js} +1 -1
- package/dist/client/assets/{ChevronUp-DIUedEx1.js → ChevronUp-BIqoKMUJ.js} +1 -1
- package/dist/client/assets/{Copy01-DEkTleE-.js → Copy01-ZIMiAxdP.js} +1 -1
- package/dist/client/assets/{CpuChip01-Dsk680MX.js → CpuChip01-ZsmfFXVO.js} +1 -1
- package/dist/client/assets/{DotsVertical-BaMvQPx5.js → DotsVertical-CtO9eku7.js} +1 -1
- package/dist/client/assets/{Eye-DdzBJpW0.js → Eye-BQWYf35S.js} +1 -1
- package/dist/client/assets/{FilterLines-1IFdHyBL.js → FilterLines-CaGojimS.js} +1 -1
- package/dist/client/assets/{HardDrive-CZF0RiCb.js → HardDrive-BRyCfhBH.js} +1 -1
- package/dist/client/assets/{Key01-qFWWm7I0.js → Key01-i8xg5eM3.js} +1 -1
- package/dist/client/assets/{LayoutLeft-D3dfvOJc.js → LayoutLeft-Co2_iLon.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BUH7ViZX.js → LinkExternal01-S8dAjzzi.js} +1 -1
- package/dist/client/assets/{LogOut01-GO407ARs.js → LogOut01-D75UBZCc.js} +1 -1
- package/dist/client/assets/{Monitor01-BBb-96JI.js → Monitor01-BAx1QWFz.js} +1 -1
- package/dist/client/assets/{Palette-G-qrN-IT.js → Palette-Bg3YC03V.js} +1 -1
- package/dist/client/assets/{Play-CkvF8PeT.js → Play-VIp82r5R.js} +1 -1
- package/dist/client/assets/{Plus-DolMQAo4.js → Plus-C9hAZmdY.js} +1 -1
- package/dist/client/assets/{SearchLg-CFQzg9fN.js → SearchLg-CqGEHAUM.js} +1 -1
- package/dist/client/assets/{SearchMd-DCX7P32_.js → SearchMd-oPsBet0y.js} +1 -1
- package/dist/client/assets/{Settings02-QFTejQVV.js → Settings02-DNMfHyCE.js} +1 -1
- package/dist/client/assets/{Shield01-BlitQe4N.js → Shield01-DD8XMdYI.js} +1 -1
- package/dist/client/assets/{Star01-D0qlrfqR.js → Star01-y2n-9wTn.js} +1 -1
- package/dist/client/assets/{Stars01-2TnupN6q.js → Stars01-CJ0QEEdc.js} +1 -1
- package/dist/client/assets/{Stars02-DbK2oBak.js → Stars02-B3TWh8au.js} +1 -1
- package/dist/client/assets/{Sun-DVajpqnC.js → Sun-BQEYQLhf.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-DY4K5cqR.js → SwitchHorizontal01-Dsxsamxe.js} +1 -1
- package/dist/client/assets/{Tool01-CgtDQOgO.js → Tool01-Oew-Vovb.js} +1 -1
- package/dist/client/assets/{Tool02-MSwzSxke.js → Tool02-CJeM1QZT.js} +1 -1
- package/dist/client/assets/{Trash01-DSxLTY0P.js → Trash01-CLRqp8e5.js} +1 -1
- package/dist/client/assets/{TrendUp01-djHA1GEE.js → TrendUp01-Bm1SbHN0.js} +1 -1
- package/dist/client/assets/{Upload01-W82kShpH.js → Upload01-ZVOuhs4w.js} +1 -1
- package/dist/client/assets/{User01-CXTn_TP5.js → User01-BYLEai7_.js} +1 -1
- package/dist/client/assets/{Users01-DQVb_7oO.js → Users01-CS4W313X.js} +1 -1
- package/dist/client/assets/{Users03-DK2c0NaU.js → Users03-CbHaoSh0.js} +1 -1
- package/dist/client/assets/{X-DsGAzzV8.js → X-x99fWfG-.js} +1 -1
- package/dist/client/assets/{XCircle-DuADiFVm.js → XCircle-CeqmuHIK.js} +1 -1
- package/dist/client/assets/{XClose-BOYWq1vy.js → XClose-CCug5seG.js} +1 -1
- package/dist/client/assets/{Zap-Djw_FpdI.js → Zap-DHqCvvjt.js} +1 -1
- package/dist/client/assets/{ZapSquare-C3s49zNL.js → ZapSquare-BKWVL4uR.js} +1 -1
- package/dist/client/assets/{access-gate-BRcWAcEH.js → access-gate-C9PFWoZS.js} +1 -1
- package/dist/client/assets/{add-section-modal-DkaZh9cy.js → add-section-modal-DEjIe-XG.js} +1 -1
- package/dist/client/assets/{agent-icon-D0etPDkN.js → agent-icon-DR5LB4zY.js} +1 -1
- package/dist/client/assets/{agents-list-1nArnMzn.js → agents-list-BvXD__fr.js} +1 -1
- package/dist/client/assets/{ai-providers-XeksWCKW.js → ai-providers-DuMestUx.js} +1 -1
- package/dist/client/assets/{alert-I-_PUhRM.js → alert-DWAFMZWl.js} +1 -1
- package/dist/client/assets/{alert-dialog-B3JnEiZT.js → alert-dialog-DR9_FciR.js} +1 -1
- package/dist/client/assets/{app-editor-BbkYtqwi.js → app-editor-BC28cPFO.js} +1 -1
- package/dist/client/assets/{auth-BkcPrlSH.js → auth-BiMrtm96.js} +1 -1
- package/dist/client/assets/{auth-catchall-JZDu0xii.js → auth-catchall-BNPPREMt.js} +1 -1
- package/dist/client/assets/{auth-entry-D376ANc2.js → auth-entry-CVJjeL2L.js} +1 -1
- package/dist/client/assets/{auth-split-layout-DULW70yu.js → auth-split-layout-CbPO57v5.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-DZxhoF_0.js → authenticate-and-persist-oauth-B8SUVbil.js} +1 -1
- package/dist/client/assets/{automation-list-row-y5_hhf0p.js → automation-list-row-C5X09Iy0.js} +1 -1
- package/dist/client/assets/{automation-runs-DNqF8MQa.js → automation-runs-i1Rm2H_V.js} +1 -1
- package/dist/client/assets/{automations-BTGiuB5f.js → automations-C48IGjrC.js} +1 -1
- package/dist/client/assets/{avatar-ShBwmidu.js → avatar-CssB4IS0.js} +1 -1
- package/dist/client/assets/{badge-CLGDkcax.js → badge-B-S2iO6e.js} +1 -1
- package/dist/client/assets/{block-document-DKkHndgg.js → block-document-Dotg4_gG.js} +1 -1
- package/dist/client/assets/{brand-context-DidwD5g4.js → brand-context-C331P1EH.js} +1 -1
- package/dist/client/assets/{buckets-BXy6rRmD.js → buckets-zt_s5mti.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-Pp9TOqgP.js → bulk-category-panel-DMe3EujP.js} +1 -1
- package/dist/client/assets/{calendar-BcaXLcUe.js → calendar-BO4sgiAT.js} +1 -1
- package/dist/client/assets/{capability-load-error-CqdQPRYW.js → capability-load-error-B2CpoAHd.js} +1 -1
- package/dist/client/assets/{card-C98b87L-.js → card-Dtd81GX2.js} +1 -1
- package/dist/client/assets/{category-editor-BnVhTkaR.js → category-editor-BxdNiDrW.js} +1 -1
- package/dist/client/assets/{chat-context-DAYV5YFw.js → chat-context-_ugV5jB0.js} +1 -1
- package/dist/client/assets/{checkbox-hx3qwtU4.js → checkbox-DyL6jqNP.js} +1 -1
- package/dist/client/assets/{cli-auth-success-CSA4lo7W.js → cli-auth-success-CBllfpZy.js} +1 -1
- package/dist/client/assets/{collection-detail-Dnt_8ShC.js → collection-detail-CJ-IT8lZ.js} +1 -1
- package/dist/client/assets/{collection-display-button-D7ZFqgmc.js → collection-display-button-rIB9x9ex.js} +1 -1
- package/dist/client/assets/{collection-search-BujcF3uz.js → collection-search-DDaBoxpd.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-Dxzi1B76.js → collection-table-wrapper-DvDVvjdJ.js} +1 -1
- package/dist/client/assets/{collection-tabs-1Doa_k8q.js → collection-tabs-6ZZEGxA4.js} +1 -1
- package/dist/client/assets/{command-DTif1pCh.js → command-B0sPw5D_.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-CkLAXxz7.js → commerce-onboarding-CA2gNg1f.js} +1 -1
- package/dist/client/assets/{companions-core-DyTSbEDy.js → companions-core-bB24Ott2.js} +1 -1
- package/dist/client/assets/{connect-BQJsmY0Z.js → connect-dTZGddot.js} +1 -1
- package/dist/client/assets/{connection-DT5hjP5L.js → connection-B2NXk64E.js} +1 -1
- package/dist/client/assets/{connection-card-BEnBoaJQ.js → connection-card-D4yqc7qp.js} +1 -1
- package/dist/client/assets/{connection-detail-3HClPo6D.js → connection-detail-BNv09xz3.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-D1M4SXKF.js → connection-form-helpers-Dp2JRmtQ.js} +1 -1
- package/dist/client/assets/{connections-ok4_lFFO.js → connections-Dkp0iGo0.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-Z3wBsgik.js → decopilot-sse-pool-tfgrlddF.js} +1 -1
- package/dist/client/assets/{dialog-B1XOtEFa.js → dialog-DDV9hxrK.js} +1 -1
- package/dist/client/assets/{domain-settings-BX-8JSGW.js → domain-settings-Cj5IWEJw.js} +1 -1
- package/dist/client/assets/{drawer-Bindqbrh.js → drawer-CLLhxT0A.js} +1 -1
- package/dist/client/assets/{dropdown-menu-B2utwqdh.js → dropdown-menu-DFyP7pd-.js} +1 -1
- package/dist/client/assets/{empty-state-ClLU6296.js → empty-state-C8MJdBfO.js} +1 -1
- package/dist/client/assets/{extract-connection-data-DSg0AjMi.js → extract-connection-data-GzPEHPIn.js} +1 -1
- package/dist/client/assets/{file-explorer-5gFVDcag.js → file-explorer-DcVPQshc.js} +1 -1
- package/dist/client/assets/{form-ujVSU6EU.js → form-dL4WOA5T.js} +1 -1
- package/dist/client/assets/{general-BgWx-5sJ.js → general-6LKGbmPX.js} +1 -1
- package/dist/client/assets/{github-repo-picker-CuyTuY6S.js → github-repo-picker-BYme-j8T.js} +1 -1
- package/dist/client/assets/{hooks-BSzBu2tD.js → hooks-B9cPFqGD.js} +1 -1
- package/dist/client/assets/{index-Cx7SoZn_.js → index-60s5nmmz.js} +1 -1
- package/dist/client/assets/{index-DLYm4Sa-.js → index-BBd4FRXS.js} +1 -1
- package/dist/client/assets/{index-BwQT5Hhi.js → index-By7P3hhU.js} +1 -1
- package/dist/client/assets/{index-Bhxc2Isb.js → index-D2YLDCkn.js} +1 -1
- package/dist/client/assets/{index-B6q32zYz.js → index-DeVgWfhn.js} +1 -1
- package/dist/client/assets/{index-CBD4gVZR.js → index-Y9ucfh4p.js} +1 -1
- package/dist/client/assets/{index-DvtCTmmx.js → index-ZADPN4om.js} +3 -3
- package/dist/client/assets/{index-DyrZQfe8.js → index-jG87093U.js} +1 -1
- package/dist/client/assets/{index-WEdfBcak.js → index-kfiIPtrP.js} +3 -3
- package/dist/client/assets/{index-PxBIb6oF.js → index-pBoO89BO.js} +1 -1
- package/dist/client/assets/{index-redirect-CzO62sP0.js → index-redirect-CfBCt2ky.js} +1 -1
- package/dist/client/assets/{index-DJEeCuky.js → index-u1ajTG-j.js} +5 -5
- package/dist/client/assets/{input-psV6HQEl.js → input-BjlpMnRZ.js} +1 -1
- package/dist/client/assets/{integration-icon-DjHXNUPP.js → integration-icon-CI602PfH.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-CB5VBjiU.js → invite-member-dialog-phqD0XUF.js} +1 -1
- package/dist/client/assets/{label-6xyucx-s.js → label-CSNgMmTA.js} +1 -1
- package/dist/client/assets/{layout-CBOg45xC.js → layout-BBpcfaXL.js} +1 -1
- package/dist/client/assets/{login-Cxn9KXio.js → login-DE_463fT.js} +1 -1
- package/dist/client/assets/{mcp-oauth-CKixkOtS.js → mcp-oauth-CxvR2V5h.js} +1 -1
- package/dist/client/assets/{members-CL8x8Krr.js → members-CeatJR1m.js} +1 -1
- package/dist/client/assets/{monaco-editor-DJpDPKHP.js → monaco-editor-zuz4s4Wv.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-DPROMALt.js → monitoring-stats-row-krDWXB2t.js} +1 -1
- package/dist/client/assets/{multi-select-Bh_v-l_m.js → multi-select-CMyA49eR.js} +1 -1
- package/dist/client/assets/{oauth-callback-DutuJ6V_.js → oauth-callback-C9jDdjjs.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-C4S55pOq.js → oauth-callback-ai-provider-CY3QZi7E.js} +1 -1
- package/dist/client/assets/{onboarding-DuerzaiT.js → onboarding-C3hOUjMo.js} +1 -1
- package/dist/client/assets/{org-layout-of8A1jAC.js → org-layout-XwuOFG3d.js} +1 -1
- package/dist/client/assets/{organization-choice-B3rPtstm.js → organization-choice-BM-XKanD.js} +1 -1
- package/dist/client/assets/{orgs-3twuRrYh.js → orgs-DmL2XQRI.js} +1 -1
- package/dist/client/assets/{page-seo-form-BY3nYdel.js → page-seo-form-0xV6qNbu.js} +1 -1
- package/dist/client/assets/{popover-BGrrSZ8M.js → popover-EE72qx8A.js} +1 -1
- package/dist/client/assets/{post-editor-C4XyjEMt.js → post-editor-BuHJ7HnN.js} +1 -1
- package/dist/client/assets/{primitives-CbLkj1JF.js → primitives-ChQICk_y.js} +1 -1
- package/dist/client/assets/{profile-QV2jNue9.js → profile-B0SoUvj9.js} +1 -1
- package/dist/client/assets/project-app-view-YTx3iCq1.js +1 -0
- package/dist/client/assets/record-editor-M7bvrOuK.js +1 -0
- package/dist/client/assets/{redirect-editor-s6PMTrlX.js → redirect-editor-_6dVoePs.js} +1 -1
- package/dist/client/assets/registry-fNrz9Fbw.js +2 -0
- package/dist/client/assets/{registry-layout-DO-5mJZI.js → registry-layout-OS_nbWHC.js} +1 -1
- package/dist/client/assets/{reports-CwFf2f6b.js → reports-B3VBQs5Y.js} +1 -1
- package/dist/client/assets/{require-capability-BeOopecx.js → require-capability-CieeBdjs.js} +1 -1
- package/dist/client/assets/{required-auth-layout-BFWyMRf5.js → required-auth-layout-BDIyJAhL.js} +1 -1
- package/dist/client/assets/{reset-password-C_-lQlSH.js → reset-password-CpG0cI8F.js} +1 -1
- package/dist/client/assets/{roles-D_oBaje3.js → roles-DlOhY5JD.js} +1 -1
- package/dist/client/assets/{search-input-Bfg6VxQW.js → search-input-cF6ciAVZ.js} +1 -1
- package/dist/client/assets/{secrets-k2GFZysm.js → secrets-Dh26lP0l.js} +1 -1
- package/dist/client/assets/{sections-editor-BujDptuZ.js → sections-editor-HbcASmu4.js} +1 -1
- package/dist/client/assets/{select-CWMyLghp.js → select-ceaThfRJ.js} +1 -1
- package/dist/client/assets/{select-model-CXvd3jI3.js → select-model-CDLnPEtQ.js} +1 -1
- package/dist/client/assets/{self-tool-result-BpCEaqPw.js → self-tool-result-CaPtQwDV.js} +1 -1
- package/dist/client/assets/{seo-editor-Cxh8JRxE.js → seo-editor-CoW5u7nN.js} +1 -1
- package/dist/client/assets/{settings-layout-D-wc3B9V.js → settings-layout-CM35yCas.js} +1 -1
- package/dist/client/assets/{settings-section-Z9R6HthO.js → settings-section-BJKYi71q.js} +1 -1
- package/dist/client/assets/{shell-controls-DJv-74jc.js → shell-controls-BLKKFd-i.js} +1 -1
- package/dist/client/assets/{shell-layout-C7_zhx2J.js → shell-layout-Cem8gTbL.js} +1 -1
- package/dist/client/assets/{sidebar-CGksZnes.js → sidebar-4JG4Ky1v.js} +1 -1
- package/dist/client/assets/{skeleton-BpfjGmFh.js → skeleton-QaXxQA1G.js} +1 -1
- package/dist/client/assets/{spinner-D0HY4fdO.js → spinner-CyUVcOie.js} +1 -1
- package/dist/client/assets/{sso-Bz5k2CGO.js → sso-CCHd62CO.js} +1 -1
- package/dist/client/assets/{store-DT_Iylxw.js → store-lf3dlAB1.js} +1 -1
- package/dist/client/assets/store-registry-BTA3Me55.js +2 -0
- package/dist/client/assets/{studio-tools-ChooDZCt.js → studio-tools-CUWFqlTh.js} +1 -1
- package/dist/client/assets/{switch-BmoPsk_L.js → switch-1Vfz3uSg.js} +1 -1
- package/dist/client/assets/{tab-id-DpWn0fbM.js → tab-id-CI2T4n3l.js} +1 -1
- package/dist/client/assets/{table-BluVU23Z.js → table-BQAbKOYa.js} +1 -1
- package/dist/client/assets/{tabs-C9Dri0XB.js → tabs-qagPrFeg.js} +1 -1
- package/dist/client/assets/{textarea-CMhJIDqb.js → textarea-C3WLqu3y.js} +1 -1
- package/dist/client/assets/{toggle-group-BK4yx2ic.js → toggle-group-NXghphbz.js} +1 -1
- package/dist/client/assets/{toolbar-CJN41Q0U.js → toolbar-ZE2CENTf.js} +1 -1
- package/dist/client/assets/{tooltip-DCC06XNr.js → tooltip-CiyZj9MW.js} +1 -1
- package/dist/client/assets/{use-ai-providers-CTGRuhSY.js → use-ai-providers-B6AoVltc.js} +1 -1
- package/dist/client/assets/{use-automations-CTEnO1Zu.js → use-automations-CiQS3Pmq.js} +1 -1
- package/dist/client/assets/{use-autosave-CgHGIUlv.js → use-autosave-DE9X8qzD.js} +1 -1
- package/dist/client/assets/{use-capability-BTlnzwER.js → use-capability-DX60Hp0S.js} +1 -1
- package/dist/client/assets/{use-clock-tick-Dg1-zfZ4.js → use-clock-tick-Q8CgV2VU.js} +1 -1
- package/dist/client/assets/{use-connection-BTIHIL2U.js → use-connection-c87Xz8U-.js} +1 -1
- package/dist/client/assets/{use-copy-Bkx7pWID.js → use-copy-BPhBM3Oi.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-ClJmipur.js → use-create-virtual-mcp-BnZL3DPb.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-Dp_dA5sI.js → use-debounced-autosave-BmT6bwNL.js} +1 -1
- package/dist/client/assets/{use-debounced-value-Dx_Znjq0.js → use-debounced-value-DViZw7k7.js} +1 -1
- package/dist/client/assets/{use-deco-credits-CnnQh7bH.js → use-deco-credits-DJJXk8t9.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-B84Jbaf1.js → use-decopilot-events-DuMl-BWe.js} +1 -1
- package/dist/client/assets/{use-delete-connection-Dd7d9SGg.js → use-delete-connection--jtVGLkv.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-CElXlSvL.js → use-deployment-admin-Cr_7c4Yl.js} +1 -1
- package/dist/client/assets/{use-file-configs-DUlhqIgH.js → use-file-configs-CwjnQywn.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CRM4xUSx.js → use-infinite-scroll-8IyahDR0.js} +1 -1
- package/dist/client/assets/{use-join-requests-B0JwpKM9.js → use-join-requests-tHCwhSs3.js} +1 -1
- package/dist/client/assets/{use-mcp-auth-status-DH8oUnNS.js → use-mcp-auth-status-sjpR15R6.js} +1 -1
- package/dist/client/assets/{use-mcp-client-C78T1evw.js → use-mcp-client-BmnPrlCp.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-qcP_UOWU.js → use-mcp-tools-B9U_ZOEs.js} +1 -1
- package/dist/client/assets/{use-members-5U5mLxdD.js → use-members-BglXgqfG.js} +1 -1
- package/dist/client/assets/{use-mobile-BufL0gpx.js → use-mobile-ZF_jSfPp.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-bcvHJsmR.js → use-navigate-to-agent-DIeI8ULY.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-B93vTKrZ.js → use-org-auth-client-C-GSCd--.js} +1 -1
- package/dist/client/assets/{use-org-sso-BpALHDeh.js → use-org-sso-BawqtY1O.js} +1 -1
- package/dist/client/assets/{use-organization-roles-CHjz2_ga.js → use-organization-roles-BfAcHhLm.js} +1 -1
- package/dist/client/assets/{use-organization-settings-rcLpLxq6.js → use-organization-settings-DcixnwK-.js} +1 -1
- package/dist/client/assets/{use-registry-connections-XjUGFr5z.js → use-registry-connections-VIMCCdEN.js} +1 -1
- package/dist/client/assets/{use-secrets-DVGBRr0e.js → use-secrets-DN6xkhJI.js} +1 -1
- package/dist/client/assets/{use-status-sounds-CNPY1kJ-.js → use-status-sounds-CVssdpKX.js} +1 -1
- package/dist/client/assets/{use-tags-d-ihZKch.js → use-tags-OVuXWbIz.js} +1 -1
- package/dist/client/assets/{use-view-mode-CxLEvfyI.js → use-view-mode-BdkdIEp5.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-tTUO8PD5.js → use-virtual-mcp-BIQdKSoy.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-QTu-xaep.js +1 -0
- package/dist/client/assets/{useQueries-CX-pbcRo.js → useQueries-D2CKhSr2.js} +1 -1
- package/dist/client/assets/{useRouterState-DM9ViZSm.js → useRouterState-B0tRZSRp.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-_f32It26.js +1 -0
- package/dist/client/assets/{users-hps1B13C.js → users-Xgmv3XAu.js} +1 -1
- package/dist/client/assets/{variant-calendar--g4p8stV.js → variant-calendar-CHbHmJQD.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-Cn3ICdtv.js → view-mode-toggle-DTYJdfuz.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +766 -766
- package/dist/server/server.js +576 -576
- package/package.json +2 -4
- package/dist/client/assets/project-app-view-CZZgc1s8.js +0 -1
- package/dist/client/assets/record-editor-Bk_Re_fD.js +0 -1
- package/dist/client/assets/registry-BTKEcIS_.js +0 -2
- package/dist/client/assets/store-registry-DwAm5lvb.js +0 -2
- package/dist/client/assets/useInfiniteQuery-C1ye6sqf.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-CiYM_Dv6.js +0 -1
- package/dist/server/node_modules/@resvg/resvg-js/LICENSE +0 -373
- package/dist/server/node_modules/@resvg/resvg-js/README.md +0 -314
- package/dist/server/node_modules/@resvg/resvg-js/index.js +0 -23
- package/dist/server/node_modules/@resvg/resvg-js/js-binding.js +0 -1
- package/dist/server/node_modules/@resvg/resvg-js/package.json +0 -152
- package/dist/server/node_modules/@shuding/opentype.js/LICENSE +0 -20
- package/dist/server/node_modules/@shuding/opentype.js/README.md +0 -9
- package/dist/server/node_modules/@shuding/opentype.js/RELEASES.md +0 -272
- package/dist/server/node_modules/@shuding/opentype.js/bin/ot +0 -84
- package/dist/server/node_modules/@shuding/opentype.js/bin/server.js +0 -64
- package/dist/server/node_modules/@shuding/opentype.js/bin/test-render +0 -96
- package/dist/server/node_modules/@shuding/opentype.js/dist/opentype.js +0 -11655
- package/dist/server/node_modules/@shuding/opentype.js/dist/opentype.min.js +0 -2
- package/dist/server/node_modules/@shuding/opentype.js/dist/opentype.module.js +0 -11639
- package/dist/server/node_modules/@shuding/opentype.js/package.json +0 -73
- package/dist/server/node_modules/@shuding/opentype.js/src/bbox.js +0 -158
- package/dist/server/node_modules/@shuding/opentype.js/src/bidi.js +0 -243
- package/dist/server/node_modules/@shuding/opentype.js/src/char.js +0 -43
- package/dist/server/node_modules/@shuding/opentype.js/src/check.js +0 -16
- package/dist/server/node_modules/@shuding/opentype.js/src/encoding.js +0 -1032
- package/dist/server/node_modules/@shuding/opentype.js/src/features/applySubstitution.js +0 -74
- package/dist/server/node_modules/@shuding/opentype.js/src/features/arab/arabicPresentationForms.js +0 -83
- package/dist/server/node_modules/@shuding/opentype.js/src/features/arab/arabicRequiredLigatures.js +0 -41
- package/dist/server/node_modules/@shuding/opentype.js/src/features/arab/contextCheck/arabicSentence.js +0 -43
- package/dist/server/node_modules/@shuding/opentype.js/src/features/arab/contextCheck/arabicWord.js +0 -31
- package/dist/server/node_modules/@shuding/opentype.js/src/features/featureQuery.js +0 -483
- package/dist/server/node_modules/@shuding/opentype.js/src/features/latn/contextCheck/latinWord.js +0 -31
- package/dist/server/node_modules/@shuding/opentype.js/src/features/latn/latinLigatures.js +0 -40
- package/dist/server/node_modules/@shuding/opentype.js/src/font.js +0 -433
- package/dist/server/node_modules/@shuding/opentype.js/src/glyph.js +0 -274
- package/dist/server/node_modules/@shuding/opentype.js/src/glyphset.js +0 -150
- package/dist/server/node_modules/@shuding/opentype.js/src/hintingtt.js +0 -3062
- package/dist/server/node_modules/@shuding/opentype.js/src/index.js +0 -5
- package/dist/server/node_modules/@shuding/opentype.js/src/layout.js +0 -357
- package/dist/server/node_modules/@shuding/opentype.js/src/opentype.js +0 -375
- package/dist/server/node_modules/@shuding/opentype.js/src/parse.js +0 -628
- package/dist/server/node_modules/@shuding/opentype.js/src/path.js +0 -212
- package/dist/server/node_modules/@shuding/opentype.js/src/position.js +0 -77
- package/dist/server/node_modules/@shuding/opentype.js/src/substitution.js +0 -447
- package/dist/server/node_modules/@shuding/opentype.js/src/table.js +0 -215
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/cff.js +0 -1156
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/cmap.js +0 -145
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/fvar.js +0 -71
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/gdef.js +0 -62
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/glyf.js +0 -349
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/gpos.js +0 -146
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/gsub.js +0 -251
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/head.js +0 -35
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/hhea.js +0 -27
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/hmtx.js +0 -51
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/kern.js +0 -69
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/loca.js +0 -31
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/ltag.js +0 -33
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/maxp.js +0 -32
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/meta.js +0 -30
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/name.js +0 -680
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/os2.js +0 -65
- package/dist/server/node_modules/@shuding/opentype.js/src/tables/post.js +0 -41
- package/dist/server/node_modules/@shuding/opentype.js/src/tokenizer.js +0 -522
- package/dist/server/node_modules/@shuding/opentype.js/src/types.js +0 -976
- package/dist/server/node_modules/@shuding/opentype.js/src/util.js +0 -17
- package/dist/server/node_modules/base64-js/.travis.yml +0 -5
- package/dist/server/node_modules/base64-js/LICENSE.MIT +0 -21
- package/dist/server/node_modules/base64-js/README.md +0 -31
- package/dist/server/node_modules/base64-js/bench/bench.js +0 -19
- package/dist/server/node_modules/base64-js/lib/b64.js +0 -124
- package/dist/server/node_modules/base64-js/package.json +0 -34
- package/dist/server/node_modules/base64-js/test/convert.js +0 -51
- package/dist/server/node_modules/base64-js/test/url-safe.js +0 -18
- package/dist/server/node_modules/camelize/.eslintrc +0 -24
- package/dist/server/node_modules/camelize/.github/FUNDING.yml +0 -12
- package/dist/server/node_modules/camelize/CHANGELOG.md +0 -64
- package/dist/server/node_modules/camelize/LICENSE +0 -18
- package/dist/server/node_modules/camelize/README.md +0 -81
- package/dist/server/node_modules/camelize/example/camel.js +0 -12
- package/dist/server/node_modules/camelize/index.js +0 -61
- package/dist/server/node_modules/camelize/package.json +0 -84
- package/dist/server/node_modules/camelize/test/camel.js +0 -48
- package/dist/server/node_modules/color-name/LICENSE +0 -8
- package/dist/server/node_modules/color-name/README.md +0 -11
- package/dist/server/node_modules/color-name/index.js +0 -152
- package/dist/server/node_modules/color-name/package.json +0 -28
- package/dist/server/node_modules/css-background-parser/LICENSE +0 -22
- package/dist/server/node_modules/css-background-parser/README.md +0 -149
- package/dist/server/node_modules/css-background-parser/index.js +0 -162
- package/dist/server/node_modules/css-background-parser/package.json +0 -19
- package/dist/server/node_modules/css-box-shadow/README.md +0 -27
- package/dist/server/node_modules/css-box-shadow/index.js +0 -64
- package/dist/server/node_modules/css-box-shadow/package.json +0 -14
- package/dist/server/node_modules/css-box-shadow/test.js +0 -204
- package/dist/server/node_modules/css-color-keywords/LICENSE +0 -15
- package/dist/server/node_modules/css-color-keywords/README.md +0 -47
- package/dist/server/node_modules/css-color-keywords/colors.json +0 -148
- package/dist/server/node_modules/css-color-keywords/index.js +0 -3
- package/dist/server/node_modules/css-color-keywords/package.json +0 -27
- package/dist/server/node_modules/css-gradient-parser/LICENSE +0 -21
- package/dist/server/node_modules/css-gradient-parser/README.md +0 -75
- package/dist/server/node_modules/css-gradient-parser/dist/index.cjs +0 -2
- package/dist/server/node_modules/css-gradient-parser/dist/index.js +0 -2
- package/dist/server/node_modules/css-gradient-parser/package.json +0 -54
- package/dist/server/node_modules/css-to-react-native/LICENSE.md +0 -21
- package/dist/server/node_modules/css-to-react-native/README.md +0 -115
- package/dist/server/node_modules/css-to-react-native/index.js +0 -886
- package/dist/server/node_modules/css-to-react-native/package.json +0 -65
- package/dist/server/node_modules/css-to-react-native/src/TokenStream.js +0 -74
- package/dist/server/node_modules/css-to-react-native/src/__tests__/aspectRatio.js +0 -23
- package/dist/server/node_modules/css-to-react-native/src/__tests__/border.js +0 -85
- package/dist/server/node_modules/css-to-react-native/src/__tests__/borderColor.js +0 -37
- package/dist/server/node_modules/css-to-react-native/src/__tests__/boxModel.js +0 -136
- package/dist/server/node_modules/css-to-react-native/src/__tests__/boxShadow.js +0 -83
- package/dist/server/node_modules/css-to-react-native/src/__tests__/colors.js +0 -31
- package/dist/server/node_modules/css-to-react-native/src/__tests__/flex.js +0 -122
- package/dist/server/node_modules/css-to-react-native/src/__tests__/flexFlow.js +0 -22
- package/dist/server/node_modules/css-to-react-native/src/__tests__/font.js +0 -117
- package/dist/server/node_modules/css-to-react-native/src/__tests__/fontFamily.js +0 -43
- package/dist/server/node_modules/css-to-react-native/src/__tests__/fontVariant.js +0 -15
- package/dist/server/node_modules/css-to-react-native/src/__tests__/fontWeight.js +0 -8
- package/dist/server/node_modules/css-to-react-native/src/__tests__/index.js +0 -204
- package/dist/server/node_modules/css-to-react-native/src/__tests__/placeContent.js +0 -19
- package/dist/server/node_modules/css-to-react-native/src/__tests__/shadowOffsets.js +0 -13
- package/dist/server/node_modules/css-to-react-native/src/__tests__/textDecoration.js +0 -103
- package/dist/server/node_modules/css-to-react-native/src/__tests__/textDecorationLine.js +0 -23
- package/dist/server/node_modules/css-to-react-native/src/__tests__/textShadow.js +0 -30
- package/dist/server/node_modules/css-to-react-native/src/__tests__/transform.js +0 -55
- package/dist/server/node_modules/css-to-react-native/src/__tests__/units.js +0 -132
- package/dist/server/node_modules/css-to-react-native/src/devPropertiesWithoutUnitsRegExp.js +0 -19
- package/dist/server/node_modules/css-to-react-native/src/index.js +0 -90
- package/dist/server/node_modules/css-to-react-native/src/tokenTypes.js +0 -75
- package/dist/server/node_modules/css-to-react-native/src/transforms/aspectRatio.js +0 -12
- package/dist/server/node_modules/css-to-react-native/src/transforms/border.js +0 -53
- package/dist/server/node_modules/css-to-react-native/src/transforms/boxShadow.js +0 -11
- package/dist/server/node_modules/css-to-react-native/src/transforms/flex.js +0 -65
- package/dist/server/node_modules/css-to-react-native/src/transforms/flexFlow.js +0 -37
- package/dist/server/node_modules/css-to-react-native/src/transforms/font.js +0 -63
- package/dist/server/node_modules/css-to-react-native/src/transforms/fontFamily.js +0 -20
- package/dist/server/node_modules/css-to-react-native/src/transforms/fontVariant.js +0 -14
- package/dist/server/node_modules/css-to-react-native/src/transforms/index.js +0 -77
- package/dist/server/node_modules/css-to-react-native/src/transforms/placeContent.js +0 -24
- package/dist/server/node_modules/css-to-react-native/src/transforms/textDecoration.js +0 -53
- package/dist/server/node_modules/css-to-react-native/src/transforms/textDecorationLine.js +0 -18
- package/dist/server/node_modules/css-to-react-native/src/transforms/textShadow.js +0 -10
- package/dist/server/node_modules/css-to-react-native/src/transforms/transform.js +0 -74
- package/dist/server/node_modules/css-to-react-native/src/transforms/util.js +0 -99
- package/dist/server/node_modules/hex-rgb/index.js +0 -47
- package/dist/server/node_modules/hex-rgb/license +0 -9
- package/dist/server/node_modules/hex-rgb/package.json +0 -39
- package/dist/server/node_modules/hex-rgb/readme.md +0 -86
- package/dist/server/node_modules/linebreak/LICENSE +0 -21
- package/dist/server/node_modules/linebreak/dist/main.cjs +0 -1369
- package/dist/server/node_modules/linebreak/dist/module.mjs +0 -1368
- package/dist/server/node_modules/linebreak/package.json +0 -57
- package/dist/server/node_modules/linebreak/readme.md +0 -62
- package/dist/server/node_modules/parse-css-color/CHANGELOG.md +0 -54
- package/dist/server/node_modules/parse-css-color/LICENSE +0 -21
- package/dist/server/node_modules/parse-css-color/README.md +0 -110
- package/dist/server/node_modules/parse-css-color/dist/index.cjs.js +0 -171
- package/dist/server/node_modules/parse-css-color/dist/index.esm.js +0 -167
- package/dist/server/node_modules/parse-css-color/dist/index.umd.js +0 -7
- package/dist/server/node_modules/parse-css-color/package.json +0 -55
- package/dist/server/node_modules/postcss-value-parser/LICENSE +0 -22
- package/dist/server/node_modules/postcss-value-parser/README.md +0 -263
- package/dist/server/node_modules/postcss-value-parser/lib/index.js +0 -28
- package/dist/server/node_modules/postcss-value-parser/lib/parse.js +0 -321
- package/dist/server/node_modules/postcss-value-parser/lib/stringify.js +0 -48
- package/dist/server/node_modules/postcss-value-parser/lib/unit.js +0 -120
- package/dist/server/node_modules/postcss-value-parser/lib/walk.js +0 -22
- package/dist/server/node_modules/postcss-value-parser/package.json +0 -58
- package/dist/server/node_modules/satori/LICENSE +0 -373
- package/dist/server/node_modules/satori/README.md +0 -516
- package/dist/server/node_modules/satori/dist/index.cjs +0 -8
- package/dist/server/node_modules/satori/dist/index.cjs.LEGAL.txt +0 -4
- package/dist/server/node_modules/satori/dist/index.js +0 -8
- package/dist/server/node_modules/satori/dist/index.js.LEGAL.txt +0 -4
- package/dist/server/node_modules/satori/dist/jsx/index.cjs +0 -2
- package/dist/server/node_modules/satori/dist/jsx/index.cjs.LEGAL.txt +0 -0
- package/dist/server/node_modules/satori/dist/jsx/index.js +0 -2
- package/dist/server/node_modules/satori/dist/jsx/index.js.LEGAL.txt +0 -0
- package/dist/server/node_modules/satori/dist/jsx/jsx-runtime.cjs +0 -2
- package/dist/server/node_modules/satori/dist/jsx/jsx-runtime.cjs.LEGAL.txt +0 -0
- package/dist/server/node_modules/satori/dist/jsx/jsx-runtime.js +0 -2
- package/dist/server/node_modules/satori/dist/jsx/jsx-runtime.js.LEGAL.txt +0 -0
- package/dist/server/node_modules/satori/dist/standalone.cjs +0 -8
- package/dist/server/node_modules/satori/dist/standalone.cjs.LEGAL.txt +0 -4
- package/dist/server/node_modules/satori/dist/standalone.js +0 -8
- package/dist/server/node_modules/satori/dist/standalone.js.LEGAL.txt +0 -4
- package/dist/server/node_modules/satori/package.json +0 -149
- package/dist/server/node_modules/satori/yoga.wasm +0 -0
- package/dist/server/node_modules/tiny-inflate/LICENSE +0 -21
- package/dist/server/node_modules/tiny-inflate/index.js +0 -375
- package/dist/server/node_modules/tiny-inflate/package.json +0 -28
- package/dist/server/node_modules/tiny-inflate/readme.md +0 -31
- package/dist/server/node_modules/tiny-inflate/test/index.js +0 -75
- package/dist/server/node_modules/tiny-inflate/test/lorem.txt +0 -199
- package/dist/server/node_modules/unicode-trie/LICENSE +0 -8
- package/dist/server/node_modules/unicode-trie/README.md +0 -77
- package/dist/server/node_modules/unicode-trie/builder.js +0 -966
- package/dist/server/node_modules/unicode-trie/index.js +0 -136
- package/dist/server/node_modules/unicode-trie/package.json +0 -27
- package/dist/server/node_modules/unicode-trie/swap.js +0 -25
- package/dist/server/node_modules/unicode-trie/test/mocha.opts +0 -1
- package/dist/server/node_modules/unicode-trie/test/test.js +0 -243
|
@@ -1,3062 +0,0 @@
|
|
|
1
|
-
/* A TrueType font hinting interpreter.
|
|
2
|
-
*
|
|
3
|
-
* (c) 2017 Axel Kittenberger
|
|
4
|
-
*
|
|
5
|
-
* This interpreter has been implemented according to this documentation:
|
|
6
|
-
* https://developer.apple.com/fonts/TrueType-Reference-Manual/RM05/Chap5.html
|
|
7
|
-
*
|
|
8
|
-
* According to the documentation F24DOT6 values are used for pixels.
|
|
9
|
-
* That means calculation is 1/64 pixel accurate and uses integer operations.
|
|
10
|
-
* However, Javascript has floating point operations by default and only
|
|
11
|
-
* those are available. One could make a case to simulate the 1/64 accuracy
|
|
12
|
-
* exactly by truncating after every division operation
|
|
13
|
-
* (for example with << 0) to get pixel exactly results as other TrueType
|
|
14
|
-
* implementations. It may make sense since some fonts are pixel optimized
|
|
15
|
-
* by hand using DELTAP instructions. The current implementation doesn't
|
|
16
|
-
* and rather uses full floating point precision.
|
|
17
|
-
*
|
|
18
|
-
* xScale, yScale and rotation is currently ignored.
|
|
19
|
-
*
|
|
20
|
-
* A few non-trivial instructions are missing as I didn't encounter yet
|
|
21
|
-
* a font that used them to test a possible implementation.
|
|
22
|
-
*
|
|
23
|
-
* Some fonts seem to use undocumented features regarding the twilight zone.
|
|
24
|
-
* Only some of them are implemented as they were encountered.
|
|
25
|
-
*
|
|
26
|
-
* The exports.DEBUG statements are removed on the minified distribution file.
|
|
27
|
-
*/
|
|
28
|
-
'use strict';
|
|
29
|
-
|
|
30
|
-
import glyf from './tables/glyf';
|
|
31
|
-
|
|
32
|
-
let instructionTable;
|
|
33
|
-
let exec;
|
|
34
|
-
let execGlyph;
|
|
35
|
-
let execComponent;
|
|
36
|
-
|
|
37
|
-
/*
|
|
38
|
-
* Creates a hinting object.
|
|
39
|
-
*
|
|
40
|
-
* There ought to be exactly one
|
|
41
|
-
* for each truetype font that is used for hinting.
|
|
42
|
-
*/
|
|
43
|
-
function Hinting(font) {
|
|
44
|
-
// the font this hinting object is for
|
|
45
|
-
this.font = font;
|
|
46
|
-
|
|
47
|
-
this.getCommands = function (hPoints) {
|
|
48
|
-
return glyf.getPath(hPoints).commands;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
// cached states
|
|
52
|
-
this._fpgmState =
|
|
53
|
-
this._prepState =
|
|
54
|
-
undefined;
|
|
55
|
-
|
|
56
|
-
// errorState
|
|
57
|
-
// 0 ... all okay
|
|
58
|
-
// 1 ... had an error in a glyf,
|
|
59
|
-
// continue working but stop spamming
|
|
60
|
-
// the console
|
|
61
|
-
// 2 ... error at prep, stop hinting at this ppem
|
|
62
|
-
// 3 ... error at fpeg, stop hinting for this font at all
|
|
63
|
-
this._errorState = 0;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/*
|
|
67
|
-
* Not rounding.
|
|
68
|
-
*/
|
|
69
|
-
function roundOff(v) {
|
|
70
|
-
return v;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/*
|
|
74
|
-
* Rounding to grid.
|
|
75
|
-
*/
|
|
76
|
-
function roundToGrid(v) {
|
|
77
|
-
//Rounding in TT is supposed to "symmetrical around zero"
|
|
78
|
-
return Math.sign(v) * Math.round(Math.abs(v));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/*
|
|
82
|
-
* Rounding to double grid.
|
|
83
|
-
*/
|
|
84
|
-
function roundToDoubleGrid(v) {
|
|
85
|
-
return Math.sign(v) * Math.round(Math.abs(v * 2)) / 2;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/*
|
|
89
|
-
* Rounding to half grid.
|
|
90
|
-
*/
|
|
91
|
-
function roundToHalfGrid(v) {
|
|
92
|
-
return Math.sign(v) * (Math.round(Math.abs(v) + 0.5) - 0.5);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/*
|
|
96
|
-
* Rounding to up to grid.
|
|
97
|
-
*/
|
|
98
|
-
function roundUpToGrid(v) {
|
|
99
|
-
return Math.sign(v) * Math.ceil(Math.abs(v));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/*
|
|
103
|
-
* Rounding to down to grid.
|
|
104
|
-
*/
|
|
105
|
-
function roundDownToGrid(v) {
|
|
106
|
-
return Math.sign(v) * Math.floor(Math.abs(v));
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/*
|
|
110
|
-
* Super rounding.
|
|
111
|
-
*/
|
|
112
|
-
const roundSuper = function (v) {
|
|
113
|
-
const period = this.srPeriod;
|
|
114
|
-
let phase = this.srPhase;
|
|
115
|
-
const threshold = this.srThreshold;
|
|
116
|
-
let sign = 1;
|
|
117
|
-
|
|
118
|
-
if (v < 0) {
|
|
119
|
-
v = -v;
|
|
120
|
-
sign = -1;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
v += threshold - phase;
|
|
124
|
-
|
|
125
|
-
v = Math.trunc(v / period) * period;
|
|
126
|
-
|
|
127
|
-
v += phase;
|
|
128
|
-
|
|
129
|
-
// according to http://xgridfit.sourceforge.net/round.html
|
|
130
|
-
if (v < 0) return phase * sign;
|
|
131
|
-
|
|
132
|
-
return v * sign;
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
/*
|
|
136
|
-
* Unit vector of x-axis.
|
|
137
|
-
*/
|
|
138
|
-
const xUnitVector = {
|
|
139
|
-
x: 1,
|
|
140
|
-
|
|
141
|
-
y: 0,
|
|
142
|
-
|
|
143
|
-
axis: 'x',
|
|
144
|
-
|
|
145
|
-
// Gets the projected distance between two points.
|
|
146
|
-
// o1/o2 ... if true, respective original position is used.
|
|
147
|
-
distance: function (p1, p2, o1, o2) {
|
|
148
|
-
return (o1 ? p1.xo : p1.x) - (o2 ? p2.xo : p2.x);
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
// Moves point p so the moved position has the same relative
|
|
152
|
-
// position to the moved positions of rp1 and rp2 than the
|
|
153
|
-
// original positions had.
|
|
154
|
-
//
|
|
155
|
-
// See APPENDIX on INTERPOLATE at the bottom of this file.
|
|
156
|
-
interpolate: function (p, rp1, rp2, pv) {
|
|
157
|
-
let do1;
|
|
158
|
-
let do2;
|
|
159
|
-
let doa1;
|
|
160
|
-
let doa2;
|
|
161
|
-
let dm1;
|
|
162
|
-
let dm2;
|
|
163
|
-
let dt;
|
|
164
|
-
|
|
165
|
-
if (!pv || pv === this) {
|
|
166
|
-
do1 = p.xo - rp1.xo;
|
|
167
|
-
do2 = p.xo - rp2.xo;
|
|
168
|
-
dm1 = rp1.x - rp1.xo;
|
|
169
|
-
dm2 = rp2.x - rp2.xo;
|
|
170
|
-
doa1 = Math.abs(do1);
|
|
171
|
-
doa2 = Math.abs(do2);
|
|
172
|
-
dt = doa1 + doa2;
|
|
173
|
-
|
|
174
|
-
if (dt === 0) {
|
|
175
|
-
p.x = p.xo + (dm1 + dm2) / 2;
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
p.x = p.xo + (dm1 * doa2 + dm2 * doa1) / dt;
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
do1 = pv.distance(p, rp1, true, true);
|
|
184
|
-
do2 = pv.distance(p, rp2, true, true);
|
|
185
|
-
dm1 = pv.distance(rp1, rp1, false, true);
|
|
186
|
-
dm2 = pv.distance(rp2, rp2, false, true);
|
|
187
|
-
doa1 = Math.abs(do1);
|
|
188
|
-
doa2 = Math.abs(do2);
|
|
189
|
-
dt = doa1 + doa2;
|
|
190
|
-
|
|
191
|
-
if (dt === 0) {
|
|
192
|
-
xUnitVector.setRelative(p, p, (dm1 + dm2) / 2, pv, true);
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
xUnitVector.setRelative(p, p, (dm1 * doa2 + dm2 * doa1) / dt, pv, true);
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
// Slope of line normal to this
|
|
200
|
-
normalSlope: Number.NEGATIVE_INFINITY,
|
|
201
|
-
|
|
202
|
-
// Sets the point 'p' relative to point 'rp'
|
|
203
|
-
// by the distance 'd'.
|
|
204
|
-
//
|
|
205
|
-
// See APPENDIX on SETRELATIVE at the bottom of this file.
|
|
206
|
-
//
|
|
207
|
-
// p ... point to set
|
|
208
|
-
// rp ... reference point
|
|
209
|
-
// d ... distance on projection vector
|
|
210
|
-
// pv ... projection vector (undefined = this)
|
|
211
|
-
// org ... if true, uses the original position of rp as reference.
|
|
212
|
-
setRelative: function (p, rp, d, pv, org) {
|
|
213
|
-
if (!pv || pv === this) {
|
|
214
|
-
p.x = (org ? rp.xo : rp.x) + d;
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
const rpx = org ? rp.xo : rp.x;
|
|
219
|
-
const rpy = org ? rp.yo : rp.y;
|
|
220
|
-
const rpdx = rpx + d * pv.x;
|
|
221
|
-
const rpdy = rpy + d * pv.y;
|
|
222
|
-
|
|
223
|
-
p.x = rpdx + (p.y - rpdy) / pv.normalSlope;
|
|
224
|
-
},
|
|
225
|
-
|
|
226
|
-
// Slope of vector line.
|
|
227
|
-
slope: 0,
|
|
228
|
-
|
|
229
|
-
// Touches the point p.
|
|
230
|
-
touch: function (p) {
|
|
231
|
-
p.xTouched = true;
|
|
232
|
-
},
|
|
233
|
-
|
|
234
|
-
// Tests if a point p is touched.
|
|
235
|
-
touched: function (p) {
|
|
236
|
-
return p.xTouched;
|
|
237
|
-
},
|
|
238
|
-
|
|
239
|
-
// Untouches the point p.
|
|
240
|
-
untouch: function (p) {
|
|
241
|
-
p.xTouched = false;
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
/*
|
|
246
|
-
* Unit vector of y-axis.
|
|
247
|
-
*/
|
|
248
|
-
const yUnitVector = {
|
|
249
|
-
x: 0,
|
|
250
|
-
|
|
251
|
-
y: 1,
|
|
252
|
-
|
|
253
|
-
axis: 'y',
|
|
254
|
-
|
|
255
|
-
// Gets the projected distance between two points.
|
|
256
|
-
// o1/o2 ... if true, respective original position is used.
|
|
257
|
-
distance: function (p1, p2, o1, o2) {
|
|
258
|
-
return (o1 ? p1.yo : p1.y) - (o2 ? p2.yo : p2.y);
|
|
259
|
-
},
|
|
260
|
-
|
|
261
|
-
// Moves point p so the moved position has the same relative
|
|
262
|
-
// position to the moved positions of rp1 and rp2 than the
|
|
263
|
-
// original positions had.
|
|
264
|
-
//
|
|
265
|
-
// See APPENDIX on INTERPOLATE at the bottom of this file.
|
|
266
|
-
interpolate: function (p, rp1, rp2, pv) {
|
|
267
|
-
let do1;
|
|
268
|
-
let do2;
|
|
269
|
-
let doa1;
|
|
270
|
-
let doa2;
|
|
271
|
-
let dm1;
|
|
272
|
-
let dm2;
|
|
273
|
-
let dt;
|
|
274
|
-
|
|
275
|
-
if (!pv || pv === this) {
|
|
276
|
-
do1 = p.yo - rp1.yo;
|
|
277
|
-
do2 = p.yo - rp2.yo;
|
|
278
|
-
dm1 = rp1.y - rp1.yo;
|
|
279
|
-
dm2 = rp2.y - rp2.yo;
|
|
280
|
-
doa1 = Math.abs(do1);
|
|
281
|
-
doa2 = Math.abs(do2);
|
|
282
|
-
dt = doa1 + doa2;
|
|
283
|
-
|
|
284
|
-
if (dt === 0) {
|
|
285
|
-
p.y = p.yo + (dm1 + dm2) / 2;
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
p.y = p.yo + (dm1 * doa2 + dm2 * doa1) / dt;
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
do1 = pv.distance(p, rp1, true, true);
|
|
294
|
-
do2 = pv.distance(p, rp2, true, true);
|
|
295
|
-
dm1 = pv.distance(rp1, rp1, false, true);
|
|
296
|
-
dm2 = pv.distance(rp2, rp2, false, true);
|
|
297
|
-
doa1 = Math.abs(do1);
|
|
298
|
-
doa2 = Math.abs(do2);
|
|
299
|
-
dt = doa1 + doa2;
|
|
300
|
-
|
|
301
|
-
if (dt === 0) {
|
|
302
|
-
yUnitVector.setRelative(p, p, (dm1 + dm2) / 2, pv, true);
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
yUnitVector.setRelative(p, p, (dm1 * doa2 + dm2 * doa1) / dt, pv, true);
|
|
307
|
-
},
|
|
308
|
-
|
|
309
|
-
// Slope of line normal to this.
|
|
310
|
-
normalSlope: 0,
|
|
311
|
-
|
|
312
|
-
// Sets the point 'p' relative to point 'rp'
|
|
313
|
-
// by the distance 'd'
|
|
314
|
-
//
|
|
315
|
-
// See APPENDIX on SETRELATIVE at the bottom of this file.
|
|
316
|
-
//
|
|
317
|
-
// p ... point to set
|
|
318
|
-
// rp ... reference point
|
|
319
|
-
// d ... distance on projection vector
|
|
320
|
-
// pv ... projection vector (undefined = this)
|
|
321
|
-
// org ... if true, uses the original position of rp as reference.
|
|
322
|
-
setRelative: function (p, rp, d, pv, org) {
|
|
323
|
-
if (!pv || pv === this) {
|
|
324
|
-
p.y = (org ? rp.yo : rp.y) + d;
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const rpx = org ? rp.xo : rp.x;
|
|
329
|
-
const rpy = org ? rp.yo : rp.y;
|
|
330
|
-
const rpdx = rpx + d * pv.x;
|
|
331
|
-
const rpdy = rpy + d * pv.y;
|
|
332
|
-
|
|
333
|
-
p.y = rpdy + pv.normalSlope * (p.x - rpdx);
|
|
334
|
-
},
|
|
335
|
-
|
|
336
|
-
// Slope of vector line.
|
|
337
|
-
slope: Number.POSITIVE_INFINITY,
|
|
338
|
-
|
|
339
|
-
// Touches the point p.
|
|
340
|
-
touch: function (p) {
|
|
341
|
-
p.yTouched = true;
|
|
342
|
-
},
|
|
343
|
-
|
|
344
|
-
// Tests if a point p is touched.
|
|
345
|
-
touched: function (p) {
|
|
346
|
-
return p.yTouched;
|
|
347
|
-
},
|
|
348
|
-
|
|
349
|
-
// Untouches the point p.
|
|
350
|
-
untouch: function (p) {
|
|
351
|
-
p.yTouched = false;
|
|
352
|
-
}
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
Object.freeze(xUnitVector);
|
|
356
|
-
Object.freeze(yUnitVector);
|
|
357
|
-
|
|
358
|
-
/*
|
|
359
|
-
* Creates a unit vector that is not x- or y-axis.
|
|
360
|
-
*/
|
|
361
|
-
function UnitVector(x, y) {
|
|
362
|
-
this.x = x;
|
|
363
|
-
this.y = y;
|
|
364
|
-
this.axis = undefined;
|
|
365
|
-
this.slope = y / x;
|
|
366
|
-
this.normalSlope = -x / y;
|
|
367
|
-
Object.freeze(this);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/*
|
|
371
|
-
* Gets the projected distance between two points.
|
|
372
|
-
* o1/o2 ... if true, respective original position is used.
|
|
373
|
-
*/
|
|
374
|
-
UnitVector.prototype.distance = function(p1, p2, o1, o2) {
|
|
375
|
-
return (
|
|
376
|
-
this.x * xUnitVector.distance(p1, p2, o1, o2) +
|
|
377
|
-
this.y * yUnitVector.distance(p1, p2, o1, o2)
|
|
378
|
-
);
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
/*
|
|
382
|
-
* Moves point p so the moved position has the same relative
|
|
383
|
-
* position to the moved positions of rp1 and rp2 than the
|
|
384
|
-
* original positions had.
|
|
385
|
-
*
|
|
386
|
-
* See APPENDIX on INTERPOLATE at the bottom of this file.
|
|
387
|
-
*/
|
|
388
|
-
UnitVector.prototype.interpolate = function(p, rp1, rp2, pv) {
|
|
389
|
-
let dm1;
|
|
390
|
-
let dm2;
|
|
391
|
-
let do1;
|
|
392
|
-
let do2;
|
|
393
|
-
let doa1;
|
|
394
|
-
let doa2;
|
|
395
|
-
let dt;
|
|
396
|
-
|
|
397
|
-
do1 = pv.distance(p, rp1, true, true);
|
|
398
|
-
do2 = pv.distance(p, rp2, true, true);
|
|
399
|
-
dm1 = pv.distance(rp1, rp1, false, true);
|
|
400
|
-
dm2 = pv.distance(rp2, rp2, false, true);
|
|
401
|
-
doa1 = Math.abs(do1);
|
|
402
|
-
doa2 = Math.abs(do2);
|
|
403
|
-
dt = doa1 + doa2;
|
|
404
|
-
|
|
405
|
-
if (dt === 0) {
|
|
406
|
-
this.setRelative(p, p, (dm1 + dm2) / 2, pv, true);
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
this.setRelative(p, p, (dm1 * doa2 + dm2 * doa1) / dt, pv, true);
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
/*
|
|
414
|
-
* Sets the point 'p' relative to point 'rp'
|
|
415
|
-
* by the distance 'd'
|
|
416
|
-
*
|
|
417
|
-
* See APPENDIX on SETRELATIVE at the bottom of this file.
|
|
418
|
-
*
|
|
419
|
-
* p ... point to set
|
|
420
|
-
* rp ... reference point
|
|
421
|
-
* d ... distance on projection vector
|
|
422
|
-
* pv ... projection vector (undefined = this)
|
|
423
|
-
* org ... if true, uses the original position of rp as reference.
|
|
424
|
-
*/
|
|
425
|
-
UnitVector.prototype.setRelative = function(p, rp, d, pv, org) {
|
|
426
|
-
pv = pv || this;
|
|
427
|
-
|
|
428
|
-
const rpx = org ? rp.xo : rp.x;
|
|
429
|
-
const rpy = org ? rp.yo : rp.y;
|
|
430
|
-
const rpdx = rpx + d * pv.x;
|
|
431
|
-
const rpdy = rpy + d * pv.y;
|
|
432
|
-
|
|
433
|
-
const pvns = pv.normalSlope;
|
|
434
|
-
const fvs = this.slope;
|
|
435
|
-
|
|
436
|
-
const px = p.x;
|
|
437
|
-
const py = p.y;
|
|
438
|
-
|
|
439
|
-
p.x = (fvs * px - pvns * rpdx + rpdy - py) / (fvs - pvns);
|
|
440
|
-
p.y = fvs * (p.x - px) + py;
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
/*
|
|
444
|
-
* Touches the point p.
|
|
445
|
-
*/
|
|
446
|
-
UnitVector.prototype.touch = function(p) {
|
|
447
|
-
p.xTouched = true;
|
|
448
|
-
p.yTouched = true;
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
/*
|
|
452
|
-
* Returns a unit vector with x/y coordinates.
|
|
453
|
-
*/
|
|
454
|
-
function getUnitVector(x, y) {
|
|
455
|
-
const d = Math.sqrt(x * x + y * y);
|
|
456
|
-
|
|
457
|
-
x /= d;
|
|
458
|
-
y /= d;
|
|
459
|
-
|
|
460
|
-
if (x === 1 && y === 0) return xUnitVector;
|
|
461
|
-
else if (x === 0 && y === 1) return yUnitVector;
|
|
462
|
-
else return new UnitVector(x, y);
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
/*
|
|
466
|
-
* Creates a point in the hinting engine.
|
|
467
|
-
*/
|
|
468
|
-
function HPoint(
|
|
469
|
-
x,
|
|
470
|
-
y,
|
|
471
|
-
lastPointOfContour,
|
|
472
|
-
onCurve
|
|
473
|
-
) {
|
|
474
|
-
this.x = this.xo = Math.round(x * 64) / 64; // hinted x value and original x-value
|
|
475
|
-
this.y = this.yo = Math.round(y * 64) / 64; // hinted y value and original y-value
|
|
476
|
-
|
|
477
|
-
this.lastPointOfContour = lastPointOfContour;
|
|
478
|
-
this.onCurve = onCurve;
|
|
479
|
-
this.prevPointOnContour = undefined;
|
|
480
|
-
this.nextPointOnContour = undefined;
|
|
481
|
-
this.xTouched = false;
|
|
482
|
-
this.yTouched = false;
|
|
483
|
-
|
|
484
|
-
Object.preventExtensions(this);
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
/*
|
|
488
|
-
* Returns the next touched point on the contour.
|
|
489
|
-
*
|
|
490
|
-
* v ... unit vector to test touch axis.
|
|
491
|
-
*/
|
|
492
|
-
HPoint.prototype.nextTouched = function(v) {
|
|
493
|
-
let p = this.nextPointOnContour;
|
|
494
|
-
|
|
495
|
-
while (!v.touched(p) && p !== this) p = p.nextPointOnContour;
|
|
496
|
-
|
|
497
|
-
return p;
|
|
498
|
-
};
|
|
499
|
-
|
|
500
|
-
/*
|
|
501
|
-
* Returns the previous touched point on the contour
|
|
502
|
-
*
|
|
503
|
-
* v ... unit vector to test touch axis.
|
|
504
|
-
*/
|
|
505
|
-
HPoint.prototype.prevTouched = function(v) {
|
|
506
|
-
let p = this.prevPointOnContour;
|
|
507
|
-
|
|
508
|
-
while (!v.touched(p) && p !== this) p = p.prevPointOnContour;
|
|
509
|
-
|
|
510
|
-
return p;
|
|
511
|
-
};
|
|
512
|
-
|
|
513
|
-
/*
|
|
514
|
-
* The zero point.
|
|
515
|
-
*/
|
|
516
|
-
const HPZero = Object.freeze(new HPoint(0, 0));
|
|
517
|
-
|
|
518
|
-
/*
|
|
519
|
-
* The default state of the interpreter.
|
|
520
|
-
*
|
|
521
|
-
* Note: Freezing the defaultState and then deriving from it
|
|
522
|
-
* makes the V8 Javascript engine going awkward,
|
|
523
|
-
* so this is avoided, albeit the defaultState shouldn't
|
|
524
|
-
* ever change.
|
|
525
|
-
*/
|
|
526
|
-
const defaultState = {
|
|
527
|
-
cvCutIn: 17 / 16, // control value cut in
|
|
528
|
-
deltaBase: 9,
|
|
529
|
-
deltaShift: 0.125,
|
|
530
|
-
loop: 1, // loops some instructions
|
|
531
|
-
minDis: 1, // minimum distance
|
|
532
|
-
autoFlip: true
|
|
533
|
-
};
|
|
534
|
-
|
|
535
|
-
/*
|
|
536
|
-
* The current state of the interpreter.
|
|
537
|
-
*
|
|
538
|
-
* env ... 'fpgm' or 'prep' or 'glyf'
|
|
539
|
-
* prog ... the program
|
|
540
|
-
*/
|
|
541
|
-
function State(env, prog) {
|
|
542
|
-
this.env = env;
|
|
543
|
-
this.stack = [];
|
|
544
|
-
this.prog = prog;
|
|
545
|
-
|
|
546
|
-
switch (env) {
|
|
547
|
-
case 'glyf' :
|
|
548
|
-
this.zp0 = this.zp1 = this.zp2 = 1;
|
|
549
|
-
this.rp0 = this.rp1 = this.rp2 = 0;
|
|
550
|
-
/* fall through */
|
|
551
|
-
case 'prep' :
|
|
552
|
-
this.fv = this.pv = this.dpv = xUnitVector;
|
|
553
|
-
this.round = roundToGrid;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
/*
|
|
558
|
-
* Executes a glyph program.
|
|
559
|
-
*
|
|
560
|
-
* This does the hinting for each glyph.
|
|
561
|
-
*
|
|
562
|
-
* Returns an array of moved points.
|
|
563
|
-
*
|
|
564
|
-
* glyph: the glyph to hint
|
|
565
|
-
* ppem: the size the glyph is rendered for
|
|
566
|
-
*/
|
|
567
|
-
Hinting.prototype.exec = function(glyph, ppem) {
|
|
568
|
-
if (typeof ppem !== 'number') {
|
|
569
|
-
throw new Error('Point size is not a number!');
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
// Received a fatal error, don't do any hinting anymore.
|
|
573
|
-
if (this._errorState > 2) return;
|
|
574
|
-
|
|
575
|
-
const font = this.font;
|
|
576
|
-
let prepState = this._prepState;
|
|
577
|
-
|
|
578
|
-
if (!prepState || prepState.ppem !== ppem) {
|
|
579
|
-
let fpgmState = this._fpgmState;
|
|
580
|
-
|
|
581
|
-
if (!fpgmState) {
|
|
582
|
-
// Executes the fpgm state.
|
|
583
|
-
// This is used by fonts to define functions.
|
|
584
|
-
State.prototype = defaultState;
|
|
585
|
-
|
|
586
|
-
fpgmState =
|
|
587
|
-
this._fpgmState =
|
|
588
|
-
new State('fpgm', font.tables.fpgm);
|
|
589
|
-
|
|
590
|
-
fpgmState.funcs = [ ];
|
|
591
|
-
fpgmState.font = font;
|
|
592
|
-
|
|
593
|
-
if (exports.DEBUG) {
|
|
594
|
-
console.log('---EXEC FPGM---');
|
|
595
|
-
fpgmState.step = -1;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
try {
|
|
599
|
-
exec(fpgmState);
|
|
600
|
-
} catch (e) {
|
|
601
|
-
console.log('Hinting error in FPGM:' + e);
|
|
602
|
-
this._errorState = 3;
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
// Executes the prep program for this ppem setting.
|
|
608
|
-
// This is used by fonts to set cvt values
|
|
609
|
-
// depending on to be rendered font size.
|
|
610
|
-
|
|
611
|
-
State.prototype = fpgmState;
|
|
612
|
-
prepState =
|
|
613
|
-
this._prepState =
|
|
614
|
-
new State('prep', font.tables.prep);
|
|
615
|
-
|
|
616
|
-
prepState.ppem = ppem;
|
|
617
|
-
|
|
618
|
-
// Creates a copy of the cvt table
|
|
619
|
-
// and scales it to the current ppem setting.
|
|
620
|
-
const oCvt = font.tables.cvt;
|
|
621
|
-
if (oCvt) {
|
|
622
|
-
const cvt = prepState.cvt = new Array(oCvt.length);
|
|
623
|
-
const scale = ppem / font.unitsPerEm;
|
|
624
|
-
for (let c = 0; c < oCvt.length; c++) {
|
|
625
|
-
cvt[c] = oCvt[c] * scale;
|
|
626
|
-
}
|
|
627
|
-
} else {
|
|
628
|
-
prepState.cvt = [];
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
if (exports.DEBUG) {
|
|
632
|
-
console.log('---EXEC PREP---');
|
|
633
|
-
prepState.step = -1;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
try {
|
|
637
|
-
exec(prepState);
|
|
638
|
-
} catch (e) {
|
|
639
|
-
if (this._errorState < 2) {
|
|
640
|
-
console.log('Hinting error in PREP:' + e);
|
|
641
|
-
}
|
|
642
|
-
this._errorState = 2;
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
if (this._errorState > 1) return;
|
|
647
|
-
|
|
648
|
-
try {
|
|
649
|
-
return execGlyph(glyph, prepState);
|
|
650
|
-
} catch (e) {
|
|
651
|
-
if (this._errorState < 1) {
|
|
652
|
-
console.log('Hinting error:' + e);
|
|
653
|
-
console.log('Note: further hinting errors are silenced');
|
|
654
|
-
}
|
|
655
|
-
this._errorState = 1;
|
|
656
|
-
return undefined;
|
|
657
|
-
}
|
|
658
|
-
};
|
|
659
|
-
|
|
660
|
-
/*
|
|
661
|
-
* Executes the hinting program for a glyph.
|
|
662
|
-
*/
|
|
663
|
-
execGlyph = function(glyph, prepState) {
|
|
664
|
-
// original point positions
|
|
665
|
-
const xScale = prepState.ppem / prepState.font.unitsPerEm;
|
|
666
|
-
const yScale = xScale;
|
|
667
|
-
let components = glyph.components;
|
|
668
|
-
let contours;
|
|
669
|
-
let gZone;
|
|
670
|
-
let state;
|
|
671
|
-
|
|
672
|
-
State.prototype = prepState;
|
|
673
|
-
if (!components) {
|
|
674
|
-
state = new State('glyf', glyph.instructions);
|
|
675
|
-
if (exports.DEBUG) {
|
|
676
|
-
console.log('---EXEC GLYPH---');
|
|
677
|
-
state.step = -1;
|
|
678
|
-
}
|
|
679
|
-
execComponent(glyph, state, xScale, yScale);
|
|
680
|
-
gZone = state.gZone;
|
|
681
|
-
} else {
|
|
682
|
-
const font = prepState.font;
|
|
683
|
-
gZone = [];
|
|
684
|
-
contours = [];
|
|
685
|
-
for (let i = 0; i < components.length; i++) {
|
|
686
|
-
const c = components[i];
|
|
687
|
-
const cg = font.glyphs.get(c.glyphIndex);
|
|
688
|
-
|
|
689
|
-
state = new State('glyf', cg.instructions);
|
|
690
|
-
|
|
691
|
-
if (exports.DEBUG) {
|
|
692
|
-
console.log('---EXEC COMP ' + i + '---');
|
|
693
|
-
state.step = -1;
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
execComponent(cg, state, xScale, yScale);
|
|
697
|
-
// appends the computed points to the result array
|
|
698
|
-
// post processes the component points
|
|
699
|
-
const dx = Math.round(c.dx * xScale);
|
|
700
|
-
const dy = Math.round(c.dy * yScale);
|
|
701
|
-
const gz = state.gZone;
|
|
702
|
-
const cc = state.contours;
|
|
703
|
-
for (let pi = 0; pi < gz.length; pi++) {
|
|
704
|
-
const p = gz[pi];
|
|
705
|
-
p.xTouched = p.yTouched = false;
|
|
706
|
-
p.xo = p.x = p.x + dx;
|
|
707
|
-
p.yo = p.y = p.y + dy;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
const gLen = gZone.length;
|
|
711
|
-
gZone.push.apply(gZone, gz);
|
|
712
|
-
for (let j = 0; j < cc.length; j++) {
|
|
713
|
-
contours.push(cc[j] + gLen);
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
if (glyph.instructions && !state.inhibitGridFit) {
|
|
718
|
-
// the composite has instructions on its own
|
|
719
|
-
state = new State('glyf', glyph.instructions);
|
|
720
|
-
|
|
721
|
-
state.gZone = state.z0 = state.z1 = state.z2 = gZone;
|
|
722
|
-
|
|
723
|
-
state.contours = contours;
|
|
724
|
-
|
|
725
|
-
// note: HPZero cannot be used here, since
|
|
726
|
-
// the point might be modified
|
|
727
|
-
gZone.push(
|
|
728
|
-
new HPoint(0, 0),
|
|
729
|
-
new HPoint(Math.round(glyph.advanceWidth * xScale), 0)
|
|
730
|
-
);
|
|
731
|
-
|
|
732
|
-
if (exports.DEBUG) {
|
|
733
|
-
console.log('---EXEC COMPOSITE---');
|
|
734
|
-
state.step = -1;
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
exec(state);
|
|
738
|
-
|
|
739
|
-
gZone.length -= 2;
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
return gZone;
|
|
744
|
-
};
|
|
745
|
-
|
|
746
|
-
/*
|
|
747
|
-
* Executes the hinting program for a component of a multi-component glyph
|
|
748
|
-
* or of the glyph itself for a non-component glyph.
|
|
749
|
-
*/
|
|
750
|
-
execComponent = function(glyph, state, xScale, yScale)
|
|
751
|
-
{
|
|
752
|
-
const points = glyph.points || [];
|
|
753
|
-
const pLen = points.length;
|
|
754
|
-
const gZone = state.gZone = state.z0 = state.z1 = state.z2 = [];
|
|
755
|
-
const contours = state.contours = [];
|
|
756
|
-
|
|
757
|
-
// Scales the original points and
|
|
758
|
-
// makes copies for the hinted points.
|
|
759
|
-
let cp; // current point
|
|
760
|
-
for (let i = 0; i < pLen; i++) {
|
|
761
|
-
cp = points[i];
|
|
762
|
-
|
|
763
|
-
gZone[i] = new HPoint(
|
|
764
|
-
cp.x * xScale,
|
|
765
|
-
cp.y * yScale,
|
|
766
|
-
cp.lastPointOfContour,
|
|
767
|
-
cp.onCurve
|
|
768
|
-
);
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
// Chain links the contours.
|
|
772
|
-
let sp; // start point
|
|
773
|
-
let np; // next point
|
|
774
|
-
|
|
775
|
-
for (let i = 0; i < pLen; i++) {
|
|
776
|
-
cp = gZone[i];
|
|
777
|
-
|
|
778
|
-
if (!sp) {
|
|
779
|
-
sp = cp;
|
|
780
|
-
contours.push(i);
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
if (cp.lastPointOfContour) {
|
|
784
|
-
cp.nextPointOnContour = sp;
|
|
785
|
-
sp.prevPointOnContour = cp;
|
|
786
|
-
sp = undefined;
|
|
787
|
-
} else {
|
|
788
|
-
np = gZone[i + 1];
|
|
789
|
-
cp.nextPointOnContour = np;
|
|
790
|
-
np.prevPointOnContour = cp;
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
if (state.inhibitGridFit) return;
|
|
795
|
-
|
|
796
|
-
if (exports.DEBUG) {
|
|
797
|
-
console.log('PROCESSING GLYPH', state.stack);
|
|
798
|
-
for (let i = 0; i < pLen; i++) {
|
|
799
|
-
console.log(i, gZone[i].x, gZone[i].y);
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
|
|
803
|
-
gZone.push(
|
|
804
|
-
new HPoint(0, 0),
|
|
805
|
-
new HPoint(Math.round(glyph.advanceWidth * xScale), 0)
|
|
806
|
-
);
|
|
807
|
-
|
|
808
|
-
exec(state);
|
|
809
|
-
|
|
810
|
-
// Removes the extra points.
|
|
811
|
-
gZone.length -= 2;
|
|
812
|
-
|
|
813
|
-
if (exports.DEBUG) {
|
|
814
|
-
console.log('FINISHED GLYPH', state.stack);
|
|
815
|
-
for (let i = 0; i < pLen; i++) {
|
|
816
|
-
console.log(i, gZone[i].x, gZone[i].y);
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
};
|
|
820
|
-
|
|
821
|
-
/*
|
|
822
|
-
* Executes the program loaded in state.
|
|
823
|
-
*/
|
|
824
|
-
exec = function(state) {
|
|
825
|
-
let prog = state.prog;
|
|
826
|
-
|
|
827
|
-
if (!prog) return;
|
|
828
|
-
|
|
829
|
-
const pLen = prog.length;
|
|
830
|
-
let ins;
|
|
831
|
-
|
|
832
|
-
for (state.ip = 0; state.ip < pLen; state.ip++) {
|
|
833
|
-
if (exports.DEBUG) state.step++;
|
|
834
|
-
ins = instructionTable[prog[state.ip]];
|
|
835
|
-
|
|
836
|
-
if (!ins) {
|
|
837
|
-
throw new Error(
|
|
838
|
-
'unknown instruction: 0x' +
|
|
839
|
-
Number(prog[state.ip]).toString(16)
|
|
840
|
-
);
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
ins(state);
|
|
844
|
-
|
|
845
|
-
// very extensive debugging for each step
|
|
846
|
-
/*
|
|
847
|
-
if (exports.DEBUG) {
|
|
848
|
-
var da;
|
|
849
|
-
if (state.gZone) {
|
|
850
|
-
da = [];
|
|
851
|
-
for (let i = 0; i < state.gZone.length; i++)
|
|
852
|
-
{
|
|
853
|
-
da.push(i + ' ' +
|
|
854
|
-
state.gZone[i].x * 64 + ' ' +
|
|
855
|
-
state.gZone[i].y * 64 + ' ' +
|
|
856
|
-
(state.gZone[i].xTouched ? 'x' : '') +
|
|
857
|
-
(state.gZone[i].yTouched ? 'y' : '')
|
|
858
|
-
);
|
|
859
|
-
}
|
|
860
|
-
console.log('GZ', da);
|
|
861
|
-
}
|
|
862
|
-
|
|
863
|
-
if (state.tZone) {
|
|
864
|
-
da = [];
|
|
865
|
-
for (let i = 0; i < state.tZone.length; i++) {
|
|
866
|
-
da.push(i + ' ' +
|
|
867
|
-
state.tZone[i].x * 64 + ' ' +
|
|
868
|
-
state.tZone[i].y * 64 + ' ' +
|
|
869
|
-
(state.tZone[i].xTouched ? 'x' : '') +
|
|
870
|
-
(state.tZone[i].yTouched ? 'y' : '')
|
|
871
|
-
);
|
|
872
|
-
}
|
|
873
|
-
console.log('TZ', da);
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
if (state.stack.length > 10) {
|
|
877
|
-
console.log(
|
|
878
|
-
state.stack.length,
|
|
879
|
-
'...', state.stack.slice(state.stack.length - 10)
|
|
880
|
-
);
|
|
881
|
-
} else {
|
|
882
|
-
console.log(state.stack.length, state.stack);
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
*/
|
|
886
|
-
}
|
|
887
|
-
};
|
|
888
|
-
|
|
889
|
-
/*
|
|
890
|
-
* Initializes the twilight zone.
|
|
891
|
-
*
|
|
892
|
-
* This is only done if a SZPx instruction
|
|
893
|
-
* refers to the twilight zone.
|
|
894
|
-
*/
|
|
895
|
-
function initTZone(state)
|
|
896
|
-
{
|
|
897
|
-
const tZone = state.tZone = new Array(state.gZone.length);
|
|
898
|
-
|
|
899
|
-
// no idea if this is actually correct...
|
|
900
|
-
for (let i = 0; i < tZone.length; i++)
|
|
901
|
-
{
|
|
902
|
-
tZone[i] = new HPoint(0, 0);
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
/*
|
|
907
|
-
* Skips the instruction pointer ahead over an IF/ELSE block.
|
|
908
|
-
* handleElse .. if true breaks on matching ELSE
|
|
909
|
-
*/
|
|
910
|
-
function skip(state, handleElse)
|
|
911
|
-
{
|
|
912
|
-
const prog = state.prog;
|
|
913
|
-
let ip = state.ip;
|
|
914
|
-
let nesting = 1;
|
|
915
|
-
let ins;
|
|
916
|
-
|
|
917
|
-
do {
|
|
918
|
-
ins = prog[++ip];
|
|
919
|
-
if (ins === 0x58) // IF
|
|
920
|
-
nesting++;
|
|
921
|
-
else if (ins === 0x59) // EIF
|
|
922
|
-
nesting--;
|
|
923
|
-
else if (ins === 0x40) // NPUSHB
|
|
924
|
-
ip += prog[ip + 1] + 1;
|
|
925
|
-
else if (ins === 0x41) // NPUSHW
|
|
926
|
-
ip += 2 * prog[ip + 1] + 1;
|
|
927
|
-
else if (ins >= 0xB0 && ins <= 0xB7) // PUSHB
|
|
928
|
-
ip += ins - 0xB0 + 1;
|
|
929
|
-
else if (ins >= 0xB8 && ins <= 0xBF) // PUSHW
|
|
930
|
-
ip += (ins - 0xB8 + 1) * 2;
|
|
931
|
-
else if (handleElse && nesting === 1 && ins === 0x1B) // ELSE
|
|
932
|
-
break;
|
|
933
|
-
} while (nesting > 0);
|
|
934
|
-
|
|
935
|
-
state.ip = ip;
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
/*----------------------------------------------------------*
|
|
939
|
-
* And then a lot of instructions... *
|
|
940
|
-
*----------------------------------------------------------*/
|
|
941
|
-
|
|
942
|
-
// SVTCA[a] Set freedom and projection Vectors To Coordinate Axis
|
|
943
|
-
// 0x00-0x01
|
|
944
|
-
function SVTCA(v, state) {
|
|
945
|
-
if (exports.DEBUG) console.log(state.step, 'SVTCA[' + v.axis + ']');
|
|
946
|
-
|
|
947
|
-
state.fv = state.pv = state.dpv = v;
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
// SPVTCA[a] Set Projection Vector to Coordinate Axis
|
|
951
|
-
// 0x02-0x03
|
|
952
|
-
function SPVTCA(v, state) {
|
|
953
|
-
if (exports.DEBUG) console.log(state.step, 'SPVTCA[' + v.axis + ']');
|
|
954
|
-
|
|
955
|
-
state.pv = state.dpv = v;
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
// SFVTCA[a] Set Freedom Vector to Coordinate Axis
|
|
959
|
-
// 0x04-0x05
|
|
960
|
-
function SFVTCA(v, state) {
|
|
961
|
-
if (exports.DEBUG) console.log(state.step, 'SFVTCA[' + v.axis + ']');
|
|
962
|
-
|
|
963
|
-
state.fv = v;
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
// SPVTL[a] Set Projection Vector To Line
|
|
967
|
-
// 0x06-0x07
|
|
968
|
-
function SPVTL(a, state) {
|
|
969
|
-
const stack = state.stack;
|
|
970
|
-
const p2i = stack.pop();
|
|
971
|
-
const p1i = stack.pop();
|
|
972
|
-
const p2 = state.z2[p2i];
|
|
973
|
-
const p1 = state.z1[p1i];
|
|
974
|
-
|
|
975
|
-
if (exports.DEBUG) console.log('SPVTL[' + a + ']', p2i, p1i);
|
|
976
|
-
|
|
977
|
-
let dx;
|
|
978
|
-
let dy;
|
|
979
|
-
|
|
980
|
-
if (!a) {
|
|
981
|
-
dx = p1.x - p2.x;
|
|
982
|
-
dy = p1.y - p2.y;
|
|
983
|
-
} else {
|
|
984
|
-
dx = p2.y - p1.y;
|
|
985
|
-
dy = p1.x - p2.x;
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
state.pv = state.dpv = getUnitVector(dx, dy);
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
// SFVTL[a] Set Freedom Vector To Line
|
|
992
|
-
// 0x08-0x09
|
|
993
|
-
function SFVTL(a, state) {
|
|
994
|
-
const stack = state.stack;
|
|
995
|
-
const p2i = stack.pop();
|
|
996
|
-
const p1i = stack.pop();
|
|
997
|
-
const p2 = state.z2[p2i];
|
|
998
|
-
const p1 = state.z1[p1i];
|
|
999
|
-
|
|
1000
|
-
if (exports.DEBUG) console.log('SFVTL[' + a + ']', p2i, p1i);
|
|
1001
|
-
|
|
1002
|
-
let dx;
|
|
1003
|
-
let dy;
|
|
1004
|
-
|
|
1005
|
-
if (!a) {
|
|
1006
|
-
dx = p1.x - p2.x;
|
|
1007
|
-
dy = p1.y - p2.y;
|
|
1008
|
-
} else {
|
|
1009
|
-
dx = p2.y - p1.y;
|
|
1010
|
-
dy = p1.x - p2.x;
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
state.fv = getUnitVector(dx, dy);
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
// SPVFS[] Set Projection Vector From Stack
|
|
1017
|
-
// 0x0A
|
|
1018
|
-
function SPVFS(state) {
|
|
1019
|
-
const stack = state.stack;
|
|
1020
|
-
const y = stack.pop();
|
|
1021
|
-
const x = stack.pop();
|
|
1022
|
-
|
|
1023
|
-
if (exports.DEBUG) console.log(state.step, 'SPVFS[]', y, x);
|
|
1024
|
-
|
|
1025
|
-
state.pv = state.dpv = getUnitVector(x, y);
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
// SFVFS[] Set Freedom Vector From Stack
|
|
1029
|
-
// 0x0B
|
|
1030
|
-
function SFVFS(state) {
|
|
1031
|
-
const stack = state.stack;
|
|
1032
|
-
const y = stack.pop();
|
|
1033
|
-
const x = stack.pop();
|
|
1034
|
-
|
|
1035
|
-
if (exports.DEBUG) console.log(state.step, 'SPVFS[]', y, x);
|
|
1036
|
-
|
|
1037
|
-
state.fv = getUnitVector(x, y);
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
// GPV[] Get Projection Vector
|
|
1041
|
-
// 0x0C
|
|
1042
|
-
function GPV(state) {
|
|
1043
|
-
const stack = state.stack;
|
|
1044
|
-
const pv = state.pv;
|
|
1045
|
-
|
|
1046
|
-
if (exports.DEBUG) console.log(state.step, 'GPV[]');
|
|
1047
|
-
|
|
1048
|
-
stack.push(pv.x * 0x4000);
|
|
1049
|
-
stack.push(pv.y * 0x4000);
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
// GFV[] Get Freedom Vector
|
|
1053
|
-
// 0x0C
|
|
1054
|
-
function GFV(state) {
|
|
1055
|
-
const stack = state.stack;
|
|
1056
|
-
const fv = state.fv;
|
|
1057
|
-
|
|
1058
|
-
if (exports.DEBUG) console.log(state.step, 'GFV[]');
|
|
1059
|
-
|
|
1060
|
-
stack.push(fv.x * 0x4000);
|
|
1061
|
-
stack.push(fv.y * 0x4000);
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
// SFVTPV[] Set Freedom Vector To Projection Vector
|
|
1065
|
-
// 0x0E
|
|
1066
|
-
function SFVTPV(state) {
|
|
1067
|
-
state.fv = state.pv;
|
|
1068
|
-
|
|
1069
|
-
if (exports.DEBUG) console.log(state.step, 'SFVTPV[]');
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
// ISECT[] moves point p to the InterSECTion of two lines
|
|
1073
|
-
// 0x0F
|
|
1074
|
-
function ISECT(state)
|
|
1075
|
-
{
|
|
1076
|
-
const stack = state.stack;
|
|
1077
|
-
const pa0i = stack.pop();
|
|
1078
|
-
const pa1i = stack.pop();
|
|
1079
|
-
const pb0i = stack.pop();
|
|
1080
|
-
const pb1i = stack.pop();
|
|
1081
|
-
const pi = stack.pop();
|
|
1082
|
-
const z0 = state.z0;
|
|
1083
|
-
const z1 = state.z1;
|
|
1084
|
-
const pa0 = z0[pa0i];
|
|
1085
|
-
const pa1 = z0[pa1i];
|
|
1086
|
-
const pb0 = z1[pb0i];
|
|
1087
|
-
const pb1 = z1[pb1i];
|
|
1088
|
-
const p = state.z2[pi];
|
|
1089
|
-
|
|
1090
|
-
if (exports.DEBUG) console.log('ISECT[], ', pa0i, pa1i, pb0i, pb1i, pi);
|
|
1091
|
-
|
|
1092
|
-
// math from
|
|
1093
|
-
// en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Given_two_points_on_each_line
|
|
1094
|
-
|
|
1095
|
-
const x1 = pa0.x;
|
|
1096
|
-
const y1 = pa0.y;
|
|
1097
|
-
const x2 = pa1.x;
|
|
1098
|
-
const y2 = pa1.y;
|
|
1099
|
-
const x3 = pb0.x;
|
|
1100
|
-
const y3 = pb0.y;
|
|
1101
|
-
const x4 = pb1.x;
|
|
1102
|
-
const y4 = pb1.y;
|
|
1103
|
-
|
|
1104
|
-
const div = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
|
|
1105
|
-
const f1 = x1 * y2 - y1 * x2;
|
|
1106
|
-
const f2 = x3 * y4 - y3 * x4;
|
|
1107
|
-
|
|
1108
|
-
p.x = (f1 * (x3 - x4) - f2 * (x1 - x2)) / div;
|
|
1109
|
-
p.y = (f1 * (y3 - y4) - f2 * (y1 - y2)) / div;
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
// SRP0[] Set Reference Point 0
|
|
1113
|
-
// 0x10
|
|
1114
|
-
function SRP0(state) {
|
|
1115
|
-
state.rp0 = state.stack.pop();
|
|
1116
|
-
|
|
1117
|
-
if (exports.DEBUG) console.log(state.step, 'SRP0[]', state.rp0);
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
// SRP1[] Set Reference Point 1
|
|
1121
|
-
// 0x11
|
|
1122
|
-
function SRP1(state) {
|
|
1123
|
-
state.rp1 = state.stack.pop();
|
|
1124
|
-
|
|
1125
|
-
if (exports.DEBUG) console.log(state.step, 'SRP1[]', state.rp1);
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
// SRP1[] Set Reference Point 2
|
|
1129
|
-
// 0x12
|
|
1130
|
-
function SRP2(state) {
|
|
1131
|
-
state.rp2 = state.stack.pop();
|
|
1132
|
-
|
|
1133
|
-
if (exports.DEBUG) console.log(state.step, 'SRP2[]', state.rp2);
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
// SZP0[] Set Zone Pointer 0
|
|
1137
|
-
// 0x13
|
|
1138
|
-
function SZP0(state) {
|
|
1139
|
-
const n = state.stack.pop();
|
|
1140
|
-
|
|
1141
|
-
if (exports.DEBUG) console.log(state.step, 'SZP0[]', n);
|
|
1142
|
-
|
|
1143
|
-
state.zp0 = n;
|
|
1144
|
-
|
|
1145
|
-
switch (n) {
|
|
1146
|
-
case 0:
|
|
1147
|
-
if (!state.tZone) initTZone(state);
|
|
1148
|
-
state.z0 = state.tZone;
|
|
1149
|
-
break;
|
|
1150
|
-
case 1 :
|
|
1151
|
-
state.z0 = state.gZone;
|
|
1152
|
-
break;
|
|
1153
|
-
default :
|
|
1154
|
-
throw new Error('Invalid zone pointer');
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
// SZP1[] Set Zone Pointer 1
|
|
1159
|
-
// 0x14
|
|
1160
|
-
function SZP1(state) {
|
|
1161
|
-
const n = state.stack.pop();
|
|
1162
|
-
|
|
1163
|
-
if (exports.DEBUG) console.log(state.step, 'SZP1[]', n);
|
|
1164
|
-
|
|
1165
|
-
state.zp1 = n;
|
|
1166
|
-
|
|
1167
|
-
switch (n) {
|
|
1168
|
-
case 0:
|
|
1169
|
-
if (!state.tZone) initTZone(state);
|
|
1170
|
-
state.z1 = state.tZone;
|
|
1171
|
-
break;
|
|
1172
|
-
case 1 :
|
|
1173
|
-
state.z1 = state.gZone;
|
|
1174
|
-
break;
|
|
1175
|
-
default :
|
|
1176
|
-
throw new Error('Invalid zone pointer');
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
// SZP2[] Set Zone Pointer 2
|
|
1181
|
-
// 0x15
|
|
1182
|
-
function SZP2(state) {
|
|
1183
|
-
const n = state.stack.pop();
|
|
1184
|
-
|
|
1185
|
-
if (exports.DEBUG) console.log(state.step, 'SZP2[]', n);
|
|
1186
|
-
|
|
1187
|
-
state.zp2 = n;
|
|
1188
|
-
|
|
1189
|
-
switch (n) {
|
|
1190
|
-
case 0:
|
|
1191
|
-
if (!state.tZone) initTZone(state);
|
|
1192
|
-
state.z2 = state.tZone;
|
|
1193
|
-
break;
|
|
1194
|
-
case 1 :
|
|
1195
|
-
state.z2 = state.gZone;
|
|
1196
|
-
break;
|
|
1197
|
-
default :
|
|
1198
|
-
throw new Error('Invalid zone pointer');
|
|
1199
|
-
}
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
// SZPS[] Set Zone PointerS
|
|
1203
|
-
// 0x16
|
|
1204
|
-
function SZPS(state) {
|
|
1205
|
-
const n = state.stack.pop();
|
|
1206
|
-
|
|
1207
|
-
if (exports.DEBUG) console.log(state.step, 'SZPS[]', n);
|
|
1208
|
-
|
|
1209
|
-
state.zp0 = state.zp1 = state.zp2 = n;
|
|
1210
|
-
|
|
1211
|
-
switch (n) {
|
|
1212
|
-
case 0:
|
|
1213
|
-
if (!state.tZone) initTZone(state);
|
|
1214
|
-
state.z0 = state.z1 = state.z2 = state.tZone;
|
|
1215
|
-
break;
|
|
1216
|
-
case 1 :
|
|
1217
|
-
state.z0 = state.z1 = state.z2 = state.gZone;
|
|
1218
|
-
break;
|
|
1219
|
-
default :
|
|
1220
|
-
throw new Error('Invalid zone pointer');
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
// SLOOP[] Set LOOP variable
|
|
1225
|
-
// 0x17
|
|
1226
|
-
function SLOOP(state) {
|
|
1227
|
-
state.loop = state.stack.pop();
|
|
1228
|
-
|
|
1229
|
-
if (exports.DEBUG) console.log(state.step, 'SLOOP[]', state.loop);
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
// RTG[] Round To Grid
|
|
1233
|
-
// 0x18
|
|
1234
|
-
function RTG(state) {
|
|
1235
|
-
if (exports.DEBUG) console.log(state.step, 'RTG[]');
|
|
1236
|
-
|
|
1237
|
-
state.round = roundToGrid;
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
// RTHG[] Round To Half Grid
|
|
1241
|
-
// 0x19
|
|
1242
|
-
function RTHG(state) {
|
|
1243
|
-
if (exports.DEBUG) console.log(state.step, 'RTHG[]');
|
|
1244
|
-
|
|
1245
|
-
state.round = roundToHalfGrid;
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
// SMD[] Set Minimum Distance
|
|
1249
|
-
// 0x1A
|
|
1250
|
-
function SMD(state) {
|
|
1251
|
-
const d = state.stack.pop();
|
|
1252
|
-
|
|
1253
|
-
if (exports.DEBUG) console.log(state.step, 'SMD[]', d);
|
|
1254
|
-
|
|
1255
|
-
state.minDis = d / 0x40;
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
// ELSE[] ELSE clause
|
|
1259
|
-
// 0x1B
|
|
1260
|
-
function ELSE(state) {
|
|
1261
|
-
// This instruction has been reached by executing a then branch
|
|
1262
|
-
// so it just skips ahead until matching EIF.
|
|
1263
|
-
//
|
|
1264
|
-
// In case the IF was negative the IF[] instruction already
|
|
1265
|
-
// skipped forward over the ELSE[]
|
|
1266
|
-
|
|
1267
|
-
if (exports.DEBUG) console.log(state.step, 'ELSE[]');
|
|
1268
|
-
|
|
1269
|
-
skip(state, false);
|
|
1270
|
-
}
|
|
1271
|
-
|
|
1272
|
-
// JMPR[] JuMP Relative
|
|
1273
|
-
// 0x1C
|
|
1274
|
-
function JMPR(state) {
|
|
1275
|
-
const o = state.stack.pop();
|
|
1276
|
-
|
|
1277
|
-
if (exports.DEBUG) console.log(state.step, 'JMPR[]', o);
|
|
1278
|
-
|
|
1279
|
-
// A jump by 1 would do nothing.
|
|
1280
|
-
state.ip += o - 1;
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
// SCVTCI[] Set Control Value Table Cut-In
|
|
1284
|
-
// 0x1D
|
|
1285
|
-
function SCVTCI(state) {
|
|
1286
|
-
const n = state.stack.pop();
|
|
1287
|
-
|
|
1288
|
-
if (exports.DEBUG) console.log(state.step, 'SCVTCI[]', n);
|
|
1289
|
-
|
|
1290
|
-
state.cvCutIn = n / 0x40;
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
// DUP[] DUPlicate top stack element
|
|
1294
|
-
// 0x20
|
|
1295
|
-
function DUP(state) {
|
|
1296
|
-
const stack = state.stack;
|
|
1297
|
-
|
|
1298
|
-
if (exports.DEBUG) console.log(state.step, 'DUP[]');
|
|
1299
|
-
|
|
1300
|
-
stack.push(stack[stack.length - 1]);
|
|
1301
|
-
}
|
|
1302
|
-
|
|
1303
|
-
// POP[] POP top stack element
|
|
1304
|
-
// 0x21
|
|
1305
|
-
function POP(state) {
|
|
1306
|
-
if (exports.DEBUG) console.log(state.step, 'POP[]');
|
|
1307
|
-
|
|
1308
|
-
state.stack.pop();
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
// CLEAR[] CLEAR the stack
|
|
1312
|
-
// 0x22
|
|
1313
|
-
function CLEAR(state) {
|
|
1314
|
-
if (exports.DEBUG) console.log(state.step, 'CLEAR[]');
|
|
1315
|
-
|
|
1316
|
-
state.stack.length = 0;
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
// SWAP[] SWAP the top two elements on the stack
|
|
1320
|
-
// 0x23
|
|
1321
|
-
function SWAP(state) {
|
|
1322
|
-
const stack = state.stack;
|
|
1323
|
-
|
|
1324
|
-
const a = stack.pop();
|
|
1325
|
-
const b = stack.pop();
|
|
1326
|
-
|
|
1327
|
-
if (exports.DEBUG) console.log(state.step, 'SWAP[]');
|
|
1328
|
-
|
|
1329
|
-
stack.push(a);
|
|
1330
|
-
stack.push(b);
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
// DEPTH[] DEPTH of the stack
|
|
1334
|
-
// 0x24
|
|
1335
|
-
function DEPTH(state) {
|
|
1336
|
-
const stack = state.stack;
|
|
1337
|
-
|
|
1338
|
-
if (exports.DEBUG) console.log(state.step, 'DEPTH[]');
|
|
1339
|
-
|
|
1340
|
-
stack.push(stack.length);
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
// LOOPCALL[] LOOPCALL function
|
|
1344
|
-
// 0x2A
|
|
1345
|
-
function LOOPCALL(state) {
|
|
1346
|
-
const stack = state.stack;
|
|
1347
|
-
const fn = stack.pop();
|
|
1348
|
-
const c = stack.pop();
|
|
1349
|
-
|
|
1350
|
-
if (exports.DEBUG) console.log(state.step, 'LOOPCALL[]', fn, c);
|
|
1351
|
-
|
|
1352
|
-
// saves callers program
|
|
1353
|
-
const cip = state.ip;
|
|
1354
|
-
const cprog = state.prog;
|
|
1355
|
-
|
|
1356
|
-
state.prog = state.funcs[fn];
|
|
1357
|
-
|
|
1358
|
-
// executes the function
|
|
1359
|
-
for (let i = 0; i < c; i++) {
|
|
1360
|
-
exec(state);
|
|
1361
|
-
|
|
1362
|
-
if (exports.DEBUG) console.log(
|
|
1363
|
-
++state.step,
|
|
1364
|
-
i + 1 < c ? 'next loopcall' : 'done loopcall',
|
|
1365
|
-
i
|
|
1366
|
-
);
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
// restores the callers program
|
|
1370
|
-
state.ip = cip;
|
|
1371
|
-
state.prog = cprog;
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
// CALL[] CALL function
|
|
1375
|
-
// 0x2B
|
|
1376
|
-
function CALL(state) {
|
|
1377
|
-
const fn = state.stack.pop();
|
|
1378
|
-
|
|
1379
|
-
if (exports.DEBUG) console.log(state.step, 'CALL[]', fn);
|
|
1380
|
-
|
|
1381
|
-
// saves callers program
|
|
1382
|
-
const cip = state.ip;
|
|
1383
|
-
const cprog = state.prog;
|
|
1384
|
-
|
|
1385
|
-
state.prog = state.funcs[fn];
|
|
1386
|
-
|
|
1387
|
-
// executes the function
|
|
1388
|
-
exec(state);
|
|
1389
|
-
|
|
1390
|
-
// restores the callers program
|
|
1391
|
-
state.ip = cip;
|
|
1392
|
-
state.prog = cprog;
|
|
1393
|
-
|
|
1394
|
-
if (exports.DEBUG) console.log(++state.step, 'returning from', fn);
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
|
-
// CINDEX[] Copy the INDEXed element to the top of the stack
|
|
1398
|
-
// 0x25
|
|
1399
|
-
function CINDEX(state) {
|
|
1400
|
-
const stack = state.stack;
|
|
1401
|
-
const k = stack.pop();
|
|
1402
|
-
|
|
1403
|
-
if (exports.DEBUG) console.log(state.step, 'CINDEX[]', k);
|
|
1404
|
-
|
|
1405
|
-
// In case of k == 1, it copies the last element after popping
|
|
1406
|
-
// thus stack.length - k.
|
|
1407
|
-
stack.push(stack[stack.length - k]);
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
// MINDEX[] Move the INDEXed element to the top of the stack
|
|
1411
|
-
// 0x26
|
|
1412
|
-
function MINDEX(state) {
|
|
1413
|
-
const stack = state.stack;
|
|
1414
|
-
const k = stack.pop();
|
|
1415
|
-
|
|
1416
|
-
if (exports.DEBUG) console.log(state.step, 'MINDEX[]', k);
|
|
1417
|
-
|
|
1418
|
-
stack.push(stack.splice(stack.length - k, 1)[0]);
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
// FDEF[] Function DEFinition
|
|
1422
|
-
// 0x2C
|
|
1423
|
-
function FDEF(state) {
|
|
1424
|
-
if (state.env !== 'fpgm') throw new Error('FDEF not allowed here');
|
|
1425
|
-
const stack = state.stack;
|
|
1426
|
-
const prog = state.prog;
|
|
1427
|
-
let ip = state.ip;
|
|
1428
|
-
|
|
1429
|
-
const fn = stack.pop();
|
|
1430
|
-
const ipBegin = ip;
|
|
1431
|
-
|
|
1432
|
-
if (exports.DEBUG) console.log(state.step, 'FDEF[]', fn);
|
|
1433
|
-
|
|
1434
|
-
while (prog[++ip] !== 0x2D);
|
|
1435
|
-
|
|
1436
|
-
state.ip = ip;
|
|
1437
|
-
state.funcs[fn] = prog.slice(ipBegin + 1, ip);
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
// MDAP[a] Move Direct Absolute Point
|
|
1441
|
-
// 0x2E-0x2F
|
|
1442
|
-
function MDAP(round, state) {
|
|
1443
|
-
const pi = state.stack.pop();
|
|
1444
|
-
const p = state.z0[pi];
|
|
1445
|
-
const fv = state.fv;
|
|
1446
|
-
const pv = state.pv;
|
|
1447
|
-
|
|
1448
|
-
if (exports.DEBUG) console.log(state.step, 'MDAP[' + round + ']', pi);
|
|
1449
|
-
|
|
1450
|
-
let d = pv.distance(p, HPZero);
|
|
1451
|
-
|
|
1452
|
-
if (round) d = state.round(d);
|
|
1453
|
-
|
|
1454
|
-
fv.setRelative(p, HPZero, d, pv);
|
|
1455
|
-
fv.touch(p);
|
|
1456
|
-
|
|
1457
|
-
state.rp0 = state.rp1 = pi;
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
// IUP[a] Interpolate Untouched Points through the outline
|
|
1461
|
-
// 0x30
|
|
1462
|
-
function IUP(v, state) {
|
|
1463
|
-
const z2 = state.z2;
|
|
1464
|
-
const pLen = z2.length - 2;
|
|
1465
|
-
let cp;
|
|
1466
|
-
let pp;
|
|
1467
|
-
let np;
|
|
1468
|
-
|
|
1469
|
-
if (exports.DEBUG) console.log(state.step, 'IUP[' + v.axis + ']');
|
|
1470
|
-
|
|
1471
|
-
for (let i = 0; i < pLen; i++) {
|
|
1472
|
-
cp = z2[i]; // current point
|
|
1473
|
-
|
|
1474
|
-
// if this point has been touched go on
|
|
1475
|
-
if (v.touched(cp)) continue;
|
|
1476
|
-
|
|
1477
|
-
pp = cp.prevTouched(v);
|
|
1478
|
-
|
|
1479
|
-
// no point on the contour has been touched?
|
|
1480
|
-
if (pp === cp) continue;
|
|
1481
|
-
|
|
1482
|
-
np = cp.nextTouched(v);
|
|
1483
|
-
|
|
1484
|
-
if (pp === np) {
|
|
1485
|
-
// only one point on the contour has been touched
|
|
1486
|
-
// so simply moves the point like that
|
|
1487
|
-
|
|
1488
|
-
v.setRelative(cp, cp, v.distance(pp, pp, false, true), v, true);
|
|
1489
|
-
}
|
|
1490
|
-
|
|
1491
|
-
v.interpolate(cp, pp, np, v);
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
// SHP[] SHift Point using reference point
|
|
1496
|
-
// 0x32-0x33
|
|
1497
|
-
function SHP(a, state) {
|
|
1498
|
-
const stack = state.stack;
|
|
1499
|
-
const rpi = a ? state.rp1 : state.rp2;
|
|
1500
|
-
const rp = (a ? state.z0 : state.z1)[rpi];
|
|
1501
|
-
const fv = state.fv;
|
|
1502
|
-
const pv = state.pv;
|
|
1503
|
-
let loop = state.loop;
|
|
1504
|
-
const z2 = state.z2;
|
|
1505
|
-
|
|
1506
|
-
while (loop--)
|
|
1507
|
-
{
|
|
1508
|
-
const pi = stack.pop();
|
|
1509
|
-
const p = z2[pi];
|
|
1510
|
-
|
|
1511
|
-
const d = pv.distance(rp, rp, false, true);
|
|
1512
|
-
fv.setRelative(p, p, d, pv);
|
|
1513
|
-
fv.touch(p);
|
|
1514
|
-
|
|
1515
|
-
if (exports.DEBUG) {
|
|
1516
|
-
console.log(
|
|
1517
|
-
state.step,
|
|
1518
|
-
(state.loop > 1 ?
|
|
1519
|
-
'loop ' + (state.loop - loop) + ': ' :
|
|
1520
|
-
''
|
|
1521
|
-
) +
|
|
1522
|
-
'SHP[' + (a ? 'rp1' : 'rp2') + ']', pi
|
|
1523
|
-
);
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
state.loop = 1;
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1530
|
-
// SHC[] SHift Contour using reference point
|
|
1531
|
-
// 0x36-0x37
|
|
1532
|
-
function SHC(a, state) {
|
|
1533
|
-
const stack = state.stack;
|
|
1534
|
-
const rpi = a ? state.rp1 : state.rp2;
|
|
1535
|
-
const rp = (a ? state.z0 : state.z1)[rpi];
|
|
1536
|
-
const fv = state.fv;
|
|
1537
|
-
const pv = state.pv;
|
|
1538
|
-
const ci = stack.pop();
|
|
1539
|
-
const sp = state.z2[state.contours[ci]];
|
|
1540
|
-
let p = sp;
|
|
1541
|
-
|
|
1542
|
-
if (exports.DEBUG) console.log(state.step, 'SHC[' + a + ']', ci);
|
|
1543
|
-
|
|
1544
|
-
const d = pv.distance(rp, rp, false, true);
|
|
1545
|
-
|
|
1546
|
-
do {
|
|
1547
|
-
if (p !== rp) fv.setRelative(p, p, d, pv);
|
|
1548
|
-
p = p.nextPointOnContour;
|
|
1549
|
-
} while (p !== sp);
|
|
1550
|
-
}
|
|
1551
|
-
|
|
1552
|
-
// SHZ[] SHift Zone using reference point
|
|
1553
|
-
// 0x36-0x37
|
|
1554
|
-
function SHZ(a, state) {
|
|
1555
|
-
const stack = state.stack;
|
|
1556
|
-
const rpi = a ? state.rp1 : state.rp2;
|
|
1557
|
-
const rp = (a ? state.z0 : state.z1)[rpi];
|
|
1558
|
-
const fv = state.fv;
|
|
1559
|
-
const pv = state.pv;
|
|
1560
|
-
|
|
1561
|
-
const e = stack.pop();
|
|
1562
|
-
|
|
1563
|
-
if (exports.DEBUG) console.log(state.step, 'SHZ[' + a + ']', e);
|
|
1564
|
-
|
|
1565
|
-
let z;
|
|
1566
|
-
switch (e) {
|
|
1567
|
-
case 0 : z = state.tZone; break;
|
|
1568
|
-
case 1 : z = state.gZone; break;
|
|
1569
|
-
default : throw new Error('Invalid zone');
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
let p;
|
|
1573
|
-
const d = pv.distance(rp, rp, false, true);
|
|
1574
|
-
const pLen = z.length - 2;
|
|
1575
|
-
for (let i = 0; i < pLen; i++)
|
|
1576
|
-
{
|
|
1577
|
-
p = z[i];
|
|
1578
|
-
fv.setRelative(p, p, d, pv);
|
|
1579
|
-
//if (p !== rp) fv.setRelative(p, p, d, pv);
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
// SHPIX[] SHift point by a PIXel amount
|
|
1584
|
-
// 0x38
|
|
1585
|
-
function SHPIX(state) {
|
|
1586
|
-
const stack = state.stack;
|
|
1587
|
-
let loop = state.loop;
|
|
1588
|
-
const fv = state.fv;
|
|
1589
|
-
const d = stack.pop() / 0x40;
|
|
1590
|
-
const z2 = state.z2;
|
|
1591
|
-
|
|
1592
|
-
while (loop--) {
|
|
1593
|
-
const pi = stack.pop();
|
|
1594
|
-
const p = z2[pi];
|
|
1595
|
-
|
|
1596
|
-
if (exports.DEBUG) {
|
|
1597
|
-
console.log(
|
|
1598
|
-
state.step,
|
|
1599
|
-
(state.loop > 1 ? 'loop ' + (state.loop - loop) + ': ' : '') +
|
|
1600
|
-
'SHPIX[]', pi, d
|
|
1601
|
-
);
|
|
1602
|
-
}
|
|
1603
|
-
|
|
1604
|
-
fv.setRelative(p, p, d);
|
|
1605
|
-
fv.touch(p);
|
|
1606
|
-
}
|
|
1607
|
-
|
|
1608
|
-
state.loop = 1;
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
|
-
// IP[] Interpolate Point
|
|
1612
|
-
// 0x39
|
|
1613
|
-
function IP(state) {
|
|
1614
|
-
const stack = state.stack;
|
|
1615
|
-
const rp1i = state.rp1;
|
|
1616
|
-
const rp2i = state.rp2;
|
|
1617
|
-
let loop = state.loop;
|
|
1618
|
-
const rp1 = state.z0[rp1i];
|
|
1619
|
-
const rp2 = state.z1[rp2i];
|
|
1620
|
-
const fv = state.fv;
|
|
1621
|
-
const pv = state.dpv;
|
|
1622
|
-
const z2 = state.z2;
|
|
1623
|
-
|
|
1624
|
-
while (loop--) {
|
|
1625
|
-
const pi = stack.pop();
|
|
1626
|
-
const p = z2[pi];
|
|
1627
|
-
|
|
1628
|
-
if (exports.DEBUG) {
|
|
1629
|
-
console.log(
|
|
1630
|
-
state.step,
|
|
1631
|
-
(state.loop > 1 ? 'loop ' + (state.loop - loop) + ': ' : '') +
|
|
1632
|
-
'IP[]', pi, rp1i, '<->', rp2i
|
|
1633
|
-
);
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
fv.interpolate(p, rp1, rp2, pv);
|
|
1637
|
-
|
|
1638
|
-
fv.touch(p);
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
state.loop = 1;
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
// MSIRP[a] Move Stack Indirect Relative Point
|
|
1645
|
-
// 0x3A-0x3B
|
|
1646
|
-
function MSIRP(a, state) {
|
|
1647
|
-
const stack = state.stack;
|
|
1648
|
-
const d = stack.pop() / 64;
|
|
1649
|
-
const pi = stack.pop();
|
|
1650
|
-
const p = state.z1[pi];
|
|
1651
|
-
const rp0 = state.z0[state.rp0];
|
|
1652
|
-
const fv = state.fv;
|
|
1653
|
-
const pv = state.pv;
|
|
1654
|
-
|
|
1655
|
-
fv.setRelative(p, rp0, d, pv);
|
|
1656
|
-
fv.touch(p);
|
|
1657
|
-
|
|
1658
|
-
if (exports.DEBUG) console.log(state.step, 'MSIRP[' + a + ']', d, pi);
|
|
1659
|
-
|
|
1660
|
-
state.rp1 = state.rp0;
|
|
1661
|
-
state.rp2 = pi;
|
|
1662
|
-
if (a) state.rp0 = pi;
|
|
1663
|
-
}
|
|
1664
|
-
|
|
1665
|
-
// ALIGNRP[] Align to reference point.
|
|
1666
|
-
// 0x3C
|
|
1667
|
-
function ALIGNRP(state) {
|
|
1668
|
-
const stack = state.stack;
|
|
1669
|
-
const rp0i = state.rp0;
|
|
1670
|
-
const rp0 = state.z0[rp0i];
|
|
1671
|
-
let loop = state.loop;
|
|
1672
|
-
const fv = state.fv;
|
|
1673
|
-
const pv = state.pv;
|
|
1674
|
-
const z1 = state.z1;
|
|
1675
|
-
|
|
1676
|
-
while (loop--) {
|
|
1677
|
-
const pi = stack.pop();
|
|
1678
|
-
const p = z1[pi];
|
|
1679
|
-
|
|
1680
|
-
if (exports.DEBUG) {
|
|
1681
|
-
console.log(
|
|
1682
|
-
state.step,
|
|
1683
|
-
(state.loop > 1 ? 'loop ' + (state.loop - loop) + ': ' : '') +
|
|
1684
|
-
'ALIGNRP[]', pi
|
|
1685
|
-
);
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
fv.setRelative(p, rp0, 0, pv);
|
|
1689
|
-
fv.touch(p);
|
|
1690
|
-
}
|
|
1691
|
-
|
|
1692
|
-
state.loop = 1;
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
|
-
// RTG[] Round To Double Grid
|
|
1696
|
-
// 0x3D
|
|
1697
|
-
function RTDG(state) {
|
|
1698
|
-
if (exports.DEBUG) console.log(state.step, 'RTDG[]');
|
|
1699
|
-
|
|
1700
|
-
state.round = roundToDoubleGrid;
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
// MIAP[a] Move Indirect Absolute Point
|
|
1704
|
-
// 0x3E-0x3F
|
|
1705
|
-
function MIAP(round, state) {
|
|
1706
|
-
const stack = state.stack;
|
|
1707
|
-
const n = stack.pop();
|
|
1708
|
-
const pi = stack.pop();
|
|
1709
|
-
const p = state.z0[pi];
|
|
1710
|
-
const fv = state.fv;
|
|
1711
|
-
const pv = state.pv;
|
|
1712
|
-
let cv = state.cvt[n];
|
|
1713
|
-
|
|
1714
|
-
if (exports.DEBUG) {
|
|
1715
|
-
console.log(
|
|
1716
|
-
state.step,
|
|
1717
|
-
'MIAP[' + round + ']',
|
|
1718
|
-
n, '(', cv, ')', pi
|
|
1719
|
-
);
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
let d = pv.distance(p, HPZero);
|
|
1723
|
-
|
|
1724
|
-
if (round) {
|
|
1725
|
-
if (Math.abs(d - cv) < state.cvCutIn) d = cv;
|
|
1726
|
-
|
|
1727
|
-
d = state.round(d);
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
fv.setRelative(p, HPZero, d, pv);
|
|
1731
|
-
|
|
1732
|
-
if (state.zp0 === 0) {
|
|
1733
|
-
p.xo = p.x;
|
|
1734
|
-
p.yo = p.y;
|
|
1735
|
-
}
|
|
1736
|
-
|
|
1737
|
-
fv.touch(p);
|
|
1738
|
-
|
|
1739
|
-
state.rp0 = state.rp1 = pi;
|
|
1740
|
-
}
|
|
1741
|
-
|
|
1742
|
-
// NPUSB[] PUSH N Bytes
|
|
1743
|
-
// 0x40
|
|
1744
|
-
function NPUSHB(state) {
|
|
1745
|
-
const prog = state.prog;
|
|
1746
|
-
let ip = state.ip;
|
|
1747
|
-
const stack = state.stack;
|
|
1748
|
-
|
|
1749
|
-
const n = prog[++ip];
|
|
1750
|
-
|
|
1751
|
-
if (exports.DEBUG) console.log(state.step, 'NPUSHB[]', n);
|
|
1752
|
-
|
|
1753
|
-
for (let i = 0; i < n; i++) stack.push(prog[++ip]);
|
|
1754
|
-
|
|
1755
|
-
state.ip = ip;
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
// NPUSHW[] PUSH N Words
|
|
1759
|
-
// 0x41
|
|
1760
|
-
function NPUSHW(state) {
|
|
1761
|
-
let ip = state.ip;
|
|
1762
|
-
const prog = state.prog;
|
|
1763
|
-
const stack = state.stack;
|
|
1764
|
-
const n = prog[++ip];
|
|
1765
|
-
|
|
1766
|
-
if (exports.DEBUG) console.log(state.step, 'NPUSHW[]', n);
|
|
1767
|
-
|
|
1768
|
-
for (let i = 0; i < n; i++) {
|
|
1769
|
-
let w = (prog[++ip] << 8) | prog[++ip];
|
|
1770
|
-
if (w & 0x8000) w = -((w ^ 0xffff) + 1);
|
|
1771
|
-
stack.push(w);
|
|
1772
|
-
}
|
|
1773
|
-
|
|
1774
|
-
state.ip = ip;
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
// WS[] Write Store
|
|
1778
|
-
// 0x42
|
|
1779
|
-
function WS(state) {
|
|
1780
|
-
const stack = state.stack;
|
|
1781
|
-
let store = state.store;
|
|
1782
|
-
|
|
1783
|
-
if (!store) store = state.store = [];
|
|
1784
|
-
|
|
1785
|
-
const v = stack.pop();
|
|
1786
|
-
const l = stack.pop();
|
|
1787
|
-
|
|
1788
|
-
if (exports.DEBUG) console.log(state.step, 'WS', v, l);
|
|
1789
|
-
|
|
1790
|
-
store[l] = v;
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
// RS[] Read Store
|
|
1794
|
-
// 0x43
|
|
1795
|
-
function RS(state) {
|
|
1796
|
-
const stack = state.stack;
|
|
1797
|
-
const store = state.store;
|
|
1798
|
-
|
|
1799
|
-
const l = stack.pop();
|
|
1800
|
-
|
|
1801
|
-
if (exports.DEBUG) console.log(state.step, 'RS', l);
|
|
1802
|
-
|
|
1803
|
-
const v = (store && store[l]) || 0;
|
|
1804
|
-
|
|
1805
|
-
stack.push(v);
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
|
-
// WCVTP[] Write Control Value Table in Pixel units
|
|
1809
|
-
// 0x44
|
|
1810
|
-
function WCVTP(state) {
|
|
1811
|
-
const stack = state.stack;
|
|
1812
|
-
|
|
1813
|
-
const v = stack.pop();
|
|
1814
|
-
const l = stack.pop();
|
|
1815
|
-
|
|
1816
|
-
if (exports.DEBUG) console.log(state.step, 'WCVTP', v, l);
|
|
1817
|
-
|
|
1818
|
-
state.cvt[l] = v / 0x40;
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
|
-
// RCVT[] Read Control Value Table entry
|
|
1822
|
-
// 0x45
|
|
1823
|
-
function RCVT(state) {
|
|
1824
|
-
const stack = state.stack;
|
|
1825
|
-
const cvte = stack.pop();
|
|
1826
|
-
|
|
1827
|
-
if (exports.DEBUG) console.log(state.step, 'RCVT', cvte);
|
|
1828
|
-
|
|
1829
|
-
stack.push(state.cvt[cvte] * 0x40);
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
// GC[] Get Coordinate projected onto the projection vector
|
|
1833
|
-
// 0x46-0x47
|
|
1834
|
-
function GC(a, state) {
|
|
1835
|
-
const stack = state.stack;
|
|
1836
|
-
const pi = stack.pop();
|
|
1837
|
-
const p = state.z2[pi];
|
|
1838
|
-
|
|
1839
|
-
if (exports.DEBUG) console.log(state.step, 'GC[' + a + ']', pi);
|
|
1840
|
-
|
|
1841
|
-
stack.push(state.dpv.distance(p, HPZero, a, false) * 0x40);
|
|
1842
|
-
}
|
|
1843
|
-
|
|
1844
|
-
// MD[a] Measure Distance
|
|
1845
|
-
// 0x49-0x4A
|
|
1846
|
-
function MD(a, state) {
|
|
1847
|
-
const stack = state.stack;
|
|
1848
|
-
const pi2 = stack.pop();
|
|
1849
|
-
const pi1 = stack.pop();
|
|
1850
|
-
const p2 = state.z1[pi2];
|
|
1851
|
-
const p1 = state.z0[pi1];
|
|
1852
|
-
const d = state.dpv.distance(p1, p2, a, a);
|
|
1853
|
-
|
|
1854
|
-
if (exports.DEBUG) console.log(state.step, 'MD[' + a + ']', pi2, pi1, '->', d);
|
|
1855
|
-
|
|
1856
|
-
state.stack.push(Math.round(d * 64));
|
|
1857
|
-
}
|
|
1858
|
-
|
|
1859
|
-
// MPPEM[] Measure Pixels Per EM
|
|
1860
|
-
// 0x4B
|
|
1861
|
-
function MPPEM(state) {
|
|
1862
|
-
if (exports.DEBUG) console.log(state.step, 'MPPEM[]');
|
|
1863
|
-
state.stack.push(state.ppem);
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
// FLIPON[] set the auto FLIP Boolean to ON
|
|
1867
|
-
// 0x4D
|
|
1868
|
-
function FLIPON(state) {
|
|
1869
|
-
if (exports.DEBUG) console.log(state.step, 'FLIPON[]');
|
|
1870
|
-
state.autoFlip = true;
|
|
1871
|
-
}
|
|
1872
|
-
|
|
1873
|
-
// LT[] Less Than
|
|
1874
|
-
// 0x50
|
|
1875
|
-
function LT(state) {
|
|
1876
|
-
const stack = state.stack;
|
|
1877
|
-
const e2 = stack.pop();
|
|
1878
|
-
const e1 = stack.pop();
|
|
1879
|
-
|
|
1880
|
-
if (exports.DEBUG) console.log(state.step, 'LT[]', e2, e1);
|
|
1881
|
-
|
|
1882
|
-
stack.push(e1 < e2 ? 1 : 0);
|
|
1883
|
-
}
|
|
1884
|
-
|
|
1885
|
-
// LTEQ[] Less Than or EQual
|
|
1886
|
-
// 0x53
|
|
1887
|
-
function LTEQ(state) {
|
|
1888
|
-
const stack = state.stack;
|
|
1889
|
-
const e2 = stack.pop();
|
|
1890
|
-
const e1 = stack.pop();
|
|
1891
|
-
|
|
1892
|
-
if (exports.DEBUG) console.log(state.step, 'LTEQ[]', e2, e1);
|
|
1893
|
-
|
|
1894
|
-
stack.push(e1 <= e2 ? 1 : 0);
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
// GTEQ[] Greater Than
|
|
1898
|
-
// 0x52
|
|
1899
|
-
function GT(state) {
|
|
1900
|
-
const stack = state.stack;
|
|
1901
|
-
const e2 = stack.pop();
|
|
1902
|
-
const e1 = stack.pop();
|
|
1903
|
-
|
|
1904
|
-
if (exports.DEBUG) console.log(state.step, 'GT[]', e2, e1);
|
|
1905
|
-
|
|
1906
|
-
stack.push(e1 > e2 ? 1 : 0);
|
|
1907
|
-
}
|
|
1908
|
-
|
|
1909
|
-
// GTEQ[] Greater Than or EQual
|
|
1910
|
-
// 0x53
|
|
1911
|
-
function GTEQ(state) {
|
|
1912
|
-
const stack = state.stack;
|
|
1913
|
-
const e2 = stack.pop();
|
|
1914
|
-
const e1 = stack.pop();
|
|
1915
|
-
|
|
1916
|
-
if (exports.DEBUG) console.log(state.step, 'GTEQ[]', e2, e1);
|
|
1917
|
-
|
|
1918
|
-
stack.push(e1 >= e2 ? 1 : 0);
|
|
1919
|
-
}
|
|
1920
|
-
|
|
1921
|
-
// EQ[] EQual
|
|
1922
|
-
// 0x54
|
|
1923
|
-
function EQ(state) {
|
|
1924
|
-
const stack = state.stack;
|
|
1925
|
-
const e2 = stack.pop();
|
|
1926
|
-
const e1 = stack.pop();
|
|
1927
|
-
|
|
1928
|
-
if (exports.DEBUG) console.log(state.step, 'EQ[]', e2, e1);
|
|
1929
|
-
|
|
1930
|
-
stack.push(e2 === e1 ? 1 : 0);
|
|
1931
|
-
}
|
|
1932
|
-
|
|
1933
|
-
// NEQ[] Not EQual
|
|
1934
|
-
// 0x55
|
|
1935
|
-
function NEQ(state) {
|
|
1936
|
-
const stack = state.stack;
|
|
1937
|
-
const e2 = stack.pop();
|
|
1938
|
-
const e1 = stack.pop();
|
|
1939
|
-
|
|
1940
|
-
if (exports.DEBUG) console.log(state.step, 'NEQ[]', e2, e1);
|
|
1941
|
-
|
|
1942
|
-
stack.push(e2 !== e1 ? 1 : 0);
|
|
1943
|
-
}
|
|
1944
|
-
|
|
1945
|
-
// ODD[] ODD
|
|
1946
|
-
// 0x56
|
|
1947
|
-
function ODD(state) {
|
|
1948
|
-
const stack = state.stack;
|
|
1949
|
-
const n = stack.pop();
|
|
1950
|
-
|
|
1951
|
-
if (exports.DEBUG) console.log(state.step, 'ODD[]', n);
|
|
1952
|
-
|
|
1953
|
-
stack.push(Math.trunc(n) % 2 ? 1 : 0);
|
|
1954
|
-
}
|
|
1955
|
-
|
|
1956
|
-
// EVEN[] EVEN
|
|
1957
|
-
// 0x57
|
|
1958
|
-
function EVEN(state) {
|
|
1959
|
-
const stack = state.stack;
|
|
1960
|
-
const n = stack.pop();
|
|
1961
|
-
|
|
1962
|
-
if (exports.DEBUG) console.log(state.step, 'EVEN[]', n);
|
|
1963
|
-
|
|
1964
|
-
stack.push(Math.trunc(n) % 2 ? 0 : 1);
|
|
1965
|
-
}
|
|
1966
|
-
|
|
1967
|
-
// IF[] IF test
|
|
1968
|
-
// 0x58
|
|
1969
|
-
function IF(state) {
|
|
1970
|
-
let test = state.stack.pop();
|
|
1971
|
-
let ins;
|
|
1972
|
-
|
|
1973
|
-
if (exports.DEBUG) console.log(state.step, 'IF[]', test);
|
|
1974
|
-
|
|
1975
|
-
// if test is true it just continues
|
|
1976
|
-
// if not the ip is skipped until matching ELSE or EIF
|
|
1977
|
-
if (!test) {
|
|
1978
|
-
skip(state, true);
|
|
1979
|
-
|
|
1980
|
-
if (exports.DEBUG) console.log(state.step, ins === 0x1B ? 'ELSE[]' : 'EIF[]');
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
|
|
1984
|
-
// EIF[] End IF
|
|
1985
|
-
// 0x59
|
|
1986
|
-
function EIF(state) {
|
|
1987
|
-
// this can be reached normally when
|
|
1988
|
-
// executing an else branch.
|
|
1989
|
-
// -> just ignore it
|
|
1990
|
-
|
|
1991
|
-
if (exports.DEBUG) console.log(state.step, 'EIF[]');
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
|
-
// AND[] logical AND
|
|
1995
|
-
// 0x5A
|
|
1996
|
-
function AND(state) {
|
|
1997
|
-
const stack = state.stack;
|
|
1998
|
-
const e2 = stack.pop();
|
|
1999
|
-
const e1 = stack.pop();
|
|
2000
|
-
|
|
2001
|
-
if (exports.DEBUG) console.log(state.step, 'AND[]', e2, e1);
|
|
2002
|
-
|
|
2003
|
-
stack.push(e2 && e1 ? 1 : 0);
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
|
-
// OR[] logical OR
|
|
2007
|
-
// 0x5B
|
|
2008
|
-
function OR(state) {
|
|
2009
|
-
const stack = state.stack;
|
|
2010
|
-
const e2 = stack.pop();
|
|
2011
|
-
const e1 = stack.pop();
|
|
2012
|
-
|
|
2013
|
-
if (exports.DEBUG) console.log(state.step, 'OR[]', e2, e1);
|
|
2014
|
-
|
|
2015
|
-
stack.push(e2 || e1 ? 1 : 0);
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
// NOT[] logical NOT
|
|
2019
|
-
// 0x5C
|
|
2020
|
-
function NOT(state) {
|
|
2021
|
-
const stack = state.stack;
|
|
2022
|
-
const e = stack.pop();
|
|
2023
|
-
|
|
2024
|
-
if (exports.DEBUG) console.log(state.step, 'NOT[]', e);
|
|
2025
|
-
|
|
2026
|
-
stack.push(e ? 0 : 1);
|
|
2027
|
-
}
|
|
2028
|
-
|
|
2029
|
-
// DELTAP1[] DELTA exception P1
|
|
2030
|
-
// DELTAP2[] DELTA exception P2
|
|
2031
|
-
// DELTAP3[] DELTA exception P3
|
|
2032
|
-
// 0x5D, 0x71, 0x72
|
|
2033
|
-
function DELTAP123(b, state) {
|
|
2034
|
-
const stack = state.stack;
|
|
2035
|
-
const n = stack.pop();
|
|
2036
|
-
const fv = state.fv;
|
|
2037
|
-
const pv = state.pv;
|
|
2038
|
-
const ppem = state.ppem;
|
|
2039
|
-
const base = state.deltaBase + (b - 1) * 16;
|
|
2040
|
-
const ds = state.deltaShift;
|
|
2041
|
-
const z0 = state.z0;
|
|
2042
|
-
|
|
2043
|
-
if (exports.DEBUG) console.log(state.step, 'DELTAP[' + b + ']', n, stack);
|
|
2044
|
-
|
|
2045
|
-
for (let i = 0; i < n; i++) {
|
|
2046
|
-
const pi = stack.pop();
|
|
2047
|
-
const arg = stack.pop();
|
|
2048
|
-
const appem = base + ((arg & 0xF0) >> 4);
|
|
2049
|
-
if (appem !== ppem) continue;
|
|
2050
|
-
|
|
2051
|
-
let mag = (arg & 0x0F) - 8;
|
|
2052
|
-
if (mag >= 0) mag++;
|
|
2053
|
-
if (exports.DEBUG) console.log(state.step, 'DELTAPFIX', pi, 'by', mag * ds);
|
|
2054
|
-
|
|
2055
|
-
const p = z0[pi];
|
|
2056
|
-
fv.setRelative(p, p, mag * ds, pv);
|
|
2057
|
-
}
|
|
2058
|
-
}
|
|
2059
|
-
|
|
2060
|
-
// SDB[] Set Delta Base in the graphics state
|
|
2061
|
-
// 0x5E
|
|
2062
|
-
function SDB(state) {
|
|
2063
|
-
const stack = state.stack;
|
|
2064
|
-
const n = stack.pop();
|
|
2065
|
-
|
|
2066
|
-
if (exports.DEBUG) console.log(state.step, 'SDB[]', n);
|
|
2067
|
-
|
|
2068
|
-
state.deltaBase = n;
|
|
2069
|
-
}
|
|
2070
|
-
|
|
2071
|
-
// SDS[] Set Delta Shift in the graphics state
|
|
2072
|
-
// 0x5F
|
|
2073
|
-
function SDS(state) {
|
|
2074
|
-
const stack = state.stack;
|
|
2075
|
-
const n = stack.pop();
|
|
2076
|
-
|
|
2077
|
-
if (exports.DEBUG) console.log(state.step, 'SDS[]', n);
|
|
2078
|
-
|
|
2079
|
-
state.deltaShift = Math.pow(0.5, n);
|
|
2080
|
-
}
|
|
2081
|
-
|
|
2082
|
-
// ADD[] ADD
|
|
2083
|
-
// 0x60
|
|
2084
|
-
function ADD(state) {
|
|
2085
|
-
const stack = state.stack;
|
|
2086
|
-
const n2 = stack.pop();
|
|
2087
|
-
const n1 = stack.pop();
|
|
2088
|
-
|
|
2089
|
-
if (exports.DEBUG) console.log(state.step, 'ADD[]', n2, n1);
|
|
2090
|
-
|
|
2091
|
-
stack.push(n1 + n2);
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2094
|
-
// SUB[] SUB
|
|
2095
|
-
// 0x61
|
|
2096
|
-
function SUB(state) {
|
|
2097
|
-
const stack = state.stack;
|
|
2098
|
-
const n2 = stack.pop();
|
|
2099
|
-
const n1 = stack.pop();
|
|
2100
|
-
|
|
2101
|
-
if (exports.DEBUG) console.log(state.step, 'SUB[]', n2, n1);
|
|
2102
|
-
|
|
2103
|
-
stack.push(n1 - n2);
|
|
2104
|
-
}
|
|
2105
|
-
|
|
2106
|
-
// DIV[] DIV
|
|
2107
|
-
// 0x62
|
|
2108
|
-
function DIV(state) {
|
|
2109
|
-
const stack = state.stack;
|
|
2110
|
-
const n2 = stack.pop();
|
|
2111
|
-
const n1 = stack.pop();
|
|
2112
|
-
|
|
2113
|
-
if (exports.DEBUG) console.log(state.step, 'DIV[]', n2, n1);
|
|
2114
|
-
|
|
2115
|
-
stack.push(n1 * 64 / n2);
|
|
2116
|
-
}
|
|
2117
|
-
|
|
2118
|
-
// MUL[] MUL
|
|
2119
|
-
// 0x63
|
|
2120
|
-
function MUL(state) {
|
|
2121
|
-
const stack = state.stack;
|
|
2122
|
-
const n2 = stack.pop();
|
|
2123
|
-
const n1 = stack.pop();
|
|
2124
|
-
|
|
2125
|
-
if (exports.DEBUG) console.log(state.step, 'MUL[]', n2, n1);
|
|
2126
|
-
|
|
2127
|
-
stack.push(n1 * n2 / 64);
|
|
2128
|
-
}
|
|
2129
|
-
|
|
2130
|
-
// ABS[] ABSolute value
|
|
2131
|
-
// 0x64
|
|
2132
|
-
function ABS(state) {
|
|
2133
|
-
const stack = state.stack;
|
|
2134
|
-
const n = stack.pop();
|
|
2135
|
-
|
|
2136
|
-
if (exports.DEBUG) console.log(state.step, 'ABS[]', n);
|
|
2137
|
-
|
|
2138
|
-
stack.push(Math.abs(n));
|
|
2139
|
-
}
|
|
2140
|
-
|
|
2141
|
-
// NEG[] NEGate
|
|
2142
|
-
// 0x65
|
|
2143
|
-
function NEG(state) {
|
|
2144
|
-
const stack = state.stack;
|
|
2145
|
-
let n = stack.pop();
|
|
2146
|
-
|
|
2147
|
-
if (exports.DEBUG) console.log(state.step, 'NEG[]', n);
|
|
2148
|
-
|
|
2149
|
-
stack.push(-n);
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
|
-
// FLOOR[] FLOOR
|
|
2153
|
-
// 0x66
|
|
2154
|
-
function FLOOR(state) {
|
|
2155
|
-
const stack = state.stack;
|
|
2156
|
-
const n = stack.pop();
|
|
2157
|
-
|
|
2158
|
-
if (exports.DEBUG) console.log(state.step, 'FLOOR[]', n);
|
|
2159
|
-
|
|
2160
|
-
stack.push(Math.floor(n / 0x40) * 0x40);
|
|
2161
|
-
}
|
|
2162
|
-
|
|
2163
|
-
// CEILING[] CEILING
|
|
2164
|
-
// 0x67
|
|
2165
|
-
function CEILING(state) {
|
|
2166
|
-
const stack = state.stack;
|
|
2167
|
-
const n = stack.pop();
|
|
2168
|
-
|
|
2169
|
-
if (exports.DEBUG) console.log(state.step, 'CEILING[]', n);
|
|
2170
|
-
|
|
2171
|
-
stack.push(Math.ceil(n / 0x40) * 0x40);
|
|
2172
|
-
}
|
|
2173
|
-
|
|
2174
|
-
// ROUND[ab] ROUND value
|
|
2175
|
-
// 0x68-0x6B
|
|
2176
|
-
function ROUND(dt, state) {
|
|
2177
|
-
const stack = state.stack;
|
|
2178
|
-
const n = stack.pop();
|
|
2179
|
-
|
|
2180
|
-
if (exports.DEBUG) console.log(state.step, 'ROUND[]');
|
|
2181
|
-
|
|
2182
|
-
stack.push(state.round(n / 0x40) * 0x40);
|
|
2183
|
-
}
|
|
2184
|
-
|
|
2185
|
-
// WCVTF[] Write Control Value Table in Funits
|
|
2186
|
-
// 0x70
|
|
2187
|
-
function WCVTF(state) {
|
|
2188
|
-
const stack = state.stack;
|
|
2189
|
-
const v = stack.pop();
|
|
2190
|
-
const l = stack.pop();
|
|
2191
|
-
|
|
2192
|
-
if (exports.DEBUG) console.log(state.step, 'WCVTF[]', v, l);
|
|
2193
|
-
|
|
2194
|
-
state.cvt[l] = v * state.ppem / state.font.unitsPerEm;
|
|
2195
|
-
}
|
|
2196
|
-
|
|
2197
|
-
// DELTAC1[] DELTA exception C1
|
|
2198
|
-
// DELTAC2[] DELTA exception C2
|
|
2199
|
-
// DELTAC3[] DELTA exception C3
|
|
2200
|
-
// 0x73, 0x74, 0x75
|
|
2201
|
-
function DELTAC123(b, state) {
|
|
2202
|
-
const stack = state.stack;
|
|
2203
|
-
const n = stack.pop();
|
|
2204
|
-
const ppem = state.ppem;
|
|
2205
|
-
const base = state.deltaBase + (b - 1) * 16;
|
|
2206
|
-
const ds = state.deltaShift;
|
|
2207
|
-
|
|
2208
|
-
if (exports.DEBUG) console.log(state.step, 'DELTAC[' + b + ']', n, stack);
|
|
2209
|
-
|
|
2210
|
-
for (let i = 0; i < n; i++) {
|
|
2211
|
-
const c = stack.pop();
|
|
2212
|
-
const arg = stack.pop();
|
|
2213
|
-
const appem = base + ((arg & 0xF0) >> 4);
|
|
2214
|
-
if (appem !== ppem) continue;
|
|
2215
|
-
|
|
2216
|
-
let mag = (arg & 0x0F) - 8;
|
|
2217
|
-
if (mag >= 0) mag++;
|
|
2218
|
-
|
|
2219
|
-
const delta = mag * ds;
|
|
2220
|
-
|
|
2221
|
-
if (exports.DEBUG) console.log(state.step, 'DELTACFIX', c, 'by', delta);
|
|
2222
|
-
|
|
2223
|
-
state.cvt[c] += delta;
|
|
2224
|
-
}
|
|
2225
|
-
}
|
|
2226
|
-
|
|
2227
|
-
// SROUND[] Super ROUND
|
|
2228
|
-
// 0x76
|
|
2229
|
-
function SROUND(state) {
|
|
2230
|
-
let n = state.stack.pop();
|
|
2231
|
-
|
|
2232
|
-
if (exports.DEBUG) console.log(state.step, 'SROUND[]', n);
|
|
2233
|
-
|
|
2234
|
-
state.round = roundSuper;
|
|
2235
|
-
|
|
2236
|
-
let period;
|
|
2237
|
-
|
|
2238
|
-
switch (n & 0xC0) {
|
|
2239
|
-
case 0x00:
|
|
2240
|
-
period = 0.5;
|
|
2241
|
-
break;
|
|
2242
|
-
case 0x40:
|
|
2243
|
-
period = 1;
|
|
2244
|
-
break;
|
|
2245
|
-
case 0x80:
|
|
2246
|
-
period = 2;
|
|
2247
|
-
break;
|
|
2248
|
-
default:
|
|
2249
|
-
throw new Error('invalid SROUND value');
|
|
2250
|
-
}
|
|
2251
|
-
|
|
2252
|
-
state.srPeriod = period;
|
|
2253
|
-
|
|
2254
|
-
switch (n & 0x30) {
|
|
2255
|
-
case 0x00:
|
|
2256
|
-
state.srPhase = 0;
|
|
2257
|
-
break;
|
|
2258
|
-
case 0x10:
|
|
2259
|
-
state.srPhase = 0.25 * period;
|
|
2260
|
-
break;
|
|
2261
|
-
case 0x20:
|
|
2262
|
-
state.srPhase = 0.5 * period;
|
|
2263
|
-
break;
|
|
2264
|
-
case 0x30:
|
|
2265
|
-
state.srPhase = 0.75 * period;
|
|
2266
|
-
break;
|
|
2267
|
-
default: throw new Error('invalid SROUND value');
|
|
2268
|
-
}
|
|
2269
|
-
|
|
2270
|
-
n &= 0x0F;
|
|
2271
|
-
|
|
2272
|
-
if (n === 0) state.srThreshold = 0;
|
|
2273
|
-
else state.srThreshold = (n / 8 - 0.5) * period;
|
|
2274
|
-
}
|
|
2275
|
-
|
|
2276
|
-
// S45ROUND[] Super ROUND 45 degrees
|
|
2277
|
-
// 0x77
|
|
2278
|
-
function S45ROUND(state) {
|
|
2279
|
-
let n = state.stack.pop();
|
|
2280
|
-
|
|
2281
|
-
if (exports.DEBUG) console.log(state.step, 'S45ROUND[]', n);
|
|
2282
|
-
|
|
2283
|
-
state.round = roundSuper;
|
|
2284
|
-
|
|
2285
|
-
let period;
|
|
2286
|
-
|
|
2287
|
-
switch (n & 0xC0) {
|
|
2288
|
-
case 0x00:
|
|
2289
|
-
period = Math.sqrt(2) / 2;
|
|
2290
|
-
break;
|
|
2291
|
-
case 0x40:
|
|
2292
|
-
period = Math.sqrt(2);
|
|
2293
|
-
break;
|
|
2294
|
-
case 0x80:
|
|
2295
|
-
period = 2 * Math.sqrt(2);
|
|
2296
|
-
break;
|
|
2297
|
-
default:
|
|
2298
|
-
throw new Error('invalid S45ROUND value');
|
|
2299
|
-
}
|
|
2300
|
-
|
|
2301
|
-
state.srPeriod = period;
|
|
2302
|
-
|
|
2303
|
-
switch (n & 0x30) {
|
|
2304
|
-
case 0x00:
|
|
2305
|
-
state.srPhase = 0;
|
|
2306
|
-
break;
|
|
2307
|
-
case 0x10:
|
|
2308
|
-
state.srPhase = 0.25 * period;
|
|
2309
|
-
break;
|
|
2310
|
-
case 0x20:
|
|
2311
|
-
state.srPhase = 0.5 * period;
|
|
2312
|
-
break;
|
|
2313
|
-
case 0x30:
|
|
2314
|
-
state.srPhase = 0.75 * period;
|
|
2315
|
-
break;
|
|
2316
|
-
default:
|
|
2317
|
-
throw new Error('invalid S45ROUND value');
|
|
2318
|
-
}
|
|
2319
|
-
|
|
2320
|
-
n &= 0x0F;
|
|
2321
|
-
|
|
2322
|
-
if (n === 0) state.srThreshold = 0;
|
|
2323
|
-
else state.srThreshold = (n / 8 - 0.5) * period;
|
|
2324
|
-
}
|
|
2325
|
-
|
|
2326
|
-
// ROFF[] Round Off
|
|
2327
|
-
// 0x7A
|
|
2328
|
-
function ROFF(state) {
|
|
2329
|
-
if (exports.DEBUG) console.log(state.step, 'ROFF[]');
|
|
2330
|
-
|
|
2331
|
-
state.round = roundOff;
|
|
2332
|
-
}
|
|
2333
|
-
|
|
2334
|
-
// RUTG[] Round Up To Grid
|
|
2335
|
-
// 0x7C
|
|
2336
|
-
function RUTG(state) {
|
|
2337
|
-
if (exports.DEBUG) console.log(state.step, 'RUTG[]');
|
|
2338
|
-
|
|
2339
|
-
state.round = roundUpToGrid;
|
|
2340
|
-
}
|
|
2341
|
-
|
|
2342
|
-
// RDTG[] Round Down To Grid
|
|
2343
|
-
// 0x7D
|
|
2344
|
-
function RDTG(state) {
|
|
2345
|
-
if (exports.DEBUG) console.log(state.step, 'RDTG[]');
|
|
2346
|
-
|
|
2347
|
-
state.round = roundDownToGrid;
|
|
2348
|
-
}
|
|
2349
|
-
|
|
2350
|
-
// SCANCTRL[] SCAN conversion ConTRoL
|
|
2351
|
-
// 0x85
|
|
2352
|
-
function SCANCTRL(state) {
|
|
2353
|
-
const n = state.stack.pop();
|
|
2354
|
-
|
|
2355
|
-
// ignored by opentype.js
|
|
2356
|
-
|
|
2357
|
-
if (exports.DEBUG) console.log(state.step, 'SCANCTRL[]', n);
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
// SDPVTL[a] Set Dual Projection Vector To Line
|
|
2361
|
-
// 0x86-0x87
|
|
2362
|
-
function SDPVTL(a, state) {
|
|
2363
|
-
const stack = state.stack;
|
|
2364
|
-
const p2i = stack.pop();
|
|
2365
|
-
const p1i = stack.pop();
|
|
2366
|
-
const p2 = state.z2[p2i];
|
|
2367
|
-
const p1 = state.z1[p1i];
|
|
2368
|
-
|
|
2369
|
-
if (exports.DEBUG) console.log(state.step, 'SDPVTL[' + a + ']', p2i, p1i);
|
|
2370
|
-
|
|
2371
|
-
let dx;
|
|
2372
|
-
let dy;
|
|
2373
|
-
|
|
2374
|
-
if (!a) {
|
|
2375
|
-
dx = p1.x - p2.x;
|
|
2376
|
-
dy = p1.y - p2.y;
|
|
2377
|
-
} else {
|
|
2378
|
-
dx = p2.y - p1.y;
|
|
2379
|
-
dy = p1.x - p2.x;
|
|
2380
|
-
}
|
|
2381
|
-
|
|
2382
|
-
state.dpv = getUnitVector(dx, dy);
|
|
2383
|
-
}
|
|
2384
|
-
|
|
2385
|
-
// GETINFO[] GET INFOrmation
|
|
2386
|
-
// 0x88
|
|
2387
|
-
function GETINFO(state) {
|
|
2388
|
-
const stack = state.stack;
|
|
2389
|
-
const sel = stack.pop();
|
|
2390
|
-
let r = 0;
|
|
2391
|
-
|
|
2392
|
-
if (exports.DEBUG) console.log(state.step, 'GETINFO[]', sel);
|
|
2393
|
-
|
|
2394
|
-
// v35 as in no subpixel hinting
|
|
2395
|
-
if (sel & 0x01) r = 35;
|
|
2396
|
-
|
|
2397
|
-
// TODO rotation and stretch currently not supported
|
|
2398
|
-
// and thus those GETINFO are always 0.
|
|
2399
|
-
|
|
2400
|
-
// opentype.js is always gray scaling
|
|
2401
|
-
if (sel & 0x20) r |= 0x1000;
|
|
2402
|
-
|
|
2403
|
-
stack.push(r);
|
|
2404
|
-
}
|
|
2405
|
-
|
|
2406
|
-
// ROLL[] ROLL the top three stack elements
|
|
2407
|
-
// 0x8A
|
|
2408
|
-
function ROLL(state) {
|
|
2409
|
-
const stack = state.stack;
|
|
2410
|
-
const a = stack.pop();
|
|
2411
|
-
const b = stack.pop();
|
|
2412
|
-
const c = stack.pop();
|
|
2413
|
-
|
|
2414
|
-
if (exports.DEBUG) console.log(state.step, 'ROLL[]');
|
|
2415
|
-
|
|
2416
|
-
stack.push(b);
|
|
2417
|
-
stack.push(a);
|
|
2418
|
-
stack.push(c);
|
|
2419
|
-
}
|
|
2420
|
-
|
|
2421
|
-
// MAX[] MAXimum of top two stack elements
|
|
2422
|
-
// 0x8B
|
|
2423
|
-
function MAX(state) {
|
|
2424
|
-
const stack = state.stack;
|
|
2425
|
-
const e2 = stack.pop();
|
|
2426
|
-
const e1 = stack.pop();
|
|
2427
|
-
|
|
2428
|
-
if (exports.DEBUG) console.log(state.step, 'MAX[]', e2, e1);
|
|
2429
|
-
|
|
2430
|
-
stack.push(Math.max(e1, e2));
|
|
2431
|
-
}
|
|
2432
|
-
|
|
2433
|
-
// MIN[] MINimum of top two stack elements
|
|
2434
|
-
// 0x8C
|
|
2435
|
-
function MIN(state) {
|
|
2436
|
-
const stack = state.stack;
|
|
2437
|
-
const e2 = stack.pop();
|
|
2438
|
-
const e1 = stack.pop();
|
|
2439
|
-
|
|
2440
|
-
if (exports.DEBUG) console.log(state.step, 'MIN[]', e2, e1);
|
|
2441
|
-
|
|
2442
|
-
stack.push(Math.min(e1, e2));
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
|
-
// SCANTYPE[] SCANTYPE
|
|
2446
|
-
// 0x8D
|
|
2447
|
-
function SCANTYPE(state) {
|
|
2448
|
-
const n = state.stack.pop();
|
|
2449
|
-
// ignored by opentype.js
|
|
2450
|
-
if (exports.DEBUG) console.log(state.step, 'SCANTYPE[]', n);
|
|
2451
|
-
}
|
|
2452
|
-
|
|
2453
|
-
// INSTCTRL[] INSTCTRL
|
|
2454
|
-
// 0x8D
|
|
2455
|
-
function INSTCTRL(state) {
|
|
2456
|
-
const s = state.stack.pop();
|
|
2457
|
-
let v = state.stack.pop();
|
|
2458
|
-
|
|
2459
|
-
if (exports.DEBUG) console.log(state.step, 'INSTCTRL[]', s, v);
|
|
2460
|
-
|
|
2461
|
-
switch (s) {
|
|
2462
|
-
case 1 : state.inhibitGridFit = !!v; return;
|
|
2463
|
-
case 2 : state.ignoreCvt = !!v; return;
|
|
2464
|
-
default: throw new Error('invalid INSTCTRL[] selector');
|
|
2465
|
-
}
|
|
2466
|
-
}
|
|
2467
|
-
|
|
2468
|
-
// PUSHB[abc] PUSH Bytes
|
|
2469
|
-
// 0xB0-0xB7
|
|
2470
|
-
function PUSHB(n, state) {
|
|
2471
|
-
const stack = state.stack;
|
|
2472
|
-
const prog = state.prog;
|
|
2473
|
-
let ip = state.ip;
|
|
2474
|
-
|
|
2475
|
-
if (exports.DEBUG) console.log(state.step, 'PUSHB[' + n + ']');
|
|
2476
|
-
|
|
2477
|
-
for (let i = 0; i < n; i++) stack.push(prog[++ip]);
|
|
2478
|
-
|
|
2479
|
-
state.ip = ip;
|
|
2480
|
-
}
|
|
2481
|
-
|
|
2482
|
-
// PUSHW[abc] PUSH Words
|
|
2483
|
-
// 0xB8-0xBF
|
|
2484
|
-
function PUSHW(n, state) {
|
|
2485
|
-
let ip = state.ip;
|
|
2486
|
-
const prog = state.prog;
|
|
2487
|
-
const stack = state.stack;
|
|
2488
|
-
|
|
2489
|
-
if (exports.DEBUG) console.log(state.ip, 'PUSHW[' + n + ']');
|
|
2490
|
-
|
|
2491
|
-
for (let i = 0; i < n; i++) {
|
|
2492
|
-
let w = (prog[++ip] << 8) | prog[++ip];
|
|
2493
|
-
if (w & 0x8000) w = -((w ^ 0xffff) + 1);
|
|
2494
|
-
stack.push(w);
|
|
2495
|
-
}
|
|
2496
|
-
|
|
2497
|
-
state.ip = ip;
|
|
2498
|
-
}
|
|
2499
|
-
|
|
2500
|
-
// MDRP[abcde] Move Direct Relative Point
|
|
2501
|
-
// 0xD0-0xEF
|
|
2502
|
-
// (if indirect is 0)
|
|
2503
|
-
//
|
|
2504
|
-
// and
|
|
2505
|
-
//
|
|
2506
|
-
// MIRP[abcde] Move Indirect Relative Point
|
|
2507
|
-
// 0xE0-0xFF
|
|
2508
|
-
// (if indirect is 1)
|
|
2509
|
-
|
|
2510
|
-
function MDRP_MIRP(indirect, setRp0, keepD, ro, dt, state) {
|
|
2511
|
-
const stack = state.stack;
|
|
2512
|
-
const cvte = indirect && stack.pop();
|
|
2513
|
-
const pi = stack.pop();
|
|
2514
|
-
const rp0i = state.rp0;
|
|
2515
|
-
const rp = state.z0[rp0i];
|
|
2516
|
-
const p = state.z1[pi];
|
|
2517
|
-
|
|
2518
|
-
const md = state.minDis;
|
|
2519
|
-
const fv = state.fv;
|
|
2520
|
-
const pv = state.dpv;
|
|
2521
|
-
let od; // original distance
|
|
2522
|
-
let d; // moving distance
|
|
2523
|
-
let sign; // sign of distance
|
|
2524
|
-
let cv;
|
|
2525
|
-
|
|
2526
|
-
d = od = pv.distance(p, rp, true, true);
|
|
2527
|
-
sign = d >= 0 ? 1 : -1; // Math.sign would be 0 in case of 0
|
|
2528
|
-
|
|
2529
|
-
// TODO consider autoFlip
|
|
2530
|
-
d = Math.abs(d);
|
|
2531
|
-
|
|
2532
|
-
if (indirect) {
|
|
2533
|
-
cv = state.cvt[cvte];
|
|
2534
|
-
|
|
2535
|
-
if (ro && Math.abs(d - cv) < state.cvCutIn) d = cv;
|
|
2536
|
-
}
|
|
2537
|
-
|
|
2538
|
-
if (keepD && d < md) d = md;
|
|
2539
|
-
|
|
2540
|
-
if (ro) d = state.round(d);
|
|
2541
|
-
|
|
2542
|
-
fv.setRelative(p, rp, sign * d, pv);
|
|
2543
|
-
fv.touch(p);
|
|
2544
|
-
|
|
2545
|
-
if (exports.DEBUG) {
|
|
2546
|
-
console.log(
|
|
2547
|
-
state.step,
|
|
2548
|
-
(indirect ? 'MIRP[' : 'MDRP[') +
|
|
2549
|
-
(setRp0 ? 'M' : 'm') +
|
|
2550
|
-
(keepD ? '>' : '_') +
|
|
2551
|
-
(ro ? 'R' : '_') +
|
|
2552
|
-
(dt === 0 ? 'Gr' : (dt === 1 ? 'Bl' : (dt === 2 ? 'Wh' : ''))) +
|
|
2553
|
-
']',
|
|
2554
|
-
indirect ?
|
|
2555
|
-
cvte + '(' + state.cvt[cvte] + ',' + cv + ')' :
|
|
2556
|
-
'',
|
|
2557
|
-
pi,
|
|
2558
|
-
'(d =', od, '->', sign * d, ')'
|
|
2559
|
-
);
|
|
2560
|
-
}
|
|
2561
|
-
|
|
2562
|
-
state.rp1 = state.rp0;
|
|
2563
|
-
state.rp2 = pi;
|
|
2564
|
-
if (setRp0) state.rp0 = pi;
|
|
2565
|
-
}
|
|
2566
|
-
|
|
2567
|
-
/*
|
|
2568
|
-
* The instruction table.
|
|
2569
|
-
*/
|
|
2570
|
-
instructionTable = [
|
|
2571
|
-
/* 0x00 */ SVTCA.bind(undefined, yUnitVector),
|
|
2572
|
-
/* 0x01 */ SVTCA.bind(undefined, xUnitVector),
|
|
2573
|
-
/* 0x02 */ SPVTCA.bind(undefined, yUnitVector),
|
|
2574
|
-
/* 0x03 */ SPVTCA.bind(undefined, xUnitVector),
|
|
2575
|
-
/* 0x04 */ SFVTCA.bind(undefined, yUnitVector),
|
|
2576
|
-
/* 0x05 */ SFVTCA.bind(undefined, xUnitVector),
|
|
2577
|
-
/* 0x06 */ SPVTL.bind(undefined, 0),
|
|
2578
|
-
/* 0x07 */ SPVTL.bind(undefined, 1),
|
|
2579
|
-
/* 0x08 */ SFVTL.bind(undefined, 0),
|
|
2580
|
-
/* 0x09 */ SFVTL.bind(undefined, 1),
|
|
2581
|
-
/* 0x0A */ SPVFS,
|
|
2582
|
-
/* 0x0B */ SFVFS,
|
|
2583
|
-
/* 0x0C */ GPV,
|
|
2584
|
-
/* 0x0D */ GFV,
|
|
2585
|
-
/* 0x0E */ SFVTPV,
|
|
2586
|
-
/* 0x0F */ ISECT,
|
|
2587
|
-
/* 0x10 */ SRP0,
|
|
2588
|
-
/* 0x11 */ SRP1,
|
|
2589
|
-
/* 0x12 */ SRP2,
|
|
2590
|
-
/* 0x13 */ SZP0,
|
|
2591
|
-
/* 0x14 */ SZP1,
|
|
2592
|
-
/* 0x15 */ SZP2,
|
|
2593
|
-
/* 0x16 */ SZPS,
|
|
2594
|
-
/* 0x17 */ SLOOP,
|
|
2595
|
-
/* 0x18 */ RTG,
|
|
2596
|
-
/* 0x19 */ RTHG,
|
|
2597
|
-
/* 0x1A */ SMD,
|
|
2598
|
-
/* 0x1B */ ELSE,
|
|
2599
|
-
/* 0x1C */ JMPR,
|
|
2600
|
-
/* 0x1D */ SCVTCI,
|
|
2601
|
-
/* 0x1E */ undefined, // TODO SSWCI
|
|
2602
|
-
/* 0x1F */ undefined, // TODO SSW
|
|
2603
|
-
/* 0x20 */ DUP,
|
|
2604
|
-
/* 0x21 */ POP,
|
|
2605
|
-
/* 0x22 */ CLEAR,
|
|
2606
|
-
/* 0x23 */ SWAP,
|
|
2607
|
-
/* 0x24 */ DEPTH,
|
|
2608
|
-
/* 0x25 */ CINDEX,
|
|
2609
|
-
/* 0x26 */ MINDEX,
|
|
2610
|
-
/* 0x27 */ undefined, // TODO ALIGNPTS
|
|
2611
|
-
/* 0x28 */ undefined,
|
|
2612
|
-
/* 0x29 */ undefined, // TODO UTP
|
|
2613
|
-
/* 0x2A */ LOOPCALL,
|
|
2614
|
-
/* 0x2B */ CALL,
|
|
2615
|
-
/* 0x2C */ FDEF,
|
|
2616
|
-
/* 0x2D */ undefined, // ENDF (eaten by FDEF)
|
|
2617
|
-
/* 0x2E */ MDAP.bind(undefined, 0),
|
|
2618
|
-
/* 0x2F */ MDAP.bind(undefined, 1),
|
|
2619
|
-
/* 0x30 */ IUP.bind(undefined, yUnitVector),
|
|
2620
|
-
/* 0x31 */ IUP.bind(undefined, xUnitVector),
|
|
2621
|
-
/* 0x32 */ SHP.bind(undefined, 0),
|
|
2622
|
-
/* 0x33 */ SHP.bind(undefined, 1),
|
|
2623
|
-
/* 0x34 */ SHC.bind(undefined, 0),
|
|
2624
|
-
/* 0x35 */ SHC.bind(undefined, 1),
|
|
2625
|
-
/* 0x36 */ SHZ.bind(undefined, 0),
|
|
2626
|
-
/* 0x37 */ SHZ.bind(undefined, 1),
|
|
2627
|
-
/* 0x38 */ SHPIX,
|
|
2628
|
-
/* 0x39 */ IP,
|
|
2629
|
-
/* 0x3A */ MSIRP.bind(undefined, 0),
|
|
2630
|
-
/* 0x3B */ MSIRP.bind(undefined, 1),
|
|
2631
|
-
/* 0x3C */ ALIGNRP,
|
|
2632
|
-
/* 0x3D */ RTDG,
|
|
2633
|
-
/* 0x3E */ MIAP.bind(undefined, 0),
|
|
2634
|
-
/* 0x3F */ MIAP.bind(undefined, 1),
|
|
2635
|
-
/* 0x40 */ NPUSHB,
|
|
2636
|
-
/* 0x41 */ NPUSHW,
|
|
2637
|
-
/* 0x42 */ WS,
|
|
2638
|
-
/* 0x43 */ RS,
|
|
2639
|
-
/* 0x44 */ WCVTP,
|
|
2640
|
-
/* 0x45 */ RCVT,
|
|
2641
|
-
/* 0x46 */ GC.bind(undefined, 0),
|
|
2642
|
-
/* 0x47 */ GC.bind(undefined, 1),
|
|
2643
|
-
/* 0x48 */ undefined, // TODO SCFS
|
|
2644
|
-
/* 0x49 */ MD.bind(undefined, 0),
|
|
2645
|
-
/* 0x4A */ MD.bind(undefined, 1),
|
|
2646
|
-
/* 0x4B */ MPPEM,
|
|
2647
|
-
/* 0x4C */ undefined, // TODO MPS
|
|
2648
|
-
/* 0x4D */ FLIPON,
|
|
2649
|
-
/* 0x4E */ undefined, // TODO FLIPOFF
|
|
2650
|
-
/* 0x4F */ undefined, // TODO DEBUG
|
|
2651
|
-
/* 0x50 */ LT,
|
|
2652
|
-
/* 0x51 */ LTEQ,
|
|
2653
|
-
/* 0x52 */ GT,
|
|
2654
|
-
/* 0x53 */ GTEQ,
|
|
2655
|
-
/* 0x54 */ EQ,
|
|
2656
|
-
/* 0x55 */ NEQ,
|
|
2657
|
-
/* 0x56 */ ODD,
|
|
2658
|
-
/* 0x57 */ EVEN,
|
|
2659
|
-
/* 0x58 */ IF,
|
|
2660
|
-
/* 0x59 */ EIF,
|
|
2661
|
-
/* 0x5A */ AND,
|
|
2662
|
-
/* 0x5B */ OR,
|
|
2663
|
-
/* 0x5C */ NOT,
|
|
2664
|
-
/* 0x5D */ DELTAP123.bind(undefined, 1),
|
|
2665
|
-
/* 0x5E */ SDB,
|
|
2666
|
-
/* 0x5F */ SDS,
|
|
2667
|
-
/* 0x60 */ ADD,
|
|
2668
|
-
/* 0x61 */ SUB,
|
|
2669
|
-
/* 0x62 */ DIV,
|
|
2670
|
-
/* 0x63 */ MUL,
|
|
2671
|
-
/* 0x64 */ ABS,
|
|
2672
|
-
/* 0x65 */ NEG,
|
|
2673
|
-
/* 0x66 */ FLOOR,
|
|
2674
|
-
/* 0x67 */ CEILING,
|
|
2675
|
-
/* 0x68 */ ROUND.bind(undefined, 0),
|
|
2676
|
-
/* 0x69 */ ROUND.bind(undefined, 1),
|
|
2677
|
-
/* 0x6A */ ROUND.bind(undefined, 2),
|
|
2678
|
-
/* 0x6B */ ROUND.bind(undefined, 3),
|
|
2679
|
-
/* 0x6C */ undefined, // TODO NROUND[ab]
|
|
2680
|
-
/* 0x6D */ undefined, // TODO NROUND[ab]
|
|
2681
|
-
/* 0x6E */ undefined, // TODO NROUND[ab]
|
|
2682
|
-
/* 0x6F */ undefined, // TODO NROUND[ab]
|
|
2683
|
-
/* 0x70 */ WCVTF,
|
|
2684
|
-
/* 0x71 */ DELTAP123.bind(undefined, 2),
|
|
2685
|
-
/* 0x72 */ DELTAP123.bind(undefined, 3),
|
|
2686
|
-
/* 0x73 */ DELTAC123.bind(undefined, 1),
|
|
2687
|
-
/* 0x74 */ DELTAC123.bind(undefined, 2),
|
|
2688
|
-
/* 0x75 */ DELTAC123.bind(undefined, 3),
|
|
2689
|
-
/* 0x76 */ SROUND,
|
|
2690
|
-
/* 0x77 */ S45ROUND,
|
|
2691
|
-
/* 0x78 */ undefined, // TODO JROT[]
|
|
2692
|
-
/* 0x79 */ undefined, // TODO JROF[]
|
|
2693
|
-
/* 0x7A */ ROFF,
|
|
2694
|
-
/* 0x7B */ undefined,
|
|
2695
|
-
/* 0x7C */ RUTG,
|
|
2696
|
-
/* 0x7D */ RDTG,
|
|
2697
|
-
/* 0x7E */ POP, // actually SANGW, supposed to do only a pop though
|
|
2698
|
-
/* 0x7F */ POP, // actually AA, supposed to do only a pop though
|
|
2699
|
-
/* 0x80 */ undefined, // TODO FLIPPT
|
|
2700
|
-
/* 0x81 */ undefined, // TODO FLIPRGON
|
|
2701
|
-
/* 0x82 */ undefined, // TODO FLIPRGOFF
|
|
2702
|
-
/* 0x83 */ undefined,
|
|
2703
|
-
/* 0x84 */ undefined,
|
|
2704
|
-
/* 0x85 */ SCANCTRL,
|
|
2705
|
-
/* 0x86 */ SDPVTL.bind(undefined, 0),
|
|
2706
|
-
/* 0x87 */ SDPVTL.bind(undefined, 1),
|
|
2707
|
-
/* 0x88 */ GETINFO,
|
|
2708
|
-
/* 0x89 */ undefined, // TODO IDEF
|
|
2709
|
-
/* 0x8A */ ROLL,
|
|
2710
|
-
/* 0x8B */ MAX,
|
|
2711
|
-
/* 0x8C */ MIN,
|
|
2712
|
-
/* 0x8D */ SCANTYPE,
|
|
2713
|
-
/* 0x8E */ INSTCTRL,
|
|
2714
|
-
/* 0x8F */ undefined,
|
|
2715
|
-
/* 0x90 */ undefined,
|
|
2716
|
-
/* 0x91 */ undefined,
|
|
2717
|
-
/* 0x92 */ undefined,
|
|
2718
|
-
/* 0x93 */ undefined,
|
|
2719
|
-
/* 0x94 */ undefined,
|
|
2720
|
-
/* 0x95 */ undefined,
|
|
2721
|
-
/* 0x96 */ undefined,
|
|
2722
|
-
/* 0x97 */ undefined,
|
|
2723
|
-
/* 0x98 */ undefined,
|
|
2724
|
-
/* 0x99 */ undefined,
|
|
2725
|
-
/* 0x9A */ undefined,
|
|
2726
|
-
/* 0x9B */ undefined,
|
|
2727
|
-
/* 0x9C */ undefined,
|
|
2728
|
-
/* 0x9D */ undefined,
|
|
2729
|
-
/* 0x9E */ undefined,
|
|
2730
|
-
/* 0x9F */ undefined,
|
|
2731
|
-
/* 0xA0 */ undefined,
|
|
2732
|
-
/* 0xA1 */ undefined,
|
|
2733
|
-
/* 0xA2 */ undefined,
|
|
2734
|
-
/* 0xA3 */ undefined,
|
|
2735
|
-
/* 0xA4 */ undefined,
|
|
2736
|
-
/* 0xA5 */ undefined,
|
|
2737
|
-
/* 0xA6 */ undefined,
|
|
2738
|
-
/* 0xA7 */ undefined,
|
|
2739
|
-
/* 0xA8 */ undefined,
|
|
2740
|
-
/* 0xA9 */ undefined,
|
|
2741
|
-
/* 0xAA */ undefined,
|
|
2742
|
-
/* 0xAB */ undefined,
|
|
2743
|
-
/* 0xAC */ undefined,
|
|
2744
|
-
/* 0xAD */ undefined,
|
|
2745
|
-
/* 0xAE */ undefined,
|
|
2746
|
-
/* 0xAF */ undefined,
|
|
2747
|
-
/* 0xB0 */ PUSHB.bind(undefined, 1),
|
|
2748
|
-
/* 0xB1 */ PUSHB.bind(undefined, 2),
|
|
2749
|
-
/* 0xB2 */ PUSHB.bind(undefined, 3),
|
|
2750
|
-
/* 0xB3 */ PUSHB.bind(undefined, 4),
|
|
2751
|
-
/* 0xB4 */ PUSHB.bind(undefined, 5),
|
|
2752
|
-
/* 0xB5 */ PUSHB.bind(undefined, 6),
|
|
2753
|
-
/* 0xB6 */ PUSHB.bind(undefined, 7),
|
|
2754
|
-
/* 0xB7 */ PUSHB.bind(undefined, 8),
|
|
2755
|
-
/* 0xB8 */ PUSHW.bind(undefined, 1),
|
|
2756
|
-
/* 0xB9 */ PUSHW.bind(undefined, 2),
|
|
2757
|
-
/* 0xBA */ PUSHW.bind(undefined, 3),
|
|
2758
|
-
/* 0xBB */ PUSHW.bind(undefined, 4),
|
|
2759
|
-
/* 0xBC */ PUSHW.bind(undefined, 5),
|
|
2760
|
-
/* 0xBD */ PUSHW.bind(undefined, 6),
|
|
2761
|
-
/* 0xBE */ PUSHW.bind(undefined, 7),
|
|
2762
|
-
/* 0xBF */ PUSHW.bind(undefined, 8),
|
|
2763
|
-
/* 0xC0 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 0),
|
|
2764
|
-
/* 0xC1 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 1),
|
|
2765
|
-
/* 0xC2 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 2),
|
|
2766
|
-
/* 0xC3 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 0, 3),
|
|
2767
|
-
/* 0xC4 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 0),
|
|
2768
|
-
/* 0xC5 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 1),
|
|
2769
|
-
/* 0xC6 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 2),
|
|
2770
|
-
/* 0xC7 */ MDRP_MIRP.bind(undefined, 0, 0, 0, 1, 3),
|
|
2771
|
-
/* 0xC8 */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 0),
|
|
2772
|
-
/* 0xC9 */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 1),
|
|
2773
|
-
/* 0xCA */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 2),
|
|
2774
|
-
/* 0xCB */ MDRP_MIRP.bind(undefined, 0, 0, 1, 0, 3),
|
|
2775
|
-
/* 0xCC */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 0),
|
|
2776
|
-
/* 0xCD */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 1),
|
|
2777
|
-
/* 0xCE */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 2),
|
|
2778
|
-
/* 0xCF */ MDRP_MIRP.bind(undefined, 0, 0, 1, 1, 3),
|
|
2779
|
-
/* 0xD0 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 0),
|
|
2780
|
-
/* 0xD1 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 1),
|
|
2781
|
-
/* 0xD2 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 2),
|
|
2782
|
-
/* 0xD3 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 0, 3),
|
|
2783
|
-
/* 0xD4 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 0),
|
|
2784
|
-
/* 0xD5 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 1),
|
|
2785
|
-
/* 0xD6 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 2),
|
|
2786
|
-
/* 0xD7 */ MDRP_MIRP.bind(undefined, 0, 1, 0, 1, 3),
|
|
2787
|
-
/* 0xD8 */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 0),
|
|
2788
|
-
/* 0xD9 */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 1),
|
|
2789
|
-
/* 0xDA */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 2),
|
|
2790
|
-
/* 0xDB */ MDRP_MIRP.bind(undefined, 0, 1, 1, 0, 3),
|
|
2791
|
-
/* 0xDC */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 0),
|
|
2792
|
-
/* 0xDD */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 1),
|
|
2793
|
-
/* 0xDE */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 2),
|
|
2794
|
-
/* 0xDF */ MDRP_MIRP.bind(undefined, 0, 1, 1, 1, 3),
|
|
2795
|
-
/* 0xE0 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 0),
|
|
2796
|
-
/* 0xE1 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 1),
|
|
2797
|
-
/* 0xE2 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 2),
|
|
2798
|
-
/* 0xE3 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 0, 3),
|
|
2799
|
-
/* 0xE4 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 0),
|
|
2800
|
-
/* 0xE5 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 1),
|
|
2801
|
-
/* 0xE6 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 2),
|
|
2802
|
-
/* 0xE7 */ MDRP_MIRP.bind(undefined, 1, 0, 0, 1, 3),
|
|
2803
|
-
/* 0xE8 */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 0),
|
|
2804
|
-
/* 0xE9 */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 1),
|
|
2805
|
-
/* 0xEA */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 2),
|
|
2806
|
-
/* 0xEB */ MDRP_MIRP.bind(undefined, 1, 0, 1, 0, 3),
|
|
2807
|
-
/* 0xEC */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 0),
|
|
2808
|
-
/* 0xED */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 1),
|
|
2809
|
-
/* 0xEE */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 2),
|
|
2810
|
-
/* 0xEF */ MDRP_MIRP.bind(undefined, 1, 0, 1, 1, 3),
|
|
2811
|
-
/* 0xF0 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 0),
|
|
2812
|
-
/* 0xF1 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 1),
|
|
2813
|
-
/* 0xF2 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 2),
|
|
2814
|
-
/* 0xF3 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 0, 3),
|
|
2815
|
-
/* 0xF4 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 0),
|
|
2816
|
-
/* 0xF5 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 1),
|
|
2817
|
-
/* 0xF6 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 2),
|
|
2818
|
-
/* 0xF7 */ MDRP_MIRP.bind(undefined, 1, 1, 0, 1, 3),
|
|
2819
|
-
/* 0xF8 */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 0),
|
|
2820
|
-
/* 0xF9 */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 1),
|
|
2821
|
-
/* 0xFA */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 2),
|
|
2822
|
-
/* 0xFB */ MDRP_MIRP.bind(undefined, 1, 1, 1, 0, 3),
|
|
2823
|
-
/* 0xFC */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 0),
|
|
2824
|
-
/* 0xFD */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 1),
|
|
2825
|
-
/* 0xFE */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 2),
|
|
2826
|
-
/* 0xFF */ MDRP_MIRP.bind(undefined, 1, 1, 1, 1, 3)
|
|
2827
|
-
];
|
|
2828
|
-
|
|
2829
|
-
export default Hinting;
|
|
2830
|
-
|
|
2831
|
-
/*****************************
|
|
2832
|
-
Mathematical Considerations
|
|
2833
|
-
******************************
|
|
2834
|
-
|
|
2835
|
-
fv ... refers to freedom vector
|
|
2836
|
-
pv ... refers to projection vector
|
|
2837
|
-
rp ... refers to reference point
|
|
2838
|
-
p ... refers to to point being operated on
|
|
2839
|
-
d ... refers to distance
|
|
2840
|
-
|
|
2841
|
-
SETRELATIVE:
|
|
2842
|
-
============
|
|
2843
|
-
|
|
2844
|
-
case freedom vector == x-axis:
|
|
2845
|
-
------------------------------
|
|
2846
|
-
|
|
2847
|
-
(pv)
|
|
2848
|
-
.-'
|
|
2849
|
-
rpd .-'
|
|
2850
|
-
.-*
|
|
2851
|
-
d .-'90°'
|
|
2852
|
-
.-' '
|
|
2853
|
-
.-' '
|
|
2854
|
-
*-' ' b
|
|
2855
|
-
rp '
|
|
2856
|
-
'
|
|
2857
|
-
'
|
|
2858
|
-
p *----------*-------------- (fv)
|
|
2859
|
-
pm
|
|
2860
|
-
|
|
2861
|
-
rpdx = rpx + d * pv.x
|
|
2862
|
-
rpdy = rpy + d * pv.y
|
|
2863
|
-
|
|
2864
|
-
equation of line b
|
|
2865
|
-
|
|
2866
|
-
y - rpdy = pvns * (x- rpdx)
|
|
2867
|
-
|
|
2868
|
-
y = p.y
|
|
2869
|
-
|
|
2870
|
-
x = rpdx + ( p.y - rpdy ) / pvns
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
case freedom vector == y-axis:
|
|
2874
|
-
------------------------------
|
|
2875
|
-
|
|
2876
|
-
* pm
|
|
2877
|
-
|\
|
|
2878
|
-
| \
|
|
2879
|
-
| \
|
|
2880
|
-
| \
|
|
2881
|
-
| \
|
|
2882
|
-
| \
|
|
2883
|
-
| \
|
|
2884
|
-
| \
|
|
2885
|
-
| \
|
|
2886
|
-
| \ b
|
|
2887
|
-
| \
|
|
2888
|
-
| \
|
|
2889
|
-
| \ .-' (pv)
|
|
2890
|
-
| 90° \.-'
|
|
2891
|
-
| .-'* rpd
|
|
2892
|
-
| .-'
|
|
2893
|
-
* *-' d
|
|
2894
|
-
p rp
|
|
2895
|
-
|
|
2896
|
-
rpdx = rpx + d * pv.x
|
|
2897
|
-
rpdy = rpy + d * pv.y
|
|
2898
|
-
|
|
2899
|
-
equation of line b:
|
|
2900
|
-
pvns ... normal slope to pv
|
|
2901
|
-
|
|
2902
|
-
y - rpdy = pvns * (x - rpdx)
|
|
2903
|
-
|
|
2904
|
-
x = p.x
|
|
2905
|
-
|
|
2906
|
-
y = rpdy + pvns * (p.x - rpdx)
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
generic case:
|
|
2911
|
-
-------------
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
.'(fv)
|
|
2915
|
-
.'
|
|
2916
|
-
.* pm
|
|
2917
|
-
.' !
|
|
2918
|
-
.' .
|
|
2919
|
-
.' !
|
|
2920
|
-
.' . b
|
|
2921
|
-
.' !
|
|
2922
|
-
* .
|
|
2923
|
-
p !
|
|
2924
|
-
90° . ... (pv)
|
|
2925
|
-
...-*-'''
|
|
2926
|
-
...---''' rpd
|
|
2927
|
-
...---''' d
|
|
2928
|
-
*--'''
|
|
2929
|
-
rp
|
|
2930
|
-
|
|
2931
|
-
rpdx = rpx + d * pv.x
|
|
2932
|
-
rpdy = rpy + d * pv.y
|
|
2933
|
-
|
|
2934
|
-
equation of line b:
|
|
2935
|
-
pvns... normal slope to pv
|
|
2936
|
-
|
|
2937
|
-
y - rpdy = pvns * (x - rpdx)
|
|
2938
|
-
|
|
2939
|
-
equation of freedom vector line:
|
|
2940
|
-
fvs ... slope of freedom vector (=fy/fx)
|
|
2941
|
-
|
|
2942
|
-
y - py = fvs * (x - px)
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
on pm both equations are true for same x/y
|
|
2946
|
-
|
|
2947
|
-
y - rpdy = pvns * (x - rpdx)
|
|
2948
|
-
|
|
2949
|
-
y - py = fvs * (x - px)
|
|
2950
|
-
|
|
2951
|
-
form to y and set equal:
|
|
2952
|
-
|
|
2953
|
-
pvns * (x - rpdx) + rpdy = fvs * (x - px) + py
|
|
2954
|
-
|
|
2955
|
-
expand:
|
|
2956
|
-
|
|
2957
|
-
pvns * x - pvns * rpdx + rpdy = fvs * x - fvs * px + py
|
|
2958
|
-
|
|
2959
|
-
switch:
|
|
2960
|
-
|
|
2961
|
-
fvs * x - fvs * px + py = pvns * x - pvns * rpdx + rpdy
|
|
2962
|
-
|
|
2963
|
-
solve for x:
|
|
2964
|
-
|
|
2965
|
-
fvs * x - pvns * x = fvs * px - pvns * rpdx - py + rpdy
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
fvs * px - pvns * rpdx + rpdy - py
|
|
2970
|
-
x = -----------------------------------
|
|
2971
|
-
fvs - pvns
|
|
2972
|
-
|
|
2973
|
-
and:
|
|
2974
|
-
|
|
2975
|
-
y = fvs * (x - px) + py
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
INTERPOLATE:
|
|
2980
|
-
============
|
|
2981
|
-
|
|
2982
|
-
Examples of point interpolation.
|
|
2983
|
-
|
|
2984
|
-
The weight of the movement of the reference point gets bigger
|
|
2985
|
-
the further the other reference point is away, thus the safest
|
|
2986
|
-
option (that is avoiding 0/0 divisions) is to weight the
|
|
2987
|
-
original distance of the other point by the sum of both distances.
|
|
2988
|
-
|
|
2989
|
-
If the sum of both distances is 0, then move the point by the
|
|
2990
|
-
arithmetic average of the movement of both reference points.
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
(+6)
|
|
2996
|
-
rp1o *---->*rp1
|
|
2997
|
-
. . (+12)
|
|
2998
|
-
. . rp2o *---------->* rp2
|
|
2999
|
-
. . . .
|
|
3000
|
-
. . . .
|
|
3001
|
-
. 10 20 . .
|
|
3002
|
-
|.........|...................| .
|
|
3003
|
-
. . .
|
|
3004
|
-
. . (+8) .
|
|
3005
|
-
po *------>*p .
|
|
3006
|
-
. . .
|
|
3007
|
-
. 12 . 24 .
|
|
3008
|
-
|...........|.......................|
|
|
3009
|
-
36
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
-------
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
(+10)
|
|
3017
|
-
rp1o *-------->*rp1
|
|
3018
|
-
. . (-10)
|
|
3019
|
-
. . rp2 *<---------* rpo2
|
|
3020
|
-
. . . .
|
|
3021
|
-
. . . .
|
|
3022
|
-
. 10 . 30 . .
|
|
3023
|
-
|.........|.............................|
|
|
3024
|
-
. .
|
|
3025
|
-
. (+5) .
|
|
3026
|
-
po *--->* p .
|
|
3027
|
-
. . .
|
|
3028
|
-
. . 20 .
|
|
3029
|
-
|....|..............|
|
|
3030
|
-
5 15
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
-------
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
(+10)
|
|
3037
|
-
rp1o *-------->*rp1
|
|
3038
|
-
. .
|
|
3039
|
-
. .
|
|
3040
|
-
rp2o *-------->*rp2
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
(+10)
|
|
3044
|
-
po *-------->* p
|
|
3045
|
-
|
|
3046
|
-
-------
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
(+10)
|
|
3050
|
-
rp1o *-------->*rp1
|
|
3051
|
-
. .
|
|
3052
|
-
. .(+30)
|
|
3053
|
-
rp2o *---------------------------->*rp2
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
(+25)
|
|
3057
|
-
po *----------------------->* p
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
vim: set ts=4 sw=4 expandtab:
|
|
3062
|
-
*****/
|