;;; tml-util.el --- support for composing tamil characters -*-coding: iso-2022-7bit;-*- ;; Copyright (C) 2001 Free Software Foundation, Inc. ;; Maintainer: KAWABATA, Taichi ;; Keywords: multilingual, Indian, Tamil ;; This file is part of GNU Emacs. ;; 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 2, 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 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; 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., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;; Created: Nov. 08. 2002 ;;; Commentary: ;; This file provides character(Unicode) to glyph(CDAC) conversion and ;; composition of Tamil script characters. ;;; Code: ;; Tamil Composable Pattern ;; C .. Consonants ;; V .. Vowel ;; H .. Pulli ;; M .. Matra ;; V .. Vowel ;; A .. Anuswar ;; D .. Chandrabindu ;; 1. vowel ;; V ;; 2. syllable : only ligature-formed pattern forms composition. ;; (CkHCs|C)(H|M)? ;; 3. sri special ;; (CsHCrVi) ;; oririnal ;; ((CH)?(CH)?(CH)?CH)?C(H|M?(A|D)?)? (defconst tamil-consonant "[$,1<5(B-$,1 (length x) (length y)))))))) ;;;###autoload (defun tamil-composition-function (from to pattern &optional string) "Compose Tamil characters in REGION, or STRING if specified. Assume that the REGION or STRING must fully match the composable PATTERN regexp." (if string (tamil-compose-syllable-string string) (tamil-compose-syllable-region from to)) (- to from)) ;; Register a function to compose Tamil characters. (mapc (function (lambda (ucs) (aset composition-function-table (decode-char 'ucs ucs) (list (cons tamil-composable-pattern 'tamil-composition-function))))) (nconc '(#x0b82 #x0b83) (tamil-range #x0b85 #x0bb9))) ;; Notes on conversion steps. ;; 1. chars to glyphs ;; Simple replacement of characters to glyphs is done. ;; 2. glyphs reordering. ;; following "$,4)j(B", "$,4)k(B", "$,4)l(B" goes to the front. ;; 3. glyphs to glyphs ;; reordered vowels are ligatured to consonants. ;; 4. Composition. ;; left modifiers will be attached at the left. ;; others will be attached right. (defvar tml-char-glyph '(;; various signs ;;("$,1<"(B" . "") ("$,1<#(B" . "$,4*G(B") ;; Independent Vowels ("$,1<%(B" . "$,4*<(B") ("$,1<&(B" . "$,4*=(B") ("$,1<'(B" . "$,4*>(B") ("$,1<((B" . "$,4*?(B") ("$,1<)(B" . "$,4*@(B") ("$,1<*(B" . "$,4*A(B") ("$,1<.(B" . "$,4*B(B") ("$,1(B" . "$,4*K(B") ("$,1