2 ;;; emu-mule.el --- Mule 2.* emulation module for Mule
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1994,1995 MORIOKA Tomohiko
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
9 ;;; $Id: emu-mule.el,v 7.11 1996/05/09 16:38:20 morioka Exp $
10 ;;; Keywords: emulation, compatibility, Mule
12 ;;; This file is part of tl (Tiny Library).
14 ;;; This program is free software; you can redistribute it and/or
15 ;;; modify it under the terms of the GNU General Public License as
16 ;;; published by the Free Software Foundation; either version 2, or
17 ;;; (at your option) any later version.
19 ;;; This program is distributed in the hope that it will be useful,
20 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 ;;; General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with This program. If not, write to the Free Software
26 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
33 (defalias 'char-charset 'char-leading-char)
39 (defun character-encode-string (str coding-system)
40 "Encode the string STR which is encoded in CODING-SYSTEM.
42 (code-convert-string str *internal* coding-system)
45 (defun character-decode-string (str coding-system)
46 "Decode the string STR which is encoded in CODING-SYSTEM.
48 (code-convert-string str coding-system *internal*)
51 (defun character-encode-region (start end coding-system)
52 "Encode the text between START and END which is
53 encoded in CODING-SYSTEM. [emu-mule.el]"
54 (code-convert start end *internal* coding-system)
57 (defun character-decode-region (start end coding-system)
58 "Decode the text between START and END which is
59 encoded in CODING-SYSTEM. [emu-mule.el]"
60 (code-convert start end coding-system *internal*)
64 ;;; @ version specific features
67 (cond (running-emacs-19
70 ;; Suggested by SASAKI Osamu <osamu@shuugr.bekkoame.or.jp>
71 ;; (cf. [os2-emacs-ja:78])
72 (defun fontset-pixel-size (fontset)
73 (let* ((font (get-font-info
74 (aref (cdr (get-fontset-info fontset)) 0)))
79 (let ((pat (aref font 1)))
80 (if (string-match "-[0-9]+-" pat)
83 pat (1+ (match-beginning 0)) (1- (match-end 0))))
89 (defun tl:make-overlay (beg end &optional buffer type))
90 (defun tl:overlay-put (overlay prop value))
94 ;;; @@ truncate-string
97 (or (fboundp 'truncate-string)
98 ;;; Imported from Mule-2.3
99 (defun truncate-string (str width &optional start-column)
100 "Truncate STR to fit in WIDTH columns.
101 Optional non-nil arg START-COLUMN specifies the starting column.
102 \[emu-mule.el; Mule 2.3 emulating function]"
104 (setq start-column 0))
105 (let ((max-width (string-width str))
110 (if (>= width max-width)
111 (setq width max-width))
112 (if (>= start-column width)
114 (while (< column start-column)
115 (setq ch (aref str from)
116 column (+ column (char-width ch))
117 from (+ from (char-bytes ch))))
118 (if (< width max-width)
121 (while (<= column width)
122 (setq ch (aref str to)
123 column (+ column (char-width ch))
125 to (+ to (char-bytes ch))))
127 (substring str from to))))
137 ;;; emu-mule.el ends here