Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 908 Bytes

README.md

File metadata and controls

31 lines (21 loc) · 908 Bytes

text2svg

convert text by sepcific windows font file(*.ttf) to canvas

##depences text2svg

##beta version

Give up text2svg option param. Always convet text to font size 72px.

Support Simple Chinese Fonts by Inziu Iosevka, inziu-iosevkaCC-SC-regular.ttf

return promise

return a promise object contains a canvas object

for nw.js only

how to use

        var fonts = 'fonts/inziu-iosevkaCC-SC-regular.ttf';
        fonts = path.normalize(fonts);
        fonts = path.join(nw.__dirname, fonts);
        //var text = "1ºÅ´°¿Ú";
        var text = "No1.Window";
        var png = Promise.resolve(require('text2canvas')).then(function (converter) {
            return converter(fonts, text);
        }, function (error) {
            return Promise.reject(error);
        })