Fix tang coverage cua SetText: chi ap dung cho font NHUNG - voi font khong nhung, PDFium moi tra bytes cua font he thong thay the (phu du glyph Viet) lam engine tuong set_text an toan, nhung font object WinAnsi trong PDF khong ma hoa duoc -> ra ky tu rac. Bug tiem an tu iteration 2, lo ra khi CI dung DLL bblanchon moi (may dev cu DLL cu khong tra data cho font khong nhung).
Build Windows portable / build (push) Canceled after 0s

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-08 02:40:51 +07:00
co-authored by Claude Fable 5
parent 8c6a819aa8
commit b457c86d4f
+7 -1
View File
@@ -754,12 +754,18 @@ pub fn apply_edits(
SetTextMode::InPlace SetTextMode::InPlace
} else if non_embedded && ascii_only { } else if non_embedded && ascii_only {
SetTextMode::InPlace SetTextMode::InPlace
} else if t } else if !non_embedded
&& t
.font() .font()
.data() .data()
.ok() .ok()
.map_or(false, |bytes| fontmatch::coverage_ok(&bytes, text)) .map_or(false, |bytes| fontmatch::coverage_ok(&bytes, text))
{ {
// Tầng coverage CHỈ cho font NHÚNG: với font không
// nhúng, PDFium (bản mới) trả bytes của font HỆ THỐNG
// thay thế — phủ đủ glyph không có nghĩa font object
// trong PDF (simple font WinAnsi) mã hoá được text
// mới; set_text khi đó ra charcode rác (ÿ).
SetTextMode::InPlace SetTextMode::InPlace
} else { } else {
let (key, bytes) = resolve_substitute_font( let (key, bytes) = resolve_substitute_font(