# zshrc/80_termfonts
#
# provide helper methods to increase/decrease fonts from the command line
#
# Copyright © 1994–2008 martin f. krafft <madduck@madduck.net>
# Released under the terms of the Artistic Licence 2.0
#
# Source repository: git://git.madduck.net/etc/zsh.git
#

typeset -ga _XTERM_FONTS
#_XTERM_FONTS+=-misc-fixed-medium-r-normal--6-60-75-75-c-40-iso10646-1
#_XTERM_FONTS+=-misc-fixed-medium-r-normal--7-70-75-75-c-50-iso10646-1
#_XTERM_FONTS+=-misc-fixed-medium-r-normal--8-80-75-75-c-50-iso10646-1
#_XTERM_FONTS+=-misc-fixed-medium-r-normal--9-90-75-75-c-60-iso10646-1
#_XTERM_FONTS+=-misc-fixed-medium-r-semicondensed--12-110-75-75-c-60-iso10646-1
_XTERM_FONTS+=-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1
#_XTERM_FONTS+=-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso10646-1
_XTERM_FONTS+=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso10646-1
#_XTERM_FONTS+=-misc-fixed-medium-r-normal--15-140-75-75-c-90-iso10646-1
_XTERM_FONTS+=-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1
_XTERM_FONTS+=-misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1
_XTERM_FONTS+='-*-lucidatypewriter-*-*-*-*-26-*-*-*-*-*-iso10646-1'
_XTERM_FONT=${_XTERM_FONT:=1}

_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 2>/dev/null

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 }

# vim:ft=zsh