Skip to content

danieldreke/pdf-font-inspector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

PDF Font Inspector

Claude

Inspect embedded fonts in PDF files — browse font subsets, view glyphs, check character coverage.

alt text

Features

  • Font list — all fonts embedded in the PDF shown as tabs; each tab shows the font name and glyph count
  • Embedded Glyphs pane — renders every glyph using the actual font outlines extracted from the PDF
  • Character coverage pane — visual grid showing which characters are present (green) or missing (red)

Requirements

# Install dependencies on Debian/Ubuntu:
sudo apt install python3-gi gir1.2-gtk-3.0 python3-cairo gir1.2-pango-1.0
pip install pymupdf fonttools
  • Python 3.12+
  • GTK 3 + GObject introspection (python3-gi, gir1.2-gtk-3.0)
  • PyMuPDF (pymupdf)
  • fontTools (fonttools)
  • Cairo + PangoCairo (python3-cairo, gir1.2-pango-1.0)

Usage

# Open the app
python3 pdf_fonts.py
# Open the app with file.pdf
python3 pdf_fonts.py file.pdf

Open a pdf via button Open PDF or drop it onto the app. Click on font tabs to view a font's subset glyphs and its character coverage.

How it works

PDF fonts are subsets that contain glyph outlines but no unicode mapping — that lives separately in the PDF as a ToUnicode CMap stream. This tool:

  • Parses this stream to build a glyph-to-codepoint map
  • Extracts raw font bytes from the PDF using PyMuPDF
  • Loads these bytes into fontTools to get glyph outlines
  • Renders these outlines directly with Cairo

About

Inspect embedded fonts in PDF files — browse font subsets, view glyphs, check character coverage.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages