Is there a way to find name of fonts used within Gimp .xcf file?
3 Answers
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
-
1This didn't work for me on OS X. I'm sure there is some different syntax for grep that I'm missing. Commented 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 Commented 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– KevinCommented 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
orvim
the .xcf file and it will show you which font is used for which spans of text; ex:<span font=\"Font Name\"</span>
– ma77cCommented Jan 11, 2020 at 17:15 -
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.
-
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.– MatthewCommented Aug 8, 2012 at 16:55
-
2Same. I copypasta'd into text editor, removed dots (
...
) from each line, copypasta'd intoGIMP > Filters > Python-Fu -> Console
then hitenter
two or three times to make it work. Success! Commented May 8, 2014 at 23:50
The accepted answer didn't work for me on Mac, so here's a solution that works with macOS grep:
grep -a 'font \"' file.xcf | sort | uniq -c
Tested with Grep version "grep (BSD grep) 2.5.1-FreeBSD". Sample output:
$ grep -a 'font \"' file.xcf | sort | uniq -c
1 (font "Alison Ultra-Light")
11 (font "Ambient")