19

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

1
  • Found out how... open it with something like scite or notepad++... Will answer my question in seven hours...
    – jaksco
    Jun 18, 2011 at 17:26

2 Answers 2

11

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
4
  • This didn't work for me on OS X. I'm sure there is some different syntax for grep that I'm missing.
    – user53251
    Mar 27, 2019 at 4:29
  • In this case the simplest thing to do is to open the xcf with a text editor and look for font " lines Sep 13, 2019 at 11:29
  • For some reason it lists some fonts, but not the ones that are being used in my file. I'm not sure why
    – Kevin
    Dec 13, 2019 at 1:47
  • 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
    Jan 11, 2020 at 17:15
17

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.

2
  • 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
    Aug 8, 2012 at 16:55
  • 2
    Same. 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! May 8, 2014 at 23:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.