Skip to content

Commit

Permalink
decodeWOFF2 a bit slicker
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorp committed Nov 7, 2024
1 parent 684b9bc commit 44543a1
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/samsa-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -3572,18 +3572,15 @@ class SamsaBuffer extends DataView {
.sort((a,b) => compareString(a.tag, b.tag)) // sort by tag
.forEach(table => outputBuf.u32_array = this.tableDirectoryEntry(table)); // write 4 U32s for the table directory entry

// write final file
const finalBufferU8 = new Uint8Array(outputBufU8.buffer, 0, finalLength);
const finalBuffer = new SamsaBuffer(outputBufU8.buffer, 0, finalLength);

// return the tables, if requested
if (options.tables !== undefined)
options.tables = tables;
if (options.tableDirectory !== undefined)
options.tableDirectory = tableDirectory;

// return the SamsaBuffer as either a Uint8Array or a SamsaBuffer, depending on options
return options.Uint8Array ? finalBufferU8 : finalBuffer;
return options.Uint8Array ? new Uint8Array(outputBufU8.buffer, 0, finalLength)
: new SamsaBuffer(outputBufU8.buffer, 0, finalLength);
}

// decode header of GSUB and GPOS table
Expand Down

0 comments on commit 44543a1

Please # to comment.