Hi guys I have an application running on a serverless node environment (vercel) and I need to generate an svg using custom (end user defined) fonts, I have the files hosted on an s3 bucket and when I parse the svg I am downloading all the fonts used to a local folder
I use sharp js to generate the images from svg but I am running into a problem because I don't know the names of the fonts, the only information I have is the file name which could be anything because it is uploaded by the user, sharp allows me to pass a path tp a fontconfig file to add custom fonts but since I don't know the names of the fonts I don't know how to go about adding the font to fontconfig, ideally I would like a way to add a font by adding a name that I choose (probably some variation of the file name) and a path to the actual file, this way I can reference it in my svg and get the correct font, I just don't know if that's even possible with fontconfig and if it is I font know how to do it
I would be ok parsing the font names from the files binary but I don't know how to do that either and it seems like the first approach if possible will be easier