x_ite 14.2.0 → 15.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/assets/components/AnnotationComponent.js +2 -2
- package/dist/assets/components/AnnotationComponent.min.js +2 -2
- package/dist/assets/components/CADGeometryComponent.js +2 -2
- package/dist/assets/components/CADGeometryComponent.min.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.js +2 -2
- package/dist/assets/components/CubeMapTexturingComponent.min.js +2 -2
- package/dist/assets/components/DISComponent.js +2 -2
- package/dist/assets/components/DISComponent.min.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.js +2 -2
- package/dist/assets/components/EventUtilitiesComponent.min.js +2 -2
- package/dist/assets/components/Geometry2DComponent.js +2 -2
- package/dist/assets/components/Geometry2DComponent.min.js +2 -2
- package/dist/assets/components/Geometry3DComponent.js +2 -2
- package/dist/assets/components/Geometry3DComponent.min.js +2 -2
- package/dist/assets/components/GeospatialComponent.js +2 -2
- package/dist/assets/components/GeospatialComponent.min.js +2 -2
- package/dist/assets/components/HAnimComponent.js +2 -2
- package/dist/assets/components/HAnimComponent.min.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.js +2 -2
- package/dist/assets/components/KeyDeviceSensorComponent.min.js +2 -2
- package/dist/assets/components/LayoutComponent.js +63 -47
- package/dist/assets/components/LayoutComponent.min.js +2 -2
- package/dist/assets/components/NURBSComponent.js +2 -2
- package/dist/assets/components/NURBSComponent.min.js +2 -2
- package/dist/assets/components/ParticleSystemsComponent.js +2 -2
- package/dist/assets/components/ParticleSystemsComponent.min.js +2 -2
- package/dist/assets/components/PickingComponent.js +4 -4
- package/dist/assets/components/PickingComponent.min.js +2 -2
- package/dist/assets/components/RigidBodyPhysicsComponent.js +2 -2
- package/dist/assets/components/RigidBodyPhysicsComponent.min.js +2 -2
- package/dist/assets/components/ScriptingComponent.js +4 -4
- package/dist/assets/components/ScriptingComponent.min.js +2 -2
- package/dist/assets/components/TextComponent.js +164 -84
- package/dist/assets/components/TextComponent.min.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.js +2 -2
- package/dist/assets/components/TextureProjectionComponent.min.js +2 -2
- package/dist/assets/components/Texturing3DComponent.js +12 -12
- package/dist/assets/components/Texturing3DComponent.min.js +2 -2
- package/dist/assets/components/VolumeRenderingComponent.js +2 -2
- package/dist/assets/components/VolumeRenderingComponent.min.js +2 -2
- package/dist/assets/components/WebXRComponent.js +2 -2
- package/dist/assets/components/WebXRComponent.min.js +2 -2
- package/dist/assets/components/X_ITEComponent.js +2 -2
- package/dist/assets/components/X_ITEComponent.min.js +2 -2
- package/dist/example.html +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.d.ts +116 -61
- package/dist/x_ite.js +747 -967
- package/dist/x_ite.min.js +2 -2
- package/dist/x_ite.min.mjs +2 -2
- package/dist/x_ite.mjs +746 -967
- package/dist/x_ite.zip +0 -0
- package/package.json +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* X_ITE
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-
|
|
1
|
+
/* X_ITE v15.0.1 */
|
|
2
|
+
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-15.0.1")];
|
|
3
3
|
/******/ (() => { // webpackBootstrap
|
|
4
4
|
/******/ "use strict";
|
|
5
5
|
/******/ var __webpack_modules__ = ({
|
|
@@ -381,7 +381,7 @@ Object .assign (Object .setPrototypeOf (Script .prototype, Scripting_X3DScriptNo
|
|
|
381
381
|
|
|
382
382
|
const handler =
|
|
383
383
|
{
|
|
384
|
-
get (target, key)
|
|
384
|
+
get (target, key, receiver)
|
|
385
385
|
{
|
|
386
386
|
switch (key)
|
|
387
387
|
{
|
|
@@ -390,7 +390,7 @@ Object .assign (Object .setPrototypeOf (Script .prototype, Scripting_X3DScriptNo
|
|
|
390
390
|
case "currentScene":
|
|
391
391
|
return getScriptNode () .getExecutionContext ();
|
|
392
392
|
default:
|
|
393
|
-
return target
|
|
393
|
+
return Reflect .get (target, key, receiver);
|
|
394
394
|
}
|
|
395
395
|
},
|
|
396
396
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/* X_ITE
|
|
2
|
-
const e=window[Symbol.for("X_ITE.X3D-
|
|
1
|
+
/* X_ITE v15.0.1 */
|
|
2
|
+
const e=window[Symbol.for("X_ITE.X3D-15.0.1")];(()=>{var t={254(t){t.exports=e.jquery}},n={};function o(e){var a=n[e];if(void 0!==a)return a.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,o),r.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const a=e.Components;var r=o.n(a);const i=e.X3DBaseNode;var s=o.n(i);const l=e.X3DFieldDefinition;var c=o.n(l);const u=e.FieldDefinitionArray;var d=o.n(u);const p=e.X3DField;var v=o.n(p);const f=e.X3DArrayField;var F=o.n(f);const h=e.Fields;var g=o.n(h);const S=e.X3DBrowser;var y=o.n(S);const D=e.ComponentInfo;var M=o.n(D);const m=e.ComponentInfoArray;var x=o.n(m);const w=e.ProfileInfo;var _=o.n(w);const N=e.ProfileInfoArray;var A=o.n(N);const O=e.ConcreteNodesArray;var E=o.n(O);const I=e.AbstractNodesArray;var b=o.n(I);const X=e.UnitInfo;var T=o.n(X);const C=e.UnitInfoArray;var V=o.n(C);const P=e.NamedNodesArray;var R=o.n(P);const j=e.ImportedNodesArray;var B=o.n(j);const U=e.X3DImportedNode;var L=o.n(U);const z=e.ExportedNodesArray;var $=o.n(z);const G=e.X3DExportedNode;var q=o.n(G);const k=e.X3DExecutionContext;var W=o.n(k);const H=e.X3DScene;var J=o.n(H);const K=e.ExternProtoDeclarationArray;var Q=o.n(K);const Y=e.ProtoDeclarationArray;var Z=o.n(Y);const ee=e.X3DExternProtoDeclaration;var te=o.n(ee);const ne=e.X3DProtoDeclaration;var oe=o.n(ne);const ae=e.X3DProtoDeclarationNode;var re=o.n(ae);const ie=e.RouteArray;var se=o.n(ie);const le=e.X3DRoute;var ce=o.n(le);const ue=e.Namespace;var de=o.n(ue);const pe=function(e,t,n){return new Function("with (arguments [0])\n {\n return eval ((() =>\n {\n const sourceText = arguments [1];\n\n delete arguments [0];\n delete arguments [1];\n\n arguments .length = 0;\n\n return sourceText;\n })\n ());\n }").call(e,t,n)},ve=de().add("evaluate",pe),fe=e.X3DNode;var Fe=o.n(fe);const he=e.X3DChildNode;var ge=o.n(he);const Se=e.X3DUrlObject;var ye=o.n(Se);const De=e.X3DConstants;var Me=o.n(De);function me(e){ge().call(this,e),ye().call(this,e),this.addType(Me().X3DScriptNode)}Object.assign(Object.setPrototypeOf(me.prototype,ge().prototype),ye().prototype,{initialize(){ge().prototype.initialize.call(this),ye().prototype.initialize.call(this)},dispose(){ye().prototype.dispose.call(this),ge().prototype.dispose.call(this)}}),Object.defineProperties(me,Fe().getStaticProperties("X3DScriptNode","Scripting",1));const xe=me,we=de().add("X3DScriptNode",xe),_e=e.FileLoader;var Ne=o.n(_e);const Ae=e.SFNodeCache;var Oe=o.n(Ae),Ee=o(254);function Ie(e){we.call(this,e),this.addType(Me().Script)}Object.assign(Object.setPrototypeOf(Ie.prototype,we.prototype),{initialize(){we.prototype.initialize.call(this),this.requestImmediateLoad().catch(Function.prototype)},getExtendedEventHandling:()=>!1,canUserDefinedFields:()=>!0,addUserDefinedField(e,t,n){we.prototype.addUserDefinedField.call(this,e,t,n),this.isInitialized()&&(this.setLoadState(Me().NOT_STARTED_STATE),this.requestImmediateLoad().catch(Function.prototype))},removeUserDefinedField(e){this.getUserDefinedFields().get(e)?.removeInterest("set_field__",this),we.prototype.removeUserDefinedField.call(this,e),this.isInitialized()&&(this.setLoadState(Me().NOT_STARTED_STATE),this.requestImmediateLoad().catch(Function.prototype))},getSourceText(){return this._url},async unloadData(){const e=this.context?.get("shutdown");"function"==typeof e&&this.call__(e,"shutdown"),Ee(window).off(`.Script-${this.getId()}`),this.getBrowser().prepareEvents().removeInterest("call__",this),this.removeInterest("call__",this);for(const e of this.getUserDefinedFields())e.removeInterest("set_field__",this)},async loadData(){await this.unloadData(),new(Ne())(this).loadDocument(this._url,async e=>{null===e?this.setLoadState(Me().FAILED_STATE):(await this.initialize__(Ee.decodeText(e)),this.setLoadState(Me().COMPLETE_STATE))})},createGlobalObject(){const e=()=>this,t={get(t,n,o){switch(n){case"getScriptNode":return e;case"currentScene":return e().getExecutionContext();default:return Reflect.get(t,n,o)}}},n=new Proxy(this.getBrowser(),t);function o(t){const n=new(g().SFNode);if(n.fromString(t,e().getExecutionContext()),n.getValue())return Oe().get(n.getValue());throw new Error("SFNode.new: invalid argument.")}o.prototype=g().SFNode.prototype;const a={NULL:{value:null},FALSE:{value:!1},TRUE:{value:!0},print:{value:n.println.bind(n)},trace:{value:n.println.bind(n)},Browser:{value:n},X3DConstants:{value:Me()},X3DBrowser:{value:y()},X3DExecutionContext:{value:W()},X3DScene:{value:J()},ComponentInfo:{value:M()},ComponentInfoArray:{value:x()},ProfileInfo:{value:_()},ProfileInfoArray:{value:A()},ConcreteNodesArray:{value:E()},AbstractNodesArray:{value:b()},UnitInfo:{value:T()},UnitInfoArray:{value:V()},NamedNodesArray:{value:R()},ImportedNodesArray:{value:B()},X3DImportedNode:{value:L()},ExportedNodesArray:{value:$()},X3DExportedNode:{value:q()},ExternProtoDeclarationArray:{value:Q()},ProtoDeclarationArray:{value:Z()},X3DExternProtoDeclaration:{value:te()},X3DProtoDeclaration:{value:oe()},X3DProtoDeclarationNode:{value:re()},RouteArray:{value:se()},X3DRoute:{value:ce()},X3DBaseNode:{value:s()},X3DFieldDefinition:{value:c()},FieldDefinitionArray:{value:d()},X3DField:{value:v()},X3DArrayField:{value:F()},SFColor:{value:g().SFColor},SFColorRGBA:{value:g().SFColorRGBA},SFImage:{value:g().SFImage},SFMatrix3d:{value:g().SFMatrix3d},SFMatrix3f:{value:g().SFMatrix3f},SFMatrix4d:{value:g().SFMatrix4d},SFMatrix4f:{value:g().SFMatrix4f},SFNode:{value:o},SFRotation:{value:g().SFRotation},SFString:{value:g().SFString},SFVec2d:{value:g().SFVec2d},SFVec2f:{value:g().SFVec2f},SFVec3d:{value:g().SFVec3d},SFVec3f:{value:g().SFVec3f},SFVec4d:{value:g().SFVec4d},SFVec4f:{value:g().SFVec4f},VrmlMatrix:{value:g().VrmlMatrix},MFBool:{value:g().MFBool},MFColor:{value:g().MFColor},MFColorRGBA:{value:g().MFColorRGBA},MFDouble:{value:g().MFDouble},MFFloat:{value:g().MFFloat},MFImage:{value:g().MFImage},MFInt32:{value:g().MFInt32},MFMatrix3d:{value:g().MFMatrix3d},MFMatrix3f:{value:g().MFMatrix3f},MFMatrix4d:{value:g().MFMatrix4d},MFMatrix4f:{value:g().MFMatrix4f},MFNode:{value:g().MFNode},MFRotation:{value:g().MFRotation},MFString:{value:g().MFString},MFTime:{value:g().MFTime},MFVec2d:{value:g().MFVec2d},MFVec2f:{value:g().MFVec2f},MFVec3d:{value:g().MFVec3d},MFVec3f:{value:g().MFVec3f},MFVec4d:{value:g().MFVec4d},MFVec4f:{value:g().MFVec4f}};for(const e of this.getUserDefinedFields()){if(e.getAccessType()===Me().inputOnly)continue;const t=[e.getName()];e.getAccessType()===Me().inputOutput&&t.push(e.getName()+"_changed");for(const n of t)n in a||(a[n]={get:e.valueOf.bind(e),set:e.setValue.bind(e)})}return Object.create(Object.prototype,a)},createContext(e){const t=["initialize","prepareEvents","eventsProcessed","shutdown"];for(const e of this.getUserDefinedFields())switch(e.getAccessType()){case Me().inputOnly:t.push(e.getName());break;case Me().inputOutput:t.push("set_"+e.getName())}e+="\n;\n["+t.map(e=>`typeof ${e} !== "undefined" ? ${e} : undefined`).join(",")+"];";const n=this.evaluate(e),o=new Map;for(let e=0;e<t.length;++e)o.set(t[e],n[e]);return o},evaluate(e){return this.globalObject??=this.createGlobalObject(),ve(Oe().get(this),this.globalObject,e)},async initialize__(e){const t=this.getBrowser();this.globalObject=this.createGlobalObject(),this.context=this.createContext(e);const n=this.context.get("shutdown");"function"==typeof n&&Ee(window).on(`unload.Script-${this.getId()}`,()=>this.call__(n,"shutdown"));const o=this.context.get("prepareEvents");"function"==typeof o&&t.prepareEvents().addInterest("call__",this,o,"prepareEvents");const a=this.context.get("eventsProcessed");"function"==typeof a&&this.addInterest("call__",this,a,"eventsProcessed");for(const e of this.getUserDefinedFields())switch(e.getAccessType()){case Me().inputOnly:{const t=this.context.get(e.getName());"function"==typeof t&&e.addInterest("set_field__",this,t,[]);break}case Me().inputOutput:{const t=this.context.get("set_"+e.getName());"function"==typeof t&&e.addInterest("set_field__",this,t,[]);break}}const r=this.context.get("initialize");"function"==typeof r&&await this.call__(r,"initialize")},async call__(e,t){try{await e.call(Oe().get(this),this.getBrowser().getCurrentTime())}catch(e){this.setError(`in function '${t}'`,e)}},async set_field__(e,t,n){const o=t.pop()??n.create();try{o.assign(n),await e.call(Oe().get(this),o.valueOf(),this.getBrowser().getCurrentTime())}catch(e){this.setError(`in function '${n.getName()}'`,e)}finally{t.push(o)}},setError(e,t){const n=this.getExecutionContext().getWorldURL().startsWith("data:")?"data:":this.getExecutionContext().getWorldURL();console.error(`JavaScript Error in Script '${this.getName()}', ${e}\nworld url is '${n}':`),console.error(t)},dispose(){this.unloadData(),we.prototype.dispose.call(this)}}),Object.defineProperties(Ie,{...Fe().getStaticProperties("Script","Scripting",1,"children","2.0"),fieldDefinitions:{value:new(d())([new(c())(Me().inputOutput,"metadata",new(g().SFNode)),new(c())(Me().inputOutput,"description",new(g().SFString)),new(c())(Me().inputOutput,"load",new(g().SFBool)(!0)),new(c())(Me().inputOutput,"url",new(g().MFString)),new(c())(Me().inputOutput,"autoRefresh",new(g().SFTime)(0)),new(c())(Me().inputOutput,"autoRefreshTimeLimit",new(g().SFTime)(3600)),new(c())(Me().initializeOnly,"directOutput",new(g().SFBool)),new(c())(Me().initializeOnly,"mustEvaluate",new(g().SFBool))]),enumerable:!0}});const be=Ie,Xe=de().add("Script",be);r().add({name:"Scripting",concreteNodes:[Xe],abstractNodes:[we]});de().add("ScriptingComponent",void 0)})();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* X_ITE
|
|
2
|
-
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-
|
|
1
|
+
/* X_ITE v15.0.1 */
|
|
2
|
+
const __X_ITE_X3D__ = window [Symbol .for ("X_ITE.X3D-15.0.1")];
|
|
3
3
|
/******/ (() => { // webpackBootstrap
|
|
4
4
|
/******/ "use strict";
|
|
5
5
|
/******/ var __webpack_modules__ = ({
|
|
@@ -449,6 +449,11 @@ Object .assign (X3DTextGeometry .prototype,
|
|
|
449
449
|
return this .bbox;
|
|
450
450
|
},
|
|
451
451
|
update ()
|
|
452
|
+
{
|
|
453
|
+
this .configure ();
|
|
454
|
+
this .build ();
|
|
455
|
+
},
|
|
456
|
+
configure ()
|
|
452
457
|
{
|
|
453
458
|
const
|
|
454
459
|
text = this .text,
|
|
@@ -1507,7 +1512,7 @@ const FontLibrary_default_ = FontLibrary;
|
|
|
1507
1512
|
;
|
|
1508
1513
|
|
|
1509
1514
|
/* harmony default export */ const Text_FontLibrary = (external_X_ITE_X3D_Namespace_default().add ("FontLibrary", FontLibrary_default_));
|
|
1510
|
-
;// ./
|
|
1515
|
+
;// ./node_modules/opentype.js/dist/opentype.mjs
|
|
1511
1516
|
// src/tiny-inflate@1.0.3.esm.mjs
|
|
1512
1517
|
var TINF_OK = 0;
|
|
1513
1518
|
var TINF_DATA_ERROR = -3;
|
|
@@ -1870,7 +1875,7 @@ function optimizeCommands(commands) {
|
|
|
1870
1875
|
if (cmd.type === "M") {
|
|
1871
1876
|
startX = cmd.x;
|
|
1872
1877
|
startY = cmd.y;
|
|
1873
|
-
} else if (cmd.type === "L" && (!nextCommand || nextCommand.
|
|
1878
|
+
} else if (cmd.type === "L" && (!nextCommand || nextCommand.type === "Z")) {
|
|
1874
1879
|
if (!(Math.abs(cmd.x - startX) > 1 || Math.abs(cmd.y - startY) > 1)) {
|
|
1875
1880
|
subpath.pop();
|
|
1876
1881
|
}
|
|
@@ -2317,9 +2322,8 @@ Path.prototype.toDOMElement = function(options, pathData) {
|
|
|
2317
2322
|
if (!pathData) {
|
|
2318
2323
|
pathData = this.toPathData(options);
|
|
2319
2324
|
}
|
|
2320
|
-
const temporaryPath = pathData;
|
|
2321
2325
|
const newPath = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
2322
|
-
newPath.setAttribute("d",
|
|
2326
|
+
newPath.setAttribute("d", pathData);
|
|
2323
2327
|
if (this.fill !== void 0 && this.fill !== "black") {
|
|
2324
2328
|
if (this.fill === null) {
|
|
2325
2329
|
newPath.setAttribute("fill", "none");
|
|
@@ -3716,7 +3720,7 @@ Parser.prototype.parseDeltaSetIndexMap = function() {
|
|
|
3716
3720
|
} else if (entrySize === 3) {
|
|
3717
3721
|
entry = this.parseUInt24();
|
|
3718
3722
|
} else if (entrySize === 4) {
|
|
3719
|
-
entry = this.
|
|
3723
|
+
entry = this.parseULong();
|
|
3720
3724
|
} else {
|
|
3721
3725
|
throw new Error(`Invalid entry size of ${entrySize}`);
|
|
3722
3726
|
}
|
|
@@ -5080,13 +5084,26 @@ function addTerminatorSegment(t) {
|
|
|
5080
5084
|
offset: 0
|
|
5081
5085
|
});
|
|
5082
5086
|
}
|
|
5087
|
+
function mergeSegments(segments) {
|
|
5088
|
+
if (segments.length === 0) return segments;
|
|
5089
|
+
const merged = [segments[0]];
|
|
5090
|
+
for (let i = 1; i < segments.length; i++) {
|
|
5091
|
+
const prev = merged[merged.length - 1];
|
|
5092
|
+
const curr = segments[i];
|
|
5093
|
+
if (prev.end + 1 === curr.start && prev.delta === curr.delta && curr.end !== 65535) {
|
|
5094
|
+
prev.end = curr.end;
|
|
5095
|
+
} else {
|
|
5096
|
+
merged.push(curr);
|
|
5097
|
+
}
|
|
5098
|
+
}
|
|
5099
|
+
return merged;
|
|
5100
|
+
}
|
|
5083
5101
|
function makeCmapTable(glyphs) {
|
|
5084
5102
|
let isPlan0Only = true;
|
|
5085
5103
|
let i;
|
|
5086
5104
|
for (i = glyphs.length - 1; i > 0; i -= 1) {
|
|
5087
5105
|
const g = glyphs.get(i);
|
|
5088
5106
|
if (g.unicode > 65535) {
|
|
5089
|
-
console.log("Adding CMAP format 12 (needed!)");
|
|
5090
5107
|
isPlan0Only = false;
|
|
5091
5108
|
break;
|
|
5092
5109
|
}
|
|
@@ -5128,6 +5145,7 @@ function makeCmapTable(glyphs) {
|
|
|
5128
5145
|
t.segments.sort(function(a, b) {
|
|
5129
5146
|
return a.start - b.start;
|
|
5130
5147
|
});
|
|
5148
|
+
t.segments = mergeSegments(t.segments);
|
|
5131
5149
|
addTerminatorSegment(t);
|
|
5132
5150
|
const segCount = t.segments.length;
|
|
5133
5151
|
let segCountToRemove = 0;
|
|
@@ -7410,13 +7428,13 @@ Glyph.prototype.getPath = function(x, y, fontSize, options, font) {
|
|
|
7410
7428
|
};
|
|
7411
7429
|
Glyph.prototype.getLayers = function(font) {
|
|
7412
7430
|
if (!font) {
|
|
7413
|
-
throw Error("The font object is required to read the colr/cpal tables in order to get the layers.");
|
|
7431
|
+
throw new Error("The font object is required to read the colr/cpal tables in order to get the layers.");
|
|
7414
7432
|
}
|
|
7415
7433
|
return font.layers.get(this.index);
|
|
7416
7434
|
};
|
|
7417
7435
|
Glyph.prototype.getSvgImage = function(font) {
|
|
7418
7436
|
if (!font) {
|
|
7419
|
-
throw Error("The font object is required to read the svg table in order to get the image.");
|
|
7437
|
+
throw new Error("The font object is required to read the svg table in order to get the image.");
|
|
7420
7438
|
}
|
|
7421
7439
|
return font.svgImages.get(this.index);
|
|
7422
7440
|
};
|
|
@@ -7480,7 +7498,7 @@ Glyph.prototype.getMetrics = function() {
|
|
|
7480
7498
|
return metrics;
|
|
7481
7499
|
};
|
|
7482
7500
|
Glyph.prototype.draw = function(ctx, x, y, fontSize, options, font) {
|
|
7483
|
-
options = Object.assign({}, font.defaultRenderOptions, options);
|
|
7501
|
+
options = Object.assign({}, font && font.defaultRenderOptions, options);
|
|
7484
7502
|
const path = this.getPath(x, y, fontSize, options, font);
|
|
7485
7503
|
path.draw(ctx);
|
|
7486
7504
|
};
|
|
@@ -7563,8 +7581,8 @@ Glyph.prototype.toPathData = function(options, font) {
|
|
|
7563
7581
|
useGlyph = font.variation.getTransform(this, options.variation);
|
|
7564
7582
|
}
|
|
7565
7583
|
let usePath = useGlyph.points && options.pointsTransform ? options.pointsTransform(useGlyph.points) : useGlyph.path;
|
|
7566
|
-
if (options.
|
|
7567
|
-
usePath = options.
|
|
7584
|
+
if (options.pathTransform) {
|
|
7585
|
+
usePath = options.pathTransform(usePath);
|
|
7568
7586
|
}
|
|
7569
7587
|
return usePath.toPathData(options);
|
|
7570
7588
|
};
|
|
@@ -7705,6 +7723,7 @@ function equals(a, b) {
|
|
|
7705
7723
|
return false;
|
|
7706
7724
|
}
|
|
7707
7725
|
}
|
|
7726
|
+
var MAX_CALL_DEPTH = 10;
|
|
7708
7727
|
function calcCFFSubroutineBias(subrs) {
|
|
7709
7728
|
let bias;
|
|
7710
7729
|
if (subrs.length < 1240) {
|
|
@@ -8176,6 +8195,7 @@ function parseCFFCharstring(font, glyph, code, version, coords) {
|
|
|
8176
8195
|
let vsindex = 0;
|
|
8177
8196
|
let vstore = [];
|
|
8178
8197
|
let blendVector;
|
|
8198
|
+
let callDepth = 0;
|
|
8179
8199
|
const cffTable = font.tables.cff2 || font.tables.cff;
|
|
8180
8200
|
defaultWidthX = cffTable.topDict._defaultWidthX;
|
|
8181
8201
|
nominalWidthX = cffTable.topDict._nominalWidthX;
|
|
@@ -8296,7 +8316,13 @@ function parseCFFCharstring(font, glyph, code, version, coords) {
|
|
|
8296
8316
|
codeIndex = stack.pop() + subrsBias;
|
|
8297
8317
|
subrCode = subrs[codeIndex];
|
|
8298
8318
|
if (subrCode) {
|
|
8319
|
+
if (callDepth >= MAX_CALL_DEPTH) {
|
|
8320
|
+
console.warn("CFF charstring subroutine call depth exceeded, skipping callsubr");
|
|
8321
|
+
break;
|
|
8322
|
+
}
|
|
8323
|
+
callDepth++;
|
|
8299
8324
|
parse(subrCode);
|
|
8325
|
+
callDepth--;
|
|
8300
8326
|
}
|
|
8301
8327
|
break;
|
|
8302
8328
|
case 11:
|
|
@@ -8562,7 +8588,13 @@ function parseCFFCharstring(font, glyph, code, version, coords) {
|
|
|
8562
8588
|
codeIndex = stack.pop() + font.gsubrsBias;
|
|
8563
8589
|
subrCode = font.gsubrs[codeIndex];
|
|
8564
8590
|
if (subrCode) {
|
|
8591
|
+
if (callDepth >= MAX_CALL_DEPTH) {
|
|
8592
|
+
console.warn("CFF charstring subroutine call depth exceeded, skipping callgsubr");
|
|
8593
|
+
break;
|
|
8594
|
+
}
|
|
8595
|
+
callDepth++;
|
|
8565
8596
|
parse(subrCode);
|
|
8597
|
+
callDepth--;
|
|
8566
8598
|
}
|
|
8567
8599
|
break;
|
|
8568
8600
|
case 30:
|
|
@@ -12293,6 +12325,7 @@ function makeSvgImage(text, unitsPerEm) {
|
|
|
12293
12325
|
}
|
|
12294
12326
|
|
|
12295
12327
|
// src/tables/glyf.mjs
|
|
12328
|
+
var _resolving = /* @__PURE__ */ new WeakMap();
|
|
12296
12329
|
function parseGlyphCoordinate(p, flag, previousValue, shortVectorBitMask, sameBitMask) {
|
|
12297
12330
|
let v;
|
|
12298
12331
|
if ((flag & shortVectorBitMask) > 0) {
|
|
@@ -12373,7 +12406,7 @@ function parseGlyph(glyph, data, start) {
|
|
|
12373
12406
|
} else {
|
|
12374
12407
|
glyph.points = [];
|
|
12375
12408
|
}
|
|
12376
|
-
} else if (glyph.
|
|
12409
|
+
} else if (glyph._numberOfContours === 0) {
|
|
12377
12410
|
glyph.points = [];
|
|
12378
12411
|
} else {
|
|
12379
12412
|
glyph.isComposite = true;
|
|
@@ -12496,35 +12529,47 @@ function getPath(points) {
|
|
|
12496
12529
|
}
|
|
12497
12530
|
function buildPath(glyphs, glyph) {
|
|
12498
12531
|
if (glyph.isComposite) {
|
|
12499
|
-
|
|
12500
|
-
|
|
12501
|
-
|
|
12502
|
-
|
|
12503
|
-
|
|
12504
|
-
|
|
12505
|
-
|
|
12506
|
-
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
|
|
12532
|
+
if (!_resolving.has(glyphs)) {
|
|
12533
|
+
_resolving.set(glyphs, /* @__PURE__ */ new Set());
|
|
12534
|
+
}
|
|
12535
|
+
const resolving = _resolving.get(glyphs);
|
|
12536
|
+
resolving.add(glyph.index);
|
|
12537
|
+
try {
|
|
12538
|
+
for (let j = 0; j < glyph.components.length; j += 1) {
|
|
12539
|
+
const component = glyph.components[j];
|
|
12540
|
+
if (resolving.has(component.glyphIndex)) {
|
|
12541
|
+
continue;
|
|
12542
|
+
}
|
|
12543
|
+
const componentGlyph = glyphs.get(component.glyphIndex);
|
|
12544
|
+
componentGlyph.getPath();
|
|
12545
|
+
if (componentGlyph.points) {
|
|
12546
|
+
let transformedPoints;
|
|
12547
|
+
if (component.matchedPoints === void 0) {
|
|
12548
|
+
transformedPoints = transformPoints(componentGlyph.points, component);
|
|
12549
|
+
} else {
|
|
12550
|
+
if (component.matchedPoints[0] > glyph.points.length - 1 || component.matchedPoints[1] > componentGlyph.points.length - 1) {
|
|
12551
|
+
throw Error("Matched points out of range in " + glyph.name);
|
|
12552
|
+
}
|
|
12553
|
+
const firstPt = glyph.points[component.matchedPoints[0]];
|
|
12554
|
+
let secondPt = componentGlyph.points[component.matchedPoints[1]];
|
|
12555
|
+
const transform = {
|
|
12556
|
+
xScale: component.xScale,
|
|
12557
|
+
scale01: component.scale01,
|
|
12558
|
+
scale10: component.scale10,
|
|
12559
|
+
yScale: component.yScale,
|
|
12560
|
+
dx: 0,
|
|
12561
|
+
dy: 0
|
|
12562
|
+
};
|
|
12563
|
+
secondPt = transformPoints([secondPt], transform)[0];
|
|
12564
|
+
transform.dx = firstPt.x - secondPt.x;
|
|
12565
|
+
transform.dy = firstPt.y - secondPt.y;
|
|
12566
|
+
transformedPoints = transformPoints(componentGlyph.points, transform);
|
|
12510
12567
|
}
|
|
12511
|
-
|
|
12512
|
-
let secondPt = componentGlyph.points[component.matchedPoints[1]];
|
|
12513
|
-
const transform = {
|
|
12514
|
-
xScale: component.xScale,
|
|
12515
|
-
scale01: component.scale01,
|
|
12516
|
-
scale10: component.scale10,
|
|
12517
|
-
yScale: component.yScale,
|
|
12518
|
-
dx: 0,
|
|
12519
|
-
dy: 0
|
|
12520
|
-
};
|
|
12521
|
-
secondPt = transformPoints([secondPt], transform)[0];
|
|
12522
|
-
transform.dx = firstPt.x - secondPt.x;
|
|
12523
|
-
transform.dy = firstPt.y - secondPt.y;
|
|
12524
|
-
transformedPoints = transformPoints(componentGlyph.points, transform);
|
|
12568
|
+
glyph.points = glyph.points.concat(transformedPoints);
|
|
12525
12569
|
}
|
|
12526
|
-
glyph.points = glyph.points.concat(transformedPoints);
|
|
12527
12570
|
}
|
|
12571
|
+
} finally {
|
|
12572
|
+
resolving.delete(glyph.index);
|
|
12528
12573
|
}
|
|
12529
12574
|
}
|
|
12530
12575
|
return getPath(glyph.points);
|
|
@@ -13168,6 +13213,9 @@ var VariationManager = class {
|
|
|
13168
13213
|
};
|
|
13169
13214
|
|
|
13170
13215
|
// src/hintingtt.mjs
|
|
13216
|
+
var MAX_INSTRUCTIONS = 1e6;
|
|
13217
|
+
var MAX_CALL_DEPTH2 = 64;
|
|
13218
|
+
var MAX_LOOP_COUNT = 1e4;
|
|
13171
13219
|
var instructionTable;
|
|
13172
13220
|
var exec;
|
|
13173
13221
|
var execGlyph;
|
|
@@ -13509,6 +13557,8 @@ Hinting.prototype.exec = function(glyph, ppem) {
|
|
|
13509
13557
|
fpgmState = this._fpgmState = new State("fpgm", font.tables.fpgm);
|
|
13510
13558
|
fpgmState.funcs = [];
|
|
13511
13559
|
fpgmState.font = font;
|
|
13560
|
+
fpgmState.instructionCount = 0;
|
|
13561
|
+
fpgmState.callDepth = 0;
|
|
13512
13562
|
if (false) // removed by dead control flow
|
|
13513
13563
|
{}
|
|
13514
13564
|
try {
|
|
@@ -13522,6 +13572,8 @@ Hinting.prototype.exec = function(glyph, ppem) {
|
|
|
13522
13572
|
State.prototype = fpgmState;
|
|
13523
13573
|
prepState = this._prepState = new State("prep", font.tables.prep);
|
|
13524
13574
|
prepState.ppem = ppem;
|
|
13575
|
+
prepState.instructionCount = 0;
|
|
13576
|
+
prepState.callDepth = 0;
|
|
13525
13577
|
const oCvt = font.variation && font.variation.process.getCvarTransform() || font.tables.cvt;
|
|
13526
13578
|
if (oCvt) {
|
|
13527
13579
|
const cvt = prepState.cvt = new Array(oCvt.length);
|
|
@@ -13565,6 +13617,8 @@ execGlyph = function(glyph, prepState) {
|
|
|
13565
13617
|
State.prototype = prepState;
|
|
13566
13618
|
if (!components) {
|
|
13567
13619
|
state = new State("glyf", glyph.instructions);
|
|
13620
|
+
state.instructionCount = 0;
|
|
13621
|
+
state.callDepth = 0;
|
|
13568
13622
|
if (false) // removed by dead control flow
|
|
13569
13623
|
{}
|
|
13570
13624
|
execComponent(glyph, state, xScale, yScale);
|
|
@@ -13577,6 +13631,8 @@ execGlyph = function(glyph, prepState) {
|
|
|
13577
13631
|
const c = components[i];
|
|
13578
13632
|
const cg = font.glyphs.get(c.glyphIndex);
|
|
13579
13633
|
state = new State("glyf", cg.instructions);
|
|
13634
|
+
state.instructionCount = 0;
|
|
13635
|
+
state.callDepth = 0;
|
|
13580
13636
|
if (false) // removed by dead control flow
|
|
13581
13637
|
{}
|
|
13582
13638
|
execComponent(cg, state, xScale, yScale);
|
|
@@ -13663,6 +13719,11 @@ exec = function(state) {
|
|
|
13663
13719
|
const pLen = prog.length;
|
|
13664
13720
|
let ins;
|
|
13665
13721
|
for (state.ip = 0; state.ip < pLen; state.ip++) {
|
|
13722
|
+
if (++state.instructionCount > MAX_INSTRUCTIONS) {
|
|
13723
|
+
throw new Error(
|
|
13724
|
+
"Hinting instructions exceeded maximum of " + MAX_INSTRUCTIONS
|
|
13725
|
+
);
|
|
13726
|
+
}
|
|
13666
13727
|
if (false) // removed by dead control flow
|
|
13667
13728
|
{}
|
|
13668
13729
|
ins = instructionTable[prog[state.ip]];
|
|
@@ -13909,6 +13970,9 @@ function SZPS(state) {
|
|
|
13909
13970
|
}
|
|
13910
13971
|
function SLOOP(state) {
|
|
13911
13972
|
state.loop = state.stack.pop();
|
|
13973
|
+
if (state.loop > MAX_LOOP_COUNT) {
|
|
13974
|
+
state.loop = MAX_LOOP_COUNT;
|
|
13975
|
+
}
|
|
13912
13976
|
if (false) // removed by dead control flow
|
|
13913
13977
|
{}
|
|
13914
13978
|
}
|
|
@@ -13979,9 +14043,13 @@ function DEPTH(state) {
|
|
|
13979
14043
|
function LOOPCALL(state) {
|
|
13980
14044
|
const stack = state.stack;
|
|
13981
14045
|
const fn = stack.pop();
|
|
13982
|
-
|
|
14046
|
+
let c = stack.pop();
|
|
14047
|
+
if (c > MAX_LOOP_COUNT) c = MAX_LOOP_COUNT;
|
|
13983
14048
|
if (false) // removed by dead control flow
|
|
13984
14049
|
{}
|
|
14050
|
+
if (++state.callDepth > MAX_CALL_DEPTH2) {
|
|
14051
|
+
throw new Error("Hinting call depth exceeded maximum of " + MAX_CALL_DEPTH2);
|
|
14052
|
+
}
|
|
13985
14053
|
const cip = state.ip;
|
|
13986
14054
|
const cprog = state.prog;
|
|
13987
14055
|
state.prog = state.funcs[fn];
|
|
@@ -13992,17 +14060,22 @@ function LOOPCALL(state) {
|
|
|
13992
14060
|
}
|
|
13993
14061
|
state.ip = cip;
|
|
13994
14062
|
state.prog = cprog;
|
|
14063
|
+
state.callDepth--;
|
|
13995
14064
|
}
|
|
13996
14065
|
function CALL(state) {
|
|
13997
14066
|
const fn = state.stack.pop();
|
|
13998
14067
|
if (false) // removed by dead control flow
|
|
13999
14068
|
{}
|
|
14069
|
+
if (++state.callDepth > MAX_CALL_DEPTH2) {
|
|
14070
|
+
throw new Error("Hinting call depth exceeded maximum of " + MAX_CALL_DEPTH2);
|
|
14071
|
+
}
|
|
14000
14072
|
const cip = state.ip;
|
|
14001
14073
|
const cprog = state.prog;
|
|
14002
14074
|
state.prog = state.funcs[fn];
|
|
14003
14075
|
exec(state);
|
|
14004
14076
|
state.ip = cip;
|
|
14005
14077
|
state.prog = cprog;
|
|
14078
|
+
state.callDepth--;
|
|
14006
14079
|
if (false) // removed by dead control flow
|
|
14007
14080
|
{}
|
|
14008
14081
|
}
|
|
@@ -15766,11 +15839,13 @@ function chainingSubstitutionFormat3(contextParams, subtable) {
|
|
|
15766
15839
|
lookup = this.getLookupMethod(lookupTable, subtable2);
|
|
15767
15840
|
}
|
|
15768
15841
|
if (substitutionType === "12") {
|
|
15769
|
-
|
|
15770
|
-
|
|
15771
|
-
|
|
15772
|
-
|
|
15773
|
-
|
|
15842
|
+
const glyphIndex = contextParams.get(lookupRecord.sequenceIndex);
|
|
15843
|
+
const substitution = lookup(glyphIndex);
|
|
15844
|
+
if (substitution) substitutions.push(substitution);
|
|
15845
|
+
} else if (substitutionType === "21") {
|
|
15846
|
+
const glyphIndex = contextParams.get(lookupRecord.sequenceIndex);
|
|
15847
|
+
const substitution = lookup(glyphIndex);
|
|
15848
|
+
if (substitution) substitutions.push(substitution);
|
|
15774
15849
|
} else {
|
|
15775
15850
|
throw new Error(`Substitution type ${substitutionType} is not supported in chaining substitution`);
|
|
15776
15851
|
}
|
|
@@ -15837,34 +15912,40 @@ function contextSubstitutionFormat1(contextParams, subtable) {
|
|
|
15837
15912
|
return null;
|
|
15838
15913
|
}
|
|
15839
15914
|
function contextSubstitutionFormat3(contextParams, subtable) {
|
|
15840
|
-
|
|
15915
|
+
if (contextParams.context.length < subtable.coverages.length) {
|
|
15916
|
+
return [];
|
|
15917
|
+
}
|
|
15841
15918
|
for (let i = 0; i < subtable.coverages.length; i++) {
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
if (ligSetIndex === -1) {
|
|
15847
|
-
return null;
|
|
15919
|
+
let glyphIndex = contextParams.get(i);
|
|
15920
|
+
glyphIndex = Array.isArray(glyphIndex) ? glyphIndex[0] : glyphIndex;
|
|
15921
|
+
if (lookupCoverage(glyphIndex, subtable.coverages[i]) === -1) {
|
|
15922
|
+
return [];
|
|
15848
15923
|
}
|
|
15849
|
-
|
|
15850
|
-
|
|
15851
|
-
|
|
15852
|
-
|
|
15853
|
-
|
|
15854
|
-
|
|
15855
|
-
|
|
15856
|
-
|
|
15857
|
-
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
|
|
15924
|
+
}
|
|
15925
|
+
let substitutions = [];
|
|
15926
|
+
for (let i = 0; i < subtable.lookupRecords.length; i++) {
|
|
15927
|
+
const lookupRecord = subtable.lookupRecords[i];
|
|
15928
|
+
const lookupListIndex = lookupRecord.lookupListIndex;
|
|
15929
|
+
const lookupTable = this.getLookupByIndex(lookupListIndex);
|
|
15930
|
+
for (let s = 0; s < lookupTable.subtables.length; s++) {
|
|
15931
|
+
let subtable2 = lookupTable.subtables[s];
|
|
15932
|
+
let lookup;
|
|
15933
|
+
let substitutionType = this.getSubstitutionType(lookupTable, subtable2);
|
|
15934
|
+
if (substitutionType === "71") {
|
|
15935
|
+
substitutionType = this.getSubstitutionType(subtable2, subtable2.extension);
|
|
15936
|
+
lookup = this.getLookupMethod(subtable2, subtable2.extension);
|
|
15937
|
+
subtable2 = subtable2.extension;
|
|
15938
|
+
} else {
|
|
15939
|
+
lookup = this.getLookupMethod(lookupTable, subtable2);
|
|
15940
|
+
}
|
|
15941
|
+
if (substitutionType === "12") {
|
|
15942
|
+
const glyphIndex = contextParams.get(lookupRecord.sequenceIndex);
|
|
15943
|
+
const substitution = lookup(glyphIndex);
|
|
15944
|
+
if (substitution) substitutions.push(substitution);
|
|
15945
|
+
} else if (substitutionType === "21") {
|
|
15946
|
+
const glyphIndex = contextParams.get(lookupRecord.sequenceIndex);
|
|
15947
|
+
const substitution = lookup(glyphIndex);
|
|
15948
|
+
if (substitution) substitutions.push(substitution);
|
|
15868
15949
|
}
|
|
15869
15950
|
}
|
|
15870
15951
|
}
|
|
@@ -16764,11 +16845,11 @@ function Font(options) {
|
|
|
16764
16845
|
options = options || {};
|
|
16765
16846
|
options.tables = options.tables || {};
|
|
16766
16847
|
if (!options.empty) {
|
|
16767
|
-
if (!options.familyName) throw "When creating a new Font object, familyName is required.";
|
|
16768
|
-
if (!options.styleName) throw "When creating a new Font object, styleName is required.";
|
|
16769
|
-
if (!options.unitsPerEm) throw "When creating a new Font object, unitsPerEm is required.";
|
|
16770
|
-
if (!options.ascender) throw "When creating a new Font object, ascender is required.";
|
|
16771
|
-
if (options.descender > 0) throw "When creating a new Font object, negative descender value is required.";
|
|
16848
|
+
if (!options.familyName) throw new Error("When creating a new Font object, familyName is required.");
|
|
16849
|
+
if (!options.styleName) throw new Error("When creating a new Font object, styleName is required.");
|
|
16850
|
+
if (!options.unitsPerEm) throw new Error("When creating a new Font object, unitsPerEm is required.");
|
|
16851
|
+
if (!options.ascender) throw new Error("When creating a new Font object, ascender is required.");
|
|
16852
|
+
if (options.descender > 0) throw new Error("When creating a new Font object, negative descender value is required.");
|
|
16772
16853
|
this.names = {};
|
|
16773
16854
|
this.names.unicode = createDefaultNamesInfo(options);
|
|
16774
16855
|
this.names.macintosh = createDefaultNamesInfo(options);
|
|
@@ -16791,7 +16872,7 @@ function Font(options) {
|
|
|
16791
16872
|
if (this.weightClass >= 600) {
|
|
16792
16873
|
selection |= this.fsSelectionValues.BOLD;
|
|
16793
16874
|
}
|
|
16794
|
-
if (selection
|
|
16875
|
+
if (selection === 0) {
|
|
16795
16876
|
selection = this.fsSelectionValues.REGULAR;
|
|
16796
16877
|
}
|
|
16797
16878
|
}
|
|
@@ -17507,7 +17588,7 @@ function parseBuffer(buffer, opt = {}) {
|
|
|
17507
17588
|
numTables = parse_default.getUShort(data, 12);
|
|
17508
17589
|
tableEntries = parseWOFFTableEntries(data, numTables);
|
|
17509
17590
|
} else if (signature === "wOF2") {
|
|
17510
|
-
|
|
17591
|
+
const issue = "https://github.com/opentypejs/opentype.js/issues/183#issuecomment-1147228025";
|
|
17511
17592
|
throw new Error("WOFF2 require an external decompressor library, see examples at: " + issue);
|
|
17512
17593
|
} else {
|
|
17513
17594
|
throw new Error("Unsupported OpenType signature " + signature);
|
|
@@ -17783,8 +17864,8 @@ const
|
|
|
17783
17864
|
|
|
17784
17865
|
function X3DTextContext ()
|
|
17785
17866
|
{
|
|
17786
|
-
this [_fontCache]
|
|
17787
|
-
this [_library]
|
|
17867
|
+
this [_fontCache] = new Map ();
|
|
17868
|
+
this [_library] = new WeakMap ();
|
|
17788
17869
|
}
|
|
17789
17870
|
|
|
17790
17871
|
Object .assign (X3DTextContext .prototype,
|
|
@@ -18016,13 +18097,12 @@ Object .assign (Object .setPrototypeOf (Text .prototype, (external_X_ITE_X3D_X3D
|
|
|
18016
18097
|
build ()
|
|
18017
18098
|
{
|
|
18018
18099
|
this .textGeometry .update ();
|
|
18019
|
-
this .textGeometry .build ();
|
|
18020
18100
|
|
|
18021
18101
|
this .setSolid (this ._solid .getValue ());
|
|
18022
18102
|
},
|
|
18023
|
-
traverseBefore (type, renderObject)
|
|
18103
|
+
traverseBefore (type, renderObject, shapeNode)
|
|
18024
18104
|
{
|
|
18025
|
-
this .textGeometry .traverseBefore ?.(type, renderObject);
|
|
18105
|
+
this .textGeometry .traverseBefore ?.(type, renderObject, shapeNode);
|
|
18026
18106
|
},
|
|
18027
18107
|
traverseAfter (type, renderObject)
|
|
18028
18108
|
{
|