new changes

This commit is contained in:
Niranjan
2026-04-07 05:05:28 +05:30
parent 7c070224bd
commit a18bba15f2
29975 changed files with 3247495 additions and 2761 deletions

View File

@@ -0,0 +1,39 @@
import { YError } from 'yerror';
import theTTFToWOFF2Module from './ttf2woff2.cjs';
export default function ttf2woff2(inputContent) {
// Prepare input
const inputBuffer = theTTFToWOFF2Module._malloc(inputContent.length + 1);
const outputSizePtr = theTTFToWOFF2Module._malloc(4);
let outputBufferPtr;
let outputSize;
let outputContent;
theTTFToWOFF2Module.writeArrayToMemory(inputContent, inputBuffer);
try {
// Run
outputBufferPtr = theTTFToWOFF2Module.convert(
inputBuffer,
inputContent.length,
outputSizePtr,
);
// Retrieve output
outputSize = theTTFToWOFF2Module.getValue(outputSizePtr, 'i32');
outputContent = Buffer.alloc(outputSize);
for (let i = 0; i < outputSize; i++) {
outputContent[i] = theTTFToWOFF2Module.getValue(outputBufferPtr + i, 'i8');
}
if (outputSize === 0) {
throw new YError('E_CONVERT_ERROR');
}
} finally {
theTTFToWOFF2Module.freePtrs(outputBufferPtr, outputSizePtr);
}
return outputContent;
};

View File

@@ -0,0 +1,8 @@
// This file need to be append to the build in order to work with browserify
// Shamelessly stolen here: https://github.com/fabiosantoscode/require-emscripten/blob/master/post-js.postjs
module.exports = Module;
// Do not recurse into module and waste all day
Module.inspect = function () {
return '[Module]';
};

File diff suppressed because one or more lines are too long

Binary file not shown.