Correctly handle XTerm.vt100.faceName

This commit is contained in:
Aidan Harris 2018-04-02 01:07:43 +01:00
parent 81db772a5d
commit 380e793c62
No known key found for this signature in database
GPG Key ID: E18BE27807DA2E96
1 changed files with 14 additions and 1 deletions

View File

@ -2183,12 +2183,25 @@ END
;; ;;
"urxvt" | "urxvtd" | "rxvt-unicode" | "xterm") "urxvt" | "urxvtd" | "rxvt-unicode" | "xterm")
term_font="$(grep -i "${term/d}\**\.*font" < <(xrdb -query))" xrdb="$(xrdb -query)"
term_font="$(grep -i "${term/d}\**\.*font" <<< "$xrdb")"
term_font="${term_font/*"*font:"}" term_font="${term_font/*"*font:"}"
term_font="${term_font/*".font:"}" term_font="${term_font/*".font:"}"
term_font="${term_font/*"*.font:"}" term_font="${term_font/*"*.font:"}"
term_font="$(trim "$term_font")" term_font="$(trim "$term_font")"
if [[ -z "$term_font" && "$term" == "xterm" ]]; then
term_font="$(grep -E '^XTerm.vt100.faceName' <<< "$xrdb")"
term_font="${term_font/*"faceName:"}"
term_font="$(trim "$term_font")"
fi
# xft: isn't required at the beginning so we prepend it if it's missing
if [[ "${term_font:0:1}" != "-" && \
"${term_font:0:4}" != "xft:" ]]; then
term_font="xft:$term_font"
fi
# Xresources has two different font formats, this checks which # Xresources has two different font formats, this checks which
# one is in use and formats it accordingly. # one is in use and formats it accordingly.
case "$term_font" in case "$term_font" in