Back to KDE Community
GSoC 2026

Implement font subsetting when saving PDF files in Poppler

Poppler (The C++ PDF rendering library used by Okular) does not support font subsetting as of now. In simple terms, if someone creates an annotation containing content "hello" with font Cantarell then the embedded font object inside the PDF will contain mappings for a lot of characters other than 'h', 'e', 'l' and 'o'. This leads to unnecessary increase in size. This project aims to solve this problem. My approach is to implement font subsetting by:- - Parsing appearance streams and default appearance of all modified annotations/forms on save, and build a structure containing key-value pairs of (fontname, ref) and the characters to be rendered with that font. - Another class consumes this structure, uses Harfbuzz to generate subsetted fonts, and replace the old font objects with the new ones.

Project details

Contributor

Ojas Maheshwari

Mentors

Not available

Technologies

Not listed in the archive