Enhance PPTX export with editable text, multi-slide decks, and in-memory output - #3643
Merged
Conversation
…ut writing to disk.
…rom the pagx export CLI.
…text so per-line runs no longer overlap.
…itles are not centered twice.
…t to match the authoritative glyph-path placement.
…suring the real advance-width span instead of a crude per-character estimate.
…th so the mask fill no longer paints an opaque patch over the masked content.
…xporters so the mask fill no longer paints an opaque patch over the masked content.
…ing line-box tops from embedded baselines.
…m glyph runs with authored bounds.
…en offset and optical alignment with siblings.
…e and align emoji runs via baseline offset.
…ine extent even when PAGX line metadata is present so Web/WASM font differences can still rewrap lines.
…o match the project code style.
OnionsYu
requested review from
Hparty,
domchen,
kevingpqi123 and
shlzxjp
as code owners
July 31, 2026 04:45
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3643 +/- ##
==========================================
+ Coverage 83.04% 83.16% +0.11%
==========================================
Files 712 712
Lines 94876 96165 +1289
Branches 26597 26762 +165
==========================================
+ Hits 78793 79977 +1184
- Misses 10410 10455 +45
- Partials 5673 5733 +60 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…at are auto-sized along the inline axis, so PowerPoint keeps a target line width instead of silently falling back to start alignment.
…s by using the embedded authoring glyph-run bounds for the envelope instead of the platform-dependent runtime layout width.
shlzxjp
reviewed
Jul 31, 2026
shlzxjp
left a comment
Collaborator
There was a problem hiding this comment.
代码评审报告(PR #3643)
专业评审团队从架构、可扩展性、可维护性、可读性、健壮性、安全性、性能、防御性编程、代码规范多维度审查,并逐条读源码复核以排除误报。
总体结论:质量高,可合入。 未发现 blocker / major 级实现缺陷;对外 API(ToFile 多文档化、新增 ToData、ignoreGlyphRuns)设计合理、精简、无冗余,convertTextToPath 优先的文档承诺在 PPTWriter.h 构造函数中确有实现。以下为经验证的真实问题(已按行级标注),供确认与后续处理。
亮点:ToFile/ToData 共用 WriteZipEntries 保证字节一致(有 memcmp 测试);多页状态隔离正确(imageIndexBase 防媒体命名冲突、_embeddedBaselineOffsets 为实例成员);MemZipSeek 拒绝越界 seek;SVG/HTML/PPT mask 修复三路一致无回归;emoji 基线补偿语义正确。规范完全符合项目约定。
…eports a layout error instead of silently emitting a blank slide, clamp zero or non-finite slide sizes to the minimum legal OOXML extent, and skip null glyph runs when computing text bounds.
shlzxjp
approved these changes
Aug 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
本 PR 完善 PAGX 到 PPTX 的导出能力,重点支持原生可编辑文本、多文档多页导出和内存导出。对于携带预排版
GlyphRun的文本,可选择牺牲字形级还原精度,改为输出可在 PowerPoint 中继续编辑和重新换行的原生文本。同时修复 SVG、HTML 以及 PPTX 非烘焙路径中,遮罩图层被重复当作可见内容输出的问题。
主要改动
原生可编辑 PPTX 文本
PPTExportOptions::ignoreGlyphRuns和 CLI 选项--ppt-ignore-glyphruns:忽略GlyphRun几何,使用Text::text生成原生 PowerPoint 文本。convertTextToPath/--text-to-path与上述选项语义相反;两者同时启用时,text-to-path优先。GlyphRun的 pen origin、advance span、bounds 和 baseline 保持文本框位置、宽高及多行垂直对齐,避免逐行文本重叠、居中重复应用和文本框尺寸漂移。TextBoxruns 合并为单个原生富文本 shape,并按基线对齐位图 emoji,改善混排文本的可编辑性和视觉一致性。多页和内存导出
PPTExporter::ToFile()改为接收std::vector<PAGXDocument*>,每个文档按传入顺序生成一页;整份 PPTX 使用第一个文档的画布尺寸。PPTExporter::ToData(),可直接获得完整 PPTX 的内存数据,无需先写入磁盘。pagx export支持重复传入--input生成多页 PPTX;SVG 和 HTML 仍只接受单个输入。遮罩导出修复
bakeUnsupported=false的 PPTX 路径不再将图层自身的 mask child 作为可见内容重复输出。兼容性说明
PPTExporter::ToFile(PAGXDocument&, ...)单文档重载已移除,调用方需要改为传入文档指针列表;单元素列表仍生成单页 PPTX。ignoreGlyphRuns会放弃GlyphRun中无法由原生 OOXML 文本表达的字形 ID、逐字偏移、锚点和旋转信息。默认行为保持不变,只有显式启用时才优先获得可编辑文本。测试
新增和完善自动化测试,覆盖:
ToFile/ToData的单页、多页、空输入、空指针、不同画布尺寸和跨页媒体命名;