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.13 1996/05/14 16:28:33 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.
30 ;;; @ version specific features
33 (cond (running-emacs-19
36 ;; Suggested by SASAKI Osamu <osamu@shuugr.bekkoame.or.jp>
37 ;; (cf. [os2-emacs-ja:78])
38 (defun fontset-pixel-size (fontset)
39 (let* ((font (get-font-info
40 (aref (cdr (get-fontset-info fontset)) 0)))
45 (let ((pat (aref font 1)))
46 (if (string-match "-[0-9]+-" pat)
49 pat (1+ (match-beginning 0)) (1- (match-end 0))))
55 (defun tl:make-overlay (beg end &optional buffer type))
56 (defun tl:overlay-put (overlay prop value))
63 (defalias 'char-charset 'char-leading-char)
69 (defun character-encode-string (str coding-system)
70 "Encode the string STR which is encoded in CODING-SYSTEM.
72 (code-convert-string str *internal* coding-system)
75 (defun character-decode-string (str coding-system)
76 "Decode the string STR which is encoded in CODING-SYSTEM.
78 (code-convert-string str coding-system *internal*)
81 (defun character-encode-region (start end coding-system)
82 "Encode the text between START and END which is
83 encoded in CODING-SYSTEM. [emu-mule.el]"
84 (code-convert start end *internal* coding-system)
87 (defun character-decode-region (start end coding-system)
88 "Decode the text between START and END which is
89 encoded in CODING-SYSTEM. [emu-mule.el]"
90 (code-convert start end coding-system *internal*)
94 ;;; @ character and string
97 (defalias 'string-to-int-list 'string-to-char-list)
99 (or (fboundp 'truncate-string)
100 ;;; Imported from Mule-2.3
101 (defun truncate-string (str width &optional start-column)
102 "Truncate STR to fit in WIDTH columns.
103 Optional non-nil arg START-COLUMN specifies the starting column.
104 \[emu-mule.el; Mule 2.3 emulating function]"
106 (setq start-column 0))
107 (let ((max-width (string-width str))
112 (if (>= width max-width)
113 (setq width max-width))
114 (if (>= start-column width)
116 (while (< column start-column)
117 (setq ch (aref str from)
118 column (+ column (char-width ch))
119 from (+ from (char-bytes ch))))
120 (if (< width max-width)
123 (while (<= column width)
124 (setq ch (aref str to)
125 column (+ column (char-width ch))
127 to (+ to (char-bytes ch))))
129 (substring str from to))))
139 ;;; emu-mule.el ends here