Why does the font change after I paste an image in an RTF file?

Here is a simple sequence of actions that produces an unexpected side-effect, and I don’t understand why, and would like to know how to prevent it.

  1. Create a new RTF document (Data ➜ New ➜ Rich Text).
  2. Type some text in the document. The font DEVONthink uses at this point is what I set in my DEVONthink preferences “Editing” tag for “Rich Text & Note Font” (which, in my case, is Roboto).
  3. Capture an image to the clipboard, e.g., using the standard macOS facility for “copy a picture of the selected area to the clipboard”. (Any image will do.)
  4. Paste the image in the RTF document.
  5. Press return to start a new line, and type more text.

The font and font size in the RTF document after step #4 is changed. (In my case, it changes to Helvetica; I don’t know if it’s the same font for everyone or there is some setting somewhere that sets Helvetica for me.) In both lines of text, the menu Format ➜ Style has a checkmark next to “Plain”.

Why does the font changes? What controls this behavior? Can I make it stop changing, so that text typed after step #4 is the font set in my “Rich Text & Note Font” preference instead of Helvetica?

Here is a screenshot showing the document, where I’ve pasted captured images of the Styles panel (Format ➜ Styles ➜ Styles…) panel as it appears for each line of text. (To be clear: this shows a single RTF document in DEVONthink in which I followed exactly the steps above. I copied and pasted the image of the Styles… panel as the image described in step #3.)

This is not a DEVONthink issue. It’s how the macOS text engine works.

Here is an example in TextEdit showing the same behavior…

First, thanks for the ultra fast reply (frighteningly fast, actually). Second, arggh :-). Third, sorry for putting the blame on the wrong software!. Fourth, is there a way to control it?

  1. You’re welcome :slight_smile:
  2. Yeah. Longstanding issue too.
  3. No worries. It’s useful to check TextEdit and Preview for similar behaviors as we use the macOS frameworks for much of this functionality.
  4. Not outside setting up a style and choosing it after the paste.
1 Like

I just tried setting the preference in TextEdit for the default font, but it didn’t seem to influence what happens after pasting an image even in TextEdit itself, which is bonkers if you ask me.

Yep. No surprise there.

You can’t Paste and Match Style either since there’s image data on the clipboard.
Here you can clearly see the font change after I paste…

But again, I added a Favorite style… and this can be used to get back to a selected font.

1 Like

I’m a long-time user of word. I thought all that was normal behaviour :smiley:

Haha! It’s funny how we get used to broken behaviors and forget they’re broken.

I have only managed to deal with this by pasting image in between 2 seperate bits of text so the font persists. V annoying! Is the font it defaults to after pasting some system default? Could this be changed?

After I posted my question here last year, I asked about this issue on the Apple Stack Exchange site because it’s a general Apple issue and not something due to DEVONthink: https://apple.stackexchange.com/questions/381090/why-does-the-font-change-after-i-paste-an-image-in-textedit

The short answer is that the behavior appears to be due to a bug in the implementation of one of Apple’s software subsystems. Changing defaults doesn’t seem to make a difference; it always reverts specifically to the Helvetica 12 pt font no matter what you do. The only solution is to do some kind of workaround, such as typing a space first, then backspacing, then pasting the image. (This could be automated using Keyboard Maestro or some other way.)

I’ve stopped using RTF files because of issues like this, so I’m afraid I don’t have any other suggestions about what to do.

2 Likes

Many thanks for your speedy response. Had almost reached critical threshold to move to MD and this will do it I think, even if it is a bit more fiddly with images! Its also much quicker when using scripts etc than RTF.

The next release will work around this issue of macOS.

2 Likes

Hi Christian. Was this addressed? Pasting image still causing fonts to change.

Also noticed that copy and paste image directly into DEVONthink resulted in much bigger file size versus insert/picture - same image but massive difference in RTFD file size.

Which version of DEVONthink & macOS do you use? And did you paste into rich text documents or formatted notes?

DEVONthink v3.8.6

I’m not technical enough to know difference between rich text or formatted notes - it’s a RTFD file in DEVONthink. Typically I copy and paste image from screenshots or from Preview and font changed when RETURN is entered after pasting image

That is rich text. A formatted note is HTML.

The next release will fix this.

Thanks for the education.

Thanks. Look forward to it.

Christian: advice on overcoming this? Copy and paste images directly cause RTFD file to dramatically increase in size - have to do extra steps by copying image - paste in Preview - save image - paste to DEVONthink via insert picture to avoid bloating RTFD

From where do you typically get these images? From a web page in a browser (Safari)? If yes, then perhaps right-mouse on the image, copy image, then in DEVONthink RTFD file put cursor where you want, then pick Menu: Edit → Paste with Source Link. Delete the source link if you don’t want. From my limited testing it does not change font in target file.

I was going to say Menu: Edit → Paste and Match Style … which is the normal way to retain formatting, it pastes only the URL … which makes sense since that Edit command really is for text.

Might be a workaround for you avoiding Preview.

Copy & paste and the rich text engine use TIFF internally, the same should happen e.g. in TextEdit. Dropping files is more efficient and retains the original format.