Last active
April 17, 2017 06:32
-
-
Save lukasvan3l/9ee51afc4fe07309724f502e6250686d to your computer and use it in GitHub Desktop.
Fabric.js + Opentype.js for pixelperfect valentine cards
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function downloadAndLoadFont(id, url) { | |
https.get(url, (res) => { | |
var data = []; | |
res.on('data', function(chunk) { | |
data.push(chunk); | |
}).on('end', function() { | |
var buffer = Buffer.concat(data); | |
fonts[id] = opentype.parse(toArrayBuffer(buffer)); | |
console.log('loaded font ' + id); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment