- How can I determine which fonts are installed from the command line, and what is the easiest way to install more?
- 4 Answers 4
- How to check which font the system uses?
- 2 Answers 2
- Is there a unix command line tool that can analyze font files?
- 2 Answers 2
- Is there a way to check which font your shell/terminal emulator is using from the commandline?
- 6 Answers 6
How can I determine which fonts are installed from the command line, and what is the easiest way to install more?
There are many questions and answers regarding fonts on Ubuntu, but not so many dealing with Ubuntu for Embedded Linux, such as Beaglebone Black. I have not been able to locate any .ttf files in standard locations on my system, and I think that given the resource constraints these have been omitted. Using the command line, how can I (1) find out which fonts are installed, and (2) install more fonts. FYI: I am looking for a simple sans-serif ttf that I can use to display text on an 8×8 LED matrix.
/usr/share/fonts isn’t there. fc-list command is not found. so far I just downloaded a free arial font from www.dafont.com and used secure copy to transfer it to my beaglebone. i will create a /usr/share/fonts/ directory manually for future use. scp /Users/me/Downloads/pixel_arial_11/PIXEARG_.TTF ubuntu@192.168.7.2:/home/ubuntu/
4 Answers 4
The best and simplest way is to use console command (this command should be available for all ubuntu-based distributions) :
/usr/share/fonts/truetype/lato/Lato-Medium.ttf: Lato,Lato Medium:style=Medium,Regular /usr/share/fonts/truetype/tlwg/TlwgTypo-Bold.ttf: Tlwg Typo:style=Bold /usr/share/fonts/truetype/lato/Lato-SemiboldItalic.ttf: Lato,Lato Semibold:style=Semibold Italic,Italic /usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf: DejaVu Serif:style=Bold /usr/share/fonts/truetype/noto/NotoSansThai-Regular.ttf: Noto Sans Thai:style=Regular .
fc-list - list available fonts
To check all available options use MAN (manual): man fc-list
How to check which font the system uses?
That depends on what terminal you use and maybe on the distro, too. Could you please give us more information about that?
Sure: at the moment I am using the default terminal on Arch Linux. I thought that maybe there was a standard, distro-independent command for that
@user1301428 There is no such thing as «default terminal» on Arch Linux (unless you mean the Linux console). Which desktop environment are you using?
If you’re using a graphical terminal, you can surely find a menu entry called Help -> About where you can possibly find the name of your terminal application. Or do you mean the terminals that are accessable using STRG + ALT + 1-6?
@AluísioA.S.G. yes, sorry, I was tired 😀 I mean the Linux console. I am currently not using a desktop environment or a window manager.
2 Answers 2
In GNOME I can print list of my gnome-terminal profiles with following command:
$ gconftool-2 --get /apps/gnome-terminal/global/profile_list [Default,Profile0]
Then I can print font settings with:
$ gconftool-2 --get /apps/gnome-terminal/profiles/Default/font Monospace 12 $ gconftool-2 --get /apps/gnome-terminal/profiles/Profile0/font TakaoMincho Bold 36
@user1301428 — yes, of course! it works for the Gnome terminal only. Moreover, the original question was about the Linux console, which does not even need an X (or Wayland) system on the computer whatsoever
as far as I understood from your comment, you are asking about the Linux console, and not about any of the [great number of the] X terminal emulators.
So unless you changed anything your Linux console is using the «default» font on your system.
In your linux console. For me, it gives
$ setfont -v Loading 256-char 8x16 font from file /lib/kbd/consolefonts/default8x16.psfu.gz Loading Unicode mapping table.
Is there a unix command line tool that can analyze font files?
Given a directory of font files (TTF and OTF) I’d like to inspect each font and determine what style (regular, italic, bold, bold-italic) it is. Is there a command line tool for unix flavored operating systems that can do this? Or does anyone know how to extract the metadata from a TTF or OTF font file?
2 Answers 2
I think you’re looking for otfinfo. There doesn’t seem to be an option to get at the Subfamily directly, but you could do:
otfinfo --info *.ttf | grep Subfamily
Note that a number of the fonts I looked at use «Oblique» instead of «Italic».
Perfect, thanks! For those interested I’m on OS X and installed it via brew with brew install lcdf-typetools
FWIW, the MacPorts package is also called lcdf-typetools (and is a dependency of texlive-fontutils , so it may already be installed for people using TeX).
In Linux, if you have .ttf fonts, you most probably also have fontconfig, which comes with the fc-scan utility. You can parse the output for the information you want, or use the badly documented —format option.
fc-scan --format "% : %\n" /usr/share/fonts/truetype/msttcorefonts/arialbd.ttf
Some properties are listed in multiple languages. For example, % may be a list. In that case, % will list the languages. If that shows you your language in fourth position in the list, you can use % as the format string to print the full name in only that language.
This language stuff being quite inconvenient, I ended up writing a full Perl script to list the info I wanted in only one language:
#!/usr/bin/perl use strict; my $VERSION = 0.1; my $debug = 1; my @wanted = qw(foundry family fullname style weight slant width spacing file); my @lang_dependent = qw(family fullname style); my $lang = "en"; my $separator = ", "; use File::Basename; use Data::Dumper; $Data::Dumper::Sortkeys = 1; my $me = basename $0; die "Usage: $me FILENAME\n" unless @ARGV; my $fontfile = shift; unless (-f $fontfile) < die "Bad argument: '$fontfile' is not a file !\n"; >my $fc_format = join( "\\n", map < "\%" > @wanted ); my @info = `fc-scan --format "$fc_format" "$fontfile"`; chomp @info; my %fontinfo; @fontinfo = @info; if ( grep /,/, @fontinfo < @lang_dependent >) < my $format = join( "\\n", map < "\%lang>" > @lang_dependent ); my @langs = `fc-scan --format "$format" "$fontfile"`; for my $i (0..$#lang_dependent) < my @lang_list = split /,/, $langs[$i]; my ($pos) = grep < $lang_list[$_] ~~ $lang >0 .. $#lang_list; my @vals = split /,/, $fontinfo; $fontinfo = $vals[$pos]; > > warn Dumper(\%fontinfo), "\n" if $debug; $fontinfo ||= $fontinfo; # some old fonts don't have a fullname? (WINNT/Fonts/marlett.ttf) print join($separator, @fontinfo), "\n";
Is there a way to check which font your shell/terminal emulator is using from the commandline?
Is there a way to check which font your shell/terminal emulator is using from the commandline? I am willing to settle reading part of a config file, if a direct command is not readily available.
6 Answers 6
The option Use the system fixed width font is usually equal and set by org.gnome.desktop.interface .
- To get current font setting run following command:
gsettings get org.gnome.desktop.interface monospace-font-name
gsettings set org.gnome.desktop.interface monospace-font-name 'Ubuntu Mono 14'
As I run above command, I found font of your terminal changed (increased size)! So, gnome-terminal using that font setting.
Thanks! I was desperately trying to find out the «system fixed width font» Ubuntu uses to also use it in urxvt.
DE-independent way of getting system’s preferred monospace font:
$ fc-match Monospace DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
grep -i "fontface" /etc/default/console-setup
There are many answers on console emulators here already, so I’ll focus on tty virtual console only. You can do cat /etc/default/console-setup and find the line saying FONTFACE. Alternatively you could grep -n FONTFACE /etc/default/console-setup
For instance, here’s my console-setup file
To change it, you can execute sudo dpkg-reconfigure console-setup in tty. This will update the kernel settings, by the way.
I tried your method and it mentioned fontface=»fixed» , while @Pandya’s answer gave me ‘Ubuntu Mono 13’ .. Wonder why there is a difference?
@alpha_989 Because Pandya’s answer relates to GUI terminal emulators, while mine — to the TTY virtual consoles. Both are valid for their respective purpose.
My /etc/default/console-setup has CODESET=»guess» , FONTFACE=»Fixed» , and FONTSIZE=»8×16″ . Is there any way to use this information to figure out which glyps can actually be shown? I don’t seem to havy any font file in /usr/share/consolefonts that obviously matches these specs.