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-ttf2woff2/LICENCE generated vendored Executable file
View File

@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2015 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-ttf2woff2
> Create a WOFF2 font from a TTF font with [Gulp](http://gulpjs.com/).
[![NPM version](https://badge.fury.io/js/gulp-ttf2woff2.svg)](https://npmjs.org/package/gulp-ttf2woff2) [![Build status](https://secure.travis-ci.org/nfroidure/gulp-ttf2woff2.svg)](https://travis-ci.org/nfroidure/gulp-ttf2woff2) [![Dependency Status](https://david-dm.org/nfroidure/gulp-ttf2woff2.svg)](https://david-dm.org/nfroidure/gulp-ttf2woff2) [![devDependency Status](https://david-dm.org/nfroidure/gulp-ttf2woff2/dev-status.svg)](https://david-dm.org/nfroidure/gulp-ttf2woff2#info=devDependencies) [![Coverage Status](https://coveralls.io/repos/nfroidure/gulp-ttf2woff2/badge.svg?branch=master)](https://coveralls.io/r/nfroidure/gulp-ttf2woff2?branch=master) [![Code Climate](https://codeclimate.com/github/nfroidure/gulp-ttf2woff2.svg)](https://codeclimate.com/github/nfroidure/gulp-ttf2woff2)
## Usage
First, install `gulp-ttf2woff2` as a development dependency:
```shell
npm install --save-dev gulp-ttf2woff2
```
Then, add it to your `gulpfile.js`:
```javascript
var ttf2woff2 = require('gulp-ttf2woff2');
gulp.task('ttf2woff2', function(){
gulp.src(['fonts/*.ttf'])
.pipe(ttf2woff2())
.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-ttf2woff2.png?downloads=true&stars=true)](https://nodei.co/npm/gulp-ttf2woff2/)
[![NPM](https://nodei.co/npm-dl/gulp-ttf2woff2.png)](https://nodei.co/npm/gulp-ttf2woff2/)
### Contributing / Issues
Please submit TTF to WOFF2 related issues to the
[ttf2woff2 project](https://github.com/nfroidure/ttf2woff2)
on wich gulp-ttf2woff2 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-ttf2woff2@^2.0.2",
"_id": "gulp-ttf2woff2@2.0.2",
"_inBundle": false,
"_integrity": "sha1-8QGxUg8jaqZ2fsRb9HVByxWe6zI=",
"_location": "/gulp-ttf2woff2",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "gulp-ttf2woff2@^2.0.2",
"name": "gulp-ttf2woff2",
"escapedName": "gulp-ttf2woff2",
"rawSpec": "^2.0.2",
"saveSpec": null,
"fetchSpec": "^2.0.2"
},
"_requiredBy": [
"/gulp-iconfont"
],
"_resolved": "https://registry.npmjs.org/gulp-ttf2woff2/-/gulp-ttf2woff2-2.0.2.tgz",
"_shasum": "f101b1520f236aa6767ec45bf47541cb159eeb32",
"_spec": "gulp-ttf2woff2@^2.0.2",
"_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-ttf2woff2/issues"
},
"bundleDependencies": false,
"dependencies": {
"bufferstreams": "^1.1.0",
"gulp-util": "^3.0.7",
"readable-stream": "^2.0.4",
"ttf2woff2": "^2.0.3"
},
"deprecated": false,
"description": "Create a WOFF2 font from a TTF font",
"devDependencies": {
"coveralls": "^2.11.4",
"eslint": "^1.10.1",
"eslint-config-simplifield": "^1.1.0",
"gulp": "^3.9.0",
"istanbul": "^0.4.0",
"mocha": "^2.3.4",
"mocha-lcov-reporter": "^1.0.0",
"streamtest": "^1.2.1"
},
"engines": {
"node": ">= 4"
},
"homepage": "https://github.com/nfroidure/gulp-ttf2woff2",
"keywords": [
"gulpplugin",
"gulp",
"gulp-plugin",
"font",
"woff2",
"ttf",
"converter"
],
"license": "MIT",
"main": "src/index.js",
"name": "gulp-ttf2woff2",
"repository": {
"type": "git",
"url": "git://github.com/nfroidure/gulp-ttf2woff2.git"
},
"scripts": {
"cli": "env NPM_RUN_CLI=1",
"cover": "istanbul cover --report html _mocha -- tests/*.mocha.js -R spec -t 5000",
"coveralls": "istanbul cover _mocha --report lcovonly -- tests/*.mocha.js -R spec -t 5000 && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage",
"lint": "eslint src/*.js tests/*.js",
"preversion": "npm run lint && npm test",
"test": "mocha tests/*.mocha.js"
},
"version": "2.0.2"
}

View File

@ -0,0 +1,101 @@
'use strict';
var path = require('path');
var Stream = require('readable-stream');
var gutil = require('gulp-util');
var BufferStreams = require('bufferstreams');
var ttf2woff2 = require('ttf2woff2');
var PLUGIN_NAME = 'gulp-ttf2woff2';
// File level transform function
function ttf2woff2Transform() {
// Return a callback function handling the buffered content
return function ttf2woff2TransformCb(err, buf, cb) {
// Handle any error
if(err) {
return cb(new gutil.PluginError(PLUGIN_NAME, err, { showStack: true }));
}
// Use the buffered content
try {
buf = ttf2woff2(buf);
return cb(null, buf);
} catch(err2) {
return cb(new gutil.PluginError(PLUGIN_NAME, err2, { showStack: true }));
}
};
}
// Plugin function
function ttf2woff2Gulp(options) {
var stream = new Stream.Transform({ objectMode: true });
options = options || {};
options.ignoreExt = options.ignoreExt || false;
options.clone = options.clone || false;
stream._transform = function ttf2woff2GulpTransform(file, unused, done) {
var cntStream;
var newFile;
// 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 {
cntStream = file.contents;
file.contents = null;
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, '.woff2');
// Buffers
if(file.isBuffer()) {
try {
file.contents = ttf2woff2(file.contents);
} catch(err) {
stream.emit('error', new gutil.PluginError(PLUGIN_NAME, err, {
showStack: true,
}));
}
// Streams
} else {
file.contents = file.contents.pipe(new BufferStreams(ttf2woff2Transform()));
}
stream.push(file);
done();
};
return stream;
}
// Export the file level transform function for other plugins usage
ttf2woff2Gulp.fileTransform = ttf2woff2Transform;
// Export the plugin main function
module.exports = ttf2woff2Gulp;

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,187 @@
/* eslint max-nested-callbacks:[1] */
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var Stream = require('stream');
var fs = require('fs');
var path = require('path');
var assert = require('assert');
var StreamTest = require('streamtest');
var ttf2woff2 = require(path.join(__dirname, '..', 'src', 'index.js'));
describe('gulp-ttf2woff2 conversion', function() {
var filename = path.join(__dirname, 'fixtures', 'iconsfont');
var woff = fs.readFileSync(filename + '.woff2');
// 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(ttf2woff2())
.pipe(StreamTest[version].toObjects(function(err, objs) {
if(err) {
return 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(ttf2woff2())
// 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) {
return done(err);
}
assert.equal(objs.length, 1);
assert.equal(objs[0].path, filename + '.woff2');
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(ttf2woff2({ clone: true }))
.pipe(StreamTest[version].toObjects(function(err, objs) {
if(err) {
return 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 + '.woff2');
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(ttf2woff2())
.pipe(StreamTest[version].toObjects(function(err, objs) {
if(err) {
return done(err);
}
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(ttf2woff2())
.pipe(StreamTest[version].toObjects(function(err, objs) {
if(err) {
return done(err);
}
assert.equal(objs.length, 1);
assert.equal(objs[0].path, filename + '.woff2');
objs[0].contents.pipe(StreamTest[version].toText(function(err, text) {
if(err) {
return done(err);
}
assert.equal(text, woff.toString('utf-8'));
done();
}));
}));
});
it('should work with the clone option', function(done) {
gulp.src(filename + '.ttf', { buffer: false })
.pipe(ttf2woff2({ clone: true }))
.pipe(StreamTest[version].toObjects(function(err, objs) {
if(err) {
return done(err);
}
assert.equal(objs.length, 2);
assert.equal(objs[0].path, filename + '.ttf');
assert.equal(objs[1].path, filename + '.woff2');
objs[0].contents.pipe(StreamTest[version].toText(function(err2, text) {
if(err2) {
return done(err2);
}
assert.equal(text, fs.readFileSync(filename + '.ttf', 'utf-8'));
objs[1].contents.pipe(StreamTest[version].toText(function(err3, text2) {
if(err3) {
return done(err3);
}
assert.equal(text2, 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(ttf2woff2())
.pipe(StreamTest[version].toObjects(function(err, objs) {
if(err) {
return done(err);
}
assert.equal(objs.length, 1);
assert.equal(objs[0].path, 'bibabelula.foo');
assert(objs[0].contents instanceof Stream.PassThrough);
done();
}));
});
});
});
});
});