md2pdf重构为x2pdf:渲染层reportlab→WeasyPrint(md/txt/html)+LibreOffice(docx/xlsx/pptx/odt*),md/txt套默认黑白CSS并页码、html不套仅显式page生效,page/css参数化版式(默认CSS<page<css文件),依赖自带声明(requirements锁weasyprint==65.1/markdown==3.6——62.x对pydyf≥0.11无上界致transform崩,63+已适配;install.sh自检pango/cairo与CJK字体),删md2pdf整目录与cjk.ttf提取逻辑,img-utils改认系统wqy,README范例改指img-utils/x2pdf,system-prompt加PDF一律走x2pdf,技能清单段落格式改为名字:描述(listSkills已排序不动)

This commit is contained in:
2026-09-25 16:59:11 +08:00
parent da9e54d96d
commit 511c884e2b
16 changed files with 426 additions and 691 deletions
+3 -5
View File
@@ -37,8 +37,8 @@ CJK_FONT_CANDIDATES = [
'/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc',
'/usr/share/fonts/truetype/wqy/wqy-microhei.ttc',
]
# Noto 只作最后兜底:Pillow(FreeType) 能读它的 CFF 轮廓,但 ttc 默认字型(索引 0)是 JP 字形,
# 中文水印会出日式写法;同仓 md2pdf 的 cjk.ttf(文泉驿)排在它前面。
# Noto 只作最后兑底:Pillow(FreeType) 能读它的 CFF 轮廓,但 ttc 默认字型(索引 0)是 JP 字形,
# 中文水印会出日式写法;因此系统文泉驿(CJK_FONT_CANDIDATES)排在它前面。
NOTO_CJK_FALLBACK = '/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc'
@@ -223,15 +223,13 @@ def action_compress(img, fmt, args):
def find_font(explicit):
"""字体查找:显式 font > 系统 wqy > 同仓 md2pdf 准备的字体 > Noto 兜底。"""
"""字体查找:显式 font > 系统 wqy > Noto 兑底。"""
if explicit:
p = Path(explicit)
if not p.exists():
raise ValueError('指定的字体不存在:%s' % explicit)
return str(p)
skill_root = Path(__file__).resolve().parent.parent
candidates = list(CJK_FONT_CANDIDATES)
candidates.append(str(skill_root / 'md2pdf' / 'fonts' / 'cjk.ttf'))
candidates.append(NOTO_CJK_FALLBACK)
for c in candidates:
if Path(c).exists():