Convert Font?
Posted: 2018-08-16T14:13:15-07:00
I'm integrating an ImageMagick command into a Firebase Function written in Node.js. I already have Ghostscript installed and have a full list of fonts available:
Here's my code:
I also tried:
The error I'm getting is:
I also tried putting quotes around the path and that didn't solve the issue. Any help would be much appreciated!
Code: Select all
convert -list font
Path: /usr/local/Cellar/imagemagick/7.0.8-10/etc/ImageMagick-7/type-apple.xml
Font: AndaleMono
family: Andale Mono
style: Undefined
stretch: Undefined
weight: 0
glyphs: /Library/Fonts//Andale Mono.ttf
Font: AppleChancery
family: Apple Chancery
style: Undefined
stretch: Undefined
weight: 0
glyphs: /Library/Fonts//Apple Chancery.ttf
Font: AppleMyungjo
family: AppleMyungjo
style: Undefined
stretch: Undefined
weight: 0
glyphs: /Library/Fonts//AppleMyungjo.ttf
Code: Select all
exec(`convert ${tempFilePath} -font /Users/emma/Library/Fonts/Nunito-Regular.ttf -fill white -pointsize 60 -gravity center -draw "text 0,300 'this is a label'" ${tempFilePath}`, {stdio: 'ignore'}, (err, stdout) => {
if (err) {
console.error('Failed to label image.', err);
reject(err);
} else {
resolve(stdout);
}
});
Code: Select all
exec(`convert ${tempFilePath} -font Arial -fill white -pointsize 60 -gravity center -draw "text 0,300 'this is a label'" ${tempFilePath}`, {stdio: 'ignore'}, (err, stdout) => {
if (err) {
console.error('Failed to label image.', err);
reject(err);
} else {
resolve(stdout);
}
});
Code: Select all
convert: unable to read font `/Library/Fonts//Nunito-Regular.ttf' @ warning/annotate.c/RenderType/872