[src/core/fonts.js] Replace some unnecessary Stream.getBytes(...)
calls with Stream.skip(...)
instead
There's a handful of cases in the code where the intention is simply to advance the `Stream` position, but rather than only doing that the code instead fetches the bytes in question (and without using the result for anything).
This commit is contained in:
parent
49f59eb627
commit
4fae1ac5c4
@ -1068,7 +1068,7 @@ var Font = (function FontClosure() {
|
|||||||
var version = stream.getUint16();
|
var version = stream.getUint16();
|
||||||
// TODO verify all OS/2 tables fields, but currently we validate only those
|
// TODO verify all OS/2 tables fields, but currently we validate only those
|
||||||
// that give us issues
|
// that give us issues
|
||||||
stream.getBytes(60); // skipping type, misc sizes, panose, unicode ranges
|
stream.skip(60); // skipping type, misc sizes, panose, unicode ranges
|
||||||
var selection = stream.getUint16();
|
var selection = stream.getUint16();
|
||||||
if (version < 4 && selection & 0x0300) {
|
if (version < 4 && selection & 0x0300) {
|
||||||
return false;
|
return false;
|
||||||
@ -1078,7 +1078,7 @@ var Font = (function FontClosure() {
|
|||||||
if (firstChar > lastChar) {
|
if (firstChar > lastChar) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
stream.getBytes(6); // skipping sTypoAscender/Descender/LineGap
|
stream.skip(6); // skipping sTypoAscender/Descender/LineGap
|
||||||
var usWinAscent = stream.getUint16();
|
var usWinAscent = stream.getUint16();
|
||||||
if (usWinAscent === 0) {
|
if (usWinAscent === 0) {
|
||||||
// makes font unreadable by windows
|
// makes font unreadable by windows
|
||||||
@ -1689,7 +1689,7 @@ var Font = (function FontClosure() {
|
|||||||
// re-creating the table in format 4 since the encoding
|
// re-creating the table in format 4 since the encoding
|
||||||
// might be changed
|
// might be changed
|
||||||
var segCount = file.getUint16() >> 1;
|
var segCount = file.getUint16() >> 1;
|
||||||
file.getBytes(6); // skipping range fields
|
file.skip(6); // skipping range fields
|
||||||
var segIndex,
|
var segIndex,
|
||||||
segments = [];
|
segments = [];
|
||||||
for (segIndex = 0; segIndex < segCount; segIndex++) {
|
for (segIndex = 0; segIndex < segCount; segIndex++) {
|
||||||
@ -2162,7 +2162,7 @@ var Font = (function FontClosure() {
|
|||||||
end = start + length;
|
end = start + length;
|
||||||
var version = font.getInt32();
|
var version = font.getInt32();
|
||||||
// skip rest to the tables
|
// skip rest to the tables
|
||||||
font.getBytes(28);
|
font.skip(28);
|
||||||
|
|
||||||
var glyphNames;
|
var glyphNames;
|
||||||
var valid = true;
|
var valid = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user