Fix return value from doprnt when message is truncated at non-ASCII character.
[emacs.git] / lisp / language / thai.el
blobdd28ec77edbf543119546454bdb36a7b3ddc3231
1 ;;; thai.el --- support for Thai -*- coding: iso-2022-7bit; no-byte-compile: t -*-
3 ;; Copyright (C) 1997-1998, 2000-2011 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
5 ;; 2005, 2006, 2007, 2008, 2009, 2010, 2011
6 ;; National Institute of Advanced Industrial Science and Technology (AIST)
7 ;; Registration Number H13PRO009
8 ;; Copyright (C) 2005
9 ;; National Institute of Advanced Industrial Science and Technology (AIST)
10 ;; Registration Number H14PRO021
12 ;; Keywords: multilingual, Thai, i18n
14 ;; This file is part of GNU Emacs.
16 ;; GNU Emacs is free software: you can redistribute it and/or modify
17 ;; it under the terms of the GNU General Public License as published by
18 ;; the Free Software Foundation, either version 3 of the License, or
19 ;; (at your option) any later version.
21 ;; GNU Emacs is distributed in the hope that it will be useful,
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ;; GNU General Public License for more details.
26 ;; You should have received a copy of the GNU General Public License
27 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
29 ;;; Commentary:
31 ;; For Thai, the character set TIS620 is supported.
33 ;;; Code:
35 (define-coding-system 'thai-tis620
36 "8-bit encoding for ASCII (MSB=0) and Thai TIS620 (MSB=1)."
37 :coding-type 'charset
38 :mnemonic ?T
39 :charset-list '(tis620-2533))
41 (define-coding-system-alias 'th-tis620 'thai-tis620)
42 (define-coding-system-alias 'tis620 'thai-tis620)
43 (define-coding-system-alias 'tis-620 'thai-tis620)
45 (set-language-info-alist
46 "Thai" '((tutorial . "TUTORIAL.th")
47 (charset thai-tis620)
48 (coding-system thai-tis620 iso-8859-11 cp874)
49 (coding-priority thai-tis620)
50 (nonascii-translation . tis620-2533)
51 (input-method . "thai-kesmanee")
52 (unibyte-display . thai-tis620)
53 (features thai-util)
54 (setup-function . setup-thai-language-environment-internal)
55 (exit-function . exit-thai-language-environment-internal)
56 (sample-text
57 . (thai-compose-string
58 (copy-sequence "Thai (\e,T@RIRd7B\e(B) \e,TJGQJ4U$CQ:\e(B, \e,TJGQJ4U$hP\e(B")))
59 (documentation . t)))
61 (define-coding-system 'cp874
62 "DOS codepage 874 (Thai)"
63 :coding-type 'charset
64 :mnemonic ?D
65 :charset-list '(cp874)
66 :mime-charset 'cp874)
67 (define-coding-system-alias 'ibm874 'cp874)
69 (define-coding-system 'iso-8859-11
70 "ISO/IEC 8859/11 (Latin/Thai)
71 This is the same as `thai-tis620' with the addition of no-break-space."
72 :coding-type 'charset
73 :mnemonic ?*
74 :mime-charset 'iso-8859-11 ; not actually registered as of 2002-05-24
75 :charset-list '(iso-8859-11))
77 ;; For automatic composition.
78 (let ((chars "\e,TQTUVWXYZghijklmn\e(B")
79 (elt '(["[\e,T!\e(B-\e,TO\e(B].[\e,Thijkl\e(B]?\e,TS\e(B?" 1 thai-composition-function]
80 [nil 0 thai-composition-function])))
81 (dotimes (i (length chars))
82 (aset composition-function-table (aref chars i) elt)))
83 (aset composition-function-table ?\e,TS\e(B '(["[\e,T!\e(B-\e,TO\e(B]." 1 thai-composition-function]))
85 (provide 'thai)
87 ;;; thai.el ends here