I use gedit on a Ubuntu installation at C++ programming and everything works fine
except for the small default font size that is used. How do I change this, I can't find
any settings (or zoom button) in the gedit menu's? I assume that it should be possible to change somewhere in the Linux environment?

Dani AI

Generated

Nice find, — gedit does let you change how the editor text looks. A few extra, practical options that people often miss when they want larger code text: temporary zoom (good for quick reading), a system-level monospace override (changes all GNOME apps that use the fixed-width font), and a per-app GTK CSS tweak when you need precise control. The short tips and a couple of troubleshooting notes follow.

The easiest quick-change is the Text Size / zoom support: modern gedit exposes a Text Size feature (it’s provided as a plugin in many distros and is built into newer releases). With that enabled you can use Ctrl + +, Ctrl + -, and Ctrl + 0 to change/reset size, and Ctrl + mouse-wheel to zoom in/out. See the gedit Text Size docs and community notes on common shortcuts for details. (gedit-text-editor.org)

To make a lasting, system-wide change for code editors and terminals, set GNOME’s monospace font (terminals and many editors pick this up). For example:

gsettings set org.gnome.desktop.interface monospace-font-name 'Source Code Pro 12'

You can also use GNOME Tweaks or dconf-editor to edit the same value if you prefer a GUI. This affects all apps that read the GNOME monospace setting and may require logging out/in. (unix.stackexchange.com)

If you want per-app precision (only gedit, only a specific window), use the GTK Inspector to find the widget’s CSS node and add rules to ~/.config/gtk-3.0/gtk.css or ~/.config/gtk-4.0/gtk.css. Example (illustrative — use the inspector to confirm selectors):

/* ~/.config/gtk-3.0/gtk.css */
.gedit {
  font-family: "DejaVu Sans Mono";
  font-size: 12pt;
}

Enable the Inspector (or run the app with GTK_DEBUG=interactive), test rules live, then restart the app. (gnome.pages.gitlab.gnome.org)

Troubleshooting: if changes don’t appear, check that the font is actually installed and rebuild the font cache (fc-cache -f -v), verify you aren’t running a sandboxed/Flatpak build (Flatpak apps can ignore host font settings), and try the Text Size plugin for a quick workaround while debugging. (github.com)

Further reading: gedit plugin docs and the GTK Inspector guide above show exact steps and caveats for different gedit/GNOME versions.

Sorry, it is an option to change font and size under (Edit > Preferences >......) in gedit. It is possible to customize font and size after the default box, which gives DejaVu Sans Mono 8, is unchecked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.