mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-18 03:04:07 +02:00
Use a TypedArray when building the "maxp" TrueType table
This commit is contained in:
parent
aaaf143156
commit
0c789ecc97
@ -327,6 +327,11 @@ function safeString16(value) {
|
||||
return String.fromCharCode((value >> 8) & 0xff, value & 0xff);
|
||||
}
|
||||
|
||||
function setArray(data, pos, arr) {
|
||||
data.set(arr, pos);
|
||||
return pos + arr.length;
|
||||
}
|
||||
|
||||
function setInt16(view, pos, val) {
|
||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
||||
assert(
|
||||
@ -3338,8 +3343,15 @@ class Font {
|
||||
// Maximum profile
|
||||
builder.addTable(
|
||||
"maxp",
|
||||
"\x00\x00\x50\x00" + // Version number
|
||||
string16(numGlyphs) // Num of glyphs
|
||||
(function fontTableMaxp() {
|
||||
const data = new Uint8Array(6),
|
||||
view = new DataView(data.buffer);
|
||||
|
||||
setArray(data, 0, [0x00, 0x00, 0x50, 0x00]); // Version number
|
||||
setInt16(view, 4, numGlyphs); // Num of glyphs
|
||||
|
||||
return data;
|
||||
})()
|
||||
);
|
||||
|
||||
// Naming tables
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user