Blazor-Captcha
Blazor-Captcha copied to clipboard
Fonts are not shown inside linux container
When I run the project inside a linux docker container the fonts and text are not shown. I think the fonts are not loaded in linux image. The image is debian:12-slim
I have already added the "SkiaSharp.NativeAssets.Linux.NoDependencies" to the project. what am I missing?
I don't know, I have no knowledge of Linux.
The app looks for the use of these fonts... https://github.com/tossnet/Blazor-Captcha/blob/24b5cf89da4afae0c50450cc4a658708c28ad68d/BlazorCaptcha/Captcha.cs#L74
a idea about this :? https://github.com/mono/SkiaSharp/issues/2142#issuecomment-1172968991
a idea about this :? mono/SkiaSharp#2142 (comment)
Thanks, This solved the problem. I just copied the fonts to "wwwroot\fonts" and changed these lines:
var fontFamilies = new string[] { "Arial.ttf", "Cour.ttf", "Times.ttf" };
and
//var typeface = SKTypeface.FromFamilyName(l.Family);
var fontFile = Path.GetFullPath(Path.Combine(environment.WebRootPath, "fonts", l.Family));
if (!System.IO.File.Exists(fontFile))
{
throw new Exception($"Font file \"{l.Family}\" missing.");
}
var typeface = SKTypeface.FromFile(fontFile);
incredible