Problem
In early this year, I am upgrading my Captcha library, the code that renders text on images blow up when running under Azure App Service for Linux. I can tell from the error message that the font I am using is not installed on Azure App Service's hosting machine. To fix this, I need to find out what fonts are there in Azure App Service for Linux. Let's see how to do it.
Solution 1
Since I can deploy code to Azure App Service. I can get font list and output on web page. Example code below is ASP.NET Core using SixLabors.ImageSharp.Drawing
package.
@{
var fonts = SystemFonts.Collection.Families;
}
<h5>System Fonts</h5>
<ul>
@foreach (var item in fonts)
{
<li>@item.Name</li>
}
</ul>
Output
Now I can fix the captcha library on Azure App Service for Linux using either one of the system fonts.
Solution 2
This is a much simpler way if you don't want to write code and deploy to App Service. Just enter "SSH" in your App Service's blade.
Then run
cd /usr/share/fonts
We can get the same result.
Adam Collings
Thanks, mate. You just made my day. I was tearing my hair out trying to deploy and reference a font file because I couldn't figure out what system fonts were available to me on my linux-hosted azure back-end. Thanks for sharing this information.