Original Usenet thread from rec.arts.ascii, started 9 Sep 1994.
_ _ _ _ _ _ | | | |___ ___ _ __ ___| |_ / \ _ __ ___| |__ (_)_ _____ | | | / __|/ _ \ '_ \ / _ \ __| / _ \ | '__/ __| '_ \| \ \ / / _ \ | |_| \__ \ __/ | | | __/ |_ / ___ \| | | (__| | | | |\ V / __/ \___/|___/\___|_| |_|\___|\__| /_/ \_\_| \___|_| |_|_| \_/ \___|
Info: Code to use Figlet within Emacs
rec.arts.ascii
· 1 message · 9 Sep 1994
From Mark Warren 415-506-4639 <mwa...@US.ORACLE.COM> off the Figlet
list:
; This is a little ditty I put together to use figlet inside of emacs.
; I'm using version 2.0 and the -F and -p options (have these changed in
; 2.1?).
;
; Brief usage instructions: Save this message in the file figlet.el
; somewhere (preferrably somewhere on your emacs' load-path), then use
; "M-x load-file /somewhere/figlet.el" to load the elisp. Once that's
; done, mark a region then use the command "M-x figify-region" to figify
; that region.
;
; Cheers,
;
; Mark
;
; P.S. Maybe it'll windup in the util directory someday. :-)
;___________________________________________________________________________
;Luck is when preparation meets opportunity Fax: 415-506-1113
;-------------------->8 Cut Here 8<--------------------
;;; filename: figlet.el
;;; author: Mark Warren
;;; creation: 08-Sep-94
;;; version: 0.1
;;; Copyright (C) 1994, Mark Warren
;;;
;;; figlet.el is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; A copy of the GNU General Public License can be obtained from
;;; the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
;;; 02139, USA.
;; Commentary:
;; Run the figlet program on a region of text within emacs. This
;; requires that you have the figlet package. Check archie for
;; other sites, then check ftp.isu.edu.
(defvar figlet-default-font "bulbhead"
"Initial default font for the figify-region function")
(defvar figlet-options "-p"
"Arguments to pass to figlet in addition to the -f <fontname> argument.")
(defun figlet-alist-fonts ()
"Return figlet-font-alist if it is set, otherwise invoke figlet -F to
construct figlet-font-alist"
(if (boundp 'figlet-font-alist)
figlet-font-alist
(let ((b (get-buffer-create "*figlet-temp*"))
figlet-font-list)
(call-process "figlet" nil b nil "-F")
;; do some editting so that the names look like a lisp list
(save-excursion
(set-buffer b)
(goto-char (point-min))
(kill-line 3)
(insert "\(\n")
(end-of-line)
(while (not (eobp))
(insert "\"")
(beginning-of-line)
(insert "\"")
(forward-line 1)
(end-of-line))
(goto-char (point-max))
(insert "\)")
(goto-char (point-min))
;; ok, done editting, actually read the names into a list
(setq figlet-font-list (read b)))
(kill-buffer b)
(setq figlet-font-alist
(mapcar (lambda (e) (list e e)) figlet-font-list))
figlet-font-alist)))
(defun figify-region (font)
(interactive (list (completing-read "Font: "
(figlet-alist-fonts)
nil
't
figlet-default-font)))
(call-process-region (point) (mark) "figlet" 't 't nil "-f" font
figlet-options)
(setq figlet-default-font font))
Related ASCII art in the Gallery
Explore these categories from our collection of 11,000+ artworks:
Make your own ASCII art
Turn images, text or 3D into ASCII, or draw your own – right in your browser.
About this thread.
These messages were posted publicly to the newsgroup
rec.arts.ascii
in 1994 and are mirrored here unchanged as part of the Historic Archives – only email addresses are masked.
The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can.
Are you one of the authors? Contact us to get your posts attributed, connected to your artist profile, or removed.
Report this message
Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.