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-svg2ttf/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.

81
static/js/ketcher2/node_modules/gulp-svg2ttf/README.md generated vendored Normal file
View File

@ -0,0 +1,81 @@
# gulp-svg2ttf
> Create a TTF font from an SVG font with [Gulp](http://gulpjs.com/).
[![NPM version](https://badge.fury.io/js/gulp-svg2ttf.png)](https://npmjs.org/package/gulp-svg2ttf) [![Build status](https://secure.travis-ci.org/nfroidure/gulp-svg2ttf.png)](https://travis-ci.org/nfroidure/gulp-svg2ttf) [![Dependency Status](https://david-dm.org/nfroidure/gulp-svg2ttf.png)](https://david-dm.org/nfroidure/gulp-svg2ttf) [![devDependency Status](https://david-dm.org/nfroidure/gulp-svg2ttf/dev-status.png)](https://david-dm.org/nfroidure/gulp-svg2ttf#info=devDependencies) [![Coverage Status](https://coveralls.io/repos/nfroidure/gulp-svg2ttf/badge.png?branch=master)](https://coveralls.io/r/nfroidure/gulp-svg2ttf?branch=master) [![Code Climate](https://codeclimate.com/github/nfroidure/gulp-svg2ttf.png)](https://codeclimate.com/github/nfroidure/gulp-svg2ttf)
## Usage
First, install `gulp-svg2ttf` as a development dependency:
```shell
npm install --save-dev gulp-svg2ttf
```
Then, add it to your `gulpfile.js`:
```javascript
var svg2ttf = require('gulp-svg2ttf');
gulp.task('svg2ttf', function(){
gulp.src(['fonts/*.svg'])
.pipe(svg2ttf())
.pipe(gulp.dest('fonts/'));
});
```
## Stats
[![NPM](https://nodei.co/npm/gulp-svg2ttf.png?downloads=true&stars=true)](https://nodei.co/npm/gulp-svg2ttf/)
[![NPM](https://nodei.co/npm-dl/gulp-svg2ttf.png)](https://nodei.co/npm/gulp-svg2ttf/)
## API
### svg2ttf(options)
#### options.ignoreExt
Type: `Boolean`
Default value: `false`
Set to true to also convert files that doesn't have the .svg 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.
#### options.timestamp
Type: `Number`
Default value: `Math.round(Date.now()/1000)`
Override the TTF font creation/modification date.
#### options.copyright
Type: `String`
Default value: Fontello ad or SVG Font copyright metadata.
Allows to set to your copyright informations.
#### options.version
Type: `String`
Default value: `undefined` (results in version `1.0`)
Allows to set the version number of the font. Needs to be in the format `Version <NUM>.<NUM>` (the `Version` prefix is optional).
### Note
You may look after a full Gulp web font workflow, see
[gulp-iconfont](https://github.com/nfroidure/gulp-iconfont)
fot that matter.
### Contributing / Issues
Please submit SVG to TTF related issues to the
[svg2ttf project](https://github.com/fontello/svg2ttf)
on wich gulp-svg2ttf 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.

80
static/js/ketcher2/node_modules/gulp-svg2ttf/package.json generated vendored Executable file
View File

@ -0,0 +1,80 @@
{
"_from": "gulp-svg2ttf@^2.0.0",
"_id": "gulp-svg2ttf@2.0.1",
"_inBundle": false,
"_integrity": "sha1-EdaLu+J7ifR2V7TY8pzzOFTX5ow=",
"_location": "/gulp-svg2ttf",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "gulp-svg2ttf@^2.0.0",
"name": "gulp-svg2ttf",
"escapedName": "gulp-svg2ttf",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/gulp-iconfont"
],
"_resolved": "https://registry.npmjs.org/gulp-svg2ttf/-/gulp-svg2ttf-2.0.1.tgz",
"_shasum": "11d68bbbe27b89f47657b4d8f29cf33854d7e68c",
"_spec": "gulp-svg2ttf@^2.0.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-svg2ttf/issues"
},
"bundleDependencies": false,
"dependencies": {
"bufferstreams": "^1.1.0",
"gulp-util": "^3.0.7",
"readable-stream": "^2.0.4",
"svg2ttf": "^4.1.0"
},
"deprecated": false,
"description": "Create a TTF font from an SVG font",
"devDependencies": {
"coveralls": "^2.11.4",
"eslint": "^4.2.0",
"eslint-config-simplifield": "^6.0.0",
"gulp": "^3.9.0",
"istanbul": "^0.4.0",
"mocha": "^3.4.2",
"mocha-lcov-reporter": "^1.0.0",
"streamtest": "^1.2.1"
},
"engines": {
"node": ">= 0.10.0"
},
"homepage": "https://github.com/nfroidure/gulp-svg2ttf",
"keywords": [
"gulpplugin",
"gulp",
"gulp-plugin",
"font",
"svg",
"ttf",
"converter"
],
"license": "MIT",
"main": "src/index.js",
"name": "gulp-svg2ttf",
"repository": {
"type": "git",
"url": "git://github.com/nfroidure/gulp-svg2ttf.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 test",
"test": "mocha tests/*.mocha.js"
},
"version": "2.0.1"
}

View File

@ -0,0 +1,114 @@
'use strict';
const path = require('path');
const Stream = require('readable-stream');
const gutil = require('gulp-util');
const BufferStreams = require('bufferstreams');
const svg2ttf = require('svg2ttf');
const PLUGIN_NAME = 'gulp-svg2ttf';
// File level transform function
function svg2ttfTransform(options) {
// Return a callback function handling the buffered content
return function svg2ttfTransformCb(err, buf, cb) {
// Handle any error
if(err) {
cb(new gutil.PluginError(PLUGIN_NAME, err, { showStack: true }));
return;
}
// Use the buffered content
try {
buf = Buffer.from(svg2ttf(String(buf), {
ts: options.timestamp,
copyright: options.copyright,
version: options.version,
}).buffer);
} catch (err2) {
cb(new gutil.PluginError(PLUGIN_NAME, err2, { showStack: true }));
return;
}
cb(null, buf);
};
}
// Plugin function
function svg2ttfGulp(options) {
const stream = new Stream.Transform({ objectMode: true });
options = options || {};
options.ignoreExt = options.ignoreExt || false;
options.clone = options.clone || false;
options.timestamp = 'number' === typeof options.timestamp ?
options.timestamp :
{}.undef;
options.copyright = 'string' === typeof options.copyright ?
options.copyright :
{}.undef;
stream._transform = function svg2ttfTransformStream(file, unused, done) {
let cntStream;
let 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) && '.svg' !== 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, '.ttf');
// Buffers
if(file.isBuffer()) {
try {
file.contents = Buffer.from(svg2ttf(String(file.contents), {
ts: options.timestamp,
copyright: options.copyright,
version: options.version,
}).buffer);
} catch (err) {
stream.emit('error',
new gutil.PluginError(PLUGIN_NAME, err, { showStack: true }));
}
// Streams
} else {
file.contents = file.contents.pipe(new BufferStreams(svg2ttfTransform(options)));
}
stream.push(file);
done();
};
return stream;
}
// Export the file level transform function for other plugins usage
svg2ttfGulp.fileTransform = svg2ttfTransform;
// Export the plugin main function
module.exports = svg2ttfGulp;

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

View File

@ -0,0 +1,309 @@
/* eslint max-nested-callbacks:0, func-names:0, "security/detect-non-literal-fs-filename":0 */
'use strict';
const gulp = require('gulp');
const gutil = require('gulp-util');
const Stream = require('stream');
const fs = require('fs');
const path = require('path');
const assert = require('assert');
const StreamTest = require('streamtest');
const svg2ttf = require('../src/index.js');
describe('gulp-svg2ttf conversion', function() {
const filename = path.join(__dirname, 'fixtures', 'iconsfont');
const ttf = fs.readFileSync(filename + '.ttf');
const ttfCopyrighted = fs.readFileSync(filename + '-copyright.ttf');
const ttfVersioned = fs.readFileSync(filename + '-versioned.ttf');
const generationTimestamp = 3;
// 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(svg2ttf({
timestamp: generationTimestamp,
}))
.pipe(StreamTest[version]
.toObjects((err, objs) => {
if(err) {
done(err);
return;
}
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 + '.svg', { buffer: true })
.pipe(svg2ttf({
timestamp: generationTimestamp,
}))
// Uncomment to regenerate the test files if changes in the svg2ttf lib
.pipe(StreamTest[version]
.toObjects((err, objs) => {
if(err) {
done(err);
return;
}
assert.equal(objs.length, 1);
assert.equal(objs[0].path, filename + '.ttf');
assert.equal(
objs[0].contents.toString('utf-8'),
ttf.toString('utf-8')
);
done();
})
);
});
it('should work with the copyright option', function(done) {
gulp.src(filename + '.svg', { buffer: true })
.pipe(svg2ttf({
timestamp: generationTimestamp,
copyright: 'Brothershood of mens 2015 - Infinity',
}))
.pipe(StreamTest[version]
.toObjects((err, objs) => {
if(err) {
done(err);
return;
}
assert.equal(objs.length, 1);
assert.equal(objs[0].path, filename + '.ttf');
assert.deepEqual(objs[0].contents, ttfCopyrighted);
done();
})
);
});
it('should work with the version option', function(done) {
gulp.src(filename + '.svg', { buffer: true })
.pipe(svg2ttf({
timestamp: generationTimestamp,
version: '2.0',
}))
.pipe(StreamTest[version]
.toObjects((err, objs) => {
if(err) {
done(err);
return;
}
assert.equal(objs.length, 1);
assert.equal(objs[0].path, filename + '.ttf');
assert.deepEqual(objs[0].contents, ttfVersioned);
done();
})
);
});
it('should work with the clone option', function(done) {
gulp.src(filename + '.svg', { buffer: true })
.pipe(svg2ttf({
clone: true,
timestamp: generationTimestamp,
}))
.pipe(StreamTest[version]
.toObjects((err, objs) => {
if(err) {
done(err);
return;
}
assert.equal(objs.length, 2);
assert.equal(objs[0].path, filename + '.svg');
assert.equal(
objs[0].contents.toString('utf-8'),
fs.readFileSync(filename + '.svg', 'utf-8')
);
assert.equal(objs[1].path, filename + '.ttf');
assert.equal(objs[1].contents.toString('utf-8'), ttf.toString('utf-8'));
done();
})
);
});
it('should let non-svg files pass through', function(done) {
StreamTest[version].fromObjects([new gutil.File({
path: 'bibabelula.foo',
contents: Buffer.from('ohyeah'),
})])
.pipe(svg2ttf({
timestamp: generationTimestamp,
}))
.pipe(StreamTest[version]
.toObjects((err, objs) => {
if(err) {
done(err);
return;
}
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 + '.svg', { buffer: false })
.pipe(svg2ttf({
timestamp: generationTimestamp,
}))
.pipe(StreamTest[version]
.toObjects((err, objs) => {
if(err) {
done(err);
return;
}
assert.equal(objs.length, 1);
assert.equal(objs[0].path, filename + '.ttf');
objs[0].contents.pipe(StreamTest[version]
.toChunks((err, chunks) => {
if(err) {
done(err);
return;
}
assert.deepEqual(Buffer.concat(chunks), ttf);
done();
})
);
})
);
});
it('should work with the clone option', function(done) {
gulp.src(filename + '.svg', { buffer: false })
.pipe(svg2ttf({
clone: true,
timestamp: generationTimestamp,
}))
.pipe(StreamTest[version]
.toObjects((err, objs) => {
if(err) {
done(err);
return;
}
assert.equal(objs.length, 2);
assert.equal(objs[0].path, filename + '.svg');
assert.equal(objs[1].path, filename + '.ttf');
objs[0].contents.pipe(StreamTest[version]
.toText((err, text) => {
if(err) {
done(err);
return;
}
assert.equal(text, fs.readFileSync(filename + '.svg', 'utf-8'));
objs[1].contents.pipe(StreamTest[version].toChunks(function(err, chunks) {
if(err) {
done(err);
return;
}
assert.deepEqual(Buffer.concat(chunks), ttf);
done();
}));
})
);
})
);
});
it('should work with the version option', function(done) {
gulp.src(filename + '.svg', { buffer: false })
.pipe(svg2ttf({
timestamp: generationTimestamp,
version: '2.0',
}))
.pipe(StreamTest[version]
.toObjects((err, objs) => {
if(err) {
done(err);
return;
}
assert.equal(objs.length, 1);
assert.equal(objs[0].path, filename + '.ttf');
objs[0].contents.pipe(StreamTest[version]
.toChunks((err, chunks) => {
if(err) {
done(err);
return;
}
assert.deepEqual(Buffer.concat(chunks), ttfVersioned);
done();
})
);
})
);
});
it('should let non-svg files pass through', function(done) {
StreamTest[version].fromObjects([new gutil.File({
path: 'bibabelula.foo',
contents: new Stream.PassThrough(),
})])
.pipe(svg2ttf({
timestamp: generationTimestamp,
}))
.pipe(StreamTest[version]
.toObjects((err, objs) => {
if(err) {
done(err);
return;
}
assert.equal(objs.length, 1);
assert.equal(objs[0].path, 'bibabelula.foo');
assert(objs[0].contents instanceof Stream.PassThrough);
done();
})
);
});
});
});
});
});