[Interest] Embedded Font in PDF

Lars Knoll lars at knoll.priv.no
Fri Aug 11 13:50:29 CEST 2023


The PDF font embedding is something that I’ve implemented quite a few years ago, and I believe the code has been mostly unchanged since then.

The reason it doesn’t look quite as many tools might expect it to has to do with how Qt uses a ‘virtual’ font to render text that can consist of a list of many physical true type fonts. That was a hard requirement back then to get text rendered in different languages although most fonts (esp. on Linux back then) only covered one or two writing systems. The situation is of course much better today where most fonts have a decent coverage of various writing systems, but is still needed in some cases (e.g. to correctly render emojis)

Anyway, Qt does honour embedding and subsetting restrictions specified in the true type font file and not embed font data if embedding is not allowed. If only subsetting is not allowed Qt will embed the font as a whole.

Cheers,
Lars

> On 11 Aug 2023, at 12:12, Sune Vuorela <nospam at vuorela.dk> wrote:
> 
> On 2023-08-10, Zander <zander.mostrova at gmail.com> wrote:
>> For some reason the font “chosen” by Qt is Tahoma, nowhere in my code do I
>> specify a font.
>> When viewing the pdf in Adobe reader I noticed that Qt embedded a subset of
>> Tahoma: "*Language parts made red for privacy"*
>> [image: tahoma.png]
>> <https://ddgobkiprc33d.cloudfront.net/4a771dc9-c091-4efc-851f-b73adaabbab5.png>
>> 
>> The weird thing is that pdffonts (part of the Poppler library) indicaties
>> that the font is completely embedded.
> 
> Qt is embedding fonts into pdf's in a slighly bizarre, but likely still
> standards compliant way.
> 
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1036585
> 
> /Sune
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest



More information about the Interest mailing list