How to use the fonteditor-core/common/ajaxFile function in fonteditor-core

To help you get started, we’ve selected a few fonteditor-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kekee000 / fonteditor-core / demo / js / ttf2eot.js View on Github external
function readeot() {
    ajaxFile({
        type: 'binary',
        url: './test/fonteditor.eot',
        onSuccess(buffer) {


            let ttfBuffer = eot2ttf(buffer);
            let ttfReader = new TTFReader();
            let ttfData = ttfReader.read(ttfBuffer);
            let base64str = ttf2base64(ttfBuffer);
            setFont(base64str);
            showTTFGlyf(ttfData);

        },
        onError() {
            console.error('error read file');
        }
github kekee000 / fonteditor-core / demo / js / woff2ttf.js View on Github external
function write() {

    ajaxFile({
        type: 'binary',
        url: 'test/fonteditor.woff',
        onSuccess(buffer) {
            let ttfBuffer = woff2ttf(buffer, {
                inflate
            });

            let saveBtn = $('.saveas');
            saveBtn.attr('href', ttf2base64(ttfBuffer));
            saveBtn.attr('download', 'save.woff');

            let ttfReader = new TTFReader();
            let ttfData = ttfReader.read(ttfBuffer);
            console.log(ttfData);
        },
        onError() {
github kekee000 / fonteditor-core / demo / js / ttf2woff.js View on Github external
function write() {
    ajaxFile({
        type: 'binary',
        url: './test/fonteditor.ttf',
        onSuccess(buffer) {

            let woffBuffer = ttf2woff(buffer, ttf2woffoptions);

            let base64str = woff2base64(woffBuffer);
            setFont(base64str);


            let saveBtn = $('.saveas');
            saveBtn.attr('href', base64str);
            saveBtn.attr('download', 'save.woff');
github kekee000 / fonteditor-core / demo / js / ttf2svg.js View on Github external
function write() {
    ajaxFile({
        type: 'binary',
        url: './test/fonteditor.ttf',
        onSuccess(buffer) {

            let svgBuffer = ttf2svg(buffer, {
                metadata: 'fonteditor V0.1'
            });

            let base64str = svg2base64(svgBuffer);
            setFont(base64str);


            let saveBtn = $('.saveas');
            saveBtn.attr('href', base64str);
            saveBtn.attr('download', 'save.svg');