Current Dev State

This commit is contained in:
Tim Lorsbach
2025-06-23 20:13:54 +02:00
parent b4f9bb277d
commit ded50edaa2
22617 changed files with 4345095 additions and 174 deletions

21
static/js/ketcher2/node_modules/gulp-ttf2woff/LICENCE generated vendored Executable file
View File

@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2013 Nicolas Froidure, <http://insertafter.com/>
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.

View File

@ -0,0 +1,63 @@
# gulp-ttf2woff
> Create a WOFF font from a TTF one with [Gulp](http://gulpjs.com/).
[![NPM version](https://badge.fury.io/js/gulp-ttf2woff.svg)](https://npmjs.org/package/gulp-ttf2woff) [![Build status](https://secure.travis-ci.org/nfroidure/gulp-ttf2woff.svg)](https://travis-ci.org/nfroidure/gulp-ttf2woff) [![Dependency Status](https://david-dm.org/nfroidure/gulp-ttf2woff.svg)](https://david-dm.org/nfroidure/gulp-ttf2woff) [![devDependency Status](https://david-dm.org/nfroidure/gulp-ttf2woff/dev-status.svg)](https://david-dm.org/nfroidure/gulp-ttf2woff#info=devDependencies) [![Coverage Status](https://coveralls.io/repos/nfroidure/gulp-ttf2woff/badge.svg?branch=master)](https://coveralls.io/r/nfroidure/gulp-ttf2woff?branch=master) [![Code Climate](https://codeclimate.com/github/nfroidure/gulp-ttf2woff.svg)](https://codeclimate.com/github/nfroidure/gulp-ttf2woff)
## Usage
First, install `gulp-ttf2woff` as a development dependency:
```shell
npm install --save-dev gulp-ttf2woff
```
Then, add it to your `gulpfile.js`:
```javascript
var ttf2woff = require('gulp-ttf2woff');
gulp.task('ttf2woff', function(){
gulp.src(['fonts/*.ttf'])
.pipe(ttf2woff())
.pipe(gulp.dest('fonts/'));
});
```
## API
### ttf2woff(options)
#### options.ignoreExt
Type: `Boolean`
Default value: `false`
Set to true to also convert files that doesn't have the .ttf extension.
#### options.clone
Type: `Boolean`
Default value: `false`
Set to true to clone the file before converting him so that it will output the
original file too.
### Note
You may look after a full Gulp web font workflow, see
[gulp-iconfont](https://github.com/nfroidure/gulp-iconfont)
fot that matter.
## Stats
[![NPM](https://nodei.co/npm/gulp-ttf2woff.png?downloads=true&stars=true)](https://nodei.co/npm/gulp-ttf2woff/)
[![NPM](https://nodei.co/npm-dl/gulp-ttf2woff.png)](https://nodei.co/npm/gulp-ttf2woff/)
### Contributing / Issues
Please submit TTF to WOFF related issues to the
[ttf2woff project](https://github.com/fontello/ttf2woff)
on wich gulp-ttf2woff is built.
This repository issues is only for gulp and gulp tasks related issues.
You may want to contribute to this project, pull requests are welcome if you
accept to publish under the MIT licence.

View File

@ -0,0 +1,80 @@
{
"_from": "gulp-ttf2woff@^1.1.0",
"_id": "gulp-ttf2woff@1.1.1",
"_inBundle": false,
"_integrity": "sha1-4iym5xvZrRBXUWRPixx+O+Owhqw=",
"_location": "/gulp-ttf2woff",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "gulp-ttf2woff@^1.1.0",
"name": "gulp-ttf2woff",
"escapedName": "gulp-ttf2woff",
"rawSpec": "^1.1.0",
"saveSpec": null,
"fetchSpec": "^1.1.0"
},
"_requiredBy": [
"/gulp-iconfont"
],
"_resolved": "https://registry.npmjs.org/gulp-ttf2woff/-/gulp-ttf2woff-1.1.1.tgz",
"_shasum": "e22ca6e71bd9ad105751644f8b1c7e3be3b086ac",
"_spec": "gulp-ttf2woff@^1.1.0",
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/gulp-iconfont",
"author": {
"name": "Nicolas Froidure",
"url": "http://www.insertafter.com/blog.html"
},
"bugs": {
"url": "https://github.com/nfroidure/gulp-ttf2woff/issues"
},
"bundleDependencies": false,
"dependencies": {
"bufferstreams": "^1.0.2",
"gulp-util": "^3.0.6",
"readable-stream": "^2.0.1",
"ttf2woff": "^2.0.1"
},
"deprecated": false,
"description": "Create a WOFF font from a TTF one",
"devDependencies": {
"coveralls": "^2.11.2",
"gulp": "^3.9.0",
"istanbul": "^0.4.5",
"mocha": "^3.4.2",
"mocha-lcov-reporter": "^1.3.0",
"streamtest": "^1.2.1"
},
"engines": {
"node": ">= 0.10.0"
},
"homepage": "https://github.com/nfroidure/gulp-ttf2woff",
"keywords": [
"gulpplugin",
"gulp",
"gulp-plugin",
"font",
"woff",
"ttf",
"converter"
],
"licenses": [
{
"type": "MIT",
"url": "https://github.com/nfroidure/gulp-ttf2woff/blob/master/LICENSE"
}
],
"main": "src/index.js",
"name": "gulp-ttf2woff",
"repository": {
"type": "git",
"url": "git://github.com/nfroidure/gulp-ttf2woff.git"
},
"scripts": {
"cover": "./node_modules/istanbul/lib/cli.js cover --report html ./node_modules/mocha/bin/_mocha -- tests/*.mocha.js -R spec -t 5000",
"coveralls": "./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha --report lcovonly -- tests/*.mocha.js -R spec -t 5000 && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage",
"test": "mocha tests/*.mocha.js"
},
"version": "1.1.1"
}

View File

@ -0,0 +1,102 @@
'use strict';
var path = require('path');
var Stream = require('readable-stream');
var gutil = require('gulp-util');
var BufferStreams = require('bufferstreams');
var ttf2woff = require('ttf2woff');
var PLUGIN_NAME = 'gulp-ttf2woff';
// File level transform function
function ttf2woffTransform(opt) {
// Return a callback function handling the buffered content
return function(err, buf, cb) {
// Handle any error
if(err) {
cb(new gutil.PluginError(PLUGIN_NAME, err, {showStack: true}));
}
// Use the buffered content
try {
buf = new Buffer(ttf2woff(new Uint8Array(buf)).buffer);
cb(null, buf);
} catch(err2) {
cb(new gutil.PluginError(PLUGIN_NAME, err2, {showStack: true}));
}
};
}
// Plugin function
function ttf2woffGulp(options) {
options = options || {};
options.ignoreExt = options.ignoreExt || false;
options.clone = options.clone || false;
var stream = new Stream.Transform({objectMode: true});
stream._transform = function(file, unused, done) {
// When null just pass through
if(file.isNull()) {
stream.push(file); done();
return;
}
// If the ext doesn't match, pass it through
if((!options.ignoreExt) && '.ttf' !== path.extname(file.path)) {
stream.push(file); done();
return;
}
// Fix for the vinyl clone method...
// https://github.com/wearefractal/vinyl/pull/9
if(options.clone) {
if(file.isBuffer()) {
stream.push(file.clone());
} else {
var cntStream = file.contents;
file.contents = null;
var newFile = file.clone();
file.contents = cntStream.pipe(new Stream.PassThrough());
newFile.contents = cntStream.pipe(new Stream.PassThrough());
stream.push(newFile);
}
}
file.path = gutil.replaceExtension(file.path, ".woff");
// Buffers
if(file.isBuffer()) {
try {
file.contents = new Buffer(ttf2woff(
new Uint8Array(file.contents)
).buffer);
} catch(err) {
stream.emit('error', new gutil.PluginError(PLUGIN_NAME, err, {
showStack: true
}));
}
// Streams
} else {
file.contents = file.contents.pipe(new BufferStreams(ttf2woffTransform()));
}
stream.push(file);
done();
};
return stream;
}
// Export the file level transform function for other plugins usage
ttf2woffGulp.fileTransform = ttf2woffTransform;
// Export the plugin main function
module.exports = ttf2woffGulp;

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,166 @@
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var Stream = require('stream');
var fs = require('fs');
var assert = require('assert');
var StreamTest = require('streamtest');
var ttf2woff = require(__dirname + '/../src/index.js');
describe('gulp-ttf2woff conversion', function() {
var filename = __dirname + '/fixtures/iconsfont';
var woff = fs.readFileSync(filename + '.woff');
// Iterating through versions
StreamTest.versions.forEach(function(version) {
describe('for ' + version + ' streams', function() {
describe('with null contents', function() {
it('should let null files pass through', function(done) {
StreamTest[version].fromObjects([new gutil.File({
path: 'bibabelula.foo',
contents: null
})])
.pipe(ttf2woff())
.pipe(StreamTest[version].toObjects(function(err, objs) {
if(err) {
done(err);
}
assert.equal(objs.length, 1);
assert.equal(objs[0].path, 'bibabelula.foo');
assert.equal(objs[0].contents, null);
done();
}));
});
});
describe('in buffer mode', function() {
it('should work', function(done) {
gulp.src(filename + '.ttf', {buffer: true})
.pipe(ttf2woff())
// Uncomment to regenerate the test files if changes in the ttf2woff lib
// .pipe(gulp.dest(__dirname + '/fixtures/'))
.pipe(StreamTest[version].toObjects(function(err, objs) {
if(err) {
done(err);
}
assert.equal(objs.length, 1);
assert.equal(objs[0].path, filename + '.woff');
assert.equal(objs[0].contents.toString('utf-8'), woff.toString('utf-8'));
done();
}));
});
it('should work with the clone option', function(done) {
gulp.src(filename + '.ttf', {buffer: true})
.pipe(ttf2woff({clone: true}))
.pipe(StreamTest[version].toObjects(function(err, objs) {
if(err) {
done(err);
}
assert.equal(objs.length, 2);
assert.equal(objs[0].path, filename + '.ttf');
assert.equal(objs[0].contents.toString('utf-8'), fs.readFileSync(filename + '.ttf','utf-8'));
assert.equal(objs[1].path, filename + '.woff');
assert.equal(objs[1].contents.toString('utf-8'), woff.toString('utf-8'));
done();
}));
});
it('should let non-ttf files pass through', function(done) {
StreamTest[version].fromObjects([new gutil.File({
path: 'bibabelula.foo',
contents: new Buffer('ohyeah')
})])
.pipe(ttf2woff())
.pipe(StreamTest[version].toObjects(function(err, objs) {
assert.equal(objs.length, 1);
assert.equal(objs[0].path, 'bibabelula.foo');
assert.equal(objs[0].contents.toString('utf-8'), 'ohyeah');
done();
}));
});
});
describe('in stream mode', function() {
it('should work', function(done) {
gulp.src(filename + '.ttf', {buffer: false})
.pipe(ttf2woff())
.pipe(StreamTest[version].toObjects(function(err, objs) {
if(err) {
done(err);
}
assert.equal(objs.length, 1);
assert.equal(objs[0].path, filename + '.woff');
objs[0].contents.pipe(StreamTest[version].toText(function(err, text) {
assert.equal(text, woff.toString('utf-8'));
done();
}));
}));
});
it('should work with the clone option', function(done) {
gulp.src(filename + '.ttf', {buffer: false})
.pipe(ttf2woff({clone: true}))
.pipe(StreamTest[version].toObjects(function(err, objs) {
if(err) {
done(err);
}
assert.equal(objs.length, 2);
assert.equal(objs[0].path, filename + '.ttf');
assert.equal(objs[1].path, filename + '.woff');
objs[0].contents.pipe(StreamTest[version].toText(function(err, text) {
assert.equal(text, fs.readFileSync(filename + '.ttf','utf-8'));
objs[1].contents.pipe(StreamTest[version].toText(function(err, text) {
assert.equal(text, woff.toString('utf-8'));
done();
}));
}));
}));
});
it('should let non-ttf files pass through', function(done) {
StreamTest[version].fromObjects([new gutil.File({
path: 'bibabelula.foo',
contents: new Stream.PassThrough()
})])
.pipe(ttf2woff())
.pipe(StreamTest[version].toObjects(function(err, objs) {
if(err) {
done(err);
}
assert.equal(objs.length, 1);
assert.equal(objs[0].path, 'bibabelula.foo');
assert(objs[0].contents instanceof Stream.PassThrough);
done();
}));
});
});
});
});
});