Emoji to PNG or JPG in Node.js


I was able to get this to work with fontkit by selecting a font from the font collection. I haven't found a case yet where using either of the TTFs included in the "Apple Color Emoji.ttc" gives different results.

const fs = require('fs');
const fontkit = require('fontkit');
const emoji = require('node-emoji');
const font = fontkit.openSync('./Apple Color Emoji.ttc').fonts[0];

let emo = emoji.get('100');
let run = font.layout(emo);
let glyph = run.glyphs[0].getImageForSize(128)

fs.writeFileSync('100.png', glyph.data);
链接地址: http://www.djcxy.com/p/39128.html

上一篇: 隐藏一个构造函数,但不是导入时的类型

下一篇: 在Node.js中将表情符号转换为PNG或JPG