harfbuzzjs 0.4.2 → 0.4.4
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/build.sh +1 -0
- package/examples/hbjs.example.html +6 -3
- package/examples/nohbjs.html +5 -8
- package/hb-subset.wasm +0 -0
- package/hb.js +6 -3
- package/hb.wasm +0 -0
- package/package.json +1 -1
- package/test/fonts/noto/NotoSansDevanagari-Regular.otf +0 -0
- package/test/index.js +71 -27
- package/.vscode/settings.json +0 -7
- package/perf.js +0 -66
package/build.sh
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
<script src="../hb.js"></script>
|
|
1
2
|
<script src="../hbjs.js"></script>
|
|
2
3
|
<script src="hbjs.example.js"></script>
|
|
3
4
|
<script>
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
let harfBuzzModule; // not really needed with the hbjs wrapper
|
|
7
|
+
createHarfBuzz().then(hbmodule=>{
|
|
8
|
+
harfBuzzModule = hbmodule;
|
|
6
9
|
fetch('../test/fonts/noto/NotoSans-Regular.ttf').then(function (x) {
|
|
7
10
|
return x.arrayBuffer();
|
|
8
11
|
}).then(function (blob) {
|
|
9
|
-
document.body.innerText = JSON.stringify(example(hbjs(
|
|
12
|
+
document.body.innerText = JSON.stringify(example(hbjs(hbmodule), new Uint8Array(blob)), undefined, 2);
|
|
10
13
|
document.body.style.whiteSpace = 'pre';
|
|
11
14
|
});
|
|
12
15
|
});
|
package/examples/nohbjs.html
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
|
+
<script src="../hb.js"></script>
|
|
2
3
|
<script>
|
|
3
4
|
var utf8Encoder = new TextEncoder("utf8");
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}).then(function (wasm) {
|
|
10
|
-
return WebAssembly.instantiate(wasm);
|
|
11
|
-
}).then(function (result) {
|
|
12
|
-
var exports = result.instance.exports;
|
|
6
|
+
let harfBuzzModule;
|
|
7
|
+
createHarfBuzz().then(hbmodule=>{
|
|
8
|
+
harfBuzzModule = hbmodule;
|
|
9
|
+
var exports = hbmodule.wasmExports;
|
|
13
10
|
|
|
14
11
|
fetch('../test/fonts/noto/NotoSans-Regular.ttf').then(function (x) {
|
|
15
12
|
return x.arrayBuffer();
|
package/hb-subset.wasm
CHANGED
|
Binary file
|
package/hb.js
CHANGED
|
@@ -6,14 +6,17 @@ var Module = (() => {
|
|
|
6
6
|
function(moduleArg = {}) {
|
|
7
7
|
var moduleRtn;
|
|
8
8
|
|
|
9
|
-
var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;var readyPromise=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";if(ENVIRONMENT_IS_NODE){}var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);var ret=fs.readFileSync(filename);return ret};readAsync=(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return new Promise((resolve,reject)=>{fs.readFile(filename,binary?undefined:"utf8",(err,data)=>{if(err)reject(err);else resolve(binary?data.buffer:data)})})};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptName){scriptDirectory=_scriptName}if(scriptDirectory.startsWith("blob:")){scriptDirectory=""}else{scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}return fetch(url,{credentials:"same-origin"}).then(response=>{if(response.ok){return response.arrayBuffer()}return Promise.reject(new Error(response.status+" : "+response.url))})}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];var wasmBinary=Module["wasmBinary"];var wasmMemory;var ABORT=false;var EXITSTATUS;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){var preRuns=Module["preRun"];if(preRuns){if(typeof preRuns=="function")preRuns=[preRuns];preRuns.forEach(addOnPreRun)}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function postRun(){var postRuns=Module["postRun"];if(postRuns){if(typeof postRuns=="function")postRuns=[postRuns];postRuns.forEach(addOnPostRun)}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");function findWasmBinary(){var f="hb.wasm";if(!isDataURI(f)){return locateFile(f)}return f}var wasmBinaryFile;function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}function getBinaryPromise(binaryFile){if(!wasmBinary){return readAsync(binaryFile).then(response=>new Uint8Array(response),()=>getBinarySync(binaryFile))}return Promise.resolve().then(()=>getBinarySync(binaryFile))}function instantiateArrayBuffer(binaryFile,imports,receiver){return getBinaryPromise(binaryFile).then(binary=>WebAssembly.instantiate(binary,imports)).then(receiver,reason=>{err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)})}function instantiateAsync(binary,binaryFile,imports,callback){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{var result=WebAssembly.instantiateStreaming(response,imports);return result.then(callback,function(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(binaryFile,imports,callback)})})}return instantiateArrayBuffer(binaryFile,imports,callback)}function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports}}function createWasm(){var info=getWasmImports();function receiveInstance(instance,module){wasmExports=instance.exports;Module["wasmExports"]=wasmExports;wasmMemory=wasmExports["memory"];Module["wasmMemory"]=wasmMemory;updateMemoryViews();wasmTable=wasmExports["__indirect_function_table"];addOnInit(wasmExports["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);readyPromiseReject(e)}}wasmBinaryFile??=findWasmBinary();instantiateAsync(wasmBinary,wasmBinaryFile,info,receiveInstantiationResult).catch(readyPromiseReject);return{}}function ExitStatus(status){this.name="ExitStatus";this.message=`Program terminated with exit(${status})`;this.status=status}var callRuntimeCallbacks=callbacks=>{callbacks.forEach(f=>f(Module))};var noExitRuntime=Module["noExitRuntime"]||true;var __abort_js=()=>{abort("")};var __emscripten_runtime_keepalive_clear=()=>{noExitRuntime=false;runtimeKeepaliveCounter=0};var timers={};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)};var runtimeKeepaliveCounter=0;var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){return}try{func();maybeExit()}catch(e){handleException(e)}};var _emscripten_get_now=()=>performance.now();var __setitimer_js=(which,timeout_ms)=>{if(timers[which]){clearTimeout(timers[which].id);delete timers[which]}if(!timeout_ms)return 0;var id=setTimeout(()=>{delete timers[which];callUserCallback(()=>__emscripten_timeout(which,_emscripten_get_now()))},timeout_ms);timers[which]={id,timeout_ms};return 0};var abortOnCannotGrowMemory=requestedSize=>{abort("OOM")};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;abortOnCannotGrowMemory(requestedSize)};var uleb128Encode=(n,target)=>{if(n<128){target.push(n)}else{target.push(n%128|128,n>>7)}};var sigToWasmTypes=sig=>{var typeNames={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"};var type={parameters:[],results:sig[0]=="v"?[]:[typeNames[sig[0]]]};for(var i=1;i<sig.length;++i){type.parameters.push(typeNames[sig[i]])}return type};var generateFuncType=(sig,target)=>{var sigRet=sig.slice(0,1);var sigParam=sig.slice(1);var typeCodes={i:127,p:127,j:126,f:125,d:124,e:111};target.push(96);uleb128Encode(sigParam.length,target);for(var i=0;i<sigParam.length;++i){target.push(typeCodes[sigParam[i]])}if(sigRet=="v"){target.push(0)}else{target.push(1,typeCodes[sigRet])}};var convertJsFunctionToWasm=(func,sig)=>{if(typeof WebAssembly.Function=="function"){return new WebAssembly.Function(sigToWasmTypes(sig),func)}var typeSectionBody=[1];generateFuncType(sig,typeSectionBody);var bytes=[0,97,115,109,1,0,0,0,1];uleb128Encode(typeSectionBody.length,bytes);bytes.push(...typeSectionBody);bytes.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var module=new WebAssembly.Module(new Uint8Array(bytes));var instance=new WebAssembly.Instance(module,{e:{f:func}});var wrappedFunc=instance.exports["f"];return wrappedFunc};var wasmTable;var getWasmTableEntry=funcPtr=>wasmTable.get(funcPtr);var updateTableMap=(offset,count)=>{if(functionsInTableMap){for(var i=offset;i<offset+count;i++){var item=getWasmTableEntry(i);if(item){functionsInTableMap.set(item,i)}}}};var functionsInTableMap;var getFunctionAddress=func=>{if(!functionsInTableMap){functionsInTableMap=new WeakMap;updateTableMap(0,wasmTable.length)}return functionsInTableMap.get(func)||0};var freeTableIndexes=[];var getEmptyTableSlot=()=>{if(freeTableIndexes.length){return freeTableIndexes.pop()}try{wasmTable.grow(1)}catch(err){if(!(err instanceof RangeError)){throw err}throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return wasmTable.length-1};var setWasmTableEntry=(idx,func)=>wasmTable.set(idx,func);var addFunction=(func,sig)=>{var rtn=getFunctionAddress(func);if(rtn){return rtn}var ret=getEmptyTableSlot();try{setWasmTableEntry(ret,func)}catch(err){if(!(err instanceof TypeError)){throw err}var wrapped=convertJsFunctionToWasm(func,sig);setWasmTableEntry(ret,wrapped)}functionsInTableMap.set(func,ret);return ret};var wasmImports={_abort_js:__abort_js,_emscripten_runtime_keepalive_clear:__emscripten_runtime_keepalive_clear,_setitimer_js:__setitimer_js,emscripten_resize_heap:_emscripten_resize_heap,proc_exit:_proc_exit};var wasmExports=createWasm();var ___wasm_call_ctors=()=>(___wasm_call_ctors=wasmExports["__wasm_call_ctors"])();var _hb_blob_create=Module["_hb_blob_create"]=(a0,a1,a2,a3,a4)=>(_hb_blob_create=Module["_hb_blob_create"]=wasmExports["hb_blob_create"])(a0,a1,a2,a3,a4);var _hb_blob_destroy=Module["_hb_blob_destroy"]=a0=>(_hb_blob_destroy=Module["_hb_blob_destroy"]=wasmExports["hb_blob_destroy"])(a0);var _free=Module["_free"]=a0=>(_free=Module["_free"]=wasmExports["free"])(a0);var _hb_blob_get_length=Module["_hb_blob_get_length"]=a0=>(_hb_blob_get_length=Module["_hb_blob_get_length"]=wasmExports["hb_blob_get_length"])(a0);var _hb_blob_get_data=Module["_hb_blob_get_data"]=(a0,a1)=>(_hb_blob_get_data=Module["_hb_blob_get_data"]=wasmExports["hb_blob_get_data"])(a0,a1);var _malloc=Module["_malloc"]=a0=>(_malloc=Module["_malloc"]=wasmExports["malloc"])(a0);var _hb_buffer_serialize_glyphs=Module["_hb_buffer_serialize_glyphs"]=(a0,a1,a2,a3,a4,a5,a6,a7,a8)=>(_hb_buffer_serialize_glyphs=Module["_hb_buffer_serialize_glyphs"]=wasmExports["hb_buffer_serialize_glyphs"])(a0,a1,a2,a3,a4,a5,a6,a7,a8);var _hb_buffer_create=Module["_hb_buffer_create"]=()=>(_hb_buffer_create=Module["_hb_buffer_create"]=wasmExports["hb_buffer_create"])();var _hb_buffer_destroy=Module["_hb_buffer_destroy"]=a0=>(_hb_buffer_destroy=Module["_hb_buffer_destroy"]=wasmExports["hb_buffer_destroy"])(a0);var _hb_buffer_get_content_type=Module["_hb_buffer_get_content_type"]=a0=>(_hb_buffer_get_content_type=Module["_hb_buffer_get_content_type"]=wasmExports["hb_buffer_get_content_type"])(a0);var _hb_buffer_set_direction=Module["_hb_buffer_set_direction"]=(a0,a1)=>(_hb_buffer_set_direction=Module["_hb_buffer_set_direction"]=wasmExports["hb_buffer_set_direction"])(a0,a1);var _hb_buffer_set_script=Module["_hb_buffer_set_script"]=(a0,a1)=>(_hb_buffer_set_script=Module["_hb_buffer_set_script"]=wasmExports["hb_buffer_set_script"])(a0,a1);var _hb_buffer_set_language=Module["_hb_buffer_set_language"]=(a0,a1)=>(_hb_buffer_set_language=Module["_hb_buffer_set_language"]=wasmExports["hb_buffer_set_language"])(a0,a1);var _hb_buffer_set_flags=Module["_hb_buffer_set_flags"]=(a0,a1)=>(_hb_buffer_set_flags=Module["_hb_buffer_set_flags"]=wasmExports["hb_buffer_set_flags"])(a0,a1);var _hb_buffer_set_cluster_level=Module["_hb_buffer_set_cluster_level"]=(a0,a1)=>(_hb_buffer_set_cluster_level=Module["_hb_buffer_set_cluster_level"]=wasmExports["hb_buffer_set_cluster_level"])(a0,a1);var _hb_buffer_get_length=Module["_hb_buffer_get_length"]=a0=>(_hb_buffer_get_length=Module["_hb_buffer_get_length"]=wasmExports["hb_buffer_get_length"])(a0);var _hb_buffer_get_glyph_infos=Module["_hb_buffer_get_glyph_infos"]=(a0,a1)=>(_hb_buffer_get_glyph_infos=Module["_hb_buffer_get_glyph_infos"]=wasmExports["hb_buffer_get_glyph_infos"])(a0,a1);var _hb_buffer_get_glyph_positions=Module["_hb_buffer_get_glyph_positions"]=(a0,a1)=>(_hb_buffer_get_glyph_positions=Module["_hb_buffer_get_glyph_positions"]=wasmExports["hb_buffer_get_glyph_positions"])(a0,a1);var _hb_glyph_info_get_glyph_flags=Module["_hb_glyph_info_get_glyph_flags"]=a0=>(_hb_glyph_info_get_glyph_flags=Module["_hb_glyph_info_get_glyph_flags"]=wasmExports["hb_glyph_info_get_glyph_flags"])(a0);var _hb_buffer_guess_segment_properties=Module["_hb_buffer_guess_segment_properties"]=a0=>(_hb_buffer_guess_segment_properties=Module["_hb_buffer_guess_segment_properties"]=wasmExports["hb_buffer_guess_segment_properties"])(a0);var _hb_buffer_add_utf8=Module["_hb_buffer_add_utf8"]=(a0,a1,a2,a3,a4)=>(_hb_buffer_add_utf8=Module["_hb_buffer_add_utf8"]=wasmExports["hb_buffer_add_utf8"])(a0,a1,a2,a3,a4);var _hb_buffer_add_utf16=Module["_hb_buffer_add_utf16"]=(a0,a1,a2,a3,a4)=>(_hb_buffer_add_utf16=Module["_hb_buffer_add_utf16"]=wasmExports["hb_buffer_add_utf16"])(a0,a1,a2,a3,a4);var _hb_buffer_set_message_func=Module["_hb_buffer_set_message_func"]=(a0,a1,a2,a3)=>(_hb_buffer_set_message_func=Module["_hb_buffer_set_message_func"]=wasmExports["hb_buffer_set_message_func"])(a0,a1,a2,a3);var _hb_language_from_string=Module["_hb_language_from_string"]=(a0,a1)=>(_hb_language_from_string=Module["_hb_language_from_string"]=wasmExports["hb_language_from_string"])(a0,a1);var _hb_script_from_string=Module["_hb_script_from_string"]=(a0,a1)=>(_hb_script_from_string=Module["_hb_script_from_string"]=wasmExports["hb_script_from_string"])(a0,a1);var _hb_version=Module["_hb_version"]=(a0,a1,a2)=>(_hb_version=Module["_hb_version"]=wasmExports["hb_version"])(a0,a1,a2);var _hb_version_string=Module["_hb_version_string"]=()=>(_hb_version_string=Module["_hb_version_string"]=wasmExports["hb_version_string"])();var _hb_feature_from_string=Module["_hb_feature_from_string"]=(a0,a1,a2)=>(_hb_feature_from_string=Module["_hb_feature_from_string"]=wasmExports["hb_feature_from_string"])(a0,a1,a2);var _hb_draw_funcs_set_move_to_func=Module["_hb_draw_funcs_set_move_to_func"]=(a0,a1,a2,a3)=>(_hb_draw_funcs_set_move_to_func=Module["_hb_draw_funcs_set_move_to_func"]=wasmExports["hb_draw_funcs_set_move_to_func"])(a0,a1,a2,a3);var _hb_draw_funcs_set_line_to_func=Module["_hb_draw_funcs_set_line_to_func"]=(a0,a1,a2,a3)=>(_hb_draw_funcs_set_line_to_func=Module["_hb_draw_funcs_set_line_to_func"]=wasmExports["hb_draw_funcs_set_line_to_func"])(a0,a1,a2,a3);var _hb_draw_funcs_set_quadratic_to_func=Module["_hb_draw_funcs_set_quadratic_to_func"]=(a0,a1,a2,a3)=>(_hb_draw_funcs_set_quadratic_to_func=Module["_hb_draw_funcs_set_quadratic_to_func"]=wasmExports["hb_draw_funcs_set_quadratic_to_func"])(a0,a1,a2,a3);var _hb_draw_funcs_set_cubic_to_func=Module["_hb_draw_funcs_set_cubic_to_func"]=(a0,a1,a2,a3)=>(_hb_draw_funcs_set_cubic_to_func=Module["_hb_draw_funcs_set_cubic_to_func"]=wasmExports["hb_draw_funcs_set_cubic_to_func"])(a0,a1,a2,a3);var _hb_draw_funcs_set_close_path_func=Module["_hb_draw_funcs_set_close_path_func"]=(a0,a1,a2,a3)=>(_hb_draw_funcs_set_close_path_func=Module["_hb_draw_funcs_set_close_path_func"]=wasmExports["hb_draw_funcs_set_close_path_func"])(a0,a1,a2,a3);var _hb_draw_funcs_create=Module["_hb_draw_funcs_create"]=()=>(_hb_draw_funcs_create=Module["_hb_draw_funcs_create"]=wasmExports["hb_draw_funcs_create"])();var _hb_face_create=Module["_hb_face_create"]=(a0,a1)=>(_hb_face_create=Module["_hb_face_create"]=wasmExports["hb_face_create"])(a0,a1);var _hb_face_destroy=Module["_hb_face_destroy"]=a0=>(_hb_face_destroy=Module["_hb_face_destroy"]=wasmExports["hb_face_destroy"])(a0);var _hb_face_reference_table=Module["_hb_face_reference_table"]=(a0,a1)=>(_hb_face_reference_table=Module["_hb_face_reference_table"]=wasmExports["hb_face_reference_table"])(a0,a1);var _hb_face_get_upem=Module["_hb_face_get_upem"]=a0=>(_hb_face_get_upem=Module["_hb_face_get_upem"]=wasmExports["hb_face_get_upem"])(a0);var _hb_face_collect_unicodes=Module["_hb_face_collect_unicodes"]=(a0,a1)=>(_hb_face_collect_unicodes=Module["_hb_face_collect_unicodes"]=wasmExports["hb_face_collect_unicodes"])(a0,a1);var _hb_font_draw_glyph=Module["_hb_font_draw_glyph"]=(a0,a1,a2,a3)=>(_hb_font_draw_glyph=Module["_hb_font_draw_glyph"]=wasmExports["hb_font_draw_glyph"])(a0,a1,a2,a3);var _hb_font_glyph_to_string=Module["_hb_font_glyph_to_string"]=(a0,a1,a2,a3)=>(_hb_font_glyph_to_string=Module["_hb_font_glyph_to_string"]=wasmExports["hb_font_glyph_to_string"])(a0,a1,a2,a3);var _hb_font_create=Module["_hb_font_create"]=a0=>(_hb_font_create=Module["_hb_font_create"]=wasmExports["hb_font_create"])(a0);var _hb_font_destroy=Module["_hb_font_destroy"]=a0=>(_hb_font_destroy=Module["_hb_font_destroy"]=wasmExports["hb_font_destroy"])(a0);var _hb_font_set_scale=Module["_hb_font_set_scale"]=(a0,a1,a2)=>(_hb_font_set_scale=Module["_hb_font_set_scale"]=wasmExports["hb_font_set_scale"])(a0,a1,a2);var _hb_font_set_variations=Module["_hb_font_set_variations"]=(a0,a1,a2)=>(_hb_font_set_variations=Module["_hb_font_set_variations"]=wasmExports["hb_font_set_variations"])(a0,a1,a2);var _hb_set_create=Module["_hb_set_create"]=()=>(_hb_set_create=Module["_hb_set_create"]=wasmExports["hb_set_create"])();var _hb_set_destroy=Module["_hb_set_destroy"]=a0=>(_hb_set_destroy=Module["_hb_set_destroy"]=wasmExports["hb_set_destroy"])(a0);var _hb_ot_var_get_axis_infos=Module["_hb_ot_var_get_axis_infos"]=(a0,a1,a2,a3)=>(_hb_ot_var_get_axis_infos=Module["_hb_ot_var_get_axis_infos"]=wasmExports["hb_ot_var_get_axis_infos"])(a0,a1,a2,a3);var _hb_set_get_population=Module["_hb_set_get_population"]=a0=>(_hb_set_get_population=Module["_hb_set_get_population"]=wasmExports["hb_set_get_population"])(a0);var _hb_set_next_many=Module["_hb_set_next_many"]=(a0,a1,a2,a3)=>(_hb_set_next_many=Module["_hb_set_next_many"]=wasmExports["hb_set_next_many"])(a0,a1,a2,a3);var _hb_shape=Module["_hb_shape"]=(a0,a1,a2,a3)=>(_hb_shape=Module["_hb_shape"]=wasmExports["hb_shape"])(a0,a1,a2,a3);var __emscripten_timeout=(a0,a1)=>(__emscripten_timeout=wasmExports["_emscripten_timeout"])(a0,a1);Module["wasmMemory"]=wasmMemory;Module["wasmExports"]=wasmExports;Module["addFunction"]=addFunction;var calledRun;var calledPrerun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(){if(runDependencies>0){return}if(!calledPrerun){calledPrerun=1;preRun();if(runDependencies>0){return}}function doRun(){if(calledRun)return;calledRun=1;Module["calledRun"]=1;if(ABORT)return;initRuntime();readyPromiseResolve(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();moduleRtn=readyPromise;
|
|
9
|
+
var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;var readyPromise=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope!="undefined";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";if(ENVIRONMENT_IS_NODE){}var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptName){scriptDirectory=_scriptName}if(scriptDirectory.startsWith("blob:")){scriptDirectory=""}else{scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];var wasmBinary=Module["wasmBinary"];var wasmMemory;var ABORT=false;var EXITSTATUS;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");function findWasmBinary(){var f="hb.wasm";if(!isDataURI(f)){return locateFile(f)}return f}var wasmBinaryFile;function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports}}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;Module["wasmExports"]=wasmExports;wasmMemory=wasmExports["memory"];Module["wasmMemory"]=wasmMemory;updateMemoryViews();wasmTable=wasmExports["__indirect_function_table"];addOnInit(wasmExports["__wasm_call_ctors"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);readyPromiseReject(e)}}wasmBinaryFile??=findWasmBinary();try{var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);receiveInstantiationResult(result);return result}catch(e){readyPromiseReject(e);return}}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var noExitRuntime=Module["noExitRuntime"]||true;var __abort_js=()=>abort("");var runtimeKeepaliveCounter=0;var __emscripten_runtime_keepalive_clear=()=>{noExitRuntime=false;runtimeKeepaliveCounter=0};var timers={};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)};var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){return}try{func();maybeExit()}catch(e){handleException(e)}};var _emscripten_get_now=()=>performance.now();var __setitimer_js=(which,timeout_ms)=>{if(timers[which]){clearTimeout(timers[which].id);delete timers[which]}if(!timeout_ms)return 0;var id=setTimeout(()=>{delete timers[which];callUserCallback(()=>__emscripten_timeout(which,_emscripten_get_now()))},timeout_ms);timers[which]={id,timeout_ms};return 0};var abortOnCannotGrowMemory=requestedSize=>{abort("OOM")};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;abortOnCannotGrowMemory(requestedSize)};var uleb128Encode=(n,target)=>{if(n<128){target.push(n)}else{target.push(n%128|128,n>>7)}};var sigToWasmTypes=sig=>{var typeNames={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"};var type={parameters:[],results:sig[0]=="v"?[]:[typeNames[sig[0]]]};for(var i=1;i<sig.length;++i){type.parameters.push(typeNames[sig[i]])}return type};var generateFuncType=(sig,target)=>{var sigRet=sig.slice(0,1);var sigParam=sig.slice(1);var typeCodes={i:127,p:127,j:126,f:125,d:124,e:111};target.push(96);uleb128Encode(sigParam.length,target);for(var i=0;i<sigParam.length;++i){target.push(typeCodes[sigParam[i]])}if(sigRet=="v"){target.push(0)}else{target.push(1,typeCodes[sigRet])}};var convertJsFunctionToWasm=(func,sig)=>{if(typeof WebAssembly.Function=="function"){return new WebAssembly.Function(sigToWasmTypes(sig),func)}var typeSectionBody=[1];generateFuncType(sig,typeSectionBody);var bytes=[0,97,115,109,1,0,0,0,1];uleb128Encode(typeSectionBody.length,bytes);bytes.push(...typeSectionBody);bytes.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var module=new WebAssembly.Module(new Uint8Array(bytes));var instance=new WebAssembly.Instance(module,{e:{f:func}});var wrappedFunc=instance.exports["f"];return wrappedFunc};var wasmTable;var getWasmTableEntry=funcPtr=>wasmTable.get(funcPtr);var updateTableMap=(offset,count)=>{if(functionsInTableMap){for(var i=offset;i<offset+count;i++){var item=getWasmTableEntry(i);if(item){functionsInTableMap.set(item,i)}}}};var functionsInTableMap;var getFunctionAddress=func=>{if(!functionsInTableMap){functionsInTableMap=new WeakMap;updateTableMap(0,wasmTable.length)}return functionsInTableMap.get(func)||0};var freeTableIndexes=[];var getEmptyTableSlot=()=>{if(freeTableIndexes.length){return freeTableIndexes.pop()}try{wasmTable.grow(1)}catch(err){if(!(err instanceof RangeError)){throw err}throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return wasmTable.length-1};var setWasmTableEntry=(idx,func)=>wasmTable.set(idx,func);var addFunction=(func,sig)=>{var rtn=getFunctionAddress(func);if(rtn){return rtn}var ret=getEmptyTableSlot();try{setWasmTableEntry(ret,func)}catch(err){if(!(err instanceof TypeError)){throw err}var wrapped=convertJsFunctionToWasm(func,sig);setWasmTableEntry(ret,wrapped)}functionsInTableMap.set(func,ret);return ret};var wasmImports={_abort_js:__abort_js,_emscripten_runtime_keepalive_clear:__emscripten_runtime_keepalive_clear,_setitimer_js:__setitimer_js,emscripten_resize_heap:_emscripten_resize_heap,proc_exit:_proc_exit};var wasmExports;createWasm();var ___wasm_call_ctors=()=>(___wasm_call_ctors=wasmExports["__wasm_call_ctors"])();var _hb_blob_create=Module["_hb_blob_create"]=(a0,a1,a2,a3,a4)=>(_hb_blob_create=Module["_hb_blob_create"]=wasmExports["hb_blob_create"])(a0,a1,a2,a3,a4);var _hb_blob_destroy=Module["_hb_blob_destroy"]=a0=>(_hb_blob_destroy=Module["_hb_blob_destroy"]=wasmExports["hb_blob_destroy"])(a0);var _free=Module["_free"]=a0=>(_free=Module["_free"]=wasmExports["free"])(a0);var _hb_blob_get_length=Module["_hb_blob_get_length"]=a0=>(_hb_blob_get_length=Module["_hb_blob_get_length"]=wasmExports["hb_blob_get_length"])(a0);var _hb_blob_get_data=Module["_hb_blob_get_data"]=(a0,a1)=>(_hb_blob_get_data=Module["_hb_blob_get_data"]=wasmExports["hb_blob_get_data"])(a0,a1);var _malloc=Module["_malloc"]=a0=>(_malloc=Module["_malloc"]=wasmExports["malloc"])(a0);var _hb_buffer_serialize_glyphs=Module["_hb_buffer_serialize_glyphs"]=(a0,a1,a2,a3,a4,a5,a6,a7,a8)=>(_hb_buffer_serialize_glyphs=Module["_hb_buffer_serialize_glyphs"]=wasmExports["hb_buffer_serialize_glyphs"])(a0,a1,a2,a3,a4,a5,a6,a7,a8);var _hb_buffer_create=Module["_hb_buffer_create"]=()=>(_hb_buffer_create=Module["_hb_buffer_create"]=wasmExports["hb_buffer_create"])();var _hb_buffer_destroy=Module["_hb_buffer_destroy"]=a0=>(_hb_buffer_destroy=Module["_hb_buffer_destroy"]=wasmExports["hb_buffer_destroy"])(a0);var _hb_buffer_get_content_type=Module["_hb_buffer_get_content_type"]=a0=>(_hb_buffer_get_content_type=Module["_hb_buffer_get_content_type"]=wasmExports["hb_buffer_get_content_type"])(a0);var _hb_buffer_set_direction=Module["_hb_buffer_set_direction"]=(a0,a1)=>(_hb_buffer_set_direction=Module["_hb_buffer_set_direction"]=wasmExports["hb_buffer_set_direction"])(a0,a1);var _hb_buffer_set_script=Module["_hb_buffer_set_script"]=(a0,a1)=>(_hb_buffer_set_script=Module["_hb_buffer_set_script"]=wasmExports["hb_buffer_set_script"])(a0,a1);var _hb_buffer_set_language=Module["_hb_buffer_set_language"]=(a0,a1)=>(_hb_buffer_set_language=Module["_hb_buffer_set_language"]=wasmExports["hb_buffer_set_language"])(a0,a1);var _hb_buffer_set_flags=Module["_hb_buffer_set_flags"]=(a0,a1)=>(_hb_buffer_set_flags=Module["_hb_buffer_set_flags"]=wasmExports["hb_buffer_set_flags"])(a0,a1);var _hb_buffer_set_cluster_level=Module["_hb_buffer_set_cluster_level"]=(a0,a1)=>(_hb_buffer_set_cluster_level=Module["_hb_buffer_set_cluster_level"]=wasmExports["hb_buffer_set_cluster_level"])(a0,a1);var _hb_buffer_get_length=Module["_hb_buffer_get_length"]=a0=>(_hb_buffer_get_length=Module["_hb_buffer_get_length"]=wasmExports["hb_buffer_get_length"])(a0);var _hb_buffer_get_glyph_infos=Module["_hb_buffer_get_glyph_infos"]=(a0,a1)=>(_hb_buffer_get_glyph_infos=Module["_hb_buffer_get_glyph_infos"]=wasmExports["hb_buffer_get_glyph_infos"])(a0,a1);var _hb_buffer_get_glyph_positions=Module["_hb_buffer_get_glyph_positions"]=(a0,a1)=>(_hb_buffer_get_glyph_positions=Module["_hb_buffer_get_glyph_positions"]=wasmExports["hb_buffer_get_glyph_positions"])(a0,a1);var _hb_glyph_info_get_glyph_flags=Module["_hb_glyph_info_get_glyph_flags"]=a0=>(_hb_glyph_info_get_glyph_flags=Module["_hb_glyph_info_get_glyph_flags"]=wasmExports["hb_glyph_info_get_glyph_flags"])(a0);var _hb_buffer_guess_segment_properties=Module["_hb_buffer_guess_segment_properties"]=a0=>(_hb_buffer_guess_segment_properties=Module["_hb_buffer_guess_segment_properties"]=wasmExports["hb_buffer_guess_segment_properties"])(a0);var _hb_buffer_add_utf8=Module["_hb_buffer_add_utf8"]=(a0,a1,a2,a3,a4)=>(_hb_buffer_add_utf8=Module["_hb_buffer_add_utf8"]=wasmExports["hb_buffer_add_utf8"])(a0,a1,a2,a3,a4);var _hb_buffer_add_utf16=Module["_hb_buffer_add_utf16"]=(a0,a1,a2,a3,a4)=>(_hb_buffer_add_utf16=Module["_hb_buffer_add_utf16"]=wasmExports["hb_buffer_add_utf16"])(a0,a1,a2,a3,a4);var _hb_buffer_set_message_func=Module["_hb_buffer_set_message_func"]=(a0,a1,a2,a3)=>(_hb_buffer_set_message_func=Module["_hb_buffer_set_message_func"]=wasmExports["hb_buffer_set_message_func"])(a0,a1,a2,a3);var _hb_language_from_string=Module["_hb_language_from_string"]=(a0,a1)=>(_hb_language_from_string=Module["_hb_language_from_string"]=wasmExports["hb_language_from_string"])(a0,a1);var _hb_script_from_string=Module["_hb_script_from_string"]=(a0,a1)=>(_hb_script_from_string=Module["_hb_script_from_string"]=wasmExports["hb_script_from_string"])(a0,a1);var _hb_version=Module["_hb_version"]=(a0,a1,a2)=>(_hb_version=Module["_hb_version"]=wasmExports["hb_version"])(a0,a1,a2);var _hb_version_string=Module["_hb_version_string"]=()=>(_hb_version_string=Module["_hb_version_string"]=wasmExports["hb_version_string"])();var _hb_feature_from_string=Module["_hb_feature_from_string"]=(a0,a1,a2)=>(_hb_feature_from_string=Module["_hb_feature_from_string"]=wasmExports["hb_feature_from_string"])(a0,a1,a2);var _hb_draw_funcs_set_move_to_func=Module["_hb_draw_funcs_set_move_to_func"]=(a0,a1,a2,a3)=>(_hb_draw_funcs_set_move_to_func=Module["_hb_draw_funcs_set_move_to_func"]=wasmExports["hb_draw_funcs_set_move_to_func"])(a0,a1,a2,a3);var _hb_draw_funcs_set_line_to_func=Module["_hb_draw_funcs_set_line_to_func"]=(a0,a1,a2,a3)=>(_hb_draw_funcs_set_line_to_func=Module["_hb_draw_funcs_set_line_to_func"]=wasmExports["hb_draw_funcs_set_line_to_func"])(a0,a1,a2,a3);var _hb_draw_funcs_set_quadratic_to_func=Module["_hb_draw_funcs_set_quadratic_to_func"]=(a0,a1,a2,a3)=>(_hb_draw_funcs_set_quadratic_to_func=Module["_hb_draw_funcs_set_quadratic_to_func"]=wasmExports["hb_draw_funcs_set_quadratic_to_func"])(a0,a1,a2,a3);var _hb_draw_funcs_set_cubic_to_func=Module["_hb_draw_funcs_set_cubic_to_func"]=(a0,a1,a2,a3)=>(_hb_draw_funcs_set_cubic_to_func=Module["_hb_draw_funcs_set_cubic_to_func"]=wasmExports["hb_draw_funcs_set_cubic_to_func"])(a0,a1,a2,a3);var _hb_draw_funcs_set_close_path_func=Module["_hb_draw_funcs_set_close_path_func"]=(a0,a1,a2,a3)=>(_hb_draw_funcs_set_close_path_func=Module["_hb_draw_funcs_set_close_path_func"]=wasmExports["hb_draw_funcs_set_close_path_func"])(a0,a1,a2,a3);var _hb_draw_funcs_create=Module["_hb_draw_funcs_create"]=()=>(_hb_draw_funcs_create=Module["_hb_draw_funcs_create"]=wasmExports["hb_draw_funcs_create"])();var _hb_face_create=Module["_hb_face_create"]=(a0,a1)=>(_hb_face_create=Module["_hb_face_create"]=wasmExports["hb_face_create"])(a0,a1);var _hb_face_destroy=Module["_hb_face_destroy"]=a0=>(_hb_face_destroy=Module["_hb_face_destroy"]=wasmExports["hb_face_destroy"])(a0);var _hb_face_reference_table=Module["_hb_face_reference_table"]=(a0,a1)=>(_hb_face_reference_table=Module["_hb_face_reference_table"]=wasmExports["hb_face_reference_table"])(a0,a1);var _hb_face_get_upem=Module["_hb_face_get_upem"]=a0=>(_hb_face_get_upem=Module["_hb_face_get_upem"]=wasmExports["hb_face_get_upem"])(a0);var _hb_face_collect_unicodes=Module["_hb_face_collect_unicodes"]=(a0,a1)=>(_hb_face_collect_unicodes=Module["_hb_face_collect_unicodes"]=wasmExports["hb_face_collect_unicodes"])(a0,a1);var _hb_font_draw_glyph=Module["_hb_font_draw_glyph"]=(a0,a1,a2,a3)=>(_hb_font_draw_glyph=Module["_hb_font_draw_glyph"]=wasmExports["hb_font_draw_glyph"])(a0,a1,a2,a3);var _hb_font_glyph_to_string=Module["_hb_font_glyph_to_string"]=(a0,a1,a2,a3)=>(_hb_font_glyph_to_string=Module["_hb_font_glyph_to_string"]=wasmExports["hb_font_glyph_to_string"])(a0,a1,a2,a3);var _hb_font_create=Module["_hb_font_create"]=a0=>(_hb_font_create=Module["_hb_font_create"]=wasmExports["hb_font_create"])(a0);var _hb_font_destroy=Module["_hb_font_destroy"]=a0=>(_hb_font_destroy=Module["_hb_font_destroy"]=wasmExports["hb_font_destroy"])(a0);var _hb_font_set_scale=Module["_hb_font_set_scale"]=(a0,a1,a2)=>(_hb_font_set_scale=Module["_hb_font_set_scale"]=wasmExports["hb_font_set_scale"])(a0,a1,a2);var _hb_font_set_variations=Module["_hb_font_set_variations"]=(a0,a1,a2)=>(_hb_font_set_variations=Module["_hb_font_set_variations"]=wasmExports["hb_font_set_variations"])(a0,a1,a2);var _hb_set_create=Module["_hb_set_create"]=()=>(_hb_set_create=Module["_hb_set_create"]=wasmExports["hb_set_create"])();var _hb_set_destroy=Module["_hb_set_destroy"]=a0=>(_hb_set_destroy=Module["_hb_set_destroy"]=wasmExports["hb_set_destroy"])(a0);var _hb_ot_var_get_axis_infos=Module["_hb_ot_var_get_axis_infos"]=(a0,a1,a2,a3)=>(_hb_ot_var_get_axis_infos=Module["_hb_ot_var_get_axis_infos"]=wasmExports["hb_ot_var_get_axis_infos"])(a0,a1,a2,a3);var _hb_set_get_population=Module["_hb_set_get_population"]=a0=>(_hb_set_get_population=Module["_hb_set_get_population"]=wasmExports["hb_set_get_population"])(a0);var _hb_set_next_many=Module["_hb_set_next_many"]=(a0,a1,a2,a3)=>(_hb_set_next_many=Module["_hb_set_next_many"]=wasmExports["hb_set_next_many"])(a0,a1,a2,a3);var _hb_shape=Module["_hb_shape"]=(a0,a1,a2,a3)=>(_hb_shape=Module["_hb_shape"]=wasmExports["hb_shape"])(a0,a1,a2,a3);var __emscripten_timeout=(a0,a1)=>(__emscripten_timeout=wasmExports["_emscripten_timeout"])(a0,a1);Module["wasmMemory"]=wasmMemory;Module["wasmExports"]=wasmExports;Module["addFunction"]=addFunction;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(){if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run();moduleRtn=readyPromise;
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
return moduleRtn;
|
|
13
13
|
}
|
|
14
14
|
);
|
|
15
15
|
})();
|
|
16
|
-
if (typeof exports === 'object' && typeof module === 'object')
|
|
16
|
+
if (typeof exports === 'object' && typeof module === 'object') {
|
|
17
17
|
module.exports = Module;
|
|
18
|
-
|
|
18
|
+
// This default export looks redundant, but it allows TS to import this
|
|
19
|
+
// commonjs style module.
|
|
20
|
+
module.exports.default = Module;
|
|
21
|
+
} else if (typeof define === 'function' && define['amd'])
|
|
19
22
|
define([], () => Module);
|
package/hb.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|
package/test/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const {expect} = require('chai');
|
|
3
|
+
const { expect } = require('chai');
|
|
4
4
|
let hb;
|
|
5
5
|
|
|
6
6
|
before(async function () {
|
|
@@ -36,8 +36,8 @@ describe('Face', function () {
|
|
|
36
36
|
this.blob = hb.createBlob(fs.readFileSync(path.join(__dirname, 'fonts/noto/NotoSansArabic-Variable.ttf')));
|
|
37
37
|
this.face = hb.createFace(this.blob);
|
|
38
38
|
expect(this.face.getAxisInfos()).to.deep.equal({
|
|
39
|
-
wght: {min: 100, default: 400, max: 900},
|
|
40
|
-
wdth: {min: 62.5, default: 100, max: 100}
|
|
39
|
+
wght: { min: 100, default: 400, max: 900 },
|
|
40
|
+
wdth: { min: 62.5, default: 100, max: 100 }
|
|
41
41
|
});
|
|
42
42
|
});
|
|
43
43
|
|
|
@@ -73,7 +73,7 @@ describe('Font', function () {
|
|
|
73
73
|
this.blob = hb.createBlob(fs.readFileSync(path.join(__dirname, 'fonts/noto/NotoSansArabic-Variable.ttf')));
|
|
74
74
|
this.face = hb.createFace(this.blob);
|
|
75
75
|
this.font = hb.createFont(this.face);
|
|
76
|
-
this.font.setVariations({'wght': 789});
|
|
76
|
+
this.font.setVariations({ 'wght': 789 });
|
|
77
77
|
this.buffer = hb.createBuffer();
|
|
78
78
|
this.buffer.addText('آلو');
|
|
79
79
|
this.buffer.guessSegmentProperties();
|
|
@@ -165,9 +165,9 @@ describe('shape', function () {
|
|
|
165
165
|
this.buffer.guessSegmentProperties();
|
|
166
166
|
hb.shape(this.font, this.buffer)
|
|
167
167
|
const glyphs = this.buffer.json();
|
|
168
|
-
expect(glyphs[0]).to.deep.equal({cl: 0, g: 68, ax: 561, ay: 0, dx: 0, dy: 0, flags: 0} /* a */);
|
|
169
|
-
expect(glyphs[1]).to.deep.equal({cl: 1, g: 69, ax: 615, ay: 0, dx: 0, dy: 0, flags: 0} /* b */);
|
|
170
|
-
expect(glyphs[2]).to.deep.equal({cl: 2, g: 70, ax: 480, ay: 0, dx: 0, dy: 0, flags: 0} /* c */);
|
|
168
|
+
expect(glyphs[0]).to.deep.equal({ cl: 0, g: 68, ax: 561, ay: 0, dx: 0, dy: 0, flags: 0 } /* a */);
|
|
169
|
+
expect(glyphs[1]).to.deep.equal({ cl: 1, g: 69, ax: 615, ay: 0, dx: 0, dy: 0, flags: 0 } /* b */);
|
|
170
|
+
expect(glyphs[2]).to.deep.equal({ cl: 2, g: 70, ax: 480, ay: 0, dx: 0, dy: 0, flags: 0 } /* c */);
|
|
171
171
|
});
|
|
172
172
|
|
|
173
173
|
it('shape Arabic string', function () {
|
|
@@ -179,10 +179,10 @@ describe('shape', function () {
|
|
|
179
179
|
this.buffer.guessSegmentProperties();
|
|
180
180
|
hb.shape(this.font, this.buffer)
|
|
181
181
|
const glyphs = this.buffer.json();
|
|
182
|
-
expect(glyphs[0]).to.deep.equal({cl: 3, g: 213, ax: 532, ay: 0, dx: 0, dy: 0, flags: 1} /* د */);
|
|
183
|
-
expect(glyphs[1]).to.deep.equal({cl: 2, g: 529, ax: 637, ay: 0, dx: 0, dy: 0, flags: 1} /* ج */);
|
|
184
|
-
expect(glyphs[2]).to.deep.equal({cl: 1, g: 101, ax: 269, ay: 0, dx: 0, dy: 0, flags: 0} /* ب */);
|
|
185
|
-
expect(glyphs[3]).to.deep.equal({cl: 0, g:
|
|
182
|
+
expect(glyphs[0]).to.deep.equal({ cl: 3, g: 213, ax: 532, ay: 0, dx: 0, dy: 0, flags: 1 } /* د */);
|
|
183
|
+
expect(glyphs[1]).to.deep.equal({ cl: 2, g: 529, ax: 637, ay: 0, dx: 0, dy: 0, flags: 1 } /* ج */);
|
|
184
|
+
expect(glyphs[2]).to.deep.equal({ cl: 1, g: 101, ax: 269, ay: 0, dx: 0, dy: 0, flags: 0 } /* ب */);
|
|
185
|
+
expect(glyphs[3]).to.deep.equal({ cl: 0, g: 50, ax: 235, ay: 0, dx: 0, dy: 0, flags: 0 } /* أ */);
|
|
186
186
|
});
|
|
187
187
|
|
|
188
188
|
it('shape with tracing', function () {
|
|
@@ -198,18 +198,18 @@ describe('shape', function () {
|
|
|
198
198
|
"m": "start table GSUB script tag 'latn'",
|
|
199
199
|
"glyphs": true,
|
|
200
200
|
"t": [
|
|
201
|
-
{cl: 0, g: 68},
|
|
202
|
-
{cl: 1, g: 69},
|
|
203
|
-
{cl: 2, g: 70},
|
|
201
|
+
{ cl: 0, g: 68 },
|
|
202
|
+
{ cl: 1, g: 69 },
|
|
203
|
+
{ cl: 2, g: 70 },
|
|
204
204
|
],
|
|
205
205
|
});
|
|
206
206
|
expect(result[41]).to.deep.equal({
|
|
207
207
|
"m": "end table GPOS script tag 'latn'",
|
|
208
208
|
"glyphs": true,
|
|
209
209
|
"t": [
|
|
210
|
-
{cl: 0, g: 68, ax: 561, ay: 0, dx: 0, dy: 0},
|
|
211
|
-
{cl: 1, g: 69, ax: 615, ay: 0, dx: 0, dy: 0},
|
|
212
|
-
{cl: 2, g: 70, ax: 480, ay: 0, dx: 0, dy: 0},
|
|
210
|
+
{ cl: 0, g: 68, ax: 561, ay: 0, dx: 0, dy: 0 },
|
|
211
|
+
{ cl: 1, g: 69, ax: 615, ay: 0, dx: 0, dy: 0 },
|
|
212
|
+
{ cl: 2, g: 70, ax: 480, ay: 0, dx: 0, dy: 0 },
|
|
213
213
|
],
|
|
214
214
|
});
|
|
215
215
|
});
|
|
@@ -227,25 +227,69 @@ describe('shape', function () {
|
|
|
227
227
|
"m": "start table GSUB script tag 'latn'",
|
|
228
228
|
"glyphs": true,
|
|
229
229
|
"t": [
|
|
230
|
-
{cl: 0, g: 73},
|
|
231
|
-
{cl: 1, g: 76},
|
|
232
|
-
{cl: 2, g: 3},
|
|
233
|
-
{cl: 3, g: 36},
|
|
234
|
-
{cl: 4, g: 57},
|
|
230
|
+
{ cl: 0, g: 73 },
|
|
231
|
+
{ cl: 1, g: 76 },
|
|
232
|
+
{ cl: 2, g: 3 },
|
|
233
|
+
{ cl: 3, g: 36 },
|
|
234
|
+
{ cl: 4, g: 57 },
|
|
235
235
|
],
|
|
236
236
|
});
|
|
237
237
|
expect(result[28]).to.deep.equal({
|
|
238
238
|
"m": "end table GPOS script tag 'latn'",
|
|
239
239
|
"glyphs": true,
|
|
240
240
|
"t": [
|
|
241
|
-
{cl: 0, g: 73, ax: 344, ay: 0, dx: 0, dy: 0},
|
|
242
|
-
{cl: 1, g: 76, ax: 258, ay: 0, dx: 0, dy: 0},
|
|
243
|
-
{cl: 2, g: 3, ax: 260, ay: 0, dx: 0, dy: 0},
|
|
244
|
-
{cl: 3, g: 36, ax: 639, ay: 0, dx: 0, dy: 0},
|
|
245
|
-
{cl: 4, g: 57, ax: 600, ay: 0, dx: 0, dy: 0},
|
|
241
|
+
{ cl: 0, g: 73, ax: 344, ay: 0, dx: 0, dy: 0 },
|
|
242
|
+
{ cl: 1, g: 76, ax: 258, ay: 0, dx: 0, dy: 0 },
|
|
243
|
+
{ cl: 2, g: 3, ax: 260, ay: 0, dx: 0, dy: 0 },
|
|
244
|
+
{ cl: 3, g: 36, ax: 639, ay: 0, dx: 0, dy: 0 },
|
|
245
|
+
{ cl: 4, g: 57, ax: 600, ay: 0, dx: 0, dy: 0 },
|
|
246
246
|
],
|
|
247
247
|
});
|
|
248
248
|
});
|
|
249
|
+
|
|
250
|
+
it('shape with 3-letter languae tag', function () {
|
|
251
|
+
this.blob = hb.createBlob(fs.readFileSync(path.join(__dirname, 'fonts/noto/NotoSansDevanagari-Regular.otf')));
|
|
252
|
+
this.face = hb.createFace(this.blob);
|
|
253
|
+
this.font = hb.createFont(this.face);
|
|
254
|
+
this.buffer = hb.createBuffer();
|
|
255
|
+
this.buffer.addText('५ल');
|
|
256
|
+
this.buffer.guessSegmentProperties();
|
|
257
|
+
hb.shape(this.font, this.buffer)
|
|
258
|
+
var glyphs = this.buffer.json();
|
|
259
|
+
expect(glyphs).to.have.lengthOf(2);
|
|
260
|
+
expect(glyphs[0].g).to.equal(118);
|
|
261
|
+
|
|
262
|
+
this.buffer = hb.createBuffer();
|
|
263
|
+
this.buffer.addText('५ल');
|
|
264
|
+
this.buffer.setLanguage('dty');
|
|
265
|
+
this.buffer.guessSegmentProperties();
|
|
266
|
+
hb.shape(this.font, this.buffer)
|
|
267
|
+
var glyphs = this.buffer.json();
|
|
268
|
+
expect(glyphs).to.have.lengthOf(2);
|
|
269
|
+
expect(glyphs[0].g).to.equal(123);
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
it('shape with OpenType language tag', function () {
|
|
273
|
+
this.blob = hb.createBlob(fs.readFileSync(path.join(__dirname, 'fonts/noto/NotoSansDevanagari-Regular.otf')));
|
|
274
|
+
this.face = hb.createFace(this.blob);
|
|
275
|
+
this.font = hb.createFont(this.face);
|
|
276
|
+
this.buffer = hb.createBuffer();
|
|
277
|
+
this.buffer.addText('५ल');
|
|
278
|
+
this.buffer.guessSegmentProperties();
|
|
279
|
+
hb.shape(this.font, this.buffer)
|
|
280
|
+
var glyphs = this.buffer.json();
|
|
281
|
+
expect(glyphs).to.have.lengthOf(2);
|
|
282
|
+
expect(glyphs[0].g).to.equal(118);
|
|
283
|
+
|
|
284
|
+
this.buffer = hb.createBuffer();
|
|
285
|
+
this.buffer.addText('५ल');
|
|
286
|
+
this.buffer.setLanguage('x-hbot-4e455020'); // 'NEP '
|
|
287
|
+
this.buffer.guessSegmentProperties();
|
|
288
|
+
hb.shape(this.font, this.buffer)
|
|
289
|
+
var glyphs = this.buffer.json();
|
|
290
|
+
expect(glyphs).to.have.lengthOf(2);
|
|
291
|
+
expect(glyphs[0].g).to.equal(123);
|
|
292
|
+
});
|
|
249
293
|
});
|
|
250
294
|
|
|
251
295
|
describe('misc', function () {
|
package/.vscode/settings.json
DELETED
package/perf.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
var fs = require('fs');
|
|
2
|
-
var path = require('path');
|
|
3
|
-
|
|
4
|
-
function example(hb, fontBlob, text) {
|
|
5
|
-
var blob = hb.createBlob(fontBlob);
|
|
6
|
-
var face = hb.createFace(blob, 0);
|
|
7
|
-
// console.log(face.getAxisInfos());
|
|
8
|
-
var font = hb.createFont(face);
|
|
9
|
-
// font.setVariations({ wdth: 200, wght: 700 });
|
|
10
|
-
font.setScale(1000, 1000); // Optional, if not given will be in font upem
|
|
11
|
-
|
|
12
|
-
var buffer = hb.createBuffer();
|
|
13
|
-
buffer.addText(text || 'abc');
|
|
14
|
-
buffer.guessSegmentProperties();
|
|
15
|
-
// buffer.setDirection('ltr'); // optional as can be set by guessSegmentProperties also
|
|
16
|
-
hb.shape(font, buffer); // features are not supported yet
|
|
17
|
-
var result = buffer.json(font);
|
|
18
|
-
|
|
19
|
-
// returns glyphs paths, totally optional
|
|
20
|
-
var glyphs = {};
|
|
21
|
-
result.forEach(function (x) {
|
|
22
|
-
if (glyphs[x.g]) return;
|
|
23
|
-
glyphs[x.g] = {
|
|
24
|
-
name: font.glyphName(x.g),
|
|
25
|
-
path: font.glyphToPath(x.g),
|
|
26
|
-
json: font.glyphToJson(x.g)
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
var unicodes = face.collectUnicodes()
|
|
31
|
-
|
|
32
|
-
buffer.destroy();
|
|
33
|
-
font.destroy();
|
|
34
|
-
face.destroy();
|
|
35
|
-
blob.destroy();
|
|
36
|
-
return { shape: result, glyphs: glyphs, unicodes: unicodes };
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
require('./').then(function (hb) {
|
|
40
|
-
var fontBlob = new Uint8Array(fs.readFileSync(path.resolve(__dirname, './test/fonts/noto/NotoSans-Regular.ttf')));
|
|
41
|
-
var blob = hb.createBlob(fontBlob);
|
|
42
|
-
var face = hb.createFace(blob, 0);
|
|
43
|
-
var font = hb.createFont(face);
|
|
44
|
-
|
|
45
|
-
/*
|
|
46
|
-
for (var i = 0; i < 100; i++) {
|
|
47
|
-
for (var g = 0; g < 4688; g++)
|
|
48
|
-
font.glyphToPath(g);
|
|
49
|
-
}
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
for (var i = 0; i < 100; i++) {
|
|
53
|
-
var buffer = hb.createBuffer();
|
|
54
|
-
buffer.addText('abc');
|
|
55
|
-
buffer.guessSegmentProperties();
|
|
56
|
-
var trace;
|
|
57
|
-
if (i < 50)
|
|
58
|
-
trace = hb.shapeWithTrace(font, buffer, "", i, 1);
|
|
59
|
-
else
|
|
60
|
-
trace = hb.shapeWithTrace(font, buffer, "", i - 50, 2);
|
|
61
|
-
//console.log(trace);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
//example(hb, new Uint8Array(fs.readFileSync(path.resolve(__dirname, './test/fonts/noto/NotoSans-Regular.ttf'))));
|
|
65
|
-
//example(hb, new Uint8Array(fs.readFileSync(path.resolve(__dirname, './test/fonts/noto/NotoSansArabic-Variable.ttf'))), "أبجد");
|
|
66
|
-
});
|