O sua dung FONT NHUNG cua PDF (FontFace): het "mat in dam" do may thieu font
Build Windows portable / build (push) Canceled after 0s

User bao: chu mono von in dam (NotoSansMono-Bold), mo o sua thi "ve chu
thuong". Chan doan bang CSS.getPlatformFontsForNode: span da co
font-weight:700 dung, nhung may khong cai font cua tai lieu nen WebView thay
the — mono roi ve Consolas-Bold (net manh hon han NotoSansMono-Bold, nhin
nhu khong dam), chu thuong roi ve Arial.

Fix WYSIWYG font that:
- Engine: ff_engine::font_data(input, page, index) — bytes font nhung (sau
  giai nen) cua 1 text run, index PHANG nhu list_objects (vao duoc run trong
  Form XObject).
- Tauri: command edit_font_data tra base64.
- UI: nap luoi theo TEN font khi loadEditPage (dedup, 1 lan/font), dang ky
  FontFace voi weight/style theo run (khong synthesize chong), dat family
  nhung LEN DAU stack cua div/span trong o sua; glyph thieu trong subset tu
  roi xuong stack he thong; doi phien sua thi bo face cu (subset khac
  coverage). Loi (font khong nhung/khong parse) -> giu stack cu.

Smoke test tren app that (CDP): FontFace tu ArrayBuffer + gan vao span mono
=> getPlatformFontsForNode tra isCustomFont:true. E2E day du sau build CI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-10 11:02:27 +07:00
co-authored by Claude Fable 5
parent c885567b26
commit f2ebf2deff
4 changed files with 110 additions and 3 deletions
+11
View File
@@ -703,6 +703,16 @@ fn edit_list_objects(path: String, page: u16, password: Option<String>) -> Resul
.collect())
}
/// Bytes font NHÚNG của 1 text run (base64) — UI đăng ký FontFace để ô sửa
/// hiển thị đúng font tài liệu thay vì font hệ thống gần giống.
#[tauri::command]
fn edit_font_data(path: String, page: u16, index: u16, password: Option<String>) -> Result<String, String> {
let pdfium = pdfium()?;
let data = ff_engine::font_data(&pdfium, std::path::Path::new(&path), page, index, password.as_deref())
.map_err(|e| e.to_string())?;
Ok(base64::engine::general_purpose::STANDARD.encode(&data))
}
/// 1 thao tác sửa nội dung (tagged theo field `op`). Field thừa cho mỗi loại để None/mặc định.
#[derive(serde::Deserialize)]
#[serde(rename_all = "camelCase")]
@@ -1424,6 +1434,7 @@ fn main() {
preview_watermark,
preview_header_footer,
edit_list_objects,
edit_font_data,
edit_apply,
edit_apply_to_temp,
edit_preview,