Change fallback font when converting docx to pdf

I currently have a docx which has some text with a specific font(John Handy LET) but it doesn’t embed said font into the document nor is it installed on my os.

So upon converting the docx to pdf, I get a totally different font output on the pdf.

Is there a way to change default font in libreoffice ? I’ve noticed there is a font replacement table, but is there a way to say: For any missing font → use this font ?

Ultimately, I would need to configure it on command line. But to start, it can be in the GUI.

Importing a .docx into Writer creates a real mess style-wise because the two applications are based on different primitives.

IF your Word document has been consistently paragraph-styled, changing a missing font can be done in the style definition(s). In Writer, paragraph styles are organised hierarchically, so changing the font in one or two key styles can do the trick. I don’t know if this hierarchy is still valid when the source is a .docx.

But if some words have undergone a font change, this can’t be handled automatically because Word has no notion of character style.

Trying to fix a .docx problem with Writer is liable to meet many compatibility issues.

Well I don’t need to go back and forth between word and Writer, I just use writer to output a PDF, then the docx gets discarded.

Only thing is when a font is missing, it seems both Word and Writer have each their own default fallback font.

And I would like to change this default fallback font, since I don’t know in advance what font will be referenced in the .docx, yet missing on the os and not being embedded in said .docx

You didn’t mention your OS. Usually, you can configure a “virtual” printer to print into files in PDF format. This would be the simplest solution.

Also, you didn’t characterize the fallback font so that it would be possible to relate it to some configuration parameter. Totally in the blue, I suggest you change the font faces in Tools>Options, LibreOffice Writer>Basic Fonts (Western).

Another try (to change the compatibility issues) would be to output an .odt out of Word (yes, it can do it) and see if the fallback is different.

For the OS it’s an alpine 3.10. As for the virtual printer, would this work without a GUI ? I don’t have any x server. I intend to be doing these conversions on a php server.

The fallback font I would like to use would be Times New Roman.

Also after testing the replacement table, I get the output result I want except that I have to know in advance which font I want to replace. Would it be possible to specify that any missing font should be replaced with Times New Roman ?

I haven’t answered to your last question (already asked in the initial post) because I have no definitive answer.

The substitution table is not the solution because it requires to designate a specific font face. This is why I suggested to look at Basic Fonts (if defaults are taken from there).

My Linux system has a “Print to file” printer. I don’t remember if I installed it manually or if it comes as a default (Fedora 33). It creates a PDF.

I looked for it among the installed packages but couldn’t easily find it. It is independent from CUPS. A cups-pdf package exists for the same function but this would need to install CUPS also. I think there should be a command line to access this file-printer.