forked from enviPath/enviPy
Current Dev State
This commit is contained in:
33
static/js/ketcher2/node_modules/ttf2eot/CHANGELOG.md
generated
vendored
Normal file
33
static/js/ketcher2/node_modules/ttf2eot/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
2.0.0 / 2016-03-06
|
||||
------------------
|
||||
|
||||
- Maintenance release.
|
||||
- Drop old nodes support.
|
||||
- Deps, CS update, tests.
|
||||
|
||||
|
||||
1.3.0 / 2013-11-02
|
||||
------------------
|
||||
|
||||
- API change: now lib takes Array/Uint8Array as TTF data,
|
||||
and return ByteBuffer object. ByteBuffer.buffer contains
|
||||
Array/Uint8Array with EOT file.
|
||||
- Removed `Buffer` dependency, should work in browser too.
|
||||
|
||||
|
||||
1.2.0 / 2013-04-21
|
||||
------------------
|
||||
|
||||
- Separated CLI to make script useable as library (node.js package)
|
||||
|
||||
|
||||
0.1.1 / 2013-04-05
|
||||
------------------
|
||||
|
||||
- Fixed compatibility with original CLI params format
|
||||
|
||||
0.1.0 / 2013-04-04
|
||||
------------------
|
||||
|
||||
- First release.
|
||||
|
||||
22
static/js/ketcher2/node_modules/ttf2eot/LICENSE
generated
vendored
Normal file
22
static/js/ketcher2/node_modules/ttf2eot/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (C) 2013-2016 by Vitaly Puzrin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
54
static/js/ketcher2/node_modules/ttf2eot/README.md
generated
vendored
Normal file
54
static/js/ketcher2/node_modules/ttf2eot/README.md
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
ttf2eot
|
||||
=======
|
||||
|
||||
ttf2eot converts TTF fonts to EOT format. That can be useful for different
|
||||
webfont generation tools.
|
||||
|
||||
This is node.js port of [ttf2eot](http://code.google.com/p/ttf2eot/).
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Install:
|
||||
|
||||
``` bash
|
||||
npm install -g ttf2eot
|
||||
```
|
||||
|
||||
Usage example:
|
||||
|
||||
``` bash
|
||||
ttf2eot fontello.ttf fontello.eot
|
||||
```
|
||||
|
||||
Or:
|
||||
|
||||
``` bash
|
||||
ttf2eot < fontello.ttf > fontello.eot
|
||||
```
|
||||
|
||||
|
||||
Possible problems
|
||||
-----------------
|
||||
|
||||
Due to bug in IE, font `FullName` __MUST__ begin with `FamilyName`. For example,
|
||||
if `FamilyName` is `fontello`, then `FullName` should be `fontello regular` and
|
||||
so on.
|
||||
|
||||
In this condition is not satisfyed, then font will not be shown in IE.
|
||||
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
* Viktor Semykin <thesame.ml@gmail.com>
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Copyright (c) 2013-2016 [Vitaly Puzrin](https://github.com/puzrin).
|
||||
Released under the MIT license. See
|
||||
[LICENSE](https://github.com/nodeca/ttf2eot/blob/master/LICENSE) for details.
|
||||
|
||||
239
static/js/ketcher2/node_modules/ttf2eot/index.js
generated
vendored
Normal file
239
static/js/ketcher2/node_modules/ttf2eot/index.js
generated
vendored
Normal file
@ -0,0 +1,239 @@
|
||||
/*
|
||||
Author: Viktor Semykin <thesame.ml@gmail.com>
|
||||
|
||||
Written for fontello.com project.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var ByteBuffer = require('microbuffer');
|
||||
|
||||
/**
|
||||
* Offsets in EOT file structure. Refer to EOTPrefix in OpenTypeUtilities.cpp
|
||||
*/
|
||||
var EOT_OFFSET = {
|
||||
LENGTH: 0,
|
||||
FONT_LENGTH: 4,
|
||||
VERSION: 8,
|
||||
CHARSET: 26,
|
||||
MAGIC: 34,
|
||||
FONT_PANOSE: 16,
|
||||
ITALIC: 27,
|
||||
WEIGHT: 28,
|
||||
UNICODE_RANGE: 36,
|
||||
CODEPAGE_RANGE: 52,
|
||||
CHECKSUM_ADJUSTMENT: 60
|
||||
};
|
||||
|
||||
/**
|
||||
* Offsets in different SFNT (TTF) structures. See OpenTypeUtilities.cpp
|
||||
*/
|
||||
var SFNT_OFFSET = {
|
||||
// sfntHeader:
|
||||
NUMTABLES: 4,
|
||||
|
||||
// TableDirectoryEntry
|
||||
TABLE_TAG: 0,
|
||||
TABLE_OFFSET: 8,
|
||||
TABLE_LENGTH: 12,
|
||||
|
||||
// OS2Table
|
||||
OS2_WEIGHT: 4,
|
||||
OS2_FONT_PANOSE: 32,
|
||||
OS2_UNICODE_RANGE: 42,
|
||||
OS2_FS_SELECTION: 62,
|
||||
OS2_CODEPAGE_RANGE: 78,
|
||||
|
||||
// headTable
|
||||
HEAD_CHECKSUM_ADJUSTMENT: 8,
|
||||
|
||||
// nameTable
|
||||
NAMETABLE_FORMAT: 0,
|
||||
NAMETABLE_COUNT: 2,
|
||||
NAMETABLE_STRING_OFFSET: 4,
|
||||
|
||||
// nameRecord
|
||||
NAME_PLATFORM_ID: 0,
|
||||
NAME_ENCODING_ID: 2,
|
||||
NAME_LANGUAGE_ID: 4,
|
||||
NAME_NAME_ID: 6,
|
||||
NAME_LENGTH: 8,
|
||||
NAME_OFFSET: 10
|
||||
};
|
||||
|
||||
/**
|
||||
* Sizes of structures
|
||||
*/
|
||||
var SIZEOF = {
|
||||
SFNT_TABLE_ENTRY: 16,
|
||||
SFNT_HEADER: 12,
|
||||
SFNT_NAMETABLE: 6,
|
||||
SFNT_NAMETABLE_ENTRY: 12,
|
||||
EOT_PREFIX: 82
|
||||
};
|
||||
|
||||
/**
|
||||
* Magic numbers
|
||||
*/
|
||||
var MAGIC = {
|
||||
EOT_VERSION: 0x00020001,
|
||||
EOT_MAGIC: 0x504c,
|
||||
EOT_CHARSET: 1,
|
||||
LANGUAGE_ENGLISH: 0x0409
|
||||
};
|
||||
|
||||
/**
|
||||
* Utility function to convert buffer of utf16be chars to buffer of utf16le
|
||||
* chars prefixed with length and suffixed with zero
|
||||
*/
|
||||
function strbuf(str) {
|
||||
var b = new ByteBuffer(str.length + 4);
|
||||
|
||||
b.setUint16 (0, str.length, true);
|
||||
|
||||
for (var i = 0; i < str.length; i += 2) {
|
||||
b.setUint16 (i + 2, str.getUint16 (i), true);
|
||||
}
|
||||
|
||||
b.setUint16 (b.length - 2, 0, true);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
// Takes TTF font on input and returns ByteBuffer with EOT font
|
||||
//
|
||||
// Params:
|
||||
//
|
||||
// - arr(Array|Uint8Array)
|
||||
//
|
||||
function ttf2eot(arr) {
|
||||
var buf = new ByteBuffer(arr);
|
||||
var out = new ByteBuffer(SIZEOF.EOT_PREFIX),
|
||||
i, j;
|
||||
|
||||
out.fill(0);
|
||||
out.setUint32(EOT_OFFSET.FONT_LENGTH, buf.length, true);
|
||||
out.setUint32(EOT_OFFSET.VERSION, MAGIC.EOT_VERSION, true);
|
||||
out.setUint8(EOT_OFFSET.CHARSET, MAGIC.EOT_CHARSET);
|
||||
out.setUint16(EOT_OFFSET.MAGIC, MAGIC.EOT_MAGIC, true);
|
||||
|
||||
var familyName = [],
|
||||
subfamilyName = [],
|
||||
fullName = [],
|
||||
versionString = [];
|
||||
|
||||
var haveOS2 = false,
|
||||
haveName = false,
|
||||
haveHead = false;
|
||||
|
||||
var numTables = buf.getUint16 (SFNT_OFFSET.NUMTABLES);
|
||||
|
||||
for (i = 0; i < numTables; ++i) {
|
||||
var data = new ByteBuffer(buf, SIZEOF.SFNT_HEADER + i * SIZEOF.SFNT_TABLE_ENTRY);
|
||||
var tableEntry = {
|
||||
tag: data.toString (SFNT_OFFSET.TABLE_TAG, 4),
|
||||
offset: data.getUint32 (SFNT_OFFSET.TABLE_OFFSET),
|
||||
length: data.getUint32 (SFNT_OFFSET.TABLE_LENGTH)
|
||||
};
|
||||
|
||||
var table = new ByteBuffer(buf, tableEntry.offset, tableEntry.length);
|
||||
|
||||
if (tableEntry.tag === 'OS/2') {
|
||||
haveOS2 = true;
|
||||
|
||||
for (j = 0; j < 10; ++j) {
|
||||
out.setUint8 (EOT_OFFSET.FONT_PANOSE + j, table.getUint8 (SFNT_OFFSET.OS2_FONT_PANOSE + j));
|
||||
}
|
||||
|
||||
/*jshint bitwise:false */
|
||||
out.setUint8 (EOT_OFFSET.ITALIC, table.getUint16 (SFNT_OFFSET.OS2_FS_SELECTION) & 0x01);
|
||||
out.setUint32 (EOT_OFFSET.WEIGHT, table.getUint16 (SFNT_OFFSET.OS2_WEIGHT), true);
|
||||
|
||||
for (j = 0; j < 4; ++j) {
|
||||
out.setUint32 (EOT_OFFSET.UNICODE_RANGE + j * 4, table.getUint32 (SFNT_OFFSET.OS2_UNICODE_RANGE + j * 4), true);
|
||||
}
|
||||
|
||||
for (j = 0; j < 2; ++j) {
|
||||
out.setUint32 (EOT_OFFSET.CODEPAGE_RANGE + j * 4, table.getUint32 (SFNT_OFFSET.OS2_CODEPAGE_RANGE + j * 4), true);
|
||||
}
|
||||
|
||||
} else if (tableEntry.tag === 'head') {
|
||||
|
||||
haveHead = true;
|
||||
out.setUint32 (EOT_OFFSET.CHECKSUM_ADJUSTMENT, table.getUint32 (SFNT_OFFSET.HEAD_CHECKSUM_ADJUSTMENT), true);
|
||||
|
||||
} else if (tableEntry.tag === 'name') {
|
||||
|
||||
haveName = true;
|
||||
|
||||
var nameTable = {
|
||||
format: table.getUint16 (SFNT_OFFSET.NAMETABLE_FORMAT),
|
||||
count: table.getUint16 (SFNT_OFFSET.NAMETABLE_COUNT),
|
||||
stringOffset: table.getUint16 (SFNT_OFFSET.NAMETABLE_STRING_OFFSET)
|
||||
};
|
||||
|
||||
for (j = 0; j < nameTable.count; ++j) {
|
||||
var nameRecord = new ByteBuffer(table, SIZEOF.SFNT_NAMETABLE + j * SIZEOF.SFNT_NAMETABLE_ENTRY);
|
||||
var name = {
|
||||
platformID: nameRecord.getUint16 (SFNT_OFFSET.NAME_PLATFORM_ID),
|
||||
encodingID: nameRecord.getUint16 (SFNT_OFFSET.NAME_ENCODING_ID),
|
||||
languageID: nameRecord.getUint16 (SFNT_OFFSET.NAME_LANGUAGE_ID),
|
||||
nameID: nameRecord.getUint16 (SFNT_OFFSET.NAME_NAME_ID),
|
||||
length: nameRecord.getUint16 (SFNT_OFFSET.NAME_LENGTH),
|
||||
offset: nameRecord.getUint16 (SFNT_OFFSET.NAME_OFFSET)
|
||||
};
|
||||
|
||||
if (name.platformID === 3 && name.encodingID === 1 && name.languageID === MAGIC.LANGUAGE_ENGLISH) {
|
||||
var s = strbuf (new ByteBuffer(table, nameTable.stringOffset + name.offset, name.length));
|
||||
|
||||
switch (name.nameID) {
|
||||
case 1:
|
||||
familyName = s;
|
||||
break;
|
||||
case 2:
|
||||
subfamilyName = s;
|
||||
break;
|
||||
case 4:
|
||||
fullName = s;
|
||||
break;
|
||||
case 5:
|
||||
versionString = s;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (haveOS2 && haveName && haveHead) { break; }
|
||||
}
|
||||
|
||||
if (!(haveOS2 && haveName && haveHead)) {
|
||||
throw new Error ('Required section not found');
|
||||
}
|
||||
|
||||
// Calculate final length
|
||||
var len =
|
||||
out.length +
|
||||
familyName.length +
|
||||
subfamilyName.length +
|
||||
versionString.length +
|
||||
fullName.length +
|
||||
2 +
|
||||
buf.length;
|
||||
|
||||
// Create final buffer with the the same array type as input one.
|
||||
var eot = new ByteBuffer(len);
|
||||
|
||||
eot.writeBytes(out.buffer);
|
||||
eot.writeBytes(familyName.buffer);
|
||||
eot.writeBytes(subfamilyName.buffer);
|
||||
eot.writeBytes(versionString.buffer);
|
||||
eot.writeBytes(fullName.buffer);
|
||||
eot.writeBytes([ 0, 0 ]);
|
||||
eot.writeBytes(buf.buffer);
|
||||
|
||||
eot.setUint32(EOT_OFFSET.LENGTH, len, true); // Calculate overall length
|
||||
|
||||
return eot;
|
||||
}
|
||||
|
||||
module.exports = ttf2eot;
|
||||
68
static/js/ketcher2/node_modules/ttf2eot/package.json
generated
vendored
Normal file
68
static/js/ketcher2/node_modules/ttf2eot/package.json
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"_from": "ttf2eot@^2.0.0",
|
||||
"_id": "ttf2eot@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-jmM3pYWr0WCKDISVirSDzmn2ZUs=",
|
||||
"_location": "/ttf2eot",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "ttf2eot@^2.0.0",
|
||||
"name": "ttf2eot",
|
||||
"escapedName": "ttf2eot",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gulp-ttf2eot"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ttf2eot/-/ttf2eot-2.0.0.tgz",
|
||||
"_shasum": "8e6337a585abd1608a0c84958ab483ce69f6654b",
|
||||
"_spec": "ttf2eot@^2.0.0",
|
||||
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/gulp-ttf2eot",
|
||||
"author": {
|
||||
"name": "Viktor Semykin",
|
||||
"email": "thesame.ml@gmail.com"
|
||||
},
|
||||
"bin": {
|
||||
"ttf2eot": "./ttf2eot.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/fontello/ttf2eot/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"argparse": "^1.0.6",
|
||||
"microbuffer": "^1.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Convert TTF font to EOT",
|
||||
"devDependencies": {
|
||||
"eslint": "^2.3.0",
|
||||
"mocha": "^2.4.5"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"ttf2eot.js"
|
||||
],
|
||||
"homepage": "https://github.com/fontello/ttf2eot#readme",
|
||||
"keywords": [
|
||||
"font",
|
||||
"ttf",
|
||||
"eot",
|
||||
"convertor"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "ttf2eot",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/fontello/ttf2eot.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "npm run lint && ./node_modules/.bin/mocha"
|
||||
},
|
||||
"version": "2.0.0"
|
||||
}
|
||||
65
static/js/ketcher2/node_modules/ttf2eot/ttf2eot.js
generated
vendored
Executable file
65
static/js/ketcher2/node_modules/ttf2eot/ttf2eot.js
generated
vendored
Executable file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env node
|
||||
/*
|
||||
Author: Viktor Semykin <thesame.ml@gmail.com>
|
||||
|
||||
Written for fontello.com project.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var ArgumentParser = require('argparse').ArgumentParser;
|
||||
|
||||
var ttf2eot = require('./index.js');
|
||||
|
||||
|
||||
var parser = new ArgumentParser ({
|
||||
version: require('./package.json').version,
|
||||
addHelp: true,
|
||||
description: 'TTF to EOT font converter'
|
||||
});
|
||||
|
||||
parser.addArgument (
|
||||
[ 'infile' ],
|
||||
{
|
||||
nargs: '?',
|
||||
help: 'Input file (stdin if not defined)'
|
||||
}
|
||||
);
|
||||
|
||||
parser.addArgument (
|
||||
[ 'outfile' ],
|
||||
{
|
||||
nargs: '?',
|
||||
help: 'Output file (stdout if not defined)'
|
||||
}
|
||||
);
|
||||
|
||||
/* eslint-disable no-console */
|
||||
|
||||
var args = parser.parseArgs();
|
||||
|
||||
var input, size;
|
||||
|
||||
try {
|
||||
if (args.infile) {
|
||||
input = fs.readFileSync(args.infile);
|
||||
} else {
|
||||
size = fs.fstatSync(process.stdin.fd).size;
|
||||
input = new Buffer(size);
|
||||
fs.readSync(process.stdin.fd, input, 0, size, 0);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Can't open input file (%s)", args.infile || 'stdin');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
var ttf = new Uint8Array(input);
|
||||
var eot = new Buffer(ttf2eot(ttf).buffer);
|
||||
|
||||
if (args.outfile) {
|
||||
fs.writeFileSync(args.outfile, eot);
|
||||
} else {
|
||||
process.stdout.write(eot);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user