Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix: add standalone CJK font for Go PDF generation (#20095)

buua436a03c9777af2f
diff --git a/Dockerfile_go b/Dockerfile_go
index 5e77e332d3..69faf0b8e2 100644
--- a/Dockerfile_go
+++ b/Dockerfile_go
@@ -86,7 +86,12 @@ RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && \
chmod 1777 /tmp && \
apt update && \
- apt --no-install-recommends install -y ca-certificates curl vim unzip iproute2 fonts-dejavu fonts-noto-cjk fontconfig && \
+ apt --no-install-recommends install -y ca-certificates curl vim unzip iproute2 fonts-dejavu fontconfig && \
+ mkdir -p /usr/local/share/fonts/truetype/noto && \
+ curl --retry 5 --retry-delay 2 --retry-all-errors -fsSL \
+ -o /usr/local/share/fonts/truetype/noto/NotoSansCJKsc-VF.ttf \
+ https://github.com/notofonts/noto-cjk/raw/main/Sans/Variable/TTF/NotoSansCJKsc-VF.ttf && \
+ fc-cache -f && \
rm -rf /var/lib/apt/lists/*
# Download resource from GitHub to /usr/share/infinity
diff --git a/internal/agent/component/io/pdf_writer.go b/internal/agent/component/io/pdf_writer.go
index 0ac6a723a0..9505f4e649 100644
--- a/internal/agent/component/io/pdf_writer.go
+++ b/internal/agent/component/io/pdf_writer.go
@@ -59,11 +59,11 @@ var defaultPDFLatinFontPaths = []string{
}
var defaultPDFCJKFontPaths = []string{
+ // Use the language-specific Noto CJK Variable TTF shipped by Dockerfile_go.
+ // gopdf uses its default variation instance; it does not expose variable
+ // font axes, so this is used as the regular CJK face.
+ "/usr/local/share/fonts/truetype/noto/NotoSansCJKsc-VF.ttf",
"/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf",
- "/usr/share/fonts/truetype/noto/NotoSansCJK-Regular.ttf",
- "/usr/share/fonts/truetype/wqy/wqy-microhei.ttc",
- "/usr/share/fonts/truetype/arphic/uming.ttc",
- "/usr/share/fonts/truetype/arphic/ukai.ttc",
}
type pdfFontSet struct {