Socket
Socket
Sign inDemoInstall

ttfjs

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ttfjs - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

test.ttf

6

lib/subset.js
var Subset = module.exports = function(font) {
this.font = font
this.font = font.clone()
this.subset = { '32': 32 }

@@ -100,2 +100,6 @@ this.mapping = { '32': 32 }

this.font.tables.name.embed(cmap.charMap)
}
Subset.prototype.save = function() {
return this.font.save()
}

@@ -12,2 +12,8 @@ var Struct = require('structjs')

Glyf.prototype.clone = function() {
var clone = new Glyf(this.loca)
clone.cache = this.cache
return clone
}
Glyf.prototype.embed = function(glyphs, mapping, old2new) {

@@ -14,0 +20,0 @@ var offsets = [], offset = 0

@@ -6,6 +6,12 @@ var Directory = require('./directory')

var self = this
this.buffer = buffer = buffer instanceof ArrayBuffer ? buffer : toArrayBuffer(buffer)
this.buffer = buffer instanceof TTFFont
? buffer.buffer
: buffer = buffer instanceof ArrayBuffer ? buffer : toArrayBuffer(buffer)
this.directory = new Directory()
this.directory.unpack(new DataView(buffer))
if (buffer instanceof TTFFont) {
this.directory = buffer.directory.clone()
} else {
this.directory = new Directory()
this.directory.unpack(new DataView(buffer))
}

@@ -22,2 +28,6 @@ var scalerType = this.directory.scalerType.toString(16)

if (!entry) return
if (buffer instanceof TTFFont) {
self.tables[name] = self.tables[table] = buffer.tables[table].clone()
return
}
var Table = require('./table/' + name)

@@ -120,4 +130,12 @@ , view = new DataView(buffer, entry.offset, entry.length)

TTFFont.TABLES = ['cmap', 'glyf', 'loca', 'hmtx', 'hhea', 'maxp', 'post', 'name', 'head', 'OS/2']
TTFFont.prototype.clone = function() {
var clone = new TTFFont(this)
clone.tables.glyf.view = this.tables.glyf.view
return clone
}
TTFFont.prototype.save = function() {
var self = this, tables = ['cmap', 'glyf', 'loca', 'hmtx', 'hhea', 'maxp', 'post', 'name', 'head', 'OS/2']
var self = this, tables = TTFFont.TABLES
for (var name in this.directory.entries) {

@@ -141,3 +159,3 @@ if (!!!~tables.indexOf(name)) delete this.directory.entries[name]

var view = new DataView(new ArrayBuffer(size + 1000))
var view = new DataView(new ArrayBuffer(size))

@@ -144,0 +162,0 @@ tables.forEach(function(name) {

2

package.json

@@ -7,3 +7,3 @@ {

},
"version": "0.1.1",
"version": "0.2.0",
"main": "./lib/ttf",

@@ -10,0 +10,0 @@ "homepage": "https://github.com/rkusa/ttfjs",

@@ -7,3 +7,3 @@ # ttfjs

{ "name": "ttfjs",
"version": "0.1.1" }
"version": "0.2.0" }
```

@@ -10,0 +10,0 @@

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