;;; disp-table.el --- functions for dealing with char tables
;; Copyright (C) 1987, 1994, 1995, 1999, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007 Free Software Foundation, Inc.
+;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
;; Author: Erik Naggum <erik@naggum.no>
;; Based on a previous version by Howard Gayle
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs 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 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
"Display character C as character SC in the g1 character set.
This function assumes that your terminal uses the SO/SI characters;
it is meaningless for an X frame."
- (if (memq window-system '(x w32 mac))
+ (if (memq window-system '(x w32 ns))
(error "Cannot use string glyphs in a windowing system"))
(or standard-display-table
(setq standard-display-table (make-display-table)))
"Display character C as character GC in graphics character set.
This function assumes VT100-compatible escapes; it is meaningless for an
X frame."
- (if (memq window-system '(x w32 mac))
+ (if (memq window-system '(x w32 ns))
(error "Cannot use string glyphs in a windowing system"))
(or standard-display-table
(setq standard-display-table (make-display-table)))
"Return a glyph code representing char CHAR with face FACE."
;; Due to limitations on Emacs integer values, faces with
;; face id greater that 512 are silently ignored.
- (if (and face (<= (face-id face) #x1ff))
- (logior char (lsh (face-id face) 22))
- char))
+ (if (not face)
+ char
+ (let ((fid (face-id face)))
+ (if (< fid 64) ; we have 32 - 3(LSB) - 1(SIGN) - 22(CHAR) = 6 bits for face id
+ (logior char (lsh fid 22))
+ (cons char fid)))))
;;;###autoload
(defun glyph-char (glyph)
"Return the character of glyph code GLYPH."
- (logand glyph #x3fffff))
+ (if (consp glyph)
+ (car glyph)
+ (logand glyph #x3fffff)))
;;;###autoload
(defun glyph-face (glyph)
"Return the face of glyph code GLYPH, or nil if glyph has default face."
- (let ((face-id (lsh glyph -22)))
+ (let ((face-id (if (consp glyph) (cdr glyph) (lsh glyph -22))))
(and (> face-id 0)
- (car (delq nil (mapcar (lambda (face)
- (and (eq (get face 'face) face-id)
- face))
- (face-list)))))))
+ (catch 'face
+ (dolist (face (face-list))
+ (when (eq (face-id face) face-id)
+ (throw 'face face)))))))
;;;###autoload
(defun standard-display-european (arg)
(equal (aref standard-display-table 161) [161])))
(progn
(standard-display-default 160 255)
- (unless (or (memq window-system '(x w32 mac)))
+ (unless (or (memq window-system '(x w32 ns)))
(and (terminal-coding-system)
(set-terminal-coding-system nil))))
;; unless some other has been specified.
(if (equal current-language-environment "English")
(set-language-environment "latin-1"))
- (unless (or noninteractive (memq window-system '(x w32 mac)))
+ (unless (or noninteractive (memq window-system '(x w32 ns)))
;; Send those codes literally to a character-based terminal.
;; If we are using single-byte characters,
;; it doesn't matter which coding system we use.