;;; -*- Mode: LISP; Syntax: Common-Lisp; Package: DICT; Base: 10; Patch-file: T -*-
;;; Patch file for DICTIONARY version 1.3
;;; Reason: new function PRINT-DEFINITION
;;; Written by jrd, 4/25/86 13:14:08
;;; while running on Xevious from FEP0:>Inc-6-1-D.load.1
;;; with Release 6.1, Netrender (DS) 1.12, COLOR 135.55, COLOR-DEMO 68.10, Paint (DS) 8.0,
;;; Menu 6.1, Experimental Color Editor 5.1, IMAGES 56.25, COLOR-EXTENSIONS 4.6,
;;; BS-FONTS 4.2, Tablet (DS) 3.7, Live Window 272.0, Dynamics (DS) 7.15,
;;; Render (DS) 15.6, COLOR-PALETTE 2.1, Geometry (DS) 7.40, Demo-Band 63.0,
;;; Experimental TMC 3d Image Toolkit 71.0, IP-TCP 29.13, DECTALK 1.1,
;;; Experimental PROSE 1.0, Japanese 24.1, Versatec 9.0, Spire 17.2,
;;; Experimental SYLPAR 1.0, DICTIONARY 1.2, Experimental SPELL 1.1,
;;; microcode TMC5-COLOR-MIC 336, FEP 127, FEP0:>v127-lisp.flod(2),
;;; FEP0:>v127-loaders.flod(3), FEP0:>v127-debug.flod(1), FEP0:>v127-info.flod(2), Bug Report Recipient.



; From file printer.lisp /local/lib/dictionary/lisp/ AMT:
#10R DICT::(GLOBAL:COMPILER-LET ((GLOBAL:PACKAGE (GLOBAL:PKG-FIND-PACKAGE "DICT")))

(defun coerce-window-to-webster-font-map (window)
  "Force window to have font map sufficient for pretty printing of definition"
  (let ((font-map (font-map window)))
    (when (not (every (lambda (font)
			(find font font-map))
		      webster-required-fonts))
      (setf (font-map window)
	    (concatenate 'list font-map webster-required-fonts)))))

(defun print-definition (word &optional (window *standard-output*))
  "Print the definition of WORD to a window"
  (let ((word-info (get-webster-info (string word))))
    (if word-info
	(progn
	  (coerce-window-to-webster-font-map window)
	  (print-definition-to-window (webster-entry-definition word-info)	window))
	(format window "Not in dictionary.~%"))))

(export 'print-definition)

)

