From 81ecb93aa5ca070d90d8e30aff0fbd0c26c3002b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A2=93=E5=BD=AD?= Date: Fri, 6 Mar 2026 22:39:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E4=BD=93=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YD_Event.Web.Core/Startup.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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,其他字符可根据喜好设置(可能部分转字符会出现绘制不出的情况)。