Skip to content

Instantly share code, notes, and snippets.

@lukasvan3l
Last active April 17, 2017 06:32
Show Gist options
  • Save lukasvan3l/9ee51afc4fe07309724f502e6250686d to your computer and use it in GitHub Desktop.
Save lukasvan3l/9ee51afc4fe07309724f502e6250686d to your computer and use it in GitHub Desktop.
Fabric.js + Opentype.js for pixelperfect valentine cards
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