Add method for decompile font stream to uint8array

This commit is contained in:
Oleg Korshul
2023-09-26 22:46:21 +03:00
parent 66531a70d1
commit a0108fbe10
3 changed files with 11 additions and 1 deletions

View File

@ -68,6 +68,11 @@ AscFonts.CopyStreamToMemory = function(data, size)
return fontStreamPointer;
};
AscFonts.GetUint8ArrayFromPointer = function(pointer, size)
{
return new Uint8Array(Module["HEAP8"].buffer, pointer, size);
};
function CShapeString(size)
{
this.size = size;

View File

@ -54,6 +54,11 @@ AscFonts.CopyStreamToMemory = function(data, size)
return data;
};
AscFonts.GetUint8ArrayFromPointer = function(pointer, size)
{
return pointer;
};
function CShapeString(size)
{
this.size = size;

View File

@ -41,6 +41,7 @@ function onLoadFontsModule(window, undefined)
AscFonts.TT_INTERPRETER_VERSION_40 = 40;
AscFonts.CopyStreamToMemory = AscFonts["CopyStreamToMemory"];
AscFonts.GetUint8ArrayFromPointer = AscFonts["GetUint8ArrayFromPointer"];
AscFonts.AllocString2 = AscFonts["AllocString"];
AscFonts.AllocString = function(size)
@ -81,7 +82,6 @@ function onLoadFontsModule(window, undefined)
AscFonts.Hyphen_CheckDictionary = AscFonts["Hyphen_CheckDictionary"];
AscFonts.Hyphen_Word = AscFonts["Hyphen_Word"];
AscFonts.CreateNativeStreamByIndex = function(stream_index)
{
let stream = AscFonts.g_fonts_streams[stream_index];