PDF export: font in "Default Appearance" string

I have a .odt file that I’m using as a “blank” table of contents page. It’s not really blank, though: it has a number of form fields that, once I export as PDF, I intend to use pypdf to locate and fill with text that I specify. I have set the default font for each of these form fields (in the “Control Properties” dialog) as Calibri, bold, size 14.

When I export this .odt file as .pdf and open it in my viewer of choice (PDF-XChange) I can see that the Calibri-Bold font is embedded in the file. Notice that Helvetica-Bold is also listed, although I have not used it anywhere in this document - this seems significant, for reasons we’re about to see.

Once I run my script to fill these fields, the resulting text is filled as Helvetica, bold, size 14. Below is what I see when I open the filled PDF in LibreOffice Draw.

My intent is that the text would be filled in whatever font was specified for that field in Writer before exporting, so I need to understand why it is not. According to ChatGPT (I know, I know…) this is most likely because the “Default Appearance” (or “/DA”) string in the PDF is set to use Helvetica, so pypdf fills the fields accordingly. This seems to have some merit, as not only does Helvetica-Bold appear in the PDF properties (where it is not called out as “Embedded”), but also when I open the blank PDF in Notepad++, I see a number of widget objects containing the string /DA that specify “HeBo 14” - which I assume refers to Helvetica, bold, size 14.

For now, I am assuming this “Default Appearance” string is, in fact, the culprit. And I have noticed that when I change the form fields’ font setting (in “Control Properties”) to Calibri, bold, size 12, the filled PDF comes out with text in Helvetica, bold, size 12. Clearly, the exported PDF is aware of the these fields’ font settings, since they appears to control the size - but, for some reason, the typeface is not similarly controlled.

In case it matters, the program-wide default font is neither Calibri nor Helvetica - it’s Liberation Serif.

How do I configure my .odt file, or the form fields therein, so that the “Default Appearance” string in my PDF is set to what I want?

Actually this is by design with the PDF Form export. Only the 14 “Standard” PDF fonts (those “guaranteed” to be available by any compliant PDF viewer) are used for LO published PDF forms.

Change your form’s source document to use one of the 14 “standard” fonts, and it should be fully functional.

See tdf#50879 or its related commit in gerrit for reasoning and implementation.

Thanks for that. And in reading the comment thread for that bug, I think it dawned on me why Calibri is described in the PDF properties as an “embedded subset.” Is it that LibreOffice is only embedding the characters from that font that I inserted prior to exporting the PDF? If so, then the form wouldn’t have the necessary characters at its disposal to render whatever input the user of that form might enter - only a full font could do that.

Welp, okay. I guess the good news is that Calibri is visually similar to Helvetica/Arial, so I guess I’ll just roll with it.