From: martin f. krafft Date: Mon, 5 May 2008 14:18:45 +0000 (+0100) Subject: add helper to manipulate xterm fonts X-Git-Url: https://git.madduck.net/etc/zsh.git/commitdiff_plain/06a9e572b889f7fd555ccd5bc5bf5d079f576f59?ds=sidebyside add helper to manipulate xterm fonts --- diff --git a/.zsh/zshrc/70_termfonts b/.zsh/zshrc/70_termfonts new file mode 100644 index 0000000..d55f056 --- /dev/null +++ b/.zsh/zshrc/70_termfonts @@ -0,0 +1,38 @@ +# zshrc/70_termfonts +# +# provide helper methods to increase/decrease fonts from the command line +# +# Copyright © 1994–2008 martin f. krafft +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: http://git.madduck.net/v/etc/zsh.git +# + +typeset -ga _XTERM_FONTS +_XTERM_FONTS+='-misc-fixed-medium-r-semicondensed-*-13-*-*-*-*-*-iso10646-1' +_XTERM_FONTS+='-misc-fixed-medium-r-normal-*-13-120-75-75-c-80-iso10646-1' +_XTERM_FONTS+='-misc-fixed-medium-*-*-*-15-*-*-*-*-*-iso10646-1' +_XTERM_FONTS+='-misc-fixed-medium-r-normal-*-18-*-*-*-*-*-iso10646-1' +_XTERM_FONTS+='-misc-fixed-medium-r-normal-*-20-200-75-75-c-100-iso10646-1' +integer -g _XTERM_FONT + +_set_xterm_font() { + if [ $1 -lt 1 ]; then + warn "no smaller font available" + _XTERM_FONT=1 + return 1 + elif [ $1 -gt $#_XTERM_FONTS ]; then + warn "no larger font available" + _XTERM_FONT=$#_XTERM_FONTS + return 1 + fi + _XTERM_FONT=$1 + info "selecting font: $_XTERM_FONTS[$_XTERM_FONT]" + echo -en "\033]50;$_XTERM_FONTS[$1]\007" +} +_set_xterm_font ${_XTERM_FONT:-1} + +f++() { _set_xterm_font $((_XTERM_FONT + 1)) } +f--() { _set_xterm_font $((_XTERM_FONT - 1)) } +f0() { _set_xterm_font 1 } +fx() { _set_xterm_font $#_XTERM_FONTS }