Substituting fonts in a document permanently

There are lots of articles about using the font substitution table to replace missing fonts with different ones on the screen or in print, but the original font name remains in the document.

That is not what I want to do. I want to actually change the font name every time it appears in the document. Basically like search and replace, except with font names instead of text. Is there a way to do that?

Thanks!

If the document has proper styles then it is just a matter of changing, probably, the Default Paragraph Style, Heading Style, or Index Style and the change will propagate through the child styles, such as Text Body, Heading n, or Contents.

If it is just a single paragraph style the you could change the font in that but it might cause some issue with paragraph styles below it.

There is a possibility that just some words have a different Character style, changing the font in the relevant character style should update all instances.

The exception to the above is if any text has had direct formatting applied to it, that will over-ride any styles. Direct formatting can be removed in a selection by pressing Ctrl+M

You wouldn’t have asked the question if you were using styles however so probably the document is direct formatted. In that case you would need to use Edit > Find and Replace (Ctrl+H).

  • Click in the Find field to select it. Then click the Format button and select the font that you want removed, e.g. Calibri, and click OK

  • Click in the Replace field to select it. Click the Format button and select the font that you want to use as a replacement, e.g. Carlito, and Click OK

  • Click the Replace All button

1 Like

You are correct that the document is (mostly) direct formatted. It’s an old document that has been maintained by several different people over the years, and I don’t think any of us have been experts in LibreOffice.

Your tip worked beautifully for everything that was direct formatted, which was most of it!

There is some occasional use of styles, and I haven’t been able to change the font in them. There is a style called “Table Contents”, and the text in that style is showing up as “Times New Roman” (italicized, since that font does not exist). I went to “Styles > Edit Style…” and set the font to “Liberation Serif” and hit “OK”. However, the text in the document that has the style “Table Contents” is still showing up as “Times New Roman” (italicized). What am I doing wrong?

I hope this description can help you:
Professional text composition with Writer

You can remove direct formatting from your document by selecting all the text with the keyboard shortcuts (Ctrl+A) and then choosing Format â–¸ Delete Direct Formatting, (Ctrl+M).

Also check character styles that is above paragraph styles in the hierarchy.

No, that would just delete most of the formatting of my document, since nearly all of it is direct formatting. The find-and-replace tip that EarnestAI gave me is what I needed for the direct formatting.

Think before you remove all direct formatting, because this looses the information in formatting. So keep a backup.

I’d suggest to search for the font/formatting as above, so you can have all places marked. Then assign a (temporary) style to all found locations.

After replacing direct formatting by styles delete direct formatting.
Now check, if you need to reorganize some styles.

Depending on your doc, a clean start may be the better approach. But that step is always possible.

I’m definitely not going to remove direct formatting at this time. Right now I’m just trying to change the fonts, not completely overhaul the document. If I was going to get a clean start, I would probably start over in something like TeX, where all the formatting is out in the open, rather than hidden behind a GUI. But that is out of scope for now.

Really, EarnestAI’s tip fixed 95% of my problem. I just can’t figure out how to change the font of the one non-default style that is used, “Table Contents”. That’s what I’m looking for now.

If changing font in Table Contents does not change the displayed appearance, you then have either a character style in force over the base paragraph style (but this seems unlikely according to your description) or an extra direct formatting which overrides everything.

To make sure, select a single Table Contents paragraph and Ctlrl+M. If this fixes the case, repeat on all paragraphs. Otherwise Ctrl+Z to restore direct formatting.

something like TeX, where all the formatting is out in the open, rather than hidden behind a GUI

Wrong, Writer formatting is “hidden” behind a GUI only when you direct format. With full styling, nothing is “hidden”. Cursor-location applied styles are highlighted in the side style pane to tell you which is the current one (you might need to alternate between paragraph and character style lists to get a full picture). Styles separate formatting from contents so that you only tune your styles without caring for text. On the contrary, direct formatting is embedded in text and is not visible other than by its effects.

I think you need to change the Paragraph style Index

@Earnest Al: Table Contents has nothing to to with TOC; it is a style implicitly applied when you create a table. It depends only on Default Paragraph Style and has a child Table Heading.

So changing Index will have no effect on it.

Whoops. I misread an of in there. I never realised how closely named they were.

@Earnest Al: there also many other badly chosen names in the Writer zoo :wink:

Thanks, the Ctrl-M fixed it. I don’t understand why, though, because I had already done the search-and-replace to change all direct-formatted “Times New Roman” to “Liberation Serif”. So if the “Table Contents” paragraph was direct-formatted to “Times New Roman”, I don’t understand why the search-and-replace didn’t change it, like it did everything else.

Direct formatting is a mystery land. It is not your friend at all and always plays tricks on your back. Newbies think it is “intuitive” because Word has no other way to do many things but DF occurs at many levels in ODF encoding. So you are never sure which layer Find & Replace will hit.

The only safe and reliable way to format a document is through styles and only styles. Don’t direct format anything. Contrary to common sense, direct formatting requires guru skills to get it right. So learn styles and practice. This is your life jacket in the tempest-prone ocean of formatting.

Even if your document is huge, it looks like you’re trying to “maintain” it (making sure it can be read by newer versions of Writer, perhaps having it portable between suites, editing it, amending it, …), styling it is worth the trouble. By experience, you need ~10 user paragraph styles + Heading n family, ~10 character styles and a small handful of page styles. If you have lists, consider creating your list styles (or generally customising at most 2 built-in styles is enough) instead of relying on Format>Bullets & Numbering which another kind of hidden direct formatting (and very very nasty on you). And with pictures or other “inserts”, go for frame styles (2-3 are enough).

The more you style the document, the more you automate it and it becomes more and more resilient against editing (which can mode unexpectedly whole bunches of text and images).

That definitely seems to be the case. I’ve found multiple other places where the text is formatted in “Times New Roman” and search-and-replace won’t find it. (So it had nothing to do with the “Table Contents” style. It was just random places with direct formatting that “Find and Replace” didn’t find.

Yes, I see the long-term benefit, but it’s a big task. And it gets back to my pet peeve about ODT not being a text-based format. With a text-based format, I could write a script to recognize certain font/size combinations in direct formatting and convert them into styles, rather than having to do all that manually.

(Yes, I could unzip the .odt and then write a script to operate on the XML, but the XML looks very verbose and non-intuitive. I’ve looked at the documentation for ODT, and although every XML tag is documented individually, there is no documentation on how the tags actually work together to form a document.)

It’s unfortunate that so many of the toolbar buttons use direct formatting. If direct formatting is really so bad, it should be hidden away in a menu where it’s harder to find.

Remember that 99% of users never read the manual nor even use Help>LibreOffice Help. And what they call “intuitive” really means “immediate action”.

You can’t hide direct formatting very deep lest your audience shrinks to nothing. Note also that M$ Word encourages direct formatting because it has no other tools (no character style, no page style, no frame style, no list style) and Word is considered the absolute reference for average Joe’s document processing (learned people use TeX as a reference).