User Tools

Site Tools


desktop:ubuntu_character_map

Ubuntu Alternative Character Map

The character map that ships with Ubuntu is not very good in my opinion. Here is a better alternative.

sudo apt install gucharmap

And here is a small script that list's all glyphs of a given font. Save it as “fontcharlist” and run it from a terminal like this.

Example: ./fontcharlist ~/.local/share/fonts/DejaVu-Sans-Mono-Nerd-Font-Complete-Mono.ttf

#!/bin/bash -

#
# List all glyphs of a given font
#
# Example:
# ./fontcharlist ~/.local/share/fonts/DejaVu-Sans-Mono-Nerd-Font-Complete-Mono.ttf
#

Usage() { echo "$0 FontFile"; exit 1; }
SayError() { local error=$1; shift; echo "$0: $@"; exit "$error"; }

[ "$#" -ne 1 ] && Usage

width=70
fontfile="$1"

[ -f "$fontfile" ] || SayError 4 'File not found'

list=$(fc-query --format='%{charset}\n' "$fontfile")

for    range in $list
do     IFS=- read start end <<<"$range"
       if    [ "$end" ]
       then
             start=$((16#$start))
         end=$((16#$end))
         for((i=start;i<=end;i++)); do
         printf -v char '\\U%x' "$i"
         printf '%b' "$char"
         done
       else
         printf '%b' "\\U$start"
       fi
done | grep -oP '.{'"$width"'}'
desktop/ubuntu_character_map.txt · Last modified: by Allan