How to change font family, not size, not italics, underline, etc

I have 240 Writer docs created in windows-7. I’m migrating them to Fedora-35. But the fonts used in windows-7 are not available in Fedora-35. Here is what I want to do:

  1. Change all “Times New Roman” to “Liberation Serif” without changing any sizes, without changing regular vs. italic vs. underline vs. bold.
  2. Change all “Vivaldi” to “Z003” without changing any sizes, without changing regular vs. italic vs. underline vs. bold.
    How do I do this in Fedora-35 for all 240 docs?

Try:

Tools>Options>LibreOffice>Fonts menu.
Put a check mark at “Apply replacement table”.
At “Font:” manually enter the font you want to replace.
Select the desired font at “Replace with:”.
Click OK.
Test a few documents.

! Make copies of your files bevor.


I have not tested it.

1 Like

You might be interested in this off-site page on installing Microsoft core fonts, How to Install Microsoft Fonts on Ubuntu Linux [Easy Way]

That could work for Times New Roman but I don’t think Vivaldi is a core font

1 Like

Thank-you. But I already know how to change fonts in a single document. What I need to know is how to make the same font changes in each of 240 documents all at once without manually doing each file one-by-one.

If the only option is to do them one-by-one manually, then it would be helpful to know that.

This is an unusual situation in that installing fonts is not an option.

This is an unusual situation in that importing/installing new fonts is not an option. I must work with what is already on the workstation.

What I need to know is how to make the same font changes in each of 240 documents all at once without manually doing each file one-by-one.

If the only option is to do them one-by-one manually, then it would be helpful to know that.

Do you need to change the font?

Or, as @Hrbrgr suggested, to replace it with a chosen substitute “when it is displayed on screen or during printing.”? See help Fonts

Note that Writer is already substituting Times New Roman with Liberation Serif on screen and in print if Times New Roman is not installed.

2 Likes

The documents were created on a windows-7 box using “Times New Roman” and “Vivaldi”.
They have been migrated to a Fedora-35 (Linux) workstation. It has neither “Times New Roman” nor “Vivaldi”. Some day in the future (I don’t know when), the documents will be migrated to some as yet unknown workstation witth as yet unknown operating system and fonts. Strict requirements:
I must use the fonts that come with Fedora-35 and/or LibreOffice by default. So…

  1. no font migration allowed.
  2. no font installation allowed.
    Further…
  3. No size changes.
  4. No changes in regular vs. italic vs. bold vs. underline allowed.
  5. The same font changes must be made in each document. Specifically, all “Times New Roman” must be changed to “Liberation Serif”, and all “Vivaldi” must be changed to “Z003”.
  6. The font changes must be permanent.
  7. Both the display and printouts must show “Liberation Serif” and “Z003”.

I have 240 of these documents needing the font changes. I recall in the good 'ol days that shell scripts would be written. They would loop through a list a files and use Linux/Unix commands like “ed”, “sed”, “ex”, and others to edit each file. I’m looking for something like that. Pseudo-code:

do for each LibreOffice Writer document in directory "my_docs"
   open the doc
   change all "Times New Roman" to "Liberation Serif"
   change all "Vivaldi" to "Z003"
   save the doc
end do
exit

That is what I need and am asking for. If the only way to change the documents is to manually do each one separately, then say so. I already know how to manually make the font changes in one document within an interactive LibreOffice Writer session.

I need to come back to this.

Each document (one 2-sided page) has 4 frames and 6 text boxes (1 or 2 per frame). I cannot find a way to select an entire document, nor can I select everything in a frame (the selection leaves out the text boxes). Am I really stuck making 10 selections and font changes in every document?

How can I actually change the font for the entire document in one shot?

With Paragraph Styles you just need to modify the font in the parent style (often Default Paragraph style) to change the font in all the child styles, except the ones which have had the font changed in which case you change the font there. Job Done. Even easier using allittoz answer, just change one document

I know you haven’t used styles because you have text boxes and they don’t support styles. Worse the contents of text boxes (they are drawing objects) don’t appear to be searched during Find & Replace. In Writer never use Text Boxes, always use Frames.

You can use Find & Replace to modify the font in the majority of your document but not Textboxes.

  • Click Edit > Find & Replace. Make sure all the boxes are unticked
  • Click in the Find field then click Format button.
    • In the new dialogue that opens select the Font tab.
    • Under Western Text Font select Times New Roman. OK
  • Click in the Replace field then click Format button
    • Under Western Text Font select Liberation Serif. OK
  • Click the button Replace All

But then you still have a problem of direct formatting and unmodified text boxes. As you are expecting to reuse these documents in other systems I would consider creating styles and applying them to your documents, rigidly following them. Also replace the text boxes with Frames which also support styles.

There is a useful chapter on styles in the Writer Guide free download at English documentation | LibreOffice Documentation - LibreOffice User Guides

1 Like

Pseudo-code:

cd my_docs
soffice --convert-to fodt *.odt
sed -i 's/Times New Roman/Liberation Serif/g; s/Vivaldi/Z003/g' *.fodt
soffice --convert-to odt *.fodt

Indeed, it will break if your documents contain “Times New Roman” or “Vivaldi” in text.

1 Like

Thank-you.
Mike Kaganski’s most recent post has the solution. But thanks to your post, I easily figured out how to determine whether or not the document contains Chinese characters (a few do).

I took a quick look at the User’s Guide chapter that you referenced. I definitely need to study that for the future. The documents I’m working on now were originally created with windows-7 microsoft office-2010 writer some 7 years ago. These documents were converted to LibreOffice in April and May (a long and tedious chore). The current phase of the project is converting the fonts.

I also need to learn templates, as ajlittoz suggested.

Hmmm…
This solution looks sed-itious!
:grinning:

Started trying it with just one document first.
Discovered that there were a few Chinese characters in it.
After figuring out the original and desired font names for Chinese characters, it was easy to adapt your suggested solution.
It tested out successfully both on a document with Chinese characters and on a document with no Chinese characters.
I have now successfully converted the fonts all 240 documents.

Thank-you, Mike.

For the future (unless you have enough patience to “patch” your existing documents), base your documents on a personal template.

Changing styles in the template is automatically forwarded to dependent documents.

Note it could pay off to force a template on your files using Template Changer extension.

2 Likes

Templates:
Definitely something I need to seriously learn in the future.
I often use an existing document as a starting point for a new one. I did not know about templates in the sense that you’re referring to.

Thank-you.