mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-20 23:57:11 -04:00
[PR #284] [CLOSED] add cyrilic and other fonts via roboto-mono #297
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/vxcontrol/pentagi/pull/284
Author: @vchaplygim
Created: 4/23/2026
Status: ❌ Closed
Base:
main← Head:fix/pdf-cyrillic-fonts📝 Commits (1)
fa4a04dadd cyrilic and other fonts via roboto-mono📊 Changes
9 files changed (+26 additions, -4 deletions)
View changed files
➕
frontend/public/fonts/Inter-Bold.ttf(+0 -0)➕
frontend/public/fonts/Inter-BoldItalic.ttf(+0 -0)➕
frontend/public/fonts/Inter-Italic.ttf(+0 -0)➕
frontend/public/fonts/Inter-Regular.ttf(+0 -0)➕
frontend/public/fonts/RobotoMono-Bold.ttf(+0 -0)➕
frontend/public/fonts/RobotoMono-BoldItalic.ttf(+0 -0)➕
frontend/public/fonts/RobotoMono-Italic.ttf(+0 -0)➕
frontend/public/fonts/RobotoMono-Regular.ttf(+0 -0)📝
frontend/src/lib/report-pdf.tsx(+26 -4)📄 Description
Description of the Change
Problem
PDF reports render Cyrillic (and other non-Latin) characters as mojibake. The
report-pdf.tsxused built-in PDF fonts (Helvetica for body text, Courier for code blocks), which use WinAnsiEncoding — a 256-character encoding that cannot represent Cyrillic. Code points above U+00FF get truncated tocharCode & 0xFF, mapping Cyrillic characters to ASCII (e.g., "пентест" → "?5=B5AB").The repository already contained Inter and Roboto Mono fonts (woff2 format) with their licenses, but they were never wired up in the PDF renderer.
Solution
@react-pdf/rendererusesfontkitinternally which does not support woff2 in browser environmentsreport-pdf.tsxto register these fonts using full absolute URLs (window.location.origin + path), which is necessary because theis-urllibrary used internally by@react-pdf/fontrejects relative paths and silently falls back to HelveticaThe woff2 files and license files already present in the repository are unchanged.
Closes #
Type of Change
Areas Affected
Testing and Verification
Test Configuration
PentAGI Version: latest
Docker Version: 27.x
Host OS: Ubuntu 24.04
LLM Provider: any
Enabled Features: none required
Test Steps
Test Results
Before fix: Cyrillic characters rendered as mojibake (e.g., "?5=B5AB" instead of "пентест")
After fix: Cyrillic characters render correctly in all text elements (headings, paragraphs, code blocks)
Security Considerations
No security implications. Font files are served as static assets from the same origin.
Performance Impact
Font files are fetched once and cached by the browser. Total additional asset size: ~1.7MB (4× Inter TTF + 4× Roboto Mono TTF).
Documentation Updates
Deployment Notes
No special deployment steps required. Font files are included in the Docker image under the frontend static assets directory.
Checklist
Code Quality
Security
Compatibility
Documentation
Additional Notes
Font licenses are already present in
frontend/public/fonts/:OFL.txt)LICENSE-Apache-2.0.txt)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.