How can I remove the pre-installed fonts in GIMP?

Solution 1:

You don't. These fonts are not pre-installed in GIMP, but on your Ubuntu system. All of the system fonts are displayed there.

Maybe a few of them are installed exclusively for GIMP - you can check edit->preferences->folders->fonts for the font folders GIMP use - there is both a system-wide folder, for all users on your Linux system, this one is on the /usr/share prefix - and the other one is on your home folder (typically /home/< user>/.gimp-2.8/fonts - it will change to /home/<user>/.config/GIMP/<version>/fonts for future stable GIMP versions).

Delisting these folders, as I wrote above, will not, however, delist the majority of your fonts. Check for your system-configurations, and uninstall the superfluous fonts from the system control panel to have them delisted from GIMP.

Unfortunately, while for other assets (brushes, palettes, gradients, etc...) GIMP 2.8 counts with a powerful tagging system that allows for fast filtering of desired resources, tags are not available for fonts. (Try it: within the respective resource tab (dockable dialog), select a resource, type in a list of tags for it on the input on the bottom of the dialog. Them just type in a tag name on the "filter" input field to have only the resources with that tag listed).

So, the only thing left,apart from uninstalling system fonts, is just to use this font-tab, at least it is better than the font-selection widget within the Font tool options. (Windows->Dockable Dialogs->Fonts)

Solution 2:

The fonts you're seeing aren't pre-installed in GIMP, they're pre-installed in your Operating System. (Ubuntu, in this case.) You can edit GIMP's configuration files so it doesn't pull the system fonts and only pulls fonts provided by directories you choose. This is because GIMP relies on fontconfig.

Warning These steps likely need to be repeated every time GIMP is upgraded. Additionally, use of the ~ may not work in future versions of GIMP.

Here's how I did it on GIMP 2.10.2 running on Windows 10. The paths are slightly different on Ubuntu, but the actions should be the same. (Unfortunately, I don't have access to an Ubuntu machine to try this first, but I will in the future.)

  1. Open GIMP and go to Edit>Preferences...>Folders>Fonts and remove all the directories in the list.
  2. Close GIMP and go to %ProgramFiles%\GIMP 2\etc\fonts
  3. Open and edit fonts.conf. (Note: Administrator privileges are needed to edit files in %ProgramFiles%.) Comment out the directories in the <!-- Font directory list --> that you don't want. I left the one with the ~ so I would have one font directory that GIMP would pull from.

    <!-- <dir>WINDOWSFONTDIR</dir> -->
    
    <!-- <dir prefix="xdg">fonts</dir> --> 
    <!-- the following element will be removed in the future -->
    <dir>~/.fonts</dir>
    
  4. Save and close fonts.conf.

  5. Clear GIMP's font cache by deleting the contents of %UserProfile%\.cache\fontconfig.
  6. Open a command prompt or PowerShell and use the following command to make the ~/.fonts directory (command is necessary because File Explorer won't let you do it): mkdir %UserProfile%\.fonts
  7. Open GIMP. Your fonts list should be TOTALLY EMPTY.
  8. Close GIMP. Put font files into %UserProfile%\.fonts and reload GIMP. The fonts you copied should appear in your font list, along with generic fonts such as "sans-serif". The generics are automatically generated shortcuts to the best fonts that match their name. You can disable those, if you care to, by removing them from the relevant files in %ProgramFiles%\GIMP 2\etc\fonts\conf.d, but that's beyond the scope of this question.