diff --git a/devel/204_30.md b/devel/204_30.md index 847cee79bd..2e72abd0f2 100644 --- a/devel/204_30.md +++ b/devel/204_30.md @@ -23,6 +23,11 @@ 3. 触发一次保存 4. 使用 vscode 或其他纯文本编辑器,打开刚刚保存的 tmu 文档,查看 tmu 头部的 style 块,不应该携带 dark 字样 +测试项五:导出PDF只允许浅色 +1. 进入软件的深色主题 +2. 在深色主题下,打开任意 tmu 文件,文档背景色应该是深色 +3. 点击 文件->导出->PDF,或者 文件->预览,我们最终看到的PDF都应该是将软件调整为浅色主题打开tmu文件看到的渲染效果 + ## 2026/03/31 文档主题跟随软件主题,保存时不保留dark ### What diff --git a/src/Edit/Editor/edit_main.cpp b/src/Edit/Editor/edit_main.cpp index 967d706af2..1e3a91bd92 100644 --- a/src/Edit/Editor/edit_main.cpp +++ b/src/Edit/Editor/edit_main.cpp @@ -202,6 +202,16 @@ edit_main_rep::print_doc (url name, bool conform, int first, int last) { if (conform && (medium != "paper")) conform= false; // FIXME: better command for conform printing + // Save current style and remove dark theme for printing + tree saved_style= the_style; + if (the_style == "dark") the_style= tree (TUPLE); + else if (is_func (the_style, TUPLE)) { + tree style (TUPLE); + for (int i= 0; i < N (the_style); ++i) + if (the_style[i] != "dark") style << the_style[i]; + the_style= style; + } + typeset_preamble (); // FIXME: when printing several files via aux buffers, // it seems that the style can be corrupted. Why? @@ -281,6 +291,9 @@ edit_main_rep::print_doc (url name, bool conform, int first, int last) { } tm_delete (ren); delete_typesetter (ttt); + + // Restore original style + the_style= saved_style; } void