← All posts

Why the font changes when you edit text in a PDF

You changed one date in a contract. The date is now in a different typeface from the rest of the line — a plain grey sans-serif where everything around it is the company's own font. Or the letters are the right shape but the spacing has gone loose, and the line ends a few millimetres further right than it did. Or the apostrophe you typed came out as a hollow box.

Nothing you did caused it, and turning the change off and on again will not fix it. The editor was never able to type in that font, and it did not tell you.

Here is what is actually happening inside the file, which is worth two minutes because it also tells you which of three quite different problems you have.

Why the typeface changes

A PDF does not name a font and hope your computer has it. It carries the font program inside the file. But carrying a whole typeface is expensive — a full Unicode face is megabytes — so almost every producer embeds a subset: only the glyphs the document actually draws.

You can see this in the font's name. Open any PDF's document properties and look at the font list: you will find entries like ABCDEF+Calibri. That six-letter prefix is the subset tag. It means "this is not Calibri, it is the twenty-nine characters of Calibri this file needed".

So when you retype a word, you are asking a mini-font to draw characters that may simply not be in it. Your document used lower-case letters and full stops; you typed a capital Q, a euro sign, or a curly apostrophe that Word inserted for you. The file holds no shape for it.

At that point the editor has to substitute, and it substitutes the whole run rather than the one character, which is why a single apostrophe can change the look of a line you had otherwise typed correctly. Which characters do that, and why the test is all or nothing, are set out in why typing in a PDF changes the font mid-line.

The second cause: the font was never in the file

Some PDFs embed nothing at all. The fourteen standard fonts — Helvetica, Times, Courier and their relatives — may be referenced by name with no font program attached, and so may fonts a badly configured export left out. Whatever program opens the file picks something local that looks close.

If this is your file, the substitution was happening before you touched it. Your machine drew Arial for Helvetica, the recipient's drew something else, and the document has never had a fixed appearance. Editing did not break it; editing just made you look.

The third cause: your editor never used the font at all

A great many browser "PDF editors" do not change the text in the page. They draw a white rectangle over the old words and paint new words on top in one of a handful of fonts they ship, or they add the new words as an annotation floating above the page.

The symptoms are recognisable. The replacement sits a point or two off the original baseline. The old text is still there — select across the patch and it copies out. Print from a different reader and the annotation moves, or does not print at all. The typeface never matched because it was never the document's typeface; it was the editor's.

If that has already been done to a file you have been sent, Flatten PDF presses the floating layer into the page so at least everyone sees the same thing — the same operation described in keeping the answers when you strip out form fields. It will not restore the font. Nothing can, once the original glyphs are hidden under a white box.

Finding out which one you have

Thirty seconds, and it decides everything else:

Keeping the document's own typeface

Cause one is fixable, and this is the part every competing page skips. What you need is an editor that removes the original glyphs from the page's content stream and redraws your words using the font already in the file, rather than covering them.

  1. Open the document in our PDF editor and click the line you want to change. If a block cannot be retyped it says why when you hover: skewed or rotated at an angle, drawn with a Type 3 font, or the embedded font is damaged.
  2. Look at the font menu before you type. The block's own typeface appears at the top under Document font, marked "(original)", already selected. Leave it there. Choosing anything else from the list is choosing a substitution.
  3. Retype the text. Nothing further along the line moves, and a replacement that does not fit the space has its own control — both are layout questions rather than font ones, and they belong with the case for editing in place.
  4. Read the notes on the result. Where the original font could not draw something you typed, the result names the page and says which font was used instead.

What this will not do

The guarantee is "your font unless it is physically impossible", and the impossible cases are worth knowing before you start.

Checking it worked

Zoom to 400% on the line you edited and compare its letterforms against an untouched line nearby. Look at the shape of the lower-case a and g, and at the terminals on t and f — those are where a substitute face gives itself away long before the overall colour of the paragraph does. At 100% almost any sans-serif looks like any other.

When something else is a better idea

Still hold the document the PDF was exported from? Then the repair is one sentence in Word, InDesign or LaTeX and a fresh export with font embedding switched on — and while that dialogue is open, turn the subsetting off as well, which is what stops the next person who corrects a name running into this.

If you do not hold it and you are working on a single page, Inkscape is the desktop option that matters here: it will set your text in the real font, provided the font is installed on your machine. It rewrites the page on save, which suits a poster and not page nine of a forty-page report. The other desktop editors, and what each of them does to the layout, are weighed up alongside the Word question.

Before you commit an hour to any of that, pdffonts from poppler-utils is free and is the fastest way to know which of the three causes you have.

The browser route above wins in the ordinary case: one line to change, a subsetted font that has the letters, and no wish to install anything.