From 969cb67c9644c231ddc6fec6d8440b73329b137c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Fri, 16 Oct 2026 12:48:59 -0400 Subject: [PATCH] R7.3: a font the lookup finds is not reported missing (patch 0048) Co-Authored-By: Claude Opus 5.5 (1M context) --- agents.md | 1 + apps/ely-doc/src/navigate/tests.rs | 36 ++++++++++++++++++ docs/compatibility.md | 2 +- ...048-lok-fonts-missing-by-search-name.patch | 38 +++++++++++++++++++ tasks/TASKS.md | 2 +- tasks/reviews/R7.3-r1.md | 1 + 6 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 patches/libreoffice/0048-lok-fonts-missing-by-search-name.patch create mode 100644 tasks/reviews/R7.3-r1.md diff --git a/agents.md b/agents.md index 3d10e3b..0ff27dc 100644 --- a/agents.md +++ b/agents.md @@ -310,3 +310,4 @@ cargo run -p ely-doc 启动一个应用(ElyDoc 先 cargo build -p ely - 2026-10-15(用户报:ElyShow 编辑区滚轮与上下键不换页,三端):内核在未选中对象时把上下键当作滚动窗口(`fupoor.cxx`),Ely 的画布整页适合、无处可滚,滚轮同样。`LokView::turn_parts`(ElyShow 首次适合时调用)之后:整页可见时滚轮换页(`view/turn.rs`):滚轮的行按本平台每格的行数(`ely_lok::notch`:macOS 1,Windows 取系统设置,X11 与 Wayland 为 3)折成格,整格的行每格一页(快速连滚与一次多格都照格数);一串行里出现不足一格的(X11、Windows 的触控板)即为平滑滚动,此后到停顿前不再换页,像素(macOS、Wayland 的触控板)同按手势:一次手势换一页(满一格或 50 像素),惯性不算;有起止的手势(macOS)只到结束才算完,没有起止的停 200 毫秒即为下一次。X11 的滚轮与触控板同为行、gpui 不分,以整格开头的触控板滑动在出现小数之前会按格换页(已知限制)。未选中对象、未编辑文字时上下键换页。换页一律经有序输入队列交 worker(`TURN`):worker 按之前各输入回报后的状态判定,有选区、选中对象或插入点即把方向键照常交内核,否则当场切页(到首末页即停,同缩略图条的 `setPart`),视图在落地时换上 worker 所示的页,其后排队的键与点按都落在新页上(Tab 后紧接的 Down 移动所选对象;Down、Tab、Down 是换页后在新页上选中并移动);ElyShow 后台读回的当前页只在视图已无待落地输入时采用(R6.13)。 - 2026-10-16(用户定):合集安装包(R7.1)。macOS 一个公证的 `ElyOffice-<版本>-<架构>.dmg`,装首批六个已签名的 .app 与“应用程序”替身,用户拖入所要的(`release.sh` 的 `dmg` 与单个应用共用);无 Developer ID Installer 证书,不出 .pkg。Windows 一个 `ElyOffice-<版本>-windows-x86_64-setup.exe`(`packaging/windows/bundle.nsi`),组件页勾选应用,所选的各自的安装程序以 `/S` 运行,所以装法、位置、升级、卸载项与单装完全相同;某个退出码非零即停下并写明其名与退出码(2 为文件被占用或位置被占),之前装上的照旧。Linux 不出合集。单个应用的包、更新清单照旧。 - 2026-10-16(Gitea #6):设置窗口多出一行应用菜单(R7.2)。设置窗口沿用主窗口的外壳 `Shell`,Windows 与 Linux 上随之画出菜单栏(macOS 菜单在系统菜单栏,不受影响)与更新横幅。菜单栏与更新横幅只属主窗口:`Shell::secondary` 去掉两者,设置窗口用它;`settings/tests.rs` 量内容起点距标题栏底:只装菜单时主窗口大于零(macOS 为零),再有待下载的新版时更大,设置窗口为零。 +- 2026-10-16(Gitea #4):装了宋体仍报缺少(R7.3)。内核按名找字体时比较 `GetEnglishSearchFontName`(小写 ASCII、去空格、中日韩本地名译为英文名,`宋体` 即 `simsun`),所以文档的 `宋体` 找到并用上 SimSun;缺字检查却比较原名与所用字体名,报为缺失。Linux 上内核以界面语言(英文)为 fontconfig 字体取名,文档里的本地名一律报缺。补丁 `0048-lok-fonts-missing-by-search-name.patch`:缺字检查同样比较检索名。实测(2026-10-16):Arch 容器装 ElyDoc 0.1.5 的 Arch 包与 simsun.ttc,40 行宋体五号、文档网格的 docx 报缺宋体,正文实为 SimSun(无此字体时为方框),与 Windows 同为一页;换上打过 0048 的内核后同一容器不再报缺、仍为一页。用户所说一页变两页未能复现,需其文件。缺字检查测试:`navigate/tests.rs` 以随包的 DejaVu Sans 写作 `DEJAVU SANS`,只报真缺的字体。另见:Linux 上属性栏的字体框为空(字体列表只有 SimSun,文档写宋体),未改。 diff --git a/apps/ely-doc/src/navigate/tests.rs b/apps/ely-doc/src/navigate/tests.rs index ae651f4..9025af2 100644 --- a/apps/ely-doc/src/navigate/tests.rs +++ b/apps/ely-doc/src/navigate/tests.rs @@ -332,3 +332,39 @@ fn an_outline_click_goes_where_its_row_was_drawn() { }); assert_eq!(target(vcx), Some((0, 300, 10, 10)), "the click goes where its row was"); } + +/// A bundled font spelled otherwise, and one nowhere. +const SPELLED: &str = r#" + + + + + + + + + + + found lost + +"#; + +#[test] +fn a_font_found_by_its_search_name_is_not_missing() { + let dir = tempfile::tempdir().expect("a temp dir"); + let mut cx = TestAppContext::single(); + let Some(docs) = docs(&mut cx, dir.path()) else { + eprintln!("SKIP: no LOK build"); + return; + }; + open_text(&mut cx, &docs, &dir.path().join("spelled.fodt"), SPELLED); + settle(&cx, |app| { + let tab = docs.read(app).active_tab().expect("a tab"); + !tab.view.read(app).missing_fonts().is_empty() + }); + let missing = cx.update(|app| { + let tab = docs.read(app).active_tab().expect("a tab"); + tab.view.read(app).missing_fonts().to_vec() + }); + assert_eq!(missing, ["Nowhere Sans"], "the lookup found DejaVu Sans"); +} diff --git a/docs/compatibility.md b/docs/compatibility.md index 1448e6d..3e23b6b 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -3,7 +3,7 @@ 随发行说明发布,每个版本一份。支持某格式不等于支持它的全部功能;下表只写已验证的内容、已知限制与保存行为。 版本:Ely Office 0.1.5(首版六个应用:ElyDoc、ElyTable、ElyShow、ElyPDF、ElyTree、ElyMark)。日期 2026-10-14。 -内核:LibreOffice 26.2.6.3(8221e31,加 `patches/libreoffice` 0001–0047);MuPDF 1.28.5(8ad45e9,加 `patches/mupdf` 0001–0005);Git 2.56.0(a018953)与 git-lfs 3.8.0。 +内核:LibreOffice 26.2.6.3(8221e31,加 `patches/libreoffice` 0001–0048);MuPDF 1.28.5(8ad45e9,加 `patches/mupdf` 0001–0005);Git 2.56.0(a018953)与 git-lfs 3.8.0。 验证机:macOS 27.0 arm64。Windows 与 Linux 未验证。本机没有 Microsoft Office:与 Office 的交叉检查未做(待做)。 ## 往返验证 diff --git a/patches/libreoffice/0048-lok-fonts-missing-by-search-name.patch b/patches/libreoffice/0048-lok-fonts-missing-by-search-name.patch new file mode 100644 index 0000000..7016ae9 --- /dev/null +++ b/patches/libreoffice/0048-lok-fonts-missing-by-search-name.patch @@ -0,0 +1,38 @@ +LOK: a font the lookup finds is not missing + +The fonts-missing filter compared names as written: a document's +"宋体" against the used face "SimSun", or "DEJAVU SANS" against +"DejaVu Sans". The font lookup finds families by their English +search name (GetEnglishSearchFontName: lower ASCII, no spaces, +localized CJK names translated), so these fonts were found and +used, yet reported missing. On Linux the kernel names fontconfig +families in its UI language, English, so every localized name in +a document failed the check. Compare search names instead. + +--- a/desktop/source/lib/init.cxx ++++ b/desktop/source/lib/init.cxx +@@ -168,6 +168,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -3047,11 +3048,12 @@ + sal_Int32 nIndex = 0; + do + { +- const OUString aFamily +- = x.mOriginalFont.getToken(0, ';', nIndex); ++ // Names compare as the font lookup matches them. ++ const OUString aFamily = GetEnglishSearchFontName( ++ x.mOriginalFont.getToken(0, ';', nIndex)); + for (const auto &j : x.mUsedFonts) +- if (j == aFamily +- || j.startsWith(Concat2View(aFamily + "/"))) ++ if (GetEnglishSearchFontName(j.getToken(0, '/')) ++ == aFamily) + return true; + } while (nIndex >= 0); + } diff --git a/tasks/TASKS.md b/tasks/TASKS.md index a41332b..d0e2ac6 100644 --- a/tasks/TASKS.md +++ b/tasks/TASKS.md @@ -278,7 +278,7 @@ - [x] R7.1 合集安装包(§4,用户定):macOS 一个公证的 dmg 装六个 .app 与“应用程序”替身,用户拖入所要的;Windows 一个安装程序,组件页勾选六个应用,每个与单独安装程序装得一样;Linux 不做合集;单个应用的包照旧(`release.sh` 的 `dmg` 单个与合集共用,Mac mini 上以两个假应用核对卷内内容;`bundle.nsi` 逐个以 `/S` 运行所选的安装程序,某个退出码非零即停下并写明;`windows-bundle.sh` 三个假应用:都装上,第二个被拒时退出码 2、第三个不运行;真包随 R7.7 建出 — 第 1 轮:被拒的是最后一个,去掉 `Abort` 测试仍过;加第三个应用后去掉即失败;第 2 轮 PASS) - [x] R7.2 设置窗口多出一行应用菜单(#6,§5):设置窗口沿用主窗口的外壳 `Shell`,Windows 与 Linux 上随之画出菜单栏与更新横幅;设置窗口不画这两者(`Shell::secondary`;测试量内容起点距标题栏底,五种变体各自失败 — 第 1 轮:只查标记容器;第 2 轮:主窗口两者合计;第 3 轮 PASS) -- [ ] R7.3 装了宋体仍报缺少(#4,§7、§8):内核按 `宋体` 找到 SimSun,缺字检查却比较原名与所用字体的英文名,报为缺失;查明 Linux 上的版面是否真用 SimSun,一页变两页的根因 +- [x] R7.3 装了宋体仍报缺少(#4,§7、§8):内核按 `宋体` 找到 SimSun,缺字检查却比较原名与所用字体的英文名,报为缺失;查明 Linux 上的版面是否真用 SimSun,一页变两页的根因(补丁 0048:缺字检查比较 `GetEnglishSearchFontName`;Windows 与 WSL 内核已重建;`navigate/tests.rs` 的 `DEJAVU SANS` 用例修前失败、修后通过,ElyDoc 单线程 55 项通过;Arch 容器装 0.1.5 包与 simsun.ttc:修前报缺宋体,正文实为 SimSun,一页;换上新内核不再报缺,仍一页。一页变两页未能复现,需报告者的文件 — 第 1 轮 PASS) - [ ] R7.4 打开 PDF 总说已损坏(#5,§11):画图块时 MuPDF 的任何警告都算损坏,未嵌入的中日韩字体(“non-embedded font using identity encoding”)即触发;损坏只认结构修复、读不出的对象与流、画不出的图片与内容 - [ ] R7.5 ElyMark 打开的正文块变成一块深色框(§14,用户定):按下的段落保持原样,不加底色与内边距,不挪位置;代码块仍有自己的底板 - [ ] R7.6 Windows 与 Linux 不能打印(#3,§19.3):`print_pdf` 只有 macOS;Windows 用系统打印对话框,Linux 经 xdg 桌面门户的打印接口 diff --git a/tasks/reviews/R7.3-r1.md b/tasks/reviews/R7.3-r1.md new file mode 100644 index 0000000..7ef22e9 --- /dev/null +++ b/tasks/reviews/R7.3-r1.md @@ -0,0 +1 @@ +PASS