diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2012-08-16 20:38:31 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2012-08-16 20:38:31 -0400 |
commit | 1fa812d32651004788aa88bd963e6f182df0fefb (patch) | |
tree | 403b4080ce2b1b77705f288422f69042cf14d74d /modules | |
parent | bbab4c1d5cdcbcd08fa783d5a24f249de6dddba5 (diff) | |
download | pango-1fa812d32651004788aa88bd963e6f182df0fefb.tar.gz |
[HB] Remove Thai shaper
Diffstat (limited to 'modules')
-rw-r--r-- | modules/thai/Makefile.am | 22 | ||||
-rw-r--r-- | modules/thai/thai-charprop.c | 164 | ||||
-rw-r--r-- | modules/thai/thai-charprop.h | 99 | ||||
-rw-r--r-- | modules/thai/thai-fc.c | 358 | ||||
-rw-r--r-- | modules/thai/thai-shaper.c | 548 | ||||
-rw-r--r-- | modules/thai/thai-shaper.h | 80 |
6 files changed, 0 insertions, 1271 deletions
diff --git a/modules/thai/Makefile.am b/modules/thai/Makefile.am index 870434e6..ba9fa842 100644 --- a/modules/thai/Makefile.am +++ b/modules/thai/Makefile.am @@ -1,27 +1,5 @@ include $(top_srcdir)/modules/Module.mk -shaper_sources = thai-charprop.c thai-charprop.h thai-shaper.c thai-shaper.h - -if HAVE_FREETYPE -INCLUDES += $(FREETYPE_CFLAGS) -if INCLUDE_THAI_FC -noinst_LTLIBRARIES += libpango-thai-fc.la -else -if DYNAMIC_THAI_FC -module_LTLIBRARIES += pango-thai-fc.la -endif -endif -endif - -thai_fc_sources = $(shaper_sources) thai-fc.c - -pango_thai_fc_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS) -pango_thai_fc_la_LIBADD = $(pangoft2libs) -pango_thai_fc_la_SOURCES = $(thai_fc_sources) -libpango_thai_fc_la_SOURCES = $(thai_fc_sources) -libpango_thai_fc_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_thai_fc - - if INCLUDE_THAI_LANG noinst_LTLIBRARIES += libpango-thai-lang.la else diff --git a/modules/thai/thai-charprop.c b/modules/thai/thai-charprop.c deleted file mode 100644 index a51e3a3d..00000000 --- a/modules/thai/thai-charprop.c +++ /dev/null @@ -1,164 +0,0 @@ -/* Pango - * thai-charprop.c: character property tables - * - * Copyright (C) 2004 Theppitak Karoonboonyanan - * Copyright (C) 2002 Software and Language Engineering Laboratory, NECTEC - * Author: Theppitak Karoonboonyanan <thep@linux.thai.net> - * - * Copyright (c) 1996-2000 by Sun Microsystems, Inc. - * Author: Chookij Vanatham <Chookij.Vanatham@Eng.Sun.COM> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "config.h" -#include "thai-charprop.h" - -const gshort thai_char_type[256] = { - /* 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, A, B, C, D, E, F */ - - /* CL1 */ - /*00*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - /*10*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - - /* Lao zone: [U+0E80..U+0EDF] */ - /*20*/ _ND, _NC, _NC, _ND, _NC, _ND, _ND, _NC, - _NC, _ND, _NC, _ND, _ND, _NC, _ND, _ND, - /*30*/ _ND, _ND, _ND, _ND, _NC, _NC, _NC, _NC, - _ND, _NC, _NC, _UC, _NC, _UC, _NC, _UC, - /*40*/ _ND, _NC, _UC, _NC, _ND, _NC, _ND, _NC, - _ND, _ND, _NC, _NC, _ND, _NC, _NC, _ND, - /*50*/ _ND, _AV, _ND, _AM, _AV, _AV, _AV, _AV, - _BV, _BV, _ND, _AV, _BD, _NC, _ND, _ND, - /*60*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _AD, - _TN, _TN, _TN, _TN, _AD, _AD, _ND, _ND, - /*70*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _NC, _NC, _ND, _ND, - - /* CL2 */ - /*80*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - /*90*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - - /* Thai zone: [U+0E00..U+0E5F] */ - /*A0*/ _ND, _NC, _NC, _NC, _NC, _NC, _NC, _NC, - _NC, _NC, _NC, _NC, _NC, _SC, _BC, _BC, - /*B0*/ _SC, _NC, _NC, _NC, _NC, _NC, _NC, _NC, - _NC, _NC, _NC, _UC, _NC, _UC, _NC, _UC, - /*C0*/ _NC, _NC, _NC, _NC, _ND, _NC, _ND, _NC, - _NC, _NC, _NC, _NC, _UC, _NC, _NC, _ND, - /*D0*/ _ND, _AV, _ND, _AM, _AV, _AV, _AV, _AV, - _BV, _BV, _BD, _ND, _ND, _ND, _ND, _ND, - /*E0*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _AD, - _TN, _TN, _TN, _TN, _AD, _AD, _AD, _ND, - /*F0*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, -}; - -const gshort thai_TAC_char_class[256] = { - /* 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, A, B, C, D, E, F */ - - /* CL1 */ - /*00*/ CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, - CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, - /*10*/ CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, - CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, - - /* Lao zone: [U+0E80..U+0EDF] */ - /*20*/ NON,CONS,CONS, NON,CONS, NON, NON,CONS, - CONS, NON,CONS, NON, NON,CONS, NON, NON, - /*30*/ NON, NON, NON, NON,CONS,CONS,CONS,CONS, - NON,CONS,CONS,CONS,CONS,CONS,CONS,CONS, - /*40*/ NON,CONS,CONS,CONS, NON,CONS, NON,CONS, - NON, NON,CONS,CONS, NON,CONS,CONS, NON, - /*50*/ FV1, AV2, FV1, AM, AV1, AV3, AV2, AV3, - BV1, BV2, NON, AV2,BCON, FV3, NON, NON, - /*60*/ LV, LV, LV, LV, LV, NON, NON, NON, - TONE,TONE,TONE,TONE, AD1, AD4, NON, NON, - /*70*/ NON, NON, NON, NON, NON, NON, NON, NON, - NON, NON, NON, NON,CONS,CONS, NON,CTRL, - - /* CL2 */ - /*80*/ CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, - CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, - /*90*/ CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, - CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL,CTRL, - - /* Thai zone: [U+0E00..U+0E5F] */ - /*A0*/ NON,CONS,CONS,CONS,CONS,CONS,CONS,CONS, - CONS,CONS,CONS,CONS,CONS,CONS,CONS,CONS, - /*B0*/ CONS,CONS,CONS,CONS,CONS,CONS,CONS,CONS, - CONS,CONS,CONS,CONS,CONS,CONS,CONS,CONS, - /*C0*/ CONS,CONS,CONS,CONS, FV3,CONS, FV3,CONS, - CONS,CONS,CONS,CONS,CONS,CONS,CONS, NON, - /*D0*/ FV1, AV2, FV1, AM, AV1, AV3, AV2, AV3, - BV1, BV2, BD, NON, NON, NON, NON, NON, - /*E0*/ LV, LV, LV, LV, LV, FV2, NON, AD2, - TONE,TONE,TONE,TONE, AD1, AD4, AD3, NON, - /*F0*/ NON, NON, NON, NON, NON, NON, NON, NON, - NON, NON, NON, NON, NON, NON, NON,CTRL, -}; - -const gchar thai_TAC_compose_input[20][20] = { - /* row: Cn-1, column: Cn */ - /*CTRL NON CONS LV FV1 FV2 FV3 AM BV1 BV2 - * BD TONE AD1 AD2 AD3 AD4 AV1 AV2 AV3 BCON*/ -/*CTRL*/{'X','A','A','A','A','A','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, -/*NON */{'X','A','A','A','S','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, -/*CONS*/{'X','A','A','A','A','S','A','C','C','C', - 'C','C','C','C','C','C','C','C','C','C'}, -/*LV */{'X','S','A','S','S','S','S','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, -/*FV1 */{'X','A','A','A','A','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, -/*FV2 */{'X','A','A','A','A','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, -/*FV3 */{'X','A','A','A','S','A','S','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, -/*AM */{'X','A','A','A','S','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, -/*BV1 */{'X','A','A','A','S','S','A','R','R','R', - 'R','C','C','R','R','C','R','R','R','R'}, -/*BV2 */{'X','A','A','A','S','S','A','R','R','R', - 'R','C','R','R','R','R','R','R','R','R'}, -/*BD */{'X','A','A','A','S','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, -/*TONE*/{'X','A','A','A','A','A','A','C','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, -/*AD1 */{'X','A','A','A','S','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, -/*AD2 */{'X','A','A','A','S','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, -/*AD3 */{'X','A','A','A','S','S','A','R','R','R', - 'R','R','R','R','R','R','R','R','R','R'}, -/*AD4 */{'X','A','A','A','S','S','A','R','R','R', - 'R','C','R','R','R','R','R','R','R','R'}, -/*AV1 */{'X','A','A','A','S','S','A','R','R','R', - 'R','C','C','R','R','C','R','R','R','R'}, -/*AV2 */{'X','A','A','A','S','S','A','R','R','R', - 'R','C','R','R','R','R','R','R','R','R'}, -/*AV3 */{'X','A','A','A','S','S','A','R','R','R', - 'R','C','R','C','R','R','R','R','R','R'}, -/*BCON*/{'X','A','A','A','A','S','A','C','C','C', - 'R','C','R','R','R','C','C','C','C','R'}, -}; - diff --git a/modules/thai/thai-charprop.h b/modules/thai/thai-charprop.h deleted file mode 100644 index 98a8f8d2..00000000 --- a/modules/thai/thai-charprop.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Pango - * thai-charprop.h: - * - * Copyright (C) 1999 Red Hat Software - * Author: Owen Taylor <otaylor@redhat.com> - * - * Copyright (C) 2004 Theppitak Karoonboonyanan - * Copyright (C) 2002 Software and Language Engineering Laboratory, NECTEC - * Author: Theppitak Karoonboonyanan <thep@linux.thai.net> - * - * Copyright (c) 1996-2000 by Sun Microsystems, Inc. - * Author: Chookij Vanatham <Chookij.Vanatham@Eng.Sun.COM> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __THAI_CHARPROP_H__ -#define __THAI_CHARPROP_H__ - -#include <glib.h> - -#define isthai(wc) (0x0E00 <= (wc) && (wc) < 0x0E60) -#define islao(wc) (0x0E80 <= (wc) && (wc) < 0x0EE0) -/* ucs2tis() - * Lao: [0x0E80..0x0EDF] -> [0x20..0x7F] - * Thai: [0x0E00..0x0E5F] -> [0xA0..0xFF] - */ -#define ucs2tis(wc) (((wc) - 0x0E00 + 0x20)^0x80) - -/* Define TACTIS character classes */ -#define CTRL 0 -#define NON 1 -#define CONS 2 -#define LV 3 -#define FV1 4 -#define FV2 5 -#define FV3 6 -#define AM 7 -#define BV1 8 -#define BV2 9 -#define BD 10 -#define TONE 11 -#define AD1 12 -#define AD2 13 -#define AD3 14 -#define AD4 15 -#define AV1 16 -#define AV2 17 -#define AV3 18 -#define BCON 19 - -#define _ND 0 -#define _NC 1 -#define _UC (1<<1) -#define _BC (1<<2) -#define _SC (1<<3) -#define _AV (1<<4) -#define _BV (1<<5) -#define _TN (1<<6) -#define _AD (1<<7) -#define _BD (1<<8) -#define _AM (1<<9) - -#define NoTailCons _NC -#define UpTailCons _UC -#define BotTailCons _BC -#define SpltTailCons _SC -#define Cons (NoTailCons|UpTailCons|BotTailCons|SpltTailCons) -#define AboveVowel _AV -#define BelowVowel _BV -#define Tone _TN -#define AboveDiac _AD -#define BelowDiac _BD -#define SaraAm _AM - -#define is_char_type(wc, mask) (thai_char_type[ucs2tis ((wc))] & (mask)) -#define TAC_char_class(wc) \ - (isthai(wc)||islao(wc) ? thai_TAC_char_class[ucs2tis (wc)] : NON) -#define TAC_compose_input(wc1,wc2) \ - thai_TAC_compose_input[TAC_char_class(wc1)][TAC_char_class(wc2)] - -extern const gshort thai_char_type[256]; -extern const gshort thai_TAC_char_class[256]; -extern const gchar thai_TAC_compose_input[20][20]; - -#endif /* __THAI_CHARPROP_H__ */ diff --git a/modules/thai/thai-fc.c b/modules/thai/thai-fc.c deleted file mode 100644 index 80c945da..00000000 --- a/modules/thai/thai-fc.c +++ /dev/null @@ -1,358 +0,0 @@ -/* Pango - * thai-fc.c: - * - * Copyright (C) 1999, 2007 Red Hat Software - * Copyright (C) 2002 NECTEC - * Copyright (c) 1996-2000 by Sun Microsystems, Inc. - * Authors: - * Owen Taylor <otaylor@redhat.com> - * Theppitak Karoonboonyanan <thep@links.nectec.or.th> - * Chookij Vanatham <Chookij.Vanatham@Eng.Sun.COM> - * Behdad Esfahbod <behdad@behdad.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - - -#include "config.h" -#include <string.h> - -#include <glib.h> -#include "pango-ot.h" - -#include "pango-engine.h" -#include "pangofc-font.h" - -#include "thai-shaper.h" - -/* No extra fields needed */ -typedef PangoEngineShape ThaiEngineFc; -typedef PangoEngineShapeClass ThaiEngineFcClass ; - -#define SCRIPT_ENGINE_NAME "ThaiScriptEngineFc" -#define RENDER_TYPE PANGO_RENDER_TYPE_FC - -/* We handle the range U+0e01 to U+0e5b exactly - */ -static PangoEngineScriptInfo thai_scripts[] = { - { PANGO_SCRIPT_THAI, "*" }, - { PANGO_SCRIPT_LAO, "*" }, -}; - -static PangoEngineInfo script_engines[] = { - { - SCRIPT_ENGINE_NAME, - PANGO_ENGINE_TYPE_SHAPE, - RENDER_TYPE, - thai_scripts, G_N_ELEMENTS(thai_scripts) - } -}; - -/* TIS-to-Unicode glyph maps for characters 0x80-0xff - */ -static const int tis620_0[128] = { - /**/ 0, 0, 0, 0, 0, 0, 0, 0, - /**/ 0, 0, 0, 0, 0, 0, 0, 0, - /**/ 0, 0, 0, 0, 0, 0, 0, 0, - /**/ 0, 0, 0, 0, 0, 0, 0, 0, - 0x0020, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, - 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, - 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, - 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, - 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, - 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, - 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, - 0x0e38, 0x0e39, 0x0e3a, 0, 0, 0, 0, 0x0e3f, - 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, - 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, - 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, - 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0, 0, 0, 0 -}; - -static const int tis620_1[128] = { - 0xf89e, 0, 0, 0xf88c, 0xf88f, 0xf892, 0xf895, 0xf898, - 0xf88b, 0xf88e, 0xf891, 0xf894, 0xf897, 0, 0, 0xf899, - 0xf89a, 0, 0xf884, 0xf889, 0xf885, 0xf886, 0xf887, 0xf888, - 0xf88a, 0xf88d, 0xf890, 0xf893, 0xf896, 0, 0, 0, - /**/ 0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, - 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, - 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, - 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, - 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, - 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, - 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, - 0x0e38, 0x0e39, 0x0e3a, 0, 0, 0, 0, 0x0e3f, - 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, - 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0, 0x0e4f, - 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, - 0x0e58, 0x0e59, 0, 0, 0xf89b, 0xf89c, 0xf89d, 0 -}; - -static const int tis620_2[128] = { - 0xf700, 0xf701, 0xf702, 0xf703, 0xf704, 0x2026, 0xf705, 0xf706, - 0xf707, 0xf708, 0xf709, 0xf70a, 0xf70b, 0xf70c, 0xf70d, 0xf70e, - 0xf70f, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0xf710, 0xf711, 0xf712, 0xf713, 0xf714, 0xf715, 0xf716, 0xf717, - 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, - 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, - 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, - 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, - 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, - 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, - 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, - 0x0e38, 0x0e39, 0x0e3a, 0, 0, 0, 0, 0x0e3f, - 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, - 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, - 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, - 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0xf718, 0xf719, 0xf71a, 0 -}; - -static const int lao_0[128] = { - /**/ 0, 0, 0, 0, 0, 0, 0, 0, - /**/ 0, 0, 0, 0, 0, 0, 0, 0, - /**/ 0, 0, 0, 0, 0, 0, 0, 0, - /**/ 0, 0, 0, 0, 0, 0, 0, 0, - 0x0020, 0x0e81, 0x0e82, 0, 0x0e84, 0, 0, 0x0e87, - 0x0e88, 0, 0x0e8a, 0, 0, 0x0e8d, 0, 0, - 0, 0, 0, 0, 0x0e94, 0x0e95, 0x0e96, 0x0e97, - /**/ 0, 0x0e99, 0x0e9a, 0x0e9b, 0x0e9c, 0x0e9d, 0x0e9e, 0x0e9f, - /**/ 0, 0x0ea1, 0x0ea2, 0x0ea3, 0, 0x0ea5, 0, 0x0ea7, - /**/ 0, 0, 0x0eaa, 0x0eab, 0, 0x0ead, 0x0eae, 0x0eaf, - 0x0eb0, 0x0eb1, 0x0eb2, 0x0eb3, 0x0eb4, 0x0eb5, 0x0eb6, 0x0eb7, - 0x0eb8, 0x0eb9, 0, 0x0ebb, 0x0ebc, 0x0ebd, 0, 0, - 0x0ec0, 0x0ec1, 0x0ec2, 0x0ec3, 0x0ec4, 0, 0x0ec6, 0, - 0x0ec8, 0x0ec9, 0x0eca, 0x0ecb, 0x0ecc, 0x0ecd, 0, 0, - 0x0ed0, 0x0ed1, 0x0ed2, 0x0ed3, 0x0ed4, 0x0ed5, 0x0ed6, 0x0ed7, - 0x0ed8, 0x0ed9, 0, 0, 0x0edc, 0x0edd, 0, 0 -}; -static int -contain_glyphs(PangoFont *font, const int glyph_map[128]) -{ - PangoFcFont *fc_font = (PangoFcFont *)font; - unsigned char c; - - for (c = 0; c < 0x80; c++) - { - if (glyph_map[c]) - { - if (!pango_fc_font_has_char (fc_font, glyph_map[c])) - return 0; - } - } - return 1; -} - -/* Returns a structure with information we will use to rendering given the - * #PangoFont. This is computed once per font and cached for later retrieval. - */ -static ThaiFontInfo * -thai_get_font_info (PangoFont *font, - const PangoOTRuleset *ruleset) -{ - ThaiFontInfo *font_info; - static GQuark info_id = 0; - - if (G_UNLIKELY (!info_id)) - info_id = g_quark_from_string ("thai-font-info"); - - font_info = g_object_get_qdata (G_OBJECT (font), info_id); - - if (G_UNLIKELY (!font_info)) - { - /* No cached information not found, so we need to compute it - * from scratch - */ - font_info = g_new (ThaiFontInfo, 1); - font_info->font = font; - - /* detect font set by determining availibility of OT ruleset & glyphs */ - if (pango_ot_ruleset_get_feature_count (ruleset, NULL, NULL)) - font_info->font_set = THAI_FONT_TIS; - else if (contain_glyphs(font, tis620_2)) - font_info->font_set = THAI_FONT_TIS_WIN; - else if (contain_glyphs(font, tis620_1)) - font_info->font_set = THAI_FONT_TIS_MAC; - else - font_info->font_set = THAI_FONT_TIS; - - g_object_set_qdata_full (G_OBJECT (font), info_id, font_info, (GDestroyNotify)g_free); - } - - return font_info; -} - -static gunichar -get_glyph_index_tis (ThaiFontInfo *font_info, guchar c) -{ - if (!(c & 0x80)) - return lao_0[c]; - - switch (font_info->font_set) { - default: - case THAI_FONT_NONE: return 0; - case THAI_FONT_TIS: return tis620_0[c & 0x7f]; - case THAI_FONT_TIS_MAC: return tis620_1[c & 0x7f]; - case THAI_FONT_TIS_WIN: return tis620_2[c & 0x7f]; - } -} - -PangoGlyph -thai_get_glyph_tis (ThaiFontInfo *font_info, guchar c) -{ - return thai_get_glyph_uni (font_info, get_glyph_index_tis (font_info, c)); -} - -PangoGlyph -thai_make_glyph_tis (ThaiFontInfo *font_info, guchar c) -{ - return thai_make_glyph_uni (font_info, get_glyph_index_tis (font_info, c)); -} - -PangoGlyph -thai_get_glyph_uni (ThaiFontInfo *font_info, gunichar uc) -{ - return pango_fc_font_get_glyph ((PangoFcFont *)font_info->font, uc); -} - -PangoGlyph -thai_make_glyph_uni (ThaiFontInfo *font_info, gunichar uc) -{ - PangoGlyph result; - PangoFcFont *fc_font = (PangoFcFont *)font_info->font; - - result = pango_fc_font_get_glyph (fc_font, uc); - if (result) - return result; - else - return PANGO_GET_UNKNOWN_GLYPH ( uc); -} - -static const PangoOTFeatureMap gsub_features[] = -{ - {"ccmp", PANGO_OT_ALL_GLYPHS}, - {"locl", PANGO_OT_ALL_GLYPHS}, - {"liga", PANGO_OT_ALL_GLYPHS}, -}; - -static const PangoOTFeatureMap gpos_features[] = -{ - {"kern", PANGO_OT_ALL_GLYPHS}, - {"mark", PANGO_OT_ALL_GLYPHS}, - {"mkmk", PANGO_OT_ALL_GLYPHS} -}; - -static void -thai_engine_shape (PangoEngineShape *engine G_GNUC_UNUSED, - PangoFont *font, - const char *text, - gint length, - const PangoAnalysis *analysis, - PangoGlyphString *glyphs) -{ - PangoFcFont *fc_font; - FT_Face face; - PangoOTRulesetDescription desc; - const PangoOTRuleset *ruleset; - PangoOTBuffer *buffer; - gint i; - ThaiFontInfo *font_info; - - g_return_if_fail (font != NULL); - g_return_if_fail (text != NULL); - g_return_if_fail (length >= 0); - g_return_if_fail (analysis != NULL); - - fc_font = PANGO_FC_FONT (font); - face = pango_fc_font_lock_face (fc_font); - if (!face) - return; - - desc.script = analysis->script; - desc.language = analysis->language; - - desc.n_static_gsub_features = G_N_ELEMENTS (gsub_features); - desc.static_gsub_features = gsub_features; - desc.n_static_gpos_features = G_N_ELEMENTS (gpos_features); - desc.static_gpos_features = gpos_features; - - /* TODO populate other_features from analysis->extra_attrs */ - desc.n_other_features = 0; - desc.other_features = NULL; - - ruleset = pango_ot_ruleset_get_for_description (pango_ot_info_get (face), &desc); - - font_info = thai_get_font_info (font, ruleset); - - thai_set_glyphs (font_info, text, length, analysis->script, glyphs); - - buffer = pango_ot_buffer_new (PANGO_FC_FONT (font)); - pango_ot_buffer_set_rtl (buffer, analysis->level % 2 != 0); - - for (i = 0; i < glyphs->num_glyphs; i++) - pango_ot_buffer_add_glyph (buffer, - glyphs->glyphs[i].glyph, - 0, - glyphs->log_clusters[i]); - - pango_ot_ruleset_substitute (ruleset, buffer); - pango_ot_ruleset_position (ruleset, buffer); - - pango_ot_buffer_output (buffer, glyphs); - pango_ot_buffer_destroy (buffer); -} - -PangoGlyph -thai_make_unknown_glyph (ThaiFontInfo *font_info G_GNUC_UNUSED, gunichar uc) -{ - return PANGO_GET_UNKNOWN_GLYPH (uc); -} - -static void -thai_engine_fc_class_init (PangoEngineShapeClass *class) -{ - class->script_shape = thai_engine_shape; -} - -PANGO_ENGINE_SHAPE_DEFINE_TYPE (ThaiEngineFc, thai_engine_fc, - thai_engine_fc_class_init, NULL) - -void -PANGO_MODULE_ENTRY(init) (GTypeModule *module) -{ - thai_engine_fc_register_type (module); -} - -void -PANGO_MODULE_ENTRY(exit) (void) -{ -} - -void -PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines, - int *n_engines) -{ - *engines = script_engines; - *n_engines = G_N_ELEMENTS (script_engines); -} - -PangoEngine * -PANGO_MODULE_ENTRY(create) (const char *id) -{ - if (!strcmp (id, SCRIPT_ENGINE_NAME)) - return g_object_new (thai_engine_fc_type, NULL); - else - return NULL; -} diff --git a/modules/thai/thai-shaper.c b/modules/thai/thai-shaper.c deleted file mode 100644 index 4ed173c8..00000000 --- a/modules/thai/thai-shaper.c +++ /dev/null @@ -1,548 +0,0 @@ -/* Pango - * thai-shaper.c: - * - * Copyright (C) 1999 Red Hat Software - * Author: Owen Taylor <otaylor@redhat.com> - * - * Copyright (C) 2005 Theppitak Karoonboonyanan - * Copyright (C) 2002 Software and Language Engineering Laboratory, NECTEC - * Author: Theppitak Karoonboonyanan <thep@links.nectec.or.th> - * - * Copyright (c) 1996-2000 by Sun Microsystems, Inc. - * Author: Chookij Vanatham <Chookij.Vanatham@Eng.Sun.COM> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#include "config.h" -#include <string.h> - -#include <glib.h> -#include "pango-engine.h" -#include "thai-charprop.h" -#include "thai-shaper.h" - -#define MAX_CLUSTER_CHRS 256 -#define MAX_GLYPHS 256 - - -typedef struct { - guchar Start_TONE_AD, Start_AV, Start_BV_BD, Start_TailCutCons; - - guchar ShiftDown_TONE_AD[8]; - guchar ShiftDownLeft_TONE_AD[8]; - guchar ShiftLeft_TONE_AD[8]; - guchar ShiftLeft_AV[7]; - guchar ShiftDown_BV_BD[3]; - guchar TailCutCons[4]; - - guchar AmComp[2]; /* Sara Am components */ -} ThaiShapeTable; - -#define shiftdown_tone_ad(c,tbl) \ - ((tbl)->ShiftDown_TONE_AD[(c)-(tbl)->Start_TONE_AD]) -#define shiftdownleft_tone_ad(c,tbl) \ - ((tbl)->ShiftDownLeft_TONE_AD[(c)-(tbl)->Start_TONE_AD]) -#define shiftleft_tone_ad(c,tbl) \ - ((tbl)->ShiftLeft_TONE_AD[(c)-(tbl)->Start_TONE_AD]) -#define shiftleft_av(c,tbl) \ - ((tbl)->ShiftLeft_AV[(c)-(tbl)->Start_AV]) -#define shiftdown_bv_bd(c,tbl) \ - ((tbl)->ShiftDown_BV_BD[(c)-(tbl)->Start_BV_BD]) -#define tailcutcons(c,tbl) \ - ((tbl)->TailCutCons[(c)-(tbl)->Start_TailCutCons]) - -/* No adjusted vowel/tonemark glyphs (tis620-0) - */ -static const ThaiShapeTable tis620_0_shape_table = { - 0xE7, 0xD1, 0xD8, 0xAD, - { 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE }, - { 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE }, - { 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE }, - { 0xD1, 0x00, 0x00, 0xD4, 0xD5, 0xD6, 0xD7 }, - { 0xD8, 0xD9, 0xDA }, - { 0xAD, 0x00, 0x00, 0xB0 }, - { 0xED, 0xD2 } -}; - -/* Macintosh - */ -static const ThaiShapeTable Mac_shape_table = { - 0xE7, 0xD1, 0xD8, 0xAD, - { 0xE7, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0xED, 0xEE }, - { 0x93, 0x83, 0x84, 0x85, 0x86, 0x87, 0x8F, 0xEE }, - { 0x93, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x8F, 0xEE }, - { 0x92, 0x00, 0x00, 0x94, 0x95, 0x96, 0x97 }, - { 0xFC, 0xFD, 0xFE }, - { 0x90, 0x00, 0x00, 0x80 }, - { 0xED, 0xD2 } -}; - -/* Microsoft Window - */ -static const ThaiShapeTable Win_shape_table = { - 0xE7, 0xD1, 0xD8, 0xAD, - { 0xE7, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0xED, 0xEE }, - { 0x9A, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x99, 0xEE }, - { 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0x99, 0xEE }, - { 0x98, 0x00, 0x00, 0x81, 0x82, 0x83, 0x84 }, - { 0xFC, 0xFD, 0xFE }, - { 0x90, 0x00, 0x00, 0x80 }, - { 0xED, 0xD2 } -}; - -static const ThaiShapeTable Lao_shape_table = { - 0x67, 0x51, 0x58, 0x2D, - { 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E }, - { 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E }, - { 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E }, - { 0x51, 0x00, 0x00, 0x54, 0x55, 0x56, 0x57 }, - { 0x58, 0x59, 0x00 }, - { 0x2D, 0x00, 0x00, 0x30 }, - { 0x6D, 0x52 } -}; - -static void -add_glyph (ThaiFontInfo *font_info, - PangoGlyphString *glyphs, - gint cluster_start, - PangoGlyph glyph, - gboolean combining) -{ - PangoRectangle ink_rect, logical_rect; - gint index = glyphs->num_glyphs; - - pango_glyph_string_set_size (glyphs, index + 1); - - glyphs->glyphs[index].glyph = glyph; - glyphs->glyphs[index].attr.is_cluster_start = combining ? 0 : 1; - - glyphs->log_clusters[index] = cluster_start; - - pango_font_get_glyph_extents (font_info->font, - glyphs->glyphs[index].glyph, &ink_rect, &logical_rect); - - if (combining || logical_rect.width > 0) - { - glyphs->glyphs[index].geometry.x_offset = 0; - glyphs->glyphs[index].geometry.width = logical_rect.width; - } - else - { - glyphs->glyphs[index].geometry.x_offset = ink_rect.width; - glyphs->glyphs[index].geometry.width = ink_rect.width; - } - glyphs->glyphs[index].geometry.y_offset = 0; -} - -static PangoGlyph -get_null_base_glyph (ThaiFontInfo *font_info) -{ - return thai_get_glyph_uni (font_info, 0x25cc); -} - -static gint -get_adjusted_glyphs_list (ThaiFontInfo *font_info, - gunichar *cluster, - gint num_chrs, - PangoGlyph *glyph_lists, - const ThaiShapeTable *shaping_table) -{ - switch (num_chrs) - { - case 1: - if (is_char_type (cluster[0], - BelowVowel|BelowDiac|AboveVowel|AboveDiac|Tone|SaraAm)) - { - gint n; - glyph_lists[0] = get_null_base_glyph (font_info); - n = glyph_lists[0] ? 1 : 0; - glyph_lists[n++] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - return n; - } - else - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - return 1; - } - break; - - case 2: - if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) && - is_char_type (cluster[1], SaraAm)) - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = thai_make_glyph_tis (font_info, shaping_table->AmComp[0]); - glyph_lists[2] = thai_make_glyph_tis (font_info, shaping_table->AmComp[1]); - return 3; - } - else if (is_char_type (cluster[0], UpTailCons) && - is_char_type (cluster[1], SaraAm)) - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = thai_make_glyph_tis (font_info, - shiftleft_tone_ad (shaping_table->AmComp[0], shaping_table)); - glyph_lists[2] = thai_make_glyph_tis (font_info, shaping_table->AmComp[1]); - return 3; - } - else if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) && - is_char_type (cluster[1], AboveVowel)) - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[1])); - return 2; - } - else if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) && - is_char_type (cluster[1], AboveDiac|Tone)) - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = thai_make_glyph_tis (font_info, - shiftdown_tone_ad (ucs2tis (cluster[1]), shaping_table)); - return 2; - } - else if (is_char_type (cluster[0], UpTailCons) && - is_char_type (cluster[1], AboveVowel)) - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = thai_make_glyph_tis (font_info, - shiftleft_av (ucs2tis (cluster[1]), shaping_table)); - return 2; - } - else if (is_char_type (cluster[0], UpTailCons) && - is_char_type (cluster[1], AboveDiac|Tone)) - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = thai_make_glyph_tis (font_info, - shiftdownleft_tone_ad (ucs2tis (cluster[1]), shaping_table)); - return 2; - } - else if (is_char_type (cluster[0], NoTailCons|UpTailCons) && - is_char_type (cluster[1], BelowVowel|BelowDiac)) - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[1])); - return 2; - } - else if (is_char_type (cluster[0], BotTailCons) && - is_char_type (cluster[1], BelowVowel|BelowDiac)) - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = - thai_make_glyph_tis (font_info, - shiftdown_bv_bd (ucs2tis (cluster[1]), shaping_table)); - return 2; - } - else if (is_char_type (cluster[0], SpltTailCons) && - is_char_type (cluster[1], BelowVowel|BelowDiac)) - { - glyph_lists[0] = thai_make_glyph_tis (font_info, - tailcutcons (ucs2tis (cluster[0]), shaping_table)); - glyph_lists[1] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[1])); - return 2; - } - else - { - gint n; - glyph_lists[0] = get_null_base_glyph (font_info); - n = glyph_lists[0] ? 1 : 0; - glyph_lists[n++] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[n++] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[1])); - return n; - } - break; - - case 3: - if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) && - is_char_type (cluster[1], Tone) && - is_char_type (cluster[2], SaraAm)) - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = thai_make_glyph_tis (font_info, shaping_table->AmComp[0]); - glyph_lists[2] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[1])); - glyph_lists[3] = thai_make_glyph_tis (font_info, shaping_table->AmComp[1]); - return 4; - } - else if (is_char_type (cluster[0], UpTailCons) && - is_char_type (cluster[1], Tone) && - is_char_type (cluster[2], SaraAm)) - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = thai_make_glyph_tis (font_info, - shiftleft_tone_ad (shaping_table->AmComp[0], shaping_table)); - glyph_lists[2] = thai_make_glyph_tis (font_info, - shiftleft_tone_ad (ucs2tis (cluster[1]), shaping_table)); - glyph_lists[3] = thai_make_glyph_tis (font_info, shaping_table->AmComp[1]); - return 4; - } - else if (is_char_type (cluster[0], UpTailCons) && - is_char_type (cluster[1], AboveVowel) && - is_char_type (cluster[2], AboveDiac|Tone)) - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = thai_make_glyph_tis (font_info, - shiftleft_av (ucs2tis (cluster[1]), shaping_table)); - glyph_lists[2] = thai_make_glyph_tis (font_info, - shiftleft_tone_ad (ucs2tis (cluster[2]), shaping_table)); - return 3; - } - else if (is_char_type (cluster[0], UpTailCons) && - is_char_type (cluster[1], BelowVowel) && - is_char_type (cluster[2], AboveDiac|Tone)) - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[1])); - glyph_lists[2] = thai_make_glyph_tis (font_info, - shiftdownleft_tone_ad (ucs2tis (cluster[2]), shaping_table)); - return 3; - } - else if (is_char_type (cluster[0], NoTailCons) && - is_char_type (cluster[1], BelowVowel) && - is_char_type (cluster[2], AboveDiac|Tone)) - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[1])); - glyph_lists[2] = - thai_make_glyph_tis (font_info, - shiftdown_tone_ad (ucs2tis (cluster[2]), shaping_table)); - return 3; - } - else if (is_char_type (cluster[0], SpltTailCons) && - is_char_type (cluster[1], BelowVowel) && - is_char_type (cluster[2], AboveDiac|Tone)) - { - glyph_lists[0] = thai_make_glyph_tis (font_info, - tailcutcons (ucs2tis (cluster[0]), shaping_table)); - glyph_lists[1] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[1])); - glyph_lists[2] = thai_make_glyph_tis (font_info, - shiftdown_tone_ad (ucs2tis (cluster[2]), shaping_table)); - return 3; - } - else if (is_char_type (cluster[0], BotTailCons) && - is_char_type (cluster[1], BelowVowel) && - is_char_type (cluster[2], AboveDiac|Tone)) - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = thai_make_glyph_tis (font_info, - shiftdown_bv_bd (ucs2tis (cluster[1]), shaping_table)); - glyph_lists[2] = thai_make_glyph_tis (font_info, - shiftdown_tone_ad (ucs2tis (cluster[2]), shaping_table)); - return 3; - } - else - { - glyph_lists[0] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[0])); - glyph_lists[1] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[1])); - glyph_lists[2] = - thai_make_glyph_tis (font_info, ucs2tis (cluster[2])); - return 3; - } - break; - - default: /* e.g. Lao cluster with below cons + upper/lower vowel + tone */ - { - gint i; - for (i = 0; i < num_chrs; i++) - glyph_lists[i] = thai_make_glyph_tis (font_info, ucs2tis (cluster[i])); - return num_chrs; - } - } - - return 0; -} - -static gint -get_glyphs_list (ThaiFontInfo *font_info, - PangoScript script, - gunichar *cluster, - gint num_chrs, - PangoGlyph *glyph_lists) -{ - gint i; - - switch ((int) script) - { - case PANGO_SCRIPT_THAI: - switch (font_info->font_set) - { - default: - case THAI_FONT_NONE: - for (i=0; i < num_chrs; i++) - glyph_lists[i] = thai_make_unknown_glyph (font_info, cluster[i]); - return num_chrs; - - case THAI_FONT_TIS: - /* TIS620-0 + Wtt2.0 Extension - */ - return get_adjusted_glyphs_list (font_info, cluster, - num_chrs, glyph_lists, &tis620_0_shape_table); - - case THAI_FONT_TIS_MAC: - /* MacIntosh Extension - */ - return get_adjusted_glyphs_list (font_info, cluster, - num_chrs, glyph_lists, &Mac_shape_table); - - case THAI_FONT_TIS_WIN: - /* Microsoft Extension - */ - return get_adjusted_glyphs_list (font_info, cluster, - num_chrs, glyph_lists, &Win_shape_table); - } - break; - - case PANGO_SCRIPT_LAO: - return get_adjusted_glyphs_list (font_info, cluster, - num_chrs, glyph_lists, &Lao_shape_table); - - default: - for (i=0; i < num_chrs; i++) - glyph_lists[i] = thai_make_unknown_glyph (font_info, cluster[i]); - return num_chrs; - } - - return 0; /* Quiet GCC */ -} - -static void -add_cluster (ThaiFontInfo *font_info, - PangoScript script, - PangoGlyphString *glyphs, - gint cluster_start, - gunichar *cluster, - gint num_chrs) -{ - PangoGlyph glyphs_list[MAX_GLYPHS]; - gint num_glyphs; - gint i; - - if (isthai (cluster[0])) - { - num_glyphs = get_glyphs_list(font_info, script, cluster, num_chrs, glyphs_list); - for (i=0; i<num_glyphs; i++) - add_glyph (font_info, glyphs, cluster_start, glyphs_list[i], - i == 0 ? FALSE : TRUE); - } - else if (islao (cluster[0])) - { - num_glyphs = get_glyphs_list(font_info, script, cluster, num_chrs, glyphs_list); - for (i=0; i<num_glyphs; i++) - add_glyph (font_info, glyphs, cluster_start, glyphs_list[i], - i == 0 ? FALSE : TRUE); - } - else - { - g_assert (num_chrs == 1); - add_glyph (font_info, glyphs, cluster_start, - thai_make_glyph_uni (font_info, cluster[0]), - FALSE); - } -} - -static gboolean -is_wtt_composible (gunichar cur_wc, gunichar nxt_wc) -{ - switch (TAC_compose_input(cur_wc, nxt_wc)) - { - case 'A': - case 'S': - case 'R': - case 'X': - return FALSE; - - case 'C': - return TRUE; - } - - g_assert_not_reached (); - return FALSE; -} - -static const char * -get_next_cluster(const char *text, - gint length, - gunichar *cluster, - gint *num_chrs) -{ - PangoScript cluster_script = PANGO_SCRIPT_INVALID_CODE, cur_script; - const char *p; - gint n_chars = 0; - gunichar current; - - for (p = text; p < text + length; p = g_utf8_next_char (p)) - { - current = g_utf8_get_char (p); - cur_script = pango_script_for_unichar (current); - if (cluster_script == PANGO_SCRIPT_INVALID_CODE) - cluster_script = cur_script; - if (cur_script != cluster_script || - (n_chars > 0 && - !is_wtt_composible (cluster[n_chars - 1], current))) - break; - cluster[n_chars++] = current; - } - - *num_chrs = n_chars; - return p; -} - -void -thai_set_glyphs (ThaiFontInfo *font_info, - const char *text, - gint length, - PangoScript script, - PangoGlyphString *glyphs) -{ - gint n_chars; - const char *p; - const char *log_cluster; - gunichar cluster[MAX_CLUSTER_CHRS]; - - pango_glyph_string_set_size (glyphs, 0); - - p = text; - while (p < text + length) - { - log_cluster = p; - p = get_next_cluster (p, text + length - p, cluster, &n_chars); - add_cluster (font_info, script, glyphs, log_cluster - text, cluster, n_chars); - } -} diff --git a/modules/thai/thai-shaper.h b/modules/thai/thai-shaper.h deleted file mode 100644 index cb2f7edc..00000000 --- a/modules/thai/thai-shaper.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Pango - * thai-shaper.h: - * - * Copyright (C) 1999 Red Hat Software - * Author: Owen Taylor <otaylor@redhat.com> - * - * Copyright (C) 2004 Theppitak Karoonboonyanan - * Copyright (C) 2002 Software and Language Engineering Laboratory, NECTEC - * Author: Theppitak Karoonboonyanan <thep@linux.thai.net> - * - * Copyright (c) 1996-2000 by Sun Microsystems, Inc. - * Author: Chookij Vanatham <Chookij.Vanatham@Eng.Sun.COM> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __THAI_SHAPER_H__ -#define __THAI_SHAPER_H__ - -typedef struct _ThaiFontInfo ThaiFontInfo; - -/* Font encodings we will use - */ -typedef enum { - THAI_FONT_NONE, - THAI_FONT_TIS, - THAI_FONT_TIS_MAC, - THAI_FONT_TIS_WIN -} ThaiFontSet; - -typedef enum { - THAI_FONTINFO_X, - THAI_FONTINFO_XFT -} ThaiFontInfoType; - -struct _ThaiFontInfo -{ - PangoFont *font; - ThaiFontSet font_set; -}; - -/* - * Abstract methods (implemented by each shaper module) - */ -PangoGlyph -thai_get_glyph_tis (ThaiFontInfo *font_info, guchar c); - -PangoGlyph -thai_make_glyph_tis (ThaiFontInfo *font_info, guchar c); - -PangoGlyph -thai_get_glyph_uni (ThaiFontInfo *font_info, gunichar uc); - -PangoGlyph -thai_make_glyph_uni (ThaiFontInfo *font_info, gunichar uc); - -PangoGlyph -thai_make_unknown_glyph (ThaiFontInfo *font_info, gunichar uc); - -void -thai_set_glyphs (ThaiFontInfo *font_info, - const char *text, - gint length, - PangoScript script, - PangoGlyphString *glyphs); - -#endif /* __THAI_SHAPER_H__ */ |