SVG font loading, Linux
os: linux
node: v10+
i use :
const buffer =
<svg>
<rect x="0" y="0" height="${textBgH}px" fill="none" width="100%"/>
<text font-family="'Algerian'" font-size="${textH}px" font-weight="bolder" x="0" y="${textH}" fill="red" >${text}</text>
</svg>;
sharp(Buffer.from(buffer)) .png() .toFile('text.png'); console.log(sharp.versions)
but cant use my custom font Algerian
Hello, the numeric FC_DEBUG environment variable can be used to help debug font loading problems. Try a value of 1 to start with.
https://www.freedesktop.org/software/fontconfig/fontconfig-user.html#DEBUG
i solve this problem by import font to os font lib。but this method s Maintainability is so poor,i hope sharp have api to load font from project one sub directory txs。
SVG rendering depends on librsvg, which depends on the cross-platform fontconfig to locate fonts.
At the bottom of the fontconfig-user page I linked to are listed various environment variables that can be used to control it e.g. to specify custom, non-OS fontconfig directories.
I am setting FC_DEBUG=1 node myscript.js but I don't see any new logging. Just to be sure, I also tried setting export FC_DEBUG=8191 in the cli and process.env.FC_DEBUG = '1' inside my script, but none of these are giving me any debugging info. I am feeling stupid right now... Is there any other way to set FC_DEBUG?