Socket
Socket
Sign inDemoInstall

opentype.js

Package Overview
Dependencies
0
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.7 to 0.4.8

new-inspector.html

2

bower.json
{
"name": "opentype.js",
"version": "0.4.7",
"version": "0.4.8",
"main": "dist/opentype.js",

@@ -5,0 +5,0 @@ "keywords": [

{
"name": "opentype.js",
"description": "OpenType font parser",
"version": "0.4.7",
"version": "0.4.8",
"author": {

@@ -6,0 +6,0 @@ "name": "Frederik De Bleser",

@@ -0,1 +1,5 @@

0.4.8 (June 3, 2015)
====================
* Fix an issue with writing out fonts that have an UPM != 1000.
0.4.6 (March 26, 2015)

@@ -2,0 +6,0 @@ ======================

@@ -1058,2 +1058,3 @@ // The `CFF` table contains the glyph outlines in PostScript format.

var fontScale = 1 / options.unitsPerEm;
// We use non-zero values for the offsets so that the DICT encodes them.

@@ -1067,2 +1068,3 @@ // This is important because the size of the Top DICT plays a role in offset calculation,

weight: options.weightName,
fontMatrix: [fontScale, 0, 0, fontScale, 0, 0],
charset: 999,

@@ -1069,0 +1071,0 @@ encoding: 0,

@@ -268,3 +268,4 @@ // The `sfnt` wrapper provides organization for the tables in the font.

weightName: font.styleName,
postScriptName: postScriptName
postScriptName: postScriptName,
unitsPerEm: font.unitsPerEm
});

@@ -271,0 +272,0 @@ // Order the tables according to the the OpenType specification 1.4.

@@ -179,2 +179,42 @@ // Data types used in the OpenType font file.

encode.REAL = function(v) {
var value = v.toString();
// Some numbers use an epsilon to encode the value. (e.g. JavaScript will store 0.0000001 as 1e-7)
// This code converts it back to a number without the epsilon.
var m = /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(value);
if (m) {
var epsilon = parseFloat('1e' + ((m[2] ? +m[2] : 0) + m[1].length));
value = (Math.round(v * epsilon) / epsilon).toString();
}
var nibbles = '';
var i;
var ii;
for (i = 0, ii = value.length; i < ii; i += 1) {
var c = value[i];
if (c === 'e') {
nibbles += value[++i] === '-' ? 'c' : 'b';
} else if (c === '.') {
nibbles += 'a';
} else if (c === '-') {
nibbles += 'e';
} else {
nibbles += c;
}
}
nibbles += (nibbles.length & 1) ? 'f' : 'ff';
var out = [30];
for (i = 0, ii = nibbles.length; i < ii; i += 2) {
out.push(parseInt(nibbles.substr(i, 2), 16));
}
return out;
};
sizeOf.REAL = function(v) {
return encode.REAL(v).length;
};
encode.NAME = encode.CHARARRAY;

@@ -290,5 +330,9 @@ sizeOf.NAME = sizeOf.CHARARRAY;

d = d.concat(encode.NUMBER32(v));
} else if (type === 'number') {
d = d.concat(encode.NUMBER(v));
} else if (type === 'real') {
d = d.concat(encode.REAL(v));
} else {
throw new Error('Unknown operand type ' + type);
// FIXME Add support for booleans
d = d.concat(encode.NUMBER(v));
}

@@ -295,0 +339,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc