How to use the fonteditor-core/ttf/ttf2base64 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 / svg2ttfobject.js View on Github external
}).done(function (data) {

            let ttfObject = svg2ttfobject(data);
            let writer = new TTFWriter();

            let ttfBuffer = writer.write(ttfObject);
            let base64str = ttf2base64(ttfBuffer);

            let saveBtn = $('.saveas');
            saveBtn.attr('href', base64str);
            saveBtn.attr('download', 'save.ttf');
            console.log(ttfObject);
        });
github kekee000 / fonteditor-core / demo / js / ttfwriter.js View on Github external
$.getJSON('./data/baiduHealth.json', function (ttf) {

            let reader = new TTFReader();
            let writer = new TTFWriter();
            let buffer = writer.write(ttf);

            let ttfData = reader.read(buffer);

            console.log(ttfData);

            let base64str = ttf2base64(buffer);
            let saveBtn = $('.saveas');
            saveBtn.attr('href', base64str);
            saveBtn.attr('download', 'save.ttf');
        });
    }
github kekee000 / fonteditor-core / demo / js / glyfcanvas.js View on Github external
function setFont(arrayBuffer) {
    let base64 = ttf2base64(arrayBuffer);
    setFontface('truetype', base64, 'font-face');
}
github kekee000 / fonteditor-core / demo / js / glyfsvg.js View on Github external
function setFont(arrayBuffer) {
    let base64 = ttf2base64(arrayBuffer);
    setFontface('truetype', base64, 'font-face');
}
github kekee000 / fonteditor-core / demo / js / ttfmin.js View on Github external
setFont({
        family: family,
        data: ttf2base64(buffer)
    }, '#' + family);



    family = 'font-without-hitting';
    ttf.get().name.fontFamily = family;
    writer = new TTFWriter({
        hinting: false
    });
    buffer = writer.write(ttf.get());
    setFont({
        family: family,
        data: ttf2base64(buffer)
    }, '#' + family);

    $('.ttf-text').html(text);
}
github kekee000 / fonteditor-core / demo / js / ttfmin.js View on Github external
glyfList.unshift(ttf.getGlyfByIndex(0));
        ttf.get().glyf = glyfList;
    }
    else {
        ttf.get().glyf = [ttf.getGlyfByIndex(0)];
    }

    let family = 'font-with-hitting';
    ttf.get().name.fontFamily = family;
    let writer = new TTFWriter({
        hinting: true
    });
    let buffer = writer.write(ttf.get());
    setFont({
        family: family,
        data: ttf2base64(buffer)
    }, '#' + family);



    family = 'font-without-hitting';
    ttf.get().name.fontFamily = family;
    writer = new TTFWriter({
        hinting: false
    });
    buffer = writer.write(ttf.get());
    setFont({
        family: family,
        data: ttf2base64(buffer)
    }, '#' + family);

    $('.ttf-text').html(text);