I am trying to run my app on Kubernetes RHEL server. But every time i am getting SixLabors.Fonts.FontFamilyNotFoundException.
I have double checked and verified that the font is available inside /usr/share/fonts/. I have also tried adding a custom font as described in readme file but still no luck. Here is stackstace for same.
public async Task<string> GetCaptchaImage(string test)
{
_log.LogInformation(string.Format("GetCaptchaImage- Font name is {0}", Environment.GetEnvironmentVariable("font_name")));
_log.LogInformation(string.Format("GetCaptchaImage- A bitmap of 130x80"));
var slc = new SixLaborsCaptchaModule(new SixLaborsCaptchaOptions
{
DrawLines = 7,
TextColor = new Color[] { Color.Blue, Color.Black },
Width = 130,
Height = 80,
FontFamilies = new string[] { Environment.GetEnvironmentVariable("font_name") },
});
_log.LogInformation(string.Format("GetCaptchaImage- Generating random text"));
var captchaText = Extentions.GetUniqueKey(6).ToUpper();
_log.LogInformation(string.Format("GetCaptchaImage- Generating bitmap..."));
var images = slc.Generate(captchaText); // this is line 945
_log.LogInformation(string.Format("GetCaptchaImage- Returning base64 image..."));
return Convert.ToBase64String(images);
}
DejaVuSans could not be found.
SixLabors.Fonts.FontFamilyNotFoundException
" at SixLabors.Fonts.FontCollection.GetImpl(String name CultureInfo culture)
at SixLabors.Fonts.FontCollection.Get(String name)
at SixLabors.Fonts.SystemFontCollection.Get(String name)
at SixLabors.Fonts.SystemFonts.CreateFont(String name Single size FontStyle style)
at SixLaborsCaptcha.Core.SixLaborsCaptchaModule.Generate(String stringText)
at classname.GetCaptchaImage(String msisdn)
in Classname.cs:line 945
at Clanname.GetCaptcha(String msisdn) in
classname.cs:line 609"