Repository navigation
Conversation
A character the standard fonts can't draw and the face supplied through pdfcraft_fonts::set_document_korean_font can is shaped with that face and drawn as Type 3 outlines with a ToUnicode map, like Thai, Arabic and Hebrew. No font is built in or committed; without a supplied face nothing changes.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
|
I checked the added test and the Korean routing/shaping path. The test uses Inter with U+0150, so it covers non-WinAnsi routing through the supplied face, but not Hangul; its One API/headless point: For comparison, the open #2560 already adds craft-fonts-backed Korean Add-text tests, including a saved-PDF ToUnicode assertion, so it may be useful to compare the coverage and coordinate overlapping |
RevisãoLGTM — Add text passa a shapear Coreano (Hangul) quando os fonts padrão não desenham, como já faz com árabe/hebraico/tailandês.
|
Korean in Add text, drawn with an embedder-supplied face
We embed PdfCraft's PDF window in a Korean web app (the wasm build). Add text currently refuses Hangul ("The PDF text fonts can't draw “ㅇ” (U+3147)"), so Korean users can't add a single word to a PDF.
This draft adds a Korean face slot that follows the Thai / Arabic / Hebrew path exactly:
pdfcraft_fonts::set_document_korean_font(&'static [u8])lets the embedding app supply a face once (first one wins; unreadable bytes are refused). Nothing is built in and no font file is committed, so AGENTS.md section 1.4 stays intact. We pass an OFL-1.1 face (Pretendard) from our own app.ShapedScript::Korean,korean_has,shape_korean(harfrust,script::HANGUL, grapheme clusters).korean_drawn) is shaped with that face and drawn as Type 3 outlines with a ToUnicode map, like the other shaped scripts. The face file is never embedded; only the glyphs used are drawn. Line wrapping,first_undrawableand the apply-time check use the same rule.Test
crates/edit/tests/korean_face.rsruns in its own binary because the face is process-wide. Inter stands in for a Korean face (U+0150 takes the same path as Hangul): refused before, drawable after, written as Type 3, and read back bylist_addedwith the same text.cargo test -p pdfcraft-edit -p pdfcraft-fontspasses locally.We have shipped the same change on the 64e0868 base in our app, and checked a saved PDF: the text renders, and copying it returns the original Korean.
Questions for you
Korescript face) as the built-in source, with this setter only as an embedder override? We're happy to rework it that way.