File size: 2,485 Bytes
e831a9b
38f9bb7
 
 
 
 
 
 
 
 
 
 
 
e831a9b
7b384e1
 
8617367
b8fedae
280d48a
38f9bb7
 
 
 
b8fedae
8617367
7b384e1
 
38f9bb7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44a8902
7b384e1
 
44a8902
8617367
 
7b384e1
44a8902
7b384e1
 
44a8902
7b384e1
 
44a8902
8617367
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Use Node.js 20 on Debian Bookworm (Chromium 149, fixes SVG context-stroke support)
#
# ── CJK 字体策略(2026-10-04 PDF 体积根因修复,勿回退到 fonts-noto-cjk)──
# Debian 的 fonts-noto-cjk 是 CFF 轮廓的 OTC 集合封装,Skia/PDF 无法对它做
# 子集嵌入,print-to-PDF 时每个 CJK 字形都退化为 Type3 逐页画(436 轮会话实测:
# 745 个 Type3 字体字典 + 2.4MB CharProcs + 每页重复字形,韩文/康熙部首同样中招;
# 变量字体也触发 Type3,已实测)。TrueType 轮廓的静态实例则正常以 TTF 子集嵌入,
# 全文档共享一份。证据链见 XWXExporter 仓库 temp/test/notebooklm/2026-10-04/。
# 因此:构建期从 google/fonts 下载变量字体(commit 固定可复现),用 fontTools
# 实例化 400/700 两个 weight 装为系统字体;不装 fonts-noto-cjk。
# 插件 document-export-css.js 的字体栈已按语言对齐静态家族名
# (Noto Sans SC/TC/JP/KR/HK 优先于 CJK OTC 名)。
# emoji 仍用 fonts-noto-color-emoji(CBDT 位图,少量 Type3 残留,视觉优先)。
FROM node:20-bookworm-slim

RUN apt-get update && apt-get install -y \
    chromium \
    fonts-noto-core \
    fonts-noto-color-emoji \
    python3-fonttools \
    fontconfig \
    curl \
    ca-certificates \
    libxss1 \
    --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*

# google/fonts 仓库 commit 固定(2026-10-04 取)
ARG NOTO_FONTS_COMMIT=a85815a42757630ce188fdad368c2dfc444d4773
RUN set -eux; \
    mkdir -p /usr/local/share/fonts/noto-sans-static; \
    for fam in notosanssc:NotoSansSC notosanstc:NotoSansTC notosansjp:NotoSansJP notosanskr:NotoSansKR notosanshk:NotoSansHK; do \
      dir="${fam%%:*}"; stem="${fam##*:}"; \
      curl -fsSL -o "/tmp/${stem}-Var.ttf" \
        "https://raw.githubusercontent.com/google/fonts/${NOTO_FONTS_COMMIT}/ofl/${dir}/${stem}%5Bwght%5D.ttf"; \
      for w in 400 700; do \
        python3 -m fontTools.varLib.instancer --update-name-table \
          -o "/usr/local/share/fonts/noto-sans-static/${stem}-${w}.ttf" \
          "/tmp/${stem}-Var.ttf" "wght=${w}"; \
      done; \
      rm -f "/tmp/${stem}-Var.ttf"; \
    done; \
    fc-cache -f

# Set working directory
WORKDIR /app

# Install Node.js Dependencies
COPY package.json .
RUN npm install

# Copy Application Code (including templates/)
COPY . .

# Expose Port (Hugging Face expects 7860)
EXPOSE 7860

# Run the Application
CMD ["node", "server.js"]