Find name of fonts used within Gimp xcf file

18

8

Is there a way to find name of fonts used within Gimp .xcf file?

jaksco

Posted 2011-06-18T17:09:05.563

Reputation: 183

Found out how... open it with something like scite or notepad++... Will answer my question in seven hours... – jaksco – 2011-06-18T17:26:11.640

Answers

10

From a linux console

grep -aPo 'font "(.*?)"' file.xcf

Sample output:

$ grep -aPo 'font "(.*?)"' file.xcf 
font "HP Simplified Italic"
font "Freehand521 BT"
font "Freehand521 BT"

Also you can look at the xcf with nano:

nano file.xcf

Marco Lazzaroni

Posted 2011-06-18T17:09:05.563

Reputation: 116

This didn't work for me on OS X. I'm sure there is some different syntax for grep that I'm missing. – user53251 – 2019-03-27T04:29:01.477

In this case the simplest thing to do is to open the xcf with a text editor and look for font " lines – Marco Lazzaroni – 2019-09-13T11:29:04.927

For some reason it lists some fonts, but not the ones that are being used in my file. I'm not sure why – Kevin – 2019-12-13T01:47:59.897

If you have transferred the .xcf file to a system that does not have the used fonts installed you can nano or vim the .xcf file and it will show you which font is used for which spans of text; ex: <span font=\"Font Name\"</span> – ma77c – 2020-01-11T17:15:14.820

16

Apart from opening the file in a text editor, I found another way to do so from within GIMP, mentioned in a German GIMP forum.

This is a Python script that can be executed from the GIMP's built-in Python console:

for image in gimp.image_list():
  for layer in image.layers:
    try:
      layer.parasite_find('gimp-text-layer').data
    except AttributeError:
      pass

It runs across all images loaded, across all layers, and dumps the data of all text layers, including font names.

Nicolas Kaiser

Posted 2011-06-18T17:09:05.563

Reputation: 538

I'd never used the gimp python console (or much python at all) before so I had to figure this out...I had to indent by four spaces per indentation stop or I got a syntax error. – Matthew – 2012-08-08T16:55:23.157

1Same. I copypasta'd into text editor, removed dots (...) from each line, copypasta'd into GIMP > Filters > Python-Fu -> Console then hit enter two or three times to make it work. Success! – Joel Mellon – 2014-05-08T23:50:14.773