fix: PDF Unicode font + malformed Markdown fallback#34
Draft
lklimek wants to merge 2 commits into
Draft
Conversation
QA-004: register a Unicode TrueType font (DejaVu Sans by default, with bold/italic/mono siblings via pdfmetrics.registerFontFamily) so emoji and non-Latin scripts (Cyrillic, Arabic, CJK ranges that the chosen face supports) render correctly in PDF output instead of as tofu boxes. Discovery order: $CLAUDIUS_PDF_FONT env override -> bundled scripts/fonts/DejaVuSans.ttf -> common Linux locations (/usr/share/fonts/truetype/dejavu, /usr/share/fonts/truetype/noto). Falls back to Helvetica/Courier with a stderr warning when no TTF is found -- never crashes. QA-005: render_markdown_to_reportlab() now wraps the Markdown -> HTML -> ReportLab pass in try/except. On parser failure, mini-XML rejection, or any other exception it logs a warning and falls back to a single XML-escaped preformatted block containing the raw source so no content is silently swallowed. Bumps plugin.json patch version (3.14.0 -> 3.14.1) and adds an [Unreleased] CHANGELOG entry. The version bump may need reconciling if another concurrent change also bumps the patch level -- pick the next free patch at merge time. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scripts/generate_review_report.pynow auto-discovers a Unicode TrueType font viapdfmetrics.registerFont/registerFontFamily. Discovery order:$CLAUDIUS_PDF_FONTenv override -> bundledscripts/fonts/DejaVuSans.ttf-> common Linux paths (/usr/share/fonts/truetype/dejavu,/usr/share/fonts/truetype/noto). ParagraphStyles now flow through anFdict so emoji and non-Latin scripts (Cyrillic, Arabic, Hebrew, etc.) render instead of tofu boxes. Falls back to Helvetica/Courier with a stderr warning when no Unicode TTF is available -- never crashes.render_markdown_to_reportlab()is now wrapped in try/except. On any failure (parser exception, ReportLab mini-XML rejection, unclosed fence, etc.) it logs a warning and falls back to a single XML-escaped preformatted block containing the raw source -- content is preserved, never silently swallowed.Bundled CJK / emoji-color TTFs are out of scope for this PR -- DejaVuSans covers Latin + Cyrillic + Greek + a useful subset of symbols. Users who need full CJK or color emoji can drop a TTF anywhere on disk and point
CLAUDIUS_PDF_FONTat it.Test plan
render_markdown_to_reportlabfallback (malformed input -> escaped pre-block, no exception bubbles)🤖 Co-authored by Claudius the Magnificent AI Agent