From 0fd49545477bec37fe05fb78ad2a445cb1740e79 Mon Sep 17 00:00:00 2001 From: xiaoqidun Date: Sat, 12 Sep 2026 12:59:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8F=90=E5=8D=87=E6=80=A7=E8=83=BD):=20?= =?UTF-8?q?=E5=87=8F=E5=B0=91=E6=97=A0=E6=95=88=E7=B2=97=E4=BD=93=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=EF=BC=8C=E6=8F=90=E5=8D=87=E6=96=87=E5=AD=97=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ofdgo_font_match.go | 5 ++++- ofdgo_renderer_text.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ofdgo_font_match.go b/ofdgo_font_match.go index 284f568..d6215d5 100644 --- a/ofdgo_font_match.go +++ b/ofdgo_font_match.go @@ -318,8 +318,11 @@ func fontDefaultSystemNames() []string { func fontNoSyntheticBold(names ...string) bool { for _, name := range names { for _, rule := range fontMatchRules { + if !rule.NoSyntheticBold { + continue + } level := fontRuleMatchLevel(rule, name) - if rule.NoSyntheticBold && level >= fontMatchExact && level <= fontMatchPartial { + if level >= fontMatchExact && level <= fontMatchPartial { return true } } diff --git a/ofdgo_renderer_text.go b/ofdgo_renderer_text.go index a1e4535..7b6acb1 100644 --- a/ofdgo_renderer_text.go +++ b/ofdgo_renderer_text.go @@ -139,7 +139,7 @@ func (r *Renderer) renderText(ctx *canvas.Context, obj TextObject, pageH float64 embeddedFont := false if of, ok := r.Reader.fontCache[fontID]; ok { embeddedFont = of.FontFile != "" - if !embeddedFont && fontNoSyntheticBold(of.FontName, of.FamilyName) { + if syntheticBold && !embeddedFont && fontNoSyntheticBold(of.FontName, of.FamilyName) { syntheticBold = false } if of.Bold {