translate.lisp 822 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
;;; remove this file whenever CLX is fixed and McCLIM removes its private
;;; implementation of translate.

(in-package :clim-clx)

(defun translate (src src-start src-end afont dst dst-start)
  (let ((min-char-index (xlib:font-min-char afont))
	(max-char-index (xlib:font-max-char afont)))
    (if (stringp src)
	(loop for i from src-start below src-end
	      for j from dst-start
	      for index = (char-code (aref src i))
	      while (<= min-char-index index max-char-index)
	      do (setf (aref dst j) index)
	      finally (return i))
	(loop for i from src-start below src-end
	      for j from dst-start
	      for index = (if (characterp (aref src i)) (char-code (aref src i)) (aref src i))
	      while (<= min-char-index index max-char-index)
	      do (setf (aref dst j) index)
	      finally (return i)))))