New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

font-toolkit

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

font-toolkit - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

7

dist/src/sfnt.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const table_1 = require("./table");

@@ -92,7 +91,5 @@ const types_1 = require("./types");

tables.forEach(t => {
const { tagName, offset, padding, length } = t.record;
const msg = `tagName: ${tagName} offset: ${offset} padding: ${padding} length: ${length} wbLength: ${wb.length}`;
console.log(msg);
assert.ok(t.record.offset === wb.length + t.record.padding);
wb.pushWriteGuard(t.size() + t.record.padding, `write table ` + t.record.tagName);
t.write2(wb);
wb.applyWriteGuard();
});

@@ -99,0 +96,0 @@ }

@@ -16,5 +16,6 @@ /// <reference types="node" />

cp: number;
gIdx: number;
gId: number;
glyph: Glyph;
gsub: Glyph[];
newId: number;
}

@@ -21,0 +22,0 @@ export declare class LookupResult {

@@ -100,7 +100,7 @@ "use strict";

const sid = table.lookup(cp);
if (result.allGlyphIds.includes(sid))
return;
result.allGlyphIds.push(sid);
if (!result.allGlyphIds.includes(sid)) {
result.allGlyphIds.push(sid);
}
const rcp = result.getCpInfo(cp, true);
rcp.gIdx = sid;
rcp.gId = sid;
rcp.glyph = glyf.readGlyphAt(sid, loca);

@@ -132,6 +132,14 @@ });

let gsub = [];
const cpNewId = {};
result.cps.forEach(cp => {
const info = result.cpInfos[cp];
allGlyphs.push(info.glyph);
gsub = gsub.concat(info.gsub);
if (cpNewId[info.gId] === undefined) {
cpNewId[info.gId] = allGlyphs.length;
info.newId = allGlyphs.length;
allGlyphs.push(info.glyph);
gsub = gsub.concat(info.gsub);
}
else {
info.newId = cpNewId[info.gId];
}
});

@@ -138,0 +146,0 @@ allGlyphs = allGlyphs.concat(gsub);

@@ -73,3 +73,3 @@ "use strict";

cmap.numTables = 1;
const cpGidMap = lookupResult.cps.map((cp, i) => ({ cp, gId: i }));
const cpGidMap = lookupResult.cps.map(cp => ({ cp, gId: lookupResult.cpInfos[cp].newId }));
const subTable = table_1.SubTableF4.pack(cpGidMap);

@@ -139,3 +139,3 @@ subTable.encoding = new table_1.EncodingRecord();

lookupResult.allGlyphIds.forEach(id => {
const name = post.getNameV20(id);
const name = this._post.getNameV20(id);
if (typeof name === "number") {

@@ -145,3 +145,3 @@ post.glyphNameIndex.push(name);

else {
post.glyphNameIndex.push(258 + id);
post.glyphNameIndex.push(258 + post.names.length);
post.names.push(name);

@@ -148,0 +148,0 @@ }

@@ -5,2 +5,3 @@ /// <reference types="node" />

export declare class WriteGuard {
title?: string;
begin: number;

@@ -31,4 +32,4 @@ end: number;

writeInt64(n: bigInt.BigInteger): void;
pushWriteGuard(match: number): void;
pushWriteGuard(match: number, title?: string): void;
applyWriteGuard(): void;
}

@@ -90,6 +90,7 @@ "use strict";

}
pushWriteGuard(match) {
pushWriteGuard(match, title) {
const g = new WriteGuard();
g.begin = this._len;
g.match = match;
g.title = title;
this._writeGuards.push(g);

@@ -102,3 +103,4 @@ }

g.end = this._len;
assert.ok(g.isMatch(), `guard not match except ${g.match} got ${g.actual}`);
const title = g.title || "no-title";
assert.ok(g.isMatch(), `[${title}] guard not match, except ${g.match}, got ${g.actual}`);
}

@@ -105,0 +107,0 @@ }

{
"name": "font-toolkit",
"version": "0.0.3",
"version": "0.0.4",
"description": "Slicing and converting fonts.",

@@ -5,0 +5,0 @@ "main": "dist/src/index.js",

@@ -129,9 +129,5 @@ import * as assert from "assert";

tables.forEach(t => {
const { tagName, offset, padding, length } = t.record;
const msg = `tagName: ${tagName} offset: ${offset} padding: ${padding} length: ${length} wbLength: ${
wb.length
}`;
console.log(msg);
assert.ok(t.record.offset === wb.length + t.record.padding);
wb.pushWriteGuard(t.size() + t.record.padding, `write table ` + t.record.tagName);
t.write2(wb);
wb.applyWriteGuard();
});

@@ -138,0 +134,0 @@ }

@@ -0,1 +1,2 @@

import * as assert from "assert";
import {

@@ -32,5 +33,6 @@ int16,

cp: number;
gIdx: number;
gId: number;
glyph: Glyph;
gsub: Glyph[] = [];
newId: number;
}

@@ -127,7 +129,7 @@

const sid = table!.lookup(cp);
if (result.allGlyphIds.includes(sid)) return;
result.allGlyphIds.push(sid);
if (!result.allGlyphIds.includes(sid)) {
result.allGlyphIds.push(sid);
}
const rcp = result.getCpInfo(cp, true);
rcp.gIdx = sid;
rcp.gId = sid;
rcp.glyph = glyf.readGlyphAt(sid, loca);

@@ -160,6 +162,13 @@ });

let gsub: Glyph[] = [];
const cpNewId: { [k: number]: number } = {};
result.cps.forEach(cp => {
const info = result.cpInfos[cp];
allGlyphs.push(info.glyph);
gsub = gsub.concat(info.gsub);
if (cpNewId[info.gId] === undefined) {
cpNewId[info.gId] = allGlyphs.length;
info.newId = allGlyphs.length;
allGlyphs.push(info.glyph);
gsub = gsub.concat(info.gsub);
} else {
info.newId = cpNewId[info.gId];
}
});

@@ -166,0 +175,0 @@ allGlyphs = allGlyphs.concat(gsub);

@@ -118,3 +118,3 @@ import * as assert from "assert";

cmap.numTables = 1;
const cpGidMap = lookupResult.cps.map((cp, i) => ({ cp, gId: i }));
const cpGidMap = lookupResult.cps.map(cp => ({ cp, gId: lookupResult.cpInfos[cp].newId }));
const subTable = SubTableF4.pack(cpGidMap);

@@ -189,7 +189,7 @@ subTable.encoding = new EncodingRecord();

lookupResult.allGlyphIds.forEach(id => {
const name = post.getNameV20(id);
const name = this._post.getNameV20(id);
if (typeof name === "number") {
post.glyphNameIndex.push(name);
} else {
post.glyphNameIndex.push(258 + id);
post.glyphNameIndex.push(258 + post.names.length);
post.names.push(name);

@@ -196,0 +196,0 @@ }

@@ -17,2 +17,4 @@ import * as assert from "assert";

export class WriteGuard {
title?: string;
begin: number = 0;

@@ -122,6 +124,7 @@ end: number = 0;

pushWriteGuard(match: number) {
pushWriteGuard(match: number, title?: string) {
const g = new WriteGuard();
g.begin = this._len;
g.match = match;
g.title = title;
this._writeGuards.push(g);

@@ -134,4 +137,5 @@ }

g.end = this._len;
assert.ok(g.isMatch(), `guard not match except ${g.match} got ${g.actual}`);
const title = g.title || "no-title";
assert.ok(g.isMatch(), `[${title}] guard not match, except ${g.match}, got ${g.actual}`);
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc