Change font for selected text in GIMP

802 Views Asked by At

I use GIMP to add text to images. For certain fonts, if I select existing text and change the font, it doesn't work. However, if I start typing, I see the text in the new font that I choose. It doesn't change the font style of the existing text. How can I fix this?

1

There are 1 best solutions below

0
On

In Gimp since 2.8, there are two ways to control the text characteristics (fonts, size, kerning, spacing...):

  1. The defaults as set in the text tool options:

enter image description here

  1. While editing text, in the on-canvas text widget:

enter image description here

The text characteristics in the on-canvas widget apply to the selected text (ie, the smaller A's in the yellowish boxes). Text is selected exactly as you would do in a word processor (swipe, click and shift-cursor....). In the image above, the inner AA is using Roboto Bold 60 as directed by the on-canvas widget, while the two outer pairs of AA are using Bungee 80 as set in the Tool options.

The pitfall: for Gimp there are two cases:

  1. You have never changed the characteristics of a letter using the on-canvas dialog. The letter is then associated with the default characteristics, and if you change these in the tool options, the letter will change accordingly.
  2. You have changed some characteristic of the letter: the letter is now "disconnected" from the defaults, it will not change if you change the tool options, it can only be changed using the on-canvas widget.

For instance, if I change the Tool options to Alphaville Bold, this will only change the outer pairs of AA:

enter image description here

So what can happen is that all your existing text is really disconnected from the defaults and changing the Tool options doesn't change it, while new text that you enter is associated with the defaults and then uses the font that is set there.

If you feel technically inclined, there is a way to check which part(s) of the text are no longer using the defaults: install the text-info-0.1.py script that you'll find here(see bottom of page for installation instructions). Once installed and Gimp restarted, right click on your text layer, and select "Show text information" (bottom of the popup menu). You will get something like(*):

Text layer "AAAAAA": (markup "<markup>AA<span font=\"Roboto Bold\"><span size=\"14745\">AA</span></span>AA</markup>")
(font "Alphaville Bold")
(font-size 80)
(font-size-unit pixels)
(antialias yes)
(language "en")
(base-direction ltr)
(color (color-rgb 0 0 0))
(justify fill)
(box-mode dynamic)
(box-unit pixels)
(hinting yes)

In the first line you can see that some of the text is bracketed with <span>...</span> while other text is outside of any span. The text in <span> has specific characteristics, the text outside uses the defaults. In your case the whole text would be inside the <span>

(*) The information displayed is generated/updated when the XCF is saved to disk, so for the latest info issue a File > Save (or File > Save as if you want to avoid an overwrite) before invoking the script.