Don't create a DataView for the "CFF " TrueType table in readTableEntry

Given that the "CFF " table may be replaced completely, during font-parsing, it shouldn't make sense to read and/or modify it piecewise.
This commit is contained in:
Jonas Jenwald 2026-05-03 13:07:12 +02:00
parent b65eedc636
commit e5e82b9617

View File

@ -1519,6 +1519,12 @@ class Font {
data[8] = data[9] = data[10] = data[11] = 0;
data[17] |= 0x20; // Set font optimized for cleartype flag.
}
// The "CFF " table may be replaced completely, hence its data shouldn't
// need to be read and/or modified piecewise through a `DataView`.
const view =
tag === "CFF "
? null
: new DataView(data.buffer, data.byteOffset, data.byteLength);
return {
tag,
@ -1526,7 +1532,7 @@ class Font {
length,
offset,
data,
view: new DataView(data.buffer, data.byteOffset, data.byteLength),
view,
};
}