cloud functionsで画像に文字入れ込もうと思った際にフォントって何が使えるのかなーと思って調べてみた.
やり方
cloud functionsで以下のような処理入れてフォント一覧取得.
const result = spawnSync('convert', ['-list', 'font']);
res.send(result.stdout);
結果
Path: System Fonts
Font: DejaVu-Sans
family: DejaVu Sans
style: Normal
stretch: Normal
weight: 400
glyphs: /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
Font: DejaVu-Sans-Bold
family: DejaVu Sans
style: Normal
stretch: Normal
weight: 700
glyphs: /usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf
Font: DejaVu-Sans-Mono
family: DejaVu Sans Mono
style: Normal
stretch: Normal
weight: 400
glyphs: /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf
Font: DejaVu-Sans-Mono-Bold
family: DejaVu Sans Mono
style: Normal
stretch: Normal
weight: 700
glyphs: /usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf
Font: DejaVu-Serif
family: DejaVu Serif
style: Normal
stretch: Normal
weight: 400
glyphs: /usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf
Font: DejaVu-Serif-Bold
family: DejaVu Serif
style: Normal
stretch: Normal
weight: 700
glyphs: /usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf
結論
cloud functions自体が持っているフォントはそんな種類多くないので使いたいフォントがあれば別途用意する必要がありそう.