diff --git a/YD_Event.Web.Core/Startup.cs b/YD_Event.Web.Core/Startup.cs index 1a14fee..410be9d 100644 --- a/YD_Event.Web.Core/Startup.cs +++ b/YD_Event.Web.Core/Startup.cs @@ -24,6 +24,8 @@ using OnceMi.AspNetCore.OSS; using QuestPDF; using QuestPDF.Infrastructure; +using SkiaSharp; + namespace YD_Event.Web.Core; public class Startup : AppStartup @@ -171,8 +173,9 @@ public class Startup : AppStartup option.ImageOption.InterferenceLineCount = 2; // 干扰线数量 option.ImageOption.FontSize = 36; // 字体大小 - // 使用系统安装的中文字体,避免使用 Lazy.Captcha.Core 内置字体(可能不兼容 Linux) - option.ImageOption.FontFamily = DefaultFontFamilies.Instance.Kaiti; + // 在 Linux 下,Lazy.Captcha.Core 的 DefaultFontFamilies 初始化可能会失败 + // 这里直接使用 SkiaSharp 加载系统字体(Dockerfile 中已安装 fonts-wqy-zenhei) + option.ImageOption.FontFamily = SKTypeface.FromFamilyName("WenQuanYi Zen Hei"); /* * 中文使用kaiti,其他字符可根据喜好设置(可能部分转字符会出现绘制不出的情况)。