mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-02 20:37:21 +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);
|
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) {
|
function setInt16(view, pos, val) {
|
||||||
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
if (typeof PDFJSDev === "undefined" || PDFJSDev.test("TESTING")) {
|
||||||
assert(
|
assert(
|
||||||
@ -3338,8 +3343,15 @@ class Font {
|
|||||||
// Maximum profile
|
// Maximum profile
|
||||||
builder.addTable(
|
builder.addTable(
|
||||||
"maxp",
|
"maxp",
|
||||||
"\x00\x00\x50\x00" + // Version number
|
(function fontTableMaxp() {
|
||||||
string16(numGlyphs) // Num of glyphs
|
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
|
// Naming tables
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user