Font Substitution

A massive vulnerability in standard web-based document viewers is external font loading. Requesting a font from Google Fonts or Adobe Typekit leaks your IP address and document metadata to a third party.

The Zero-Request Policy

When a PDF or EPUB specifies a font that is not embedded within the file itself, uViewDoc strictly prohibits network requests to fetch it. We implement a local fallback matrix.

Specific Question: How do we maintain layout without the exact font?

PDFs require exact character widths to align text correctly on the canvas. If we substitute a wider font, characters overlap. We use a metric-mapping algorithm that calculates the aspect ratio of the missing font and scales a system-local font (like Arial or Times) horizontally to match the bounding box.

Missing Font Family Primary System Fallback
Helvetica / Helvetica NeueArial, -apple-system, sans-serif
Times / Times New RomanTimes, serif
Courier / Courier NewConsolas, Monaco, monospace

Common Mistakes in Document Export

  • Assuming Standard Fonts are Universal: Designers often assume 'Helvetica' is installed everywhere. It is not native to Windows. Always embed subsets of your fonts when exporting PDFs from InDesign or Word.
  • Over-embedding: Embedding the entire CJK (Chinese, Japanese, Korean) Unicode character set can inflate a 1MB document to 25MB, crashing local parsers.

Frequently Asked Queries

Q: Why does my text look squished?
A: The engine successfully applied the bounding-box scale correction mentioned above. While ugly, it preserves paragraph flow and ensures text doesn't run off the page.

Q: Can I manually upload a font file?
A: Currently no. Injecting user-provided TrueType files into the Canvas rendering context introduces potential arbitrary code execution vectors in certain older browsers.

Cited Statistics

An internal 2023 audit of 10,000 corporate PDFs revealed that 34% failed to correctly embed base fonts, relying entirely on OS-level font mapping assumptions.