List of fonts containing selected character

On Mac OS X, the Character Viewer (equivalent to Character Map on Ubuntu) has a feature where, when looking at a certain character, it can show a list of all fonts that contain that character. Is there something equivalent on Ubuntu?

The use case is that, for instance, I could click on a Kannada character and see all fonts that cover that character (and presumably, the rest of the Kannada language range).


Edit: Just for an idea of what I mean, here's a screenshot of Character Viewer on Mac OS X 10.6. The "Containing selected character" is near the bottom of the screen. I seem to remember that this part of the interface was better in 10.5 or 10.4, actually.

enter image description here


In Fontmatrix you can compare font characteristics - In the Font Information - Compare.

Fontmatrix's Font Compare

PS. I think that feature of Character Viewer on Mac OS X would be an awesome feature request to ask of the fontmatrix developer team.


In fact, the interface of Fontmatrix has something even better: you can select the Preview tab and enter a string (containing characters you would like the font to have), and see how it is displayed by each font. So you can scroll through the list of fonts and simultaneously see the fonts' coverage of all the interesting characters, instead of just one character at a time. This helps you visually pick out the fonts containing the selected character(s).

In the screenshot below, you can see that "BABEL Unicode Bold" (selected) contains all characters except ṝ and that "Arial Regular" (where the mouse is) contains only a few characters.

Screenshot of Fontmatrix's Preview


Since I originally asked this question in 2011, the information has become more difficult to find on both Ubuntu (where the previously recommended FontMatrix no longer seems to have the feature) and on macOS.

If one cares about a language in general rather than a specific character, is to use fc-list with :lang, for example:

~% fc-list :lang=kn-in
/usr/share/fonts/truetype/noto/NotoSansKannadaUI-Regular.ttf: Noto Sans Kannada UI:style=Regular
/usr/share/fonts/truetype/noto/NotoSansKannada-Bold.ttf: Noto Sans Kannada:style=Bold
/usr/share/fonts/truetype/noto/NotoSansKannadaUI-Bold.ttf: Noto Sans Kannada UI:style=Bold
/usr/share/fonts/truetype/noto/NotoSerifKannada-Regular.ttf: Noto Serif Kannada:style=Regular
/usr/share/fonts/truetype/Navilu/Navilu.ttf: Navilu:style=Normal
/usr/share/fonts/truetype/noto/NotoSansKannada-Regular.ttf: Noto Sans Kannada:style=Regular
/usr/share/fonts/truetype/lohit-kannada/Lohit-Kannada.ttf: Lohit Kannada:style=Regular
/usr/share/fonts/truetype/Gubbi/Gubbi.ttf: Gubbi:style=Normal
/usr/share/fonts/truetype/noto/NotoSerifKannada-Bold.ttf: Noto Serif Kannada:style=Bold

For specific characters, I asked a similar question on “Ask Different”; copying here the Python script that I ended up using (it works on both operating systems).

  1. Install either the python-fontconfig or the python3-fontconfig package (or both), depending on whether you prefer to use Python 2 or Python 3.

  2. Save the following code into a file called (say) find_fonts.py:

#!/usr/bin/env python

def find_fonts(c):
    """Finds fonts containing  the (Unicode) character c."""
    import fontconfig
    fonts = fontconfig.query()
    for path in sorted(fonts):
        font = fontconfig.FcFont(path)
        if font.has_char(c):
            yield path

if __name__ == '__main__':
    import sys
    search = sys.argv[1]
    char = search.decode('utf-8') if isinstance(search, bytes) else search
    for path in find_fonts(char):
        print(path)
  1. Run the script with either python find_fonts.py ಠ or python3 find_fonts.py ಠ replacing with the character you care about.

Example output:

$ python3 find_fonts.py ಠ
/usr/share/fonts/truetype/Gubbi/Gubbi.ttf
/usr/share/fonts/truetype/Navilu/Navilu.ttf
/usr/share/fonts/truetype/lohit-kannada/Lohit-Kannada.ttf
/usr/share/fonts/truetype/noto/NotoSansKannada-Bold.ttf
/usr/share/fonts/truetype/noto/NotoSansKannada-Regular.ttf
/usr/share/fonts/truetype/noto/NotoSansKannadaUI-Bold.ttf
/usr/share/fonts/truetype/noto/NotoSansKannadaUI-Regular.ttf
/usr/share/fonts/truetype/noto/NotoSerifKannada-Bold.ttf
/usr/share/fonts/truetype/noto/NotoSerifKannada-Regular.ttf