diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 62028aed6f52..6554c1589981 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -131,7 +131,6 @@ MOZ_ENABLE_LIBXUL = @MOZ_ENABLE_LIBXUL@ ENABLE_TESTS = @ENABLE_TESTS@ IBMBIDI = @IBMBIDI@ MOZ_UNIVERSALCHARDET = @MOZ_UNIVERSALCHARDET@ -SUNCTL = @SUNCTL@ ACCESSIBILITY = @ACCESSIBILITY@ MOZ_VIEW_SOURCE = @MOZ_VIEW_SOURCE@ MOZ_XPINSTALL = @MOZ_XPINSTALL@ diff --git a/configure.in b/configure.in index 9b1a09334608..0d0f3466f481 100644 --- a/configure.in +++ b/configure.in @@ -4405,7 +4405,6 @@ NECKO_COOKIES=1 NECKO_DISK_CACHE=1 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource" NECKO_SMALL_BUFFERS= -SUNCTL= JS_STATIC_BUILD= XPC_IDISPATCH_SUPPORT= @@ -5227,14 +5226,6 @@ dnl bi-directional support always on IBMBIDI=1 AC_DEFINE(IBMBIDI) -dnl ======================================================== -dnl complex text support off by default -dnl ======================================================== -MOZ_ARG_ENABLE_BOOL(ctl, -[ --enable-ctl Enable Thai Complex Script support], - SUNCTL=1, - SUNCTL= ) - dnl ======================================================== dnl view source support on by default dnl ======================================================== @@ -7863,22 +7854,6 @@ if test "$MOZ_LDAP_XPCOM"; then fi fi -if test "$COMPILE_ENVIRONMENT"; then -if test "$SUNCTL"; then - dnl older versions of glib do not seem to have gmodule which ctl needs - _SAVE_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS $GLIB_CFLAGS" - AC_LANG_SAVE - AC_LANG_C - AC_TRY_COMPILE([#include ], - [ int x = 1; x++; ],, - [AC_MSG_ERROR([Cannot build ctl without gmodule support in glib.])]) - AC_LANG_RESTORE - CFLAGS=$_SAVE_CFLAGS - AC_DEFINE(SUNCTL) -fi -fi # COMPILE_ENVIRONMENT - dnl ======================================================== dnl = dnl = Maintainer debug option (no --enable equivalent) @@ -7985,7 +7960,6 @@ AC_SUBST(BUILD_STATIC_LIBS) AC_SUBST(MOZ_ENABLE_LIBXUL) AC_SUBST(ENABLE_TESTS) AC_SUBST(IBMBIDI) -AC_SUBST(SUNCTL) AC_SUBST(MOZ_UNIVERSALCHARDET) AC_SUBST(ACCESSIBILITY) AC_SUBST(MOZ_XPINSTALL) diff --git a/intl/Makefile.in b/intl/Makefile.in index 7a998cd569eb..9822f6476132 100644 --- a/intl/Makefile.in +++ b/intl/Makefile.in @@ -44,10 +44,5 @@ include $(DEPTH)/config/autoconf.mk DIRS = unicharutil uconv locale strres lwbrk build -# Sun's Complex Text Layout support -ifdef SUNCTL -DIRS += ctl -endif - include $(topsrcdir)/config/rules.mk diff --git a/intl/ctl/Makefile.in b/intl/ctl/Makefile.in deleted file mode 100644 index 3066e6985d2a..000000000000 --- a/intl/ctl/Makefile.in +++ /dev/null @@ -1,49 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Prabhat Hegde (prabhat.hegde@sun.com) -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -DIRS = public src/pangoLite src/thaiShaper src/hindiShaper src - -include $(topsrcdir)/config/rules.mk - diff --git a/intl/ctl/public/Makefile.in b/intl/ctl/public/Makefile.in deleted file mode 100644 index 1248c502268f..000000000000 --- a/intl/ctl/public/Makefile.in +++ /dev/null @@ -1,57 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Sun Microsystems, Inc. -# Portions created by the Initial Developer are Copyright (C) 2000 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Prabhat Hegde (prabhat.hegde@sun.com) -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = ctl - -EXPORTS = \ - nsCtlCIID.h \ - nsILE.h \ - $(NULL) - -LOCAL_INCLUDES += -I../src/include - -EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) - -include $(topsrcdir)/config/rules.mk diff --git a/intl/ctl/public/nsCtlCIID.h b/intl/ctl/public/nsCtlCIID.h deleted file mode 100644 index 1032c390202e..000000000000 --- a/intl/ctl/public/nsCtlCIID.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * XPCTL : nsCtlCIID.h - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Sun Microsystems, Inc. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Prabhat Hegde (prabhat.hegde@sun.com) - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsCtlCIID_h___ -#define nsCtlCIID_h___ - -// Class ID for UnicodeToSunIndia font encoding converter for *nix -#define NS_UNICODETOSUNINDIC_CID \ -{ 0xc270e4e7, 0x3915, 0x43fe, \ - { 0xbc, 0xb0, 0x57, 0x4e, 0x68, 0xaf, 0x6b, 0xaf } } - -// Class ID for UnicodeToTIS620 charset converter for *nix -#define NS_UNICODETOTIS620_CID \ -{ 0xa2297171, 0x41ee, 0x498a, \ - { 0x83, 0x12, 0x1a, 0x63, 0x27, 0xd0, 0x44, 0x3a } } - -// Class ID for UnicodeToThaiTTF charset converter -#define NS_UNICODETOTHAITTF_CID \ -{ 0xf15aec07, 0xd606, 0x452b, \ - { 0x96, 0xd6, 0x55, 0xa6, 0x84, 0x3f, 0x97, 0xf6 } } - -// 1B285478-11B7-4EA3-AF47-2A7D117845AC -#define NS_ILE_IID \ -{ 0x1b285478, 0x11b7, 0x4ea3, \ -{ 0xaf, 0x47, 0x2a, 0x7d, 0x11, 0x78, 0x45, 0xac } } - -#define NS_ILE_PROGID "@mozilla.org/extensions/ctl;1" - -// A47B6D8A-CB2D-439E-B186-AC40F73B8252 -#define NS_ULE_CID \ -{ 0xa47b6d8a, 0xcb2d, 0x439e, \ - { 0xb1, 0x86, 0xac, 0x40, 0xf7, 0x3b, 0x82, 0x52 } } - -// 6898A17D-5933-4D49-9CB4-CB261206FCC0 -#define NS_ULE_IID \ -{ 0x6898a17d, 0x5933, 0x4d49, \ - { 0x9c, 0xb4, 0xcb, 0x26, 0x12, 0x06, 0xfc, 0xc0 } } - -#define NS_ULE_PROGID "@mozilla.org/intl/extensions/nsULE;1" - -// D9E30F46-0EB5-4763-A7BD-26DECB30952F -#define NS_ISHAPEDTEXT_IID \ -{ 0xd9e30f46, 0x0eb5, 0x4763, \ -{ 0xa7, 0xbd, 0x26, 0xde, 0xcb, 0x30, 0x95, 0x2f } } - -// {2997A657-AD7B-4036-827C-FBB3B443845B} -#define NS_SHAPEDTEXT_CID \ -{ 0x2997a657, 0xad7b, 0x4036, \ - { 0x82, 0x7c, 0xfb, 0xb3, 0xb4, 0x43, 0x84, 0x5b } } - -// {A47B6D8A-CB2D-439E-B186-AC40F73B8252} -#define NS_SHAPEDTEXT_IID \ -{ 0xa47b6d8a, 0xcb2d, 0x439e, \ - { 0xb1, 0x86, 0xac, 0x40, 0xf7, 0x3b, 0x82, 0x52 } } - -#define NS_SHAPEDTEXT_PROGID "component://netscape/extensions/ctl/nsShapedText" - -#endif /* !nsCtlCIID_h___ */ diff --git a/intl/ctl/public/nsILE.h b/intl/ctl/public/nsILE.h deleted file mode 100644 index c04eda6fc5c0..000000000000 --- a/intl/ctl/public/nsILE.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * XPCTL : nsILE.h - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code.. - * - * The Initial Developer of the Original Code is - * Sun Microsystems, Inc. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Prabhat Hegde (prabhat.hegde@sun.com) - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsILE_h__ -#define nsILE_h__ - -#include "nscore.h" -#include "nsISupports.h" -#include "nsCtlCIID.h" - -/* - * nsILE Interface declaration - */ -class nsILE : public nsISupports { -public: - - NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILE_IID) - - NS_IMETHOD NeedsCTLFix(const PRUnichar*, const PRInt32, - const PRInt32, PRBool *) = 0; - - NS_IMETHOD GetPresentationForm(const PRUnichar*, PRUint32, - const char*, char*, PRSize*, - PRBool = PR_FALSE) = 0; - - NS_IMETHOD PrevCluster(const PRUnichar*, PRUint32, - const PRInt32, PRInt32*) = 0; - - NS_IMETHOD NextCluster(const PRUnichar*, PRUint32, - const PRInt32, PRInt32*) = 0; - - NS_IMETHOD GetRangeOfCluster(const PRUnichar*, PRUint32, - const PRInt32, PRInt32*, PRInt32*) = 0; -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsILE, NS_ILE_IID) - -#endif /* !nsILE_h */ - diff --git a/intl/ctl/readme.txt b/intl/ctl/readme.txt deleted file mode 100644 index 7d5ab44719c4..000000000000 --- a/intl/ctl/readme.txt +++ /dev/null @@ -1 +0,0 @@ -we should add the pango ctl code here diff --git a/intl/ctl/src/Makefile.in b/intl/ctl/src/Makefile.in deleted file mode 100644 index ce3b142d0850..000000000000 --- a/intl/ctl/src/Makefile.in +++ /dev/null @@ -1,89 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Sun Microsystems, Inc. -# Portions created by the Initial Developer are Copyright (C) 2000 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Prabhat Hegde (prabhat.hegde@sun.com) -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = ctl -LIBRARY_NAME = ctl -EXPORT_LIBRARY = 1 -IS_COMPONENT = 1 -LIBXUL_LIBRARY = 1 -MODULE_NAME = nsCtlLEModule - -PACKAGE_FILE = ctl.pkg - -REQUIRES = \ - xpcom \ - string \ - uconv \ - locale \ - $(NULL) - -EXTRA_DSO_LIBS = mozpango - -CPPSRCS = \ - nsULE.cpp \ - nsUnicodeToTIS620.cpp \ - nsUnicodeToSunIndic.cpp \ - nsUnicodeToThaiTTF.cpp \ - nsCtlLEModule.cpp \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -LOCAL_INCLUDES += -I$(srcdir)/pangoLite - -EXTRA_DSO_LDOPTS += $(LIBS_DIR) - -ifdef MOZ_ENABLE_GTK2 - CXXFLAGS += $(MOZ_GTK2_CFLAGS) - EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS) -else - CXXFLAGS += $(GLIB_CFLAGS) - EXTRA_DSO_LDOPTS += $(GLIB_GMODULE_LIBS) -endif - -EXTRA_DSO_LDOPTS += \ - $(MOZ_COMPONENT_LIBS) \ - $(EXTRA_DSO_LIBS) \ - $(NULL) diff --git a/intl/ctl/src/ctl.pkg b/intl/ctl/src/ctl.pkg deleted file mode 100644 index 233ac309ed93..000000000000 --- a/intl/ctl/src/ctl.pkg +++ /dev/null @@ -1,6 +0,0 @@ -[gecko] -#if SHARED_LIBRARY -dist/bin/components/@SHARED_LIBRAYR@ -#else -!staticcomp @LIBRARY@ @MODULE_NAME@ -#endif diff --git a/intl/ctl/src/hindiShaper/Makefile.in b/intl/ctl/src/hindiShaper/Makefile.in deleted file mode 100644 index 25f0a8ac99c7..000000000000 --- a/intl/ctl/src/hindiShaper/Makefile.in +++ /dev/null @@ -1,77 +0,0 @@ -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Sun Microsystems, Inc. -# Portions created by the Initial Developer are Copyright (C) 2002 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Prabhat Hegde (prabhat.hegde@sun.com) -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = mozpango-dvngx -LIBRARY_NAME = mozpango-dvngx -# See bug 201167 ("No CTL support in StaticBuilds") -FORCE_SHARED_LIB = 1 -EXTRA_DSO_LIBS = mozpango - -CSRCS = \ - dvng-x.c \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -LOCAL_INCLUDES += \ - -I$(srcdir)/../pangoLite \ - $(NULL) - -ifdef MOZ_ENABLE_GTK2 - CFLAGS += $(MOZ_GTK2_CFLAGS) - EXTRA_DSO_LDOPTS += \ - -L$(DIST)/lib \ - $(EXTRA_DSO_LIBS) \ - $(GLIB_LIBS) \ - $(MOZ_GTK2_LIBS) \ - $(NULL) -else - CFLAGS += $(GLIB_CFLAGS) - EXTRA_DSO_LDOPTS += \ - -L$(DIST)/lib \ - $(EXTRA_DSO_LIBS) \ - $(GLIB_LIBS) \ - $(GLIB_GMODULE_LIBS) \ - $(NULL) -endif diff --git a/intl/ctl/src/hindiShaper/dvng-x.c b/intl/ctl/src/hindiShaper/dvng-x.c deleted file mode 100644 index 45f88fdb0c99..000000000000 --- a/intl/ctl/src/hindiShaper/dvng-x.c +++ /dev/null @@ -1,1502 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pangolite - * dvng-x.c: - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Sun Microsystems, Inc. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Prabhat Hegde (prabhat.hegde@sun.com) - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include -#include - -#include "pango-engine.h" -#include "pango-coverage.h" - -#define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) -#define MAX_CLUSTER_CHRS 256 -#define MAX_GLYPHS 256 -#define GLYPH_COMBINING 256 - -/************************************************************************* - * CHARACTER TYPE CONSTANTS - What they represent * - * ---------------------------------------------- * - * * - * _NP : Vowel-Modifier Visarg(U+0903) (Displayed to the right). * - * _UP : Vowel-Modifer Chandrabindu(U+0901) and Anuswar (U+0902). * - * Displayed above the Consonant/Vowel * - * _IV : Independant Vowels * - * _CN : All consonants except _CK and _RC below * - * _CK : Consonants that can be followed by a Nukta(U+093C). Characters * - * (U+0958-U+095F). No clue why Unicode imposed it on Devanagari. * - * _RC : Consonant Ra - Needs to handle 'Reph' * - * _NM : Handle special case of Matras when followed by a Chandrabindu/ * - * Anuswar. * - * _IM : Choti I Matra (U+093F). Needs to handle re-ordering. * - * _HL : Halant (U+094D) * - * _NK : Nukta (U+093C) * - * _VD : For Vedic extension characters (U+0951 - U+0954) * - * _HD : Hindu Numerals written in Devanagari * - * _MS : For Matras such U+0941, U+0942 which need to be attached to the * - * holding consonant at the Stem. * - * _RM : A cluster of Ra+Halant at the begining would be represented by * - * a Reph (placed in sun.unicode.india-0 at 0xF812). Reph is * - * typically attached on top of the last consonant. * - * _II_M, _EY_M, _AI_M, _OW1_M, _OW2_M, _AYE_M, _EE_M, _AWE_M, _O_M, * - * : Separate glyphs are provided which combine matra with a reph. * - * Matras which need to use this are represented by the above. * - *************************************************************************/ - -/************************************************************************* - * CLUSTERING LOGIC * - * ---------------- * - * * - * Notations used to describe Devanagari Script Generic Info: * - * D : Vowel-Modifiers (U+0901 - U+0903) * - * V : Vowels (U+0905 - U+0913) & (U+0960, U+0961) * - * C : Consonants (U+0915 - U+0939) * - * M : Matras (U+093E - U+094C) & (U+0962, U+0963) * - * H : Halant (U+094D) * - * N : Nukta (U+093C) * - * * - * RULES:- * - * ------- * - * Syllable/Cluster types * - * * - * 1] Vowel Syllable ::- V[D] * - * 2] Cons - Vowel Syllable ::- [Cons-Syllable] Full- Cons [M] [D] * - * 3] Cons-Syllable ::- [Pure-Cons][Pure-Cons] Pure-Cons * - * 4] Pure-Cons ::- Full-Cons H * - * 5] Full-Cons ::- C[N] * - * * - * Notes: * - * 1] Nukta (N) can come after only those consonants with which it can * - * combine, ie U+0915-U+0917, U+091C, U+0921, U+0922, U+092B & U+092F * - * 2] Worst case Vowel cluster - V D * - * 3] A worst case Consonant cluster: C N H C N H C N H C N M D * - *************************************************************************/ - -/* - * Devanagari character classes - */ -#define _NP 1L -#define _UP (1L<<1) -#define _IV (1L<<2) -#define _CN (1L<<3) -#define _CK (1L<<4) -#define _RC (1L<<5) -#define _NM (1L<<6) -#define _IM (1L<<7) -#define _HL (1L<<8) -#define _NK (1L<<9) -#define _VD (1L<<10) -#define _HD (1L<<11) -#define _II_M (1L<<12) -#define _EY_M (1L<<13) -#define _AI_M (1L<<14) -#define _OW1_M (1L<<15) -#define _OW2_M (1L<<16) -#define _MS (1L<<17) -#define _AYE_M (1L<<18) -#define _EE_M (1L<<19) -#define _AWE_M (1L<<20) -#define _O_M (1L<<21) -#define _RM (_II_M|_EY_M|_AI_M|_OW1_M|_OW2_M|_AYE_M|_EE_M|_AWE_M|_O_M) - -/* Common Non-defined type */ -#define __ND 0 - -/* - * Devanagari character types - */ -#define __UP 1 -#define __NP 2 -#define __IV 3 -#define __CN 4 -#define __CK 5 -#define __RC 6 -#define __NM 7 -#define __RM 8 -#define __IM 9 -#define __HL 10 -#define __NK 11 -#define __VD 12 -#define __HD 13 - -/* - * Devanagari Glyph Type State - */ -#define St0 0 -#define St1 1 -#define St2 2 -#define St3 3 -#define St4 4 -#define St5 5 -#define St6 6 -#define St7 7 -#define St8 8 -#define St9 9 -#define St10 10 -#define St11 11 -#define St12 12 -#define St13 13 -#define St14 14 -#define St15 15 -#define St16 16 -#define St17 17 -#define St18 18 -#define St19 19 -#define St20 20 - -#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 MAP_SIZE 243 -#define MAX_STATE 21 -#define MAX_DEVA_TYPE 14 -#define MAX_CORE_CONS 6 - -#define SCRIPT_ENGINE_NAME "DvngScriptEngineX" -#define PANGO_RENDER_TYPE_X "PangoliteRenderX" - -#define ucs2dvng(ch) (gunichar2)((gunichar2)(ch) - 0x0900) - -typedef guint16 PangoliteXSubfont; -#define PANGO_MOZ_MAKE_GLYPH(index) ((guint32)0 | (index)) - -/* We handle the following ranges between U+0901 to U+0970 exactly - */ -static PangoliteEngineRange dvng_ranges[] = { - { 0x0901, 0x0903, "*" }, - { 0x0905, 0x0939, "*" }, - { 0x093c, 0x094d, "*" }, - { 0x0950, 0x0954, "*" }, - { 0x0958, 0x0970, "*" }, /* Hindi Ranges */ -}; - -static PangoliteEngineInfo script_engines[] = { - { - SCRIPT_ENGINE_NAME, - PANGO_ENGINE_TYPE_SHAPE, - PANGO_RENDER_TYPE_X, - dvng_ranges, - G_N_ELEMENTS(dvng_ranges) - } -}; - -/* X window system script engine portion - */ -typedef struct _DvngFontInfo DvngFontInfo; - -/* The type of encoding that we will use - */ -typedef enum { - DVNG_FONT_NONE, - DVNG_FONT_SUN -} DvngFontType; - -/* - */ -typedef struct { - const gunichar ISCII[MAX_CORE_CONS]; - const unsigned short ISFOC[MAX_CORE_CONS]; -} DvngGlyphEntry; - -/* - */ -struct _DvngFontInfo -{ - DvngFontType type; - PangoliteXSubfont subfont; -}; - -typedef long DvngCls; -typedef int StateType; - -/* - * Devanagari character class table - */ -static const DvngCls DvngChrClsTbl[128] = { -/* 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, A, B, C, D, E, F, */ -/* 0 */ _ND, _UP, _UP, _NP, _ND, _IV, _IV, _IV, - _IV, _IV, _IV, _IV, _IV, _IV, _IV, _IV, -/* 1 */ _IV, _IV, _IV, _IV, _IV, _CK|_MS, _CK, _CK, - _CN, _CN, _CN, _CN, _CK, _CN, _CN,_CN|_MS, -/* 2 */ _CN|_MS, _CK|_MS, _CK|_MS, _CN, _CN, _CN, _CN, _CN, - _CN, _CN, _CN, _CK|_MS, _CN, _CN, _CN, _CN, -/* 3 */ _RC, _CN, _CN, _CN, _CN, _CN, _CN, _CN, - _CN, _CN|_MS, _ND, _ND, _NK, _VD, _NM, _IM, -/* 4 */ _II_M, _NM, _NM, _NM, _NM, _AYE_M, _EE_M, _EY_M, - _AI_M, _AWE_M, _O_M, _OW1_M, _OW2_M, _HL, _ND, _ND, -/* 5 */ _ND, _VD, _VD, _VD, _VD, _ND, _ND, _ND, - _CN, _CN, _CN, _CN, _CN, _CN, _CN, _CN, -/* 6 */ _IV, _IV, _NM, _NM, _ND, _ND, _HD, _HD, - _HD, _HD, _HD, _HD, _HD, _HD, _HD, _HD, -/* 7 */ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, -}; - -/* - * Devanagari character type table - */ -static const gint DvngChrTypeTbl[128] = { -/* 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, A, B, C, D, E, F, */ -/* 0 */ __ND, __UP, __UP, __NP, __ND, __IV, __IV, __IV, - __IV, __IV, __IV, __IV, __IV, __IV, __IV, __IV, -/* 1 */ __IV, __IV, __IV, __IV, __IV, __CK, __CK, __CK, - __CN, __CN, __CN, __CN, __CK, __CN, __CN, __CN, -/* 2 */ __CN, __CK, __CK, __CN, __CN, __CN, __CN, __CN, - __CN, __CN, __CN, __CK, __CN, __CN, __CN, __CN, -/* 3 */ __RC, __CN, __CN, __CN, __CN, __CN, __CN, __CN, - __CN, __CN, __ND, __ND, __NK, __VD, __NM, __IM, -/* 4 */ __RM, __NM, __NM, __NM, __NM, __RM, __RM, __RM, - __RM, __RM, __RM, __RM, __RM, __HL, __ND, __ND, -/* 5 */ __ND, __VD, __VD, __VD, __VD, __ND, __ND, __ND, - __CN, __CN, __CN, __CN, __CN, __CN, __CN, __CN, -/* 6 */ __IV, __IV, __NM, __NM, __ND, __ND, __HD, __HD, - __HD, __HD, __HD, __HD, __HD, __HD, __HD, __HD, -/* 7 */ __ND, __ND, __ND, __ND, __ND, __ND, __ND, __ND, - __ND, __ND, __ND, __ND, __ND, __ND, __ND, __ND, -}; - -/* - * Devanagari character composible table - */ -static const gint DvngComposeTbl[14][14] = { - /* ND, UP, NP, IV, CN, CK, RC, NM, RM, IM, HL, NK, VD, HD, */ - /* 0 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, /* ND */ - /* 1 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, /* UP */ - /* 2 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, /* NP */ - /* 3 */ { 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, /* IV */ - /* 4 */ { 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,}, /* CN */ - /* 5 */ { 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0,}, /* CK */ - /* 6 */ { 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,}, /* RC */ - /* 7 */ { 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, /* NM */ - /* 8 */ { 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, /* RM */ - /* 9 */ { 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, /* IM */ - /* 10 */ { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,}, /* HL */ - /* 11 */ { 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0,}, /* NK */ - /* 12 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, /* VD */ - /* 13 */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}, /* HD */ -}; - -StateType DvngStateTbl[MAX_STATE][MAX_DEVA_TYPE] = { - - /* ND, UP, NP, IV, CN, CK, RC, NM, RM, - IM, HL, NK, VD, HD */ - /* State 0 */ - { St11, St1, St1, St2, St4, St4, St12, St1, St1, - St1, St1, St1, St1, St11, }, - /* State 1 */ - { St1, St1, St1, St1, St1, St1, St1, St1, St1, - St1, St1, St1, St1, St1, }, - /* State 2 */ - { St2, St3, St3, St2, St2, St2, St2, St2, St2, - St2, St2, St2, St2, St2, }, - /* State 3 */ - { St3, St3, St3, St3, St3, St3, St3, St3, St3, - St3, St3, St3, St3, St3, }, - /* State 4 */ - { St4, St8, St8, St4, St4, St4, St4, St6, St6, - St9, St5, St4, St4, St4, }, - /* State 5 */ - { St5, St5, St5, St5, St4, St4, St4, St5, St5, - St5, St5, St5, St5, St5, }, - /* State 6 */ - { St6, St7, St7, St6, St6, St6, St6, St6, St6, - St6, St6, St6, St6, St6, }, - /* State 7 */ - { St7, St7, St7, St7, St7, St7, St7, St7, St7, - St7, St7, St7, St7, St7, }, - /* State 8 */ - { St8, St8, St8, St8, St8, St8, St8, St8, St8, - St8, St8, St8, St8, St8, }, - /* State 9 */ - { St9, St10, St10, St9, St9, St9, St9, St9, St9, - St9, St9, St9, St9, St9, }, - /* State 10 */ - { St10, St10, St10, St10, St10, St10, St10, St10, St10, - St10, St10, St10, St10, St10, }, - /* State 11 */ - { St11, St11, St11, St11, St11, St11, St11, St11, St11, - St11, St11, St11, St11, St11, }, - /* State 12 */ - { St12, St8, St8, St12, St12, St12, St12, St6, St6, - St9, St13, St12, St12, St12, }, - /* State 13 */ - { St13, St13, St13, St13, St14, St14, St14, St13, St13, - St13, St13, St13, St13, St13, }, - /* State 14 */ - { St14, St18, St18, St14, St14, St14, St14, St16, St16, - St19, St15, St14, St14, St14, }, - /* State 15 */ - { St15, St15, St15, St15, St14, St14, St14, St15, St15, - St15, St15, St15, St15, St15, }, - /* State 16 */ - { St16, St17, St17, St16, St16, St16, St16, St16, St16, - St16, St16, St16, St16, St16, }, - /* State 17 */ - { St17, St17, St17, St17, St17, St17, St17, St17, St17, - St17, St17, St17, St17, St17, }, - /* State 18 */ - { St18, St18, St18, St18, St18, St18, St18, St18, St18, - St18, St18, St18, St18, St18, }, - /* State 19 */ - { St19, St20, St20, St19, St19, St19, St19, St19, St19, - St19, St19, St19, St19, St19, }, - /* State 20 */ - { St20, St20, St20, St20, St20, St20, St20, St20, St20, - St20, St20, St20, St20, St20, }, -}; - -int DvngRuleTbl[128] = { -/* 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, A, B, C, D, E, F, */ - -/* 0 */ 0, 1, 1, 1, 0, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, -/* 1 */ 1, 1, 1, 1, 1, 4, 4, 4, - 4, 2, 4, 1, 4, 4, 3, 3, -/* 2 */ 3, 3, 3, 2, 4, 4, 4, 4, - 4, 1, 4, 4, 4, 4, 4, 4, -/* 3 */ 2, 2, 2, 2, 1, 4, 4, 3, - 5, 4, 0, 0, 2, 1, 1, 1, -/* 4 */ 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 0, 0, -/* 5 */ 1, 1, 1, 1, 1, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, -/* 6 */ 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, -/* 7 */ 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -}; - -#define IsDvngCharCls(ch, mask) (DvngChrClsTbl[ucs2dvng((ch))] & (mask)) - -#define IsComposible(ch1, ch2) (DvngComposeTbl[DvngChrTypeTbl[ucs2dvng((ch1))]][DvngChrTypeTbl[ucs2dvng((ch2))]]) - -#define GetDvngRuleCt(ch) (DvngRuleTbl[ucs2dvng((ch))]) - -#define IsKern(gid) ((gid >= 0xF830 && gid <= 0xF83E) ? TRUE : FALSE) - -#define IsMatraAtStem(gid) (((gid >= 0xF811 && gid <= 0xF813) || \ - (gid >= 0xF81E && gid <= 0xF82F) || \ - (gid >= 0x0962 && gid <= 0x0963) || \ - (gid >= 0x0941 && gid <= 0x0948) || \ - (gid == 0x093C) || (gid == 0x094D)) ? TRUE : FALSE) - -#define SetClusterState(st, ch) DvngStateTbl[(st)][DvngChrTypeTbl[ucs2dvng((ch))]] - -#define MAP_SIZE 243 - -/* - * Devanagari Glyph Tables - */ -static const DvngGlyphEntry sunGlyphTbl[MAP_SIZE] = { - /* Vowel Modifiers - Ct 3 */ - { {0x0901,0x0}, {0x0901,0x0} }, - { {0x0902,0x0}, {0x0902,0x0} }, - { {0x0903,0x0}, {0x0903,0x0} }, - - /* vowels 13 - Ct 18 */ - { {0x0905,0x0}, {0x0905,0x0} }, - { {0x0906,0x0}, {0x0906,0x0} }, - { {0x0907,0x0}, {0x0907,0x0} }, - { {0x0908,0x0}, {0x0908,0x0} }, - { {0x0909,0x0}, {0x0909,0x0} }, - { {0x090a,0x0}, {0x090a,0xF830,0x0} }, - { {0x090b,0x0}, {0x090b,0xF831,0x0} }, - { {0x0960,0x0}, {0x0960,0xF831,0x0} }, - { {0x090c,0x0}, {0x090c,0xF83D,0x0} }, - { {0x0961,0x0}, {0x0961,0xF83D,0x0} }, - { {0x090d,0x0}, {0x090d,0x0} }, - { {0x090e,0x0}, {0x090e,0x0} }, - { {0x090f,0x0}, {0x090f,0x0} }, - { {0x0910,0x0}, {0x0910,0x0} }, - { {0x0911,0x0}, {0x0911,0x0} }, - { {0x0912,0x0}, {0x0912,0x0} }, - { {0x0913,0x0}, {0x0913,0x0} }, - { {0x0914,0x0}, {0x0914,0x0} }, - - /* Vowel signs - Ct 17 */ - { {0x093e,0x0}, {0x093e,0x0} }, - { {0x093f,0x0}, {0x093f,0x0} }, - { {0x0940,0x0}, {0x0940,0x0} }, - { {0x0941,0x0}, {0x0941,0x0} }, - { {0x0942,0x0}, {0x0942,0x0} }, - { {0x0943,0x0}, {0x0943,0x0} }, - { {0x0944,0x0}, {0x0944,0x0} }, - { {0x0945,0x0}, {0x0945,0x0} }, - { {0x0946,0x0}, {0x0946,0x0} }, - { {0x0947,0x0}, {0x0947,0x0} }, - { {0x0948,0x0}, {0x0948,0x0} }, - { {0x0949,0x0}, {0x0949,0x0} }, - { {0x094a,0x0}, {0x094a,0x0} }, - { {0x094b,0x0}, {0x094b,0x0} }, - { {0x094c,0x0}, {0x094c,0x0} }, - { {0x0962,0x0}, {0x0962,0x0} }, - { {0x0963,0x0}, {0x0963,0x0} }, - - /* Consonants */ - /* ka -> ka + kern space */ - { {0x0915,0x0}, {0x0915,0xF832,0x0} }, - /* ka nukta -> ka nukta + kern space */ - { {0x0915,0x093c,0x0}, {0x0958,0xF832,0x0} }, - /* ka + halant -> half ka */ - { {0x0915,0x094d,0x0}, {0xF7C1,0x0} }, - /* ka nukta + halant-> half ka nukta */ - { {0x0915,0x093c,0x094d,0x0}, {0xF7C2,0x0} }, - - { {0x0915,0x094d,0x0915,0x0}, {0xF845,0xF832,0x0} }, - - /* ka + halant + ta -> kta + kern space */ - { {0x0915,0x094d,0x0924,0x0}, {0xF7C4,0xF832,0x0} }, - /* ka + halant + ra -> kra + kern space */ - { {0x0915,0x094d,0x0930,0x0}, {0xF7C3,0xF832,0x0} }, - { {0x0915,0x094d,0x0930,0x094d,0x0}, {0xF7C3,0x094d,0xF832,0x0} }, - /* ka + halant + SHa -> kSHa */ - { {0x0915,0x094d,0x0937,0x0}, {0xF7C5,0x093E,0x0} }, - /* ka + halant + SHa + halant -> half kSHa */ - { {0x0915,0x094d,0x0937,0x094d,0x0}, {0xF7C5,0x0} }, - - /* kha 6 */ - { {0x0916,0x0}, {0x0916,0x0} }, - { {0x0916,0x094d,0x0}, {0xF7C6,0x0} }, - { {0x0916,0x093c,0x0}, {0x0959,0x0} }, - { {0x0916,0x093c,0x094d,0x0}, {0xF7C7,0x0} }, - { {0x0916,0x094d,0x0930,0x0}, {0xF7C8,0x093E,0x0} }, - { {0x0916,0x094d,0x0930,0x094d,0x0}, {0xF7C8,0x0} }, - - /* ga 6 */ - { {0x0917,0x0}, {0x0917,0x0} }, - { {0x0917,0x094d,0x0}, {0xF7C9,0x0} }, - { {0x0917,0x093c,0x0}, {0x095a,0x0} }, - { {0x0917,0x093c,0x094d,0x0}, {0xF7CA,0x0} }, - { {0x0917,0x094d,0x0930,0x0}, {0xF7CB,0x093E,0x0} }, - { {0x0917,0x094d,0x0930,0x094d,0x0}, {0xF7CB,0x0} }, - - /* gha 4 */ - { {0x0918,0x0}, {0x0918,0x0} }, - { {0x0918,0x094d,0x0}, {0xF7CC,0x0} }, - { {0x0918,0x094d,0x0930,0x0}, {0xF7CD,0x093E,0x0} }, - { {0x0918,0x094d,0x0930,0x094d,0x0}, {0xF7CD,0x0} }, - - /* nga 1 */ - { {0x0919,0x0}, {0x0919,0xF833,0x0} }, - - /* { {0x0919,0x094d,0x0}, {0x0919,0x094d,0xF833,0x0} }, */ - - /* cha 4 */ - { {0x091a,0x0}, {0x091a,0x0} }, - /* cha + halant -> half cha */ - { {0x091a,0x094d,0x0}, {0xF7CE,0x0} }, - /* cha + halant ra -> chra */ - { {0x091a,0x094d,0x0930,0x0}, {0xF7CF,0x093E,0x0} }, - /* cha + halant ra + halant */ - { {0x091a,0x094d,0x0930,0x094d,0x0}, {0xF7CF,0x0} }, - - /* chha 1 */ - { {0x091b,0x0}, {0x091b,0xF834,0x0} }, - - /* chha + halant -> chha+ halant */ - /* { {0x091b,0x094d,0x0 }, {0x091b,0x094d,0xF834,0x0} }, */ - - /* ja 6 */ - /* ja */ - { {0x091c,0x0}, {0x091c,0x0} }, - /* ja + halant -> half ja */ - { {0x091c,0x094d,0x0}, {0xF7D0,0x0} }, - /* ja + nukta -> za */ - { {0x091c,0x093c,0x0}, {0xF7D1,0x093E,0x0} }, - /* ja + nukta + halant -> half za */ - { {0x091c,0x093c,0x094d,0x0 }, {0xF7D1,0x0} }, - /* ja + halant + ra -> jra */ - { {0x091c,0x094d,0x0930,0x0}, {0xF7D2,0x093E,0x0} }, - /* ja + halant + ra + halant -> */ - { {0x091c,0x094d,0x0930,0x094d,0x0}, {0xF7D2,0x0} }, - - /* dna 2 */ - /* ja + halant + jna -> dna */ - { {0x091c,0x094d,0x091e,0x0}, {0xF7D3,0x093E,0x0} }, - /* ja + halant + jna -> half dna */ - { {0x091c,0x094d,0x091e,0x094d,0x0}, {0xF7D3,0x0} }, - - /* jha 4 */ - /* jha */ - { {0x091d,0x0}, {0x091d,0x0} }, - /* jha + halant -> half jha */ - { {0x091d,0x094d,0x0}, {0xF7D4,0x0} }, - /* jha + halant -> jhra */ - { {0x091d,0x094d,0x0930,0x0}, {0xF7D5,0x093E,0x0} }, - /* jha + halant -> half jhra */ - { {0x091d,0x094d,0x0930,0x094d,0x0}, {0xF7D5,0x0} }, - - /* nya 2 */ - /* nya */ - { {0x091e,0x0}, {0x091e,0x0} }, - /* nya + halant -> half nya */ - { {0x091e,0x094d,0x0}, {0xF7D6,0x0} }, - - { {0x091e,0x094d,0x091c,0x0}, {0xF846,0x0} }, - - /* Ta 3 */ - /* Ta -> Ta + kern space */ - { {0x091f,0x0}, {0x091F,0xF835,0x0} }, - - { {0x091f,0x094d,0x0}, {0x091f,0x094d,0xF835,0x0} }, - - /* Ta + halant + Ta -> TaTa + kern space */ - { {0x091f,0x094d,0x091f,0x0}, {0xF7D7,0xF835,0x0} }, - /* Ta + halant + Tha -> TaTha + kern space */ - { {0x091f,0x094d,0x0920,0x0}, {0xF7D8,0xF835,0x0} }, - - /* Tha 2 */ - /* Tha -> Tha + kern space */ - { {0x0920,0x0}, {0x0920,0xF836,0x0} }, - - { {0x0920,0x094d,0x0}, {0x0920,0x094d,0xF836,0x0} }, - - /* Tha + halant + Tha -> + kern space */ - { {0x0920,0x094d,0x0920,0x0}, {0xF7D9,0xF836,0x0} }, - - /* Da 1 */ - /* Da -> Da + kern space */ - { {0x0921,0x0}, {0x0921,0xF837,0x0} }, - - { {0x0921,0x094d,0x0}, {0x0921,0x094d,0xF837,0x0} }, - - /* Da nukta 1 */ - /* Da + nukta -> + kern space */ - { {0x0921,0x093c,0x0}, {0x095c,0xF837,0x0} }, - - /* Da + nukta+ halant */ - { {0x0921,0x093c,0x094d,0x0}, {0x095c,0x094d,0xF837,0x0} }, - - { {0x0921,0x094d,0x0917,0x0}, {0xF847,0xF837,0x0} }, - - /* Da halant Da 1 */ - /* Da + halant + Da - > + kern space */ - { {0x0921,0x094d,0x0921,0x0}, {0xF7DA,0xF837,0x0} }, - - /* Da halant Dha 1 */ - /* Da + halant + Dha -> + kern space */ - { {0x0921,0x094d,0x0922,0x0}, {0xF7DB,0xF837,0x0} }, - - /* Dha 1 */ - /* Dha + kern space */ - { {0x0922,0x0}, {0x0922,0xF838,0x0} }, - - /* Dha nukta 1 */ - /* Dha + nukta -> + kern space */ - { {0x0922,0x093c,0x0}, {0x095d,0xF838,0x0} }, - { {0x0922,0x093c,0x094d,0x0}, {0x095d,0x094d,0xF838,0x0} }, - - { {0x0922,0x094d,0x0}, {0x0922,0x094d,0xF838,0x0} }, - - /* Nna 2 */ - /* Nna */ - { {0x0923,0x0}, {0x0923,0x0} }, - /* Nna + halant -> half Nna */ - { {0x0923,0x094d,0x0}, {0xF7DC,0x0} }, - - /* ta 6 */ - /* ta */ - { {0x0924,0x0}, {0x0924,0x0} }, - /* ta + halant -> half ta */ - { {0x0924,0x094d,0x0}, {0xF7DD,0x0} }, - /* ta + halant + ra -> half tra */ - { {0x0924,0x094d,0x0930,0x0}, {0xF7DE,0x093E,0x0} }, - /* ta + halant + ra + halant -> half tra */ - { {0x0924,0x094d,0x0930,0x094d,0x0}, {0xF7DE,0x0} }, - /* ta + halant + ta -> */ - { {0x0924,0x094d,0x0924,0x0}, {0xF7DF,0x093E,0x0} }, - /* ta + halant + ta + halant -> */ - { {0x0924,0x094d,0x0924,0x094d,0x0}, {0xF7DF,0x0} }, - - /* tha 4 */ - /* tha */ - { {0x0925,0x0}, {0x0925,0x0} }, - /* tha + halant -> half tha */ - { {0x0925,0x094d,0x0}, {0xF7E0,0x0} }, - /* tha + halant + ra -> */ - { {0x0925,0x094d,0x0930,0x0}, {0xF7E1,0x093E,0x0} }, - /* tha + halant + ra + halant -> */ - { {0x0925,0x094d,0x0930,0x094d,0x0}, {0xF7E1,0x0} }, - - /* da 1 */ - /* da -> da + kern space */ - { {0x0926,0x0}, {0x0926,0xF839,0x0} }, - /* da + halant -> half da + kern space */ - { {0x0926,0x094d,0x0}, {0x0926,0x094d,0xF839,0x0} }, - - /* da ri 1 */ - /* da + ru -> da + ru + kern space */ - { {0x0926,0x0943,0x0}, {0xF7E2,0xF839,0x0} }, - - /* da halant ra 1 */ - /* da + halant + ra -> dra + kern space */ - { {0x0926,0x094d,0x0930,0x0}, {0xF7E3,0xF839,0x0} }, - { {0x0926,0x094d,0x0930,0x094d,0x0}, {0xF7E3,0x094d,0xF839,0x0} }, - - { {0x0926,0x094d,0x0918,0x0}, {0xF848,0xF839,0x0} }, - - /* da halant da 1 */ - /* da + halant + da -> + kern space */ - { {0x0926,0x094d,0x0926,0x0}, {0xF7E4,0xF839,0x0} }, - - /* da halant dha 1 */ - /* da + halant + dha -> + kern space */ - { {0x0926,0x094d,0x0927,0x0}, {0xF7E5,0xF839,0x0} }, - - { {0x0926,0x094d,0x092c,0x0}, {0xF849,0xF839,0x0} }, - - { {0x0926,0x094d,0x092d,0x0}, {0xF844,0xF839,0x0} }, - - /* da halant ma 1 */ - /* da + halant + ma -> + kern space */ - { {0x0926,0x094d,0x092e,0x0}, {0xF7E6,0xF839,0x0} }, - - /* da halant ya 1 */ - /* da + halant + ya -> + kern space */ - { {0x0926,0x094d,0x092f,0x0}, {0xF7E7,0xF839,0x0} }, - - /* da halant va 1 */ - /* da + halant + va -> + kern space */ - { {0x0926,0x094d,0x0935,0x0}, {0xF7E8,0xF839,0x0} }, - - /* dha 4 */ - /* Dha */ - { {0x0927,0x0}, {0x0927,0x0} }, - /* Dha + halant - > half Dha */ - { {0x0927,0x094d,0x0}, {0xF7E9,0x0} }, - /* Dha + halant + ra -> half Dhra */ - { {0x0927,0x094d,0x0930,0x0}, {0xF7EA,0x093E,0x0} }, - /* Dha + halant + ra + halant -> */ - { {0x0927,0x094d,0x0930,0x094d,0x0}, {0xF7EA,0x0} }, - - /* na 6 */ - /* na */ - { {0x0928,0x0}, {0x0928,0x0} }, - /* na + halant -> half na */ - { {0x0928,0x094d,0x0}, {0xF7EB,0x0} }, - /* na + halant + ra -> */ - { {0x0928,0x094d,0x0930,0x0}, {0xF7EC,0x093E,0x0} }, - /* na + halant + ra + halant -> */ - { {0x0928,0x094d,0x0930,0x094d,0x0}, {0xF7EC,0x0} }, - /* na + halant + na -> */ - { {0x0928,0x094d,0x0928,0x0}, {0xF7ED,0x093E,0x0} }, - /* na + halant + na + halant -> */ - { {0x0928,0x094d,0x0928,0x094d,0x0}, {0xF7ED,0x0} }, - - { {0x0929,0x0}, {0x0929,0x0} }, - - /* pa 4 */ - /* pa */ - { {0x092a,0x0}, {0x092a,0x0} }, - /* pa + halant -> half pa */ - { {0x092a,0x094d,0x0}, {0xF7EE,0x0} }, - /* pa + halant +ra -> pra */ - { {0x092a,0x094d,0x0930,0x0}, {0xF7EF,0x093E,0x0} }, - /* pa + halant + ra + halant -> half pra */ - { {0x092a,0x094d,0x0930,0x094d,0x0}, {0xF7EF,0x0} }, - - /* pha 5 */ - /* pha -> pha + kern space */ - { {0x092b,0x0 }, {0x092b,0xF832,0x0} }, - /* pha + halant -> half pha */ - { {0x092b,0x094d,0x0}, {0xF7F0,0x0} }, - /* pha nukta -> pha nukta + kern space */ - { {0x092b,0x093c,0x0}, {0x095e,0xF832,0x0} }, - /* pha nukta + halant-> half pha nukta */ - { {0x092b,0x093c,0x094d,0x0}, {0xF7F1,0x0} }, - /* pha + halant + ra -> fra + kern space */ - { {0x092b,0x094d,0x0930,0x0}, {0xF7F5,0xF832,0x0} }, - /* pha + halant + ra -> fra + kern space */ - { {0x092b,0x094d,0x0930,0x094d,0x0}, {0xF7F5,0xF832,0x094d,0x0} }, - - /* ba 4 */ - /* ba */ - { {0x092c,0x0}, {0x092c,0x0} }, - /* ba + halant -> half ba */ - { {0x092c,0x094d,0x0}, {0xF7F6,0x0} }, - /* ba + halant + ra -> */ - { {0x092c,0x094d,0x0930,0x0}, {0xF7F7,0x093E,0x0} }, - /* ba + halant ra + halant -> */ - { {0x092c,0x094d,0x0930,0x094d,0x0}, {0xF7F7,0x0} }, - - /* bha 4 */ - /* bha */ - { {0x092d,0x0}, {0x092d,0x0} }, - /* bha + halant -> half halant */ - { {0x092d,0x094d,0x0}, {0xF7F8,0x0} }, - /* bha + halant + ra -> */ - { {0x092d,0x094d,0x0930,0x0}, {0xF7F9,0x093E,0x0} }, - /* bha + halant + ra + halant -> */ - { {0x092d,0x094d,0x0930,0x094d,0x0}, {0xF7F9,0x0} }, - /* ma 4 */ - /* ma */ - { {0x092e,0x0}, {0x092e,0x0} }, - /* ma + halant -> half ma */ - { {0x092e,0x094d,0x0}, {0xF7FA,0x0} }, - /* ma + halant + ra -> */ - { {0x092e,0x094d,0x0930,0x0}, {0xF7FB,0x093E,0x0} }, - /* ma + halant + ra + halant -> */ - { {0x092e,0x094d,0x0930,0x094d,0x0}, {0xF7FB,0x0} }, - - /* ya 4 */ - /* ya */ - { {0x092f,0x0}, {0x092f,0x0} }, - /* ya + halant -> half ya */ - { {0x092f,0x094d,0x0}, {0xF7FC,0x0} }, - /* ya + halant + ra -> */ - { {0x092f,0x094d,0x0930,0x0}, {0xF7FD,0x093E,0x0} }, - /* ya + halant + ra + halant -> */ - { {0x092f,0x094d,0x0930,0x094d,0x0}, {0xF7FD,0x0} }, - - /* ra 3 */ - /* ra */ - { {0x0930,0x0 }, {0x0930,0xF83A,0x0} }, - /* { {0x0930,0x094d,0x0}, {0xF812,0x0} }, */ - /* ra + u -> Ru + kern space */ - { {0x0930,0x0941,0x0}, {0xF800,0xF83B,0x0} }, - /* ra + U -> RU + kern space */ - { {0x0930,0x0942,0x0}, {0xF801,0xF83C,0x0} }, - - { {0x0931,0x0}, {0x0931,0x0} }, - { {0x0931,0x094d,0x0}, {0xF7FF,0x0} }, - - /* la 2 */ - /* la */ - { {0x0932,0x0}, {0x0932,0x0} }, - /* la + halant -> */ - { {0x0932,0x094d,0x0}, {0xF802,0x0} }, - /* La 2 */ - /* La */ - { {0x0933,0x0}, {0x0933,0x0} }, - /* La + halant -> half La */ - { {0x0933,0x094d,0x0}, {0xF803,0x0} }, - - { {0x0934,0x0} , {0x0934,0x0} }, - /* va 4 */ - /* va */ - { {0x0935,0x0}, {0x0935,0x0} }, - /* va + halant -> half va */ - { {0x0935,0x094d,0x0}, {0xF804,0x0} }, - /* va + halant + ra -> */ - { {0x0935,0x094d,0x0930,0x0}, {0xF805,0x093E,0x0} }, - /* va + halant + ra + halant -> */ - { {0x0935,0x094d,0x0930,0x094d,0x0}, {0xF805,0x0} }, - - /* sha 6 */ - /* sha */ - { {0x0936,0x0}, {0x0936,0x0} }, - /* sha + halant -> half sha */ - { {0x0936,0x094d,0x0}, {0xF806,0x0} }, - - { {0x0936,0x094d,0x091a,0x0}, {0xF83F,0x0} }, - { {0x0936,0x094d,0x0928,0x0}, {0xF840,0x0} }, - - /* sha + halant + va -> shwa */ - { {0x0936,0x094d,0x0935,0x0}, {0xF807,0x093E,0x0} }, - /* sha + halant + va + halant -> half shwa */ - { {0x0936,0x094d,0x0935,0x094d,0x0}, {0xF807,0x0} }, - /* sha + halant + ra -> shra */ - { {0x0936,0x094d,0x0930,0x0}, {0xF808,0x093E,0x0} }, - /* sha + halant + ra + halant -> half shra */ - { {0x0936,0x094d,0x0930,0x094d,0x0}, {0xF808,0x0} }, - /* SHa 2 */ - /* SHa */ - { {0x0937,0x0}, {0x0937,0x0} }, - /* SHa + halant -> half SHa */ - { {0x0937,0x094d,0x0}, {0xF809,0x0} }, - - { {0x0937,0x094d,0x091f,0x0}, {0xF841,0xF835,0x0} }, - { {0x0937,0x094d,0x0920,0x0}, {0xF842,0xF836,0x0} }, - - /* sa 4 */ - /* sa */ - { {0x0938,0x0}, {0x0938,0x0} }, - /* sa + halant -> half sa */ - { {0x0938,0x094d,0x0}, {0xF80A,0x0} }, - /* sa + halant + ra -> */ - { {0x0938,0x094d,0x0930,0x0}, {0xF80B,0x093E,0x0} }, - /* sa + halan + ra + halant -> */ - { {0x0938,0x094d,0x0930,0x094d,0x0}, {0xF80B,0x0} }, - - { {0x0938,0x094d,0x0924,0x094d,0x0930,0x0}, {0xF843,0x0} }, - - /* ha 2 */ - /* ha + kern space */ - { {0x0939,0x0}, {0x0939,0xF83E,0x0} }, - /* ha + halant -> half ha */ - { {0x0939,0x094d,0x0}, {0xF80C,0xF83E,0x0} }, - /* ha + Rii + matra -> */ - { {0x0939,0x0943,0x0}, {0xF80D,0xF83E,0x0} }, - /* ha + halant + ra -> */ - { {0x0939,0x094d,0x0930,0x0}, {0xF80E,0xF83E,0x0} }, - /* ha + halant + ra + halant -> */ - { {0x0939,0x094d,0x0930,0x094d,0x0}, {0xF80E,0x094d,0xF83E,0x0} }, - - { {0x0939,0x094d,0x0923,0x0}, {0xF84D,0xF83E,0x0} }, - { {0x0939,0x094d,0x0928,0x0}, {0xF84C,0xF83E,0x0} }, - - /* ha + halant + ma -> */ - { {0x0939,0x094d,0x092e,0x0}, {0xF80F,0xF83E,0x0} }, - /* ha + halant + ya -> */ - { {0x0939,0x094d,0x092f,0x0}, {0xF810,0xF83E,0x0} }, - - { {0x0939,0x094d,0x0932,0x0}, {0xF84A,0xF83E,0x0} }, - { {0x0939,0x094d,0x0935,0x0}, {0xF84B,0xF83E,0x0} }, - - { {0x0958,0x0}, {0x0958,0xF832,0x0} }, - { {0x0959,0x0}, {0x0959,0x0} }, - { {0x095a,0x0}, {0x095a,0x0} }, - { {0x095b,0x0}, {0x095b,0x0} }, - { {0x095c,0x0}, {0x095c,0xF837,0x0} }, - { {0x095d,0x0}, {0x095d,0xF838,0x0} }, - { {0x095e,0x0}, {0x095e,0xF832,0x0} }, - { {0x095f,0x0}, {0x095f,0x0} }, - - /*"\xd8\x", "", */ - - /* misc 5 */ - - /* nukta */ - { {0x093c,0x0}, {0x093c,0x0} }, - /* nukta + u matra */ - { {0x093c,0x0941,0x0}, {0xF81E,0x0} }, - /* nukta + Uu matra -> */ - { {0x093c,0x0942,0x0}, {0xF821,0x0} }, - - /* halant */ - { {0x094d,0x0}, {0x094d,0x0} }, - /* halant + ya -> */ - { {0x094d,0x092f,0x0}, {0xF7FE,0x0} }, - /* halant + ra */ - { {0x094d,0x0930,0x0}, {0xF811,0x0} }, - /* halant + ra + halant */ - { {0x094d,0x0930,0x094d,0x0}, {0x094d,0x0930,0x0930,0x0} }, - /* halant + ra + u matra -> */ - { {0x094d,0x0930,0x0941,0x0}, {0xF81F,0x0} }, - /* halant + ra + Uu matra -> */ - { {0x094d,0x0930,0x0942,0x0}, {0xF822,0x0} }, - - /* Vedic Characters */ - { {0x093d,0x0}, {0x093d,0x0} }, - { {0x0950,0x0}, {0x0950,0x0} }, - { {0x0951,0x0}, {0x0951,0x0} }, - { {0x0952,0x0}, {0x0952,0x0} }, - { {0x0953,0x0}, {0x0953,0x0} }, - { {0x0954,0x0}, {0x0954,0x0} }, - { {0x0964,0x0}, {0x0964,0x0} }, - { {0x0965,0x0}, {0x0965,0x0} }, - { {0x0970,0x0}, {0x0970,0x0} }, - - /* Dig09its */ - { {0x0966,0x0}, {0x0966,0x0} }, - { {0x0967,0x0}, {0x0967,0x0} }, - { {0x0968,0x0}, {0x0968,0x0} }, - { {0x0969,0x0}, {0x0969,0x0} }, - { {0x096a,0x0}, {0x096a,0x0} }, - { {0x096b,0x0}, {0x096b,0x0} }, - { {0x096c,0x0}, {0x096c,0x0} }, - { {0x096d,0x0}, {0x096d,0x0} }, - { {0x096e,0x0}, {0x096e,0x0} }, - { {0x096f,0x0}, {0x096f,0x0} } -}; - -/* Returns a structure with information we will use to render given the - * #PangoliteFont. This is computed once per font and cached for retrieval. - */ -static DvngFontInfo * -get_font_info(const char *fontCharset) -{ - static const char *charsets[] = { - "sun.unicode.india-0", - }; - - static const int charset_types[] = { - DVNG_FONT_SUN - }; - - DvngFontInfo *font_info = g_new(DvngFontInfo, 1); - guint i; - - font_info->type = DVNG_FONT_NONE; - for (i = 0; i < G_N_ELEMENTS(charsets); i++) { - if (strcmp(fontCharset, charsets[i]) == 0) { - font_info->type = (DvngFontType)charset_types[i]; - font_info->subfont = (PangoliteXSubfont)i; - break; - } - } - - return font_info; -} - -static void -add_glyph(PangoliteGlyphString *glyphs, - gint clusterStart, - PangoliteGlyph glyph, - gint combining) -{ - gint index = glyphs->num_glyphs; - - if ((clusterStart == 0) && (index != 0)) - clusterStart++; - - pangolite_glyph_string_set_size (glyphs, index + 1); - glyphs->glyphs[index].glyph = glyph; - glyphs->glyphs[index].is_cluster_start = combining; - glyphs->log_clusters[index] = clusterStart; -} - -static void -GetBaseConsGlyphs(gunichar2 *cluster, - gint numCoreCons, - PangoliteGlyph *glyphList, - gint *nGlyphs) -{ - int i, j, delta, nMin, nMaxRuleCt, ruleIdx; - gboolean StillMatching; - gunichar2 temp_out; - gint tmpCt = *nGlyphs; - - i = 0; - while (i < numCoreCons) { - - nMaxRuleCt = GetDvngRuleCt(cluster[i]); - while (nMaxRuleCt) { - nMin = MIN(nMaxRuleCt, numCoreCons); - ruleIdx = 0; - -NotFound: - j = delta = 0; - StillMatching = FALSE; - while (((delta < nMin) || sunGlyphTbl[ruleIdx].ISCII[j]) && - (ruleIdx < MAP_SIZE) ) { - StillMatching = TRUE; - if ((delta < nMin) && (j < MAX_CORE_CONS) && - (cluster[i + delta] != sunGlyphTbl[ruleIdx].ISCII[j])) { - ruleIdx++; - goto NotFound; - } - delta++; - j++; - } - - if (StillMatching) /* Found */ - break; - else - nMaxRuleCt--; - } - - i += nMin; - - /* Can't find entry in the table */ - if ((StillMatching == FALSE) || (ruleIdx >= MAP_SIZE)) { - for (j = 0; j < numCoreCons; j++) - glyphList[tmpCt++] = PANGO_MOZ_MAKE_GLYPH(cluster[j]); - } - else if (((tmpCt > 0) && IsKern(glyphList[tmpCt - 1])) && - IsMatraAtStem(sunGlyphTbl[ruleIdx].ISFOC[0])) { - temp_out = glyphList[tmpCt - 1]; - - for (j=0; sunGlyphTbl[ruleIdx].ISFOC[j]; j++) - glyphList[tmpCt - 1] = PANGO_MOZ_MAKE_GLYPH(sunGlyphTbl[ruleIdx].ISFOC[j]); - - glyphList[tmpCt++] = PANGO_MOZ_MAKE_GLYPH(temp_out); - } - else { - for (j=0; sunGlyphTbl[ruleIdx].ISFOC[j]; j++) - glyphList[tmpCt++] = PANGO_MOZ_MAKE_GLYPH(sunGlyphTbl[ruleIdx].ISFOC[j]); - } - } - *nGlyphs = tmpCt; -} - -static gint -get_adjusted_glyphs_list(DvngFontInfo *fontInfo, - gunichar2 *cluster, - gint nChars, - PangoliteGlyph *gLst, - StateType *DvngClusterState) -{ - int i, k, len; - gint nGlyphs = 0; - gunichar2 dummy; - - switch (*DvngClusterState) { - case St1: - if (IsDvngCharCls(cluster[0], _IM)) { - GetBaseConsGlyphs(cluster, nChars, gLst, &nGlyphs); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF7C0); - } - else { - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF7C0); - GetBaseConsGlyphs(cluster, nChars, gLst, &nGlyphs); - } - break; - - case St2: - case St3: - case St4: - case St5: - case St6: - GetBaseConsGlyphs(cluster, nChars, gLst, &nGlyphs); - break; - - case St7: - if (IsDvngCharCls(cluster[nChars - 1], _UP)) { - - if (IsDvngCharCls(cluster[nChars - 2], _RM)) - GetBaseConsGlyphs(cluster, nChars - 2, gLst, &nGlyphs); - else - GetBaseConsGlyphs(cluster, nChars, gLst, &nGlyphs); - - if (IsDvngCharCls(cluster[nChars - 2], _RM)) { - - if (IsDvngCharCls(cluster[nChars - 2], _II_M)) - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF81B); - - else if (IsDvngCharCls(cluster[nChars - 2], _AYE_M)) { - dummy = gLst[nGlyphs - 1]; - gLst[nGlyphs - 1] = PANGO_MOZ_MAKE_GLYPH(0xF82D); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(dummy); - } - - else if (IsDvngCharCls(cluster[nChars - 2], _EE_M)) - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF824); - - else if (IsDvngCharCls(cluster[nChars - 2], _EY_M)) - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF827); - - else if (IsDvngCharCls(cluster[nChars - 2], _AI_M)) - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF82A); - - else if (IsDvngCharCls(cluster[nChars - 2], _AWE_M)) { - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0x093E); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF82D); - } - - else if (IsDvngCharCls(cluster[nChars - 2], _O_M)) { - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0x093E); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF824); - } - - else if (IsDvngCharCls(cluster[nChars - 2], _OW1_M)) { - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0x093E); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF827); - } - - else if (IsDvngCharCls(cluster[nChars - 2], _OW2_M)) { - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0x093E); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF82A); - } - } - } - else { - GetBaseConsGlyphs(cluster, nChars, gLst, &nGlyphs); - } - break; - - case St8: - GetBaseConsGlyphs(cluster, nChars - 1, gLst, &nGlyphs); - if (IsKern(gLst[nGlyphs - 1])) { - dummy = gLst[nGlyphs - 1]; - gLst[nGlyphs - 1] = PANGO_MOZ_MAKE_GLYPH(cluster[nChars - 1]); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(dummy); - } - else - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(cluster[nChars - 1]); - break; - - case St9: - if (IsDvngCharCls(cluster[0], _MS)) - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0x093F); - else - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF817); - - GetBaseConsGlyphs(cluster, nChars - 1, gLst, &nGlyphs); - break; - - case St10: - if (IsDvngCharCls(cluster[0], _MS)) - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF814); - else - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF818); - - GetBaseConsGlyphs(cluster, nChars - 2, gLst, &nGlyphs); - break; - - case St11: - GetBaseConsGlyphs(cluster, nChars, gLst, &nGlyphs); - break; - - case St12: - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0x0930); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF83A); - break; - - case St13: - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0x0930); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0x094D); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF83A); - break; - - case St14: - GetBaseConsGlyphs(cluster+2, nChars - 2, gLst, &nGlyphs); - if (IsKern(gLst[nGlyphs - 1])) { - dummy = gLst[nGlyphs - 1]; - gLst[nGlyphs - 1] = PANGO_MOZ_MAKE_GLYPH(0xF812); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(dummy); - } - else - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF812); - break; - - case St15: - GetBaseConsGlyphs(cluster+2, nChars - 3, gLst, &nGlyphs); - if (IsKern(gLst[nGlyphs - 1])) { - dummy = gLst[nGlyphs - 2]; - gLst[nGlyphs - 2] = PANGO_MOZ_MAKE_GLYPH(0xF812); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0x094D); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(dummy); - } - else { - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF812); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0x094D); - } - break; - - case St16: - if (IsDvngCharCls(cluster[nChars - 1], _RM)) - GetBaseConsGlyphs(cluster+2, nChars - 3, gLst, &nGlyphs); - else - GetBaseConsGlyphs(cluster+2, nChars - 2, gLst, &nGlyphs); - - if (IsDvngCharCls(cluster[nChars - 1], ~(_RM))){ - - if (IsKern(gLst[nGlyphs - 1])) { - dummy = gLst[nGlyphs - 1]; - gLst[nGlyphs - 1] = PANGO_MOZ_MAKE_GLYPH(0xF812); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(dummy); - } - else - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF812); - } - else { - - if (IsDvngCharCls(cluster[nChars - 1], _II_M)) - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF81C); - - else if (IsDvngCharCls(cluster[nChars - 1], _EY_M)) - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF828); - - else if (IsDvngCharCls(cluster[nChars -1], _AI_M)) - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF82B); - - else if (IsDvngCharCls(cluster[nChars - 1], _OW1_M)) { - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0x093E); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF828); - } - - else if (IsDvngCharCls(cluster[nChars - 1], _OW2_M)) { - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0x093E); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF82B); - } - } - break; - - case St17: - if (IsDvngCharCls(cluster[nChars - 1], _UP)) { - - if (IsDvngCharCls(cluster[nChars - 2], _RM)) - GetBaseConsGlyphs(cluster+2, nChars - 4, gLst, &nGlyphs); - else - GetBaseConsGlyphs(cluster+2, nChars - 3, gLst, &nGlyphs); - - if (IsDvngCharCls(cluster[nChars - 2], ~(_RM))) { - - if (IsKern(gLst[nGlyphs - 1])) { - dummy = gLst[nGlyphs - 1]; - gLst[nGlyphs - 1] = PANGO_MOZ_MAKE_GLYPH(0xF813); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(dummy); - } - else - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF813); - } - else { - if (IsDvngCharCls(cluster[nChars - 2], _II_M)) - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF81D); - - else if (IsDvngCharCls(cluster[nChars - 2], _EY_M)) - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF829); - - else if (IsDvngCharCls(cluster[nChars - 2], _AI_M)) - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF82C); - - else if (IsDvngCharCls(cluster[nChars - 2], _OW1_M)) { - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0x093E); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF829); - } - else if (IsDvngCharCls(cluster[nChars - 2], _OW2_M)) { - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0x093E); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF82C); - } - } /* ? else GetBaseConsGlyphs(); */ - break; - - case St18: - GetBaseConsGlyphs(cluster-2, nChars-3, gLst, &nGlyphs); - if (IsKern(gLst[nGlyphs - 1])) { - dummy = gLst[nGlyphs - 1]; - gLst[nGlyphs - 1] = PANGO_MOZ_MAKE_GLYPH(0xF813); - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(dummy); - } - else - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF813); - break; - - case St19: - if (IsDvngCharCls(cluster[0], _MS)) - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF815); - else - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF819); - - GetBaseConsGlyphs(cluster+2, nChars-3, gLst, &nGlyphs); - break; - - case St20: - if (IsDvngCharCls(cluster[0], _MS)) - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF816); - else - gLst[nGlyphs++] = PANGO_MOZ_MAKE_GLYPH(0xF81A); - - GetBaseConsGlyphs(cluster+2, nChars - 4, gLst, &nGlyphs); - break; - } - } - - return nGlyphs; -} - -static gint -get_glyphs_list(DvngFontInfo *fontInfo, - gunichar2 *cluster, - gint numChars, - PangoliteGlyph *glyphLst, - StateType *clustState) -{ - PangoliteGlyph glyph; - gint i; - - switch (fontInfo->type) { - case DVNG_FONT_NONE: - for (i = 0; i < numChars; i++) - glyphLst[i] = 0; /*pangolite_x_get_unknown_glyph(fontInfo->font);*/ - return numChars; - - case DVNG_FONT_SUN: - return get_adjusted_glyphs_list(fontInfo, cluster, numChars, glyphLst, clustState); - } - - return 0; /* Quiet GCC */ -} - -static void -add_cluster(DvngFontInfo *fontInfo, - PangoliteGlyphString *glyphs, - gint clusterBeg, - gunichar2 *cluster, - gint numChars, - StateType *clustState) -{ - PangoliteGlyph glyphsList[MAX_GLYPHS]; - gint i, numGlyphs, ClusterStart=0; - - numGlyphs = get_glyphs_list(fontInfo, cluster, numChars, glyphsList, clustState); - for (i = 0; i < numGlyphs; i++) { - - ClusterStart = (gint)GLYPH_COMBINING; - if (i == 0) - ClusterStart = numChars; - add_glyph(glyphs, clusterBeg, glyphsList[i], ClusterStart); - } -} - -static const gunichar2 * -get_next_cluster(const gunichar2 *text, - gint length, - gunichar2 *cluster, - gint *numChars, - StateType *clustState) -{ - const gunichar2 *p; - gint n_chars = 0; - StateType aSt = *clustState; - - p = text; - while (p < text + length) { - gunichar2 cur = *p; - - if ((n_chars == 0) || - ((n_chars > 0) && IsComposible(cluster[n_chars - 1], cur))) { - cluster[n_chars++] = cur; - aSt = SetClusterState(aSt, cur); - p++; - } - else - break; - } - - *numChars = n_chars; - *clustState = aSt; - return p; -} - -static void -dvng_engine_shape(const char *fontCharset, - const gunichar2 *text, - gint length, - PangoliteAnalysis *analysis, - PangoliteGlyphString *glyphs) -{ - DvngFontInfo *fontInfo; - const gunichar2 *p, *log_cluster; - gunichar2 cluster[MAX_CLUSTER_CHRS]; - gint num_chrs; - StateType aSt = St0; - - fontInfo = get_font_info(fontCharset); - - p = text; - while (p < text + length) { - log_cluster = p; - aSt = St0; - p = get_next_cluster(p, text + length - p, cluster, &num_chrs, &aSt); - add_cluster(fontInfo, glyphs, log_cluster-text, cluster, num_chrs, &aSt); - } -} - -static PangoliteCoverage * -dvng_engine_get_coverage(const char *fontCharset, - const char *lang) -{ - PangoliteCoverage *result = pangolite_coverage_new (); - DvngFontInfo *fontInfo = get_font_info (fontCharset); - - if (fontInfo->type != DVNG_FONT_NONE) { - gunichar2 wc; - - for (wc = 0x901; wc <= 0x903; wc++) - pangolite_coverage_set (result, wc, PANGO_COVERAGE_EXACT); - for (wc = 0x905; wc <= 0x939; wc++) - pangolite_coverage_set (result, wc, PANGO_COVERAGE_EXACT); - for (wc = 0x93c; wc <= 0x94d; wc++) - pangolite_coverage_set (result, wc, PANGO_COVERAGE_EXACT); - for (wc = 0x950; wc <= 0x954; wc++) - pangolite_coverage_set (result, wc, PANGO_COVERAGE_EXACT); - for (wc = 0x958; wc <= 0x970; wc++) - pangolite_coverage_set (result, wc, PANGO_COVERAGE_EXACT); - /* pangolite_coverage_set (result, ZWJ, PANGO_COVERAGE_EXACT); */ - } - - return result; -} - -static PangoliteEngine * -dvng_engine_x_new () -{ - PangoliteEngineShape *result; - - result = g_new (PangoliteEngineShape, 1); - result->engine.id = SCRIPT_ENGINE_NAME; - result->engine.type = PANGO_ENGINE_TYPE_SHAPE; - result->engine.length = sizeof (result); - result->script_shape = dvng_engine_shape; - result->get_coverage = dvng_engine_get_coverage; - return (PangoliteEngine *)result; -} - -/* The following three functions provide the public module API for - * Pangolite. If we are compiling it is a module, then we name the - * entry points script_engine_list, etc. But if we are compiling - * it for inclusion directly in Pangolite, then we need them to - * to have distinct names for this module, so we prepend - * _pangolite_thai_x_ - */ -#ifdef X_MODULE_PREFIX -#define MODULE_ENTRY(func) _pangolite_dvng_x_##func -#else -#define MODULE_ENTRY(func) func -#endif - -/* List the engines contained within this module - */ -void -MODULE_ENTRY(script_engine_list) (PangoliteEngineInfo **engines, gint *n_engines) -{ - *engines = script_engines; - *n_engines = G_N_ELEMENTS (script_engines); -} - -/* Load a particular engine given the ID for the engine - */ -PangoliteEngine * -MODULE_ENTRY(script_engine_load) (const char *id) -{ - if (!strcmp (id, SCRIPT_ENGINE_NAME)) - return dvng_engine_x_new (); - else - return NULL; -} - -void -MODULE_ENTRY(script_engine_unload) (PangoliteEngine *engine) -{ -} - diff --git a/intl/ctl/src/nsCtlLEModule.cpp b/intl/ctl/src/nsCtlLEModule.cpp deleted file mode 100644 index dd90954bbf2a..000000000000 --- a/intl/ctl/src/nsCtlLEModule.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * XPCTL : nsCtlLEModule.cpp - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Sun Microsystems, Inc. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Prabhat Hegde (prabhat.hegde@sun.com) - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsCOMPtr.h" -#include "nsCRT.h" - -#include "nsIFactory.h" -#include "nsIGenericFactory.h" -#include "nsIModule.h" -#include "nsULE.h" -#include "nsICategoryManager.h" -#include "nsEncoderDecoderUtils.h" -#include "nsUnicodeToTIS620.h" -#include "nsUnicodeToSunIndic.h" -#include "nsUnicodeToThaiTTF.h" - -//---------------------------------------------------------------------------- -// Global functions and data [declaration] - -#define ENCODER_NAME_BASE "Unicode Encoder-" - -NS_GENERIC_FACTORY_CONSTRUCTOR(nsULE) - -// Per DLL Globals -PRInt32 g_InstanceCount = 0; -PRInt32 g_LockCount = 0; - -NS_CONVERTER_REGISTRY_START -NS_UCONV_REG_UNREG_ENCODER("tis620-2", NS_UNICODETOTIS620_CID) -NS_UCONV_REG_UNREG_ENCODER("x-thaittf-0", NS_UNICODETOTHAITTF_CID) -NS_UCONV_REG_UNREG_ENCODER("x-sun-unicode-india-0", NS_UNICODETOSUNINDIC_CID) -NS_CONVERTER_REGISTRY_END - -NS_IMPL_NSUCONVERTERREGSELF - -NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToTIS620) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToThaiTTF) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsUnicodeToSunIndic) - -static const nsModuleComponentInfo components[] = -{ - { ENCODER_NAME_BASE "tis620-2" , NS_UNICODETOTIS620_CID, - NS_UNICODEENCODER_CONTRACTID_BASE "tis620-2", - nsUnicodeToTIS620Constructor, - nsUConverterRegSelf, nsUConverterUnregSelf }, - { ENCODER_NAME_BASE "x-thaittf-0" , NS_UNICODETOTHAITTF_CID, - NS_UNICODEENCODER_CONTRACTID_BASE "x-thaittf-0", - nsUnicodeToThaiTTFConstructor, - nsUConverterRegSelf, nsUConverterUnregSelf }, - { ENCODER_NAME_BASE "x-sun-unicode-india-0" , NS_UNICODETOSUNINDIC_CID, - NS_UNICODEENCODER_CONTRACTID_BASE "x-sun-unicode-india-0", - nsUnicodeToSunIndicConstructor, - nsUConverterRegSelf, nsUConverterUnregSelf }, - { "Unicode Layout Engine", NS_ULE_CID, NS_ULE_PROGID, - nsULEConstructor, NULL, NULL } -}; - -NS_IMPL_NSGETMODULE(nsCtlLEModule, components) diff --git a/intl/ctl/src/nsULE.cpp b/intl/ctl/src/nsULE.cpp deleted file mode 100644 index 50460573f18f..000000000000 --- a/intl/ctl/src/nsULE.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * XPCTL : nsULE.cpp - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Sun Microsystems, Inc. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Prabhat Hegde (prabhat.hegde@sun.com) - * Jungshik Shin (jshin@mailmaps.org) - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsULE.h" -#include "nsString.h" - -#include "pango-types.h" -#include "pango-glyph.h" -#include "pango-modules.h" -#include "pango-utils.h" - -#define GLYPH_COMBINING 256 - -/* - * To Do:(prabhat-04/01/03) Cache GlyphString -*/ - -nsULE::nsULE() { -} - -nsULE::~nsULE() { -} - -NS_IMPL_THREADSAFE_ISUPPORTS1(nsULE, nsILE) - -// Default font encoding by code-range -// At the moment pangoLite only supports 2 shapers/scripts -const char* -nsULE::GetDefaultFont(const PRUnichar aString) -{ - if ((aString >= 0x0e01) && (aString <= 0x0e5b)) - return "tis620-2"; - if ((aString >= 0x0901) && (aString <= 0x0970)) - return "sun.unicode.india-0"; - return "iso8859-1"; -} - -PRInt32 -nsULE::GetGlyphInfo(const PRUnichar *aSrcBuf, - PRInt32 aSrcLen, - PangoliteGlyphString *aGlyphData, - const char *aFontCharset) -{ - int ct=0, start=0, i, index, startgid, lastCluster=0; - PRBool sameCtlRun=PR_FALSE; - PangoliteEngineShape *curShaper=NULL, *prevShaper=NULL; - PangoliteMap *pngMap=NULL; - PangoliteAnalysis pngAnalysis; - guint enginetypeId=0, rendertypeId=0; - - pngAnalysis.aDir = PANGO_DIRECTION_LTR; - - // Maybe find a better way to handle font encodings - if (aFontCharset == NULL) - pngAnalysis.fontCharset = strdup(GetDefaultFont(aSrcBuf[0])); - else - pngAnalysis.fontCharset = strdup(aFontCharset); - - enginetypeId = g_quark_from_static_string(PANGO_ENGINE_TYPE_SHAPE); - rendertypeId = g_quark_from_static_string(PANGO_RENDER_TYPE_X); - pngMap = pangolite_find_map("en_US", enginetypeId, rendertypeId); - - for (ct=0; ct < aSrcLen;) { - start = ct; - curShaper = (PangoliteEngineShape*) - pangolite_map_get_engine(pngMap, (PRUint32)aSrcBuf[ct++]); - sameCtlRun = (curShaper != NULL); - prevShaper = curShaper; - - if (sameCtlRun) { - while (sameCtlRun && ct < aSrcLen) { - curShaper = (PangoliteEngineShape*) - pangolite_map_get_engine(pngMap, (PRUint32)aSrcBuf[ct]); - sameCtlRun = ((curShaper != NULL) && (curShaper == prevShaper)); - if (sameCtlRun) - ct++; - } - startgid = aGlyphData->num_glyphs; - pngAnalysis.shape_engine = curShaper; - prevShaper->script_shape(pngAnalysis.fontCharset, - &aSrcBuf[start], (ct-start), - &pngAnalysis, aGlyphData); - if (lastCluster > 0) { - for (i=startgid; i < aGlyphData->num_glyphs; i++) - aGlyphData->log_clusters[i] += lastCluster; - } - } - else { - while (!sameCtlRun && ct < aSrcLen) { - curShaper = (PangoliteEngineShape*) - pangolite_map_get_engine(pngMap, (PRUint32)aSrcBuf[ct]); - sameCtlRun = (curShaper != NULL); - if (!sameCtlRun) - ct++; - } - index = aGlyphData->num_glyphs; - for (i=0; i < (ct-start); i++) { - pangolite_glyph_string_set_size(aGlyphData, index+1); - aGlyphData->glyphs[index].glyph = aSrcBuf[start+i]; - aGlyphData->glyphs[index].is_cluster_start = (gint)1; - aGlyphData->log_clusters[index] = i+lastCluster; - index++; - } - } - lastCluster = aGlyphData->log_clusters[aGlyphData->num_glyphs-1]; - } - nsMemory::Free(pngAnalysis.fontCharset); - return aGlyphData->num_glyphs; -} - -NS_IMETHODIMP -nsULE::NeedsCTLFix(const PRUnichar *aString, - const PRInt32 aBeg, - const PRInt32 aEnd, - PRBool *aCTLNeeded) -{ - PangoliteEngineShape *BegShaper=NULL, *EndShaper=NULL; - PangoliteMap *pngMap=NULL; - guint enginetypeId=0, rendertypeId=0; - - enginetypeId = g_quark_from_static_string(PANGO_ENGINE_TYPE_SHAPE); - rendertypeId = g_quark_from_static_string(PANGO_RENDER_TYPE_X); - pngMap = pangolite_find_map("en_US", enginetypeId, rendertypeId); - - *aCTLNeeded = PR_FALSE; - if (aBeg >= 0) - BegShaper = (PangoliteEngineShape*) - pangolite_map_get_engine(pngMap, (PRUint32)aString[aBeg]); - - if (!BegShaper) { - - if ((aEnd < 0) && ((aBeg+aEnd) >= 0)) { - EndShaper = (PangoliteEngineShape*) - pangolite_map_get_engine(pngMap, (PRUint32)aString[aBeg+aEnd]); - } - else { - EndShaper = (PangoliteEngineShape*) - pangolite_map_get_engine(pngMap, (PRUint32)aString[aEnd]); - } - } - - if (BegShaper || EndShaper) - *aCTLNeeded = PR_TRUE; - return NS_OK; -} - -NS_IMETHODIMP -nsULE::GetPresentationForm(const PRUnichar *aString, - PRUint32 aLength, - const char *aFontCharset, - char *aGlyphs, - PRSize *aOutLength, - PRBool aIsWide) -{ - PangoliteGlyphString *tmpGlyphs=pangolite_glyph_string_new(); - - GetGlyphInfo(aString, aLength, tmpGlyphs, aFontCharset); - - if (tmpGlyphs->num_glyphs > 0) { - gint i=0, glyphCt=0; - for (i=0; i < tmpGlyphs->num_glyphs; i++, glyphCt++) { - if (aIsWide) - aGlyphs[glyphCt++]=(unsigned char) - ((tmpGlyphs->glyphs[i].glyph & 0xFF00) >> 8); - aGlyphs[glyphCt]=(unsigned char)(tmpGlyphs->glyphs[i].glyph & 0x00FF); - } - *aOutLength = (PRSize)glyphCt; - } - pangolite_glyph_string_free(tmpGlyphs); - return NS_OK; -} - -// This routine returns the string index of the next cluster -// corresponding to the cluster at string index 'aIndex' -NS_IMETHODIMP -nsULE::NextCluster(const PRUnichar *aString, - PRUint32 aLength, - const PRInt32 aIndex, - PRInt32 *aNextOffset) -{ - int mStart, mEnd; - - if (aIndex < 0) { - *aNextOffset = 0; - return NS_OK; - } - - if (PRUint32(aIndex) >= aLength) { - *aNextOffset = aLength; - return NS_OK; - } - this->GetRangeOfCluster(aString, aLength, aIndex, &mStart, &mEnd); - *aNextOffset = mEnd; - return NS_OK; -} - -// This routine returns the end-offset of the previous block -// corresponding to string index 'aIndex' -NS_IMETHODIMP -nsULE::PrevCluster(const PRUnichar *aString, - PRUint32 aLength, - const PRInt32 aIndex, - PRInt32 *aPrevOffset) -{ - int gCt, pCluster, cCluster; - PangoliteGlyphString *GlyphInfo=pangolite_glyph_string_new(); - - if (aIndex <= 1) { - *aPrevOffset = 0; - return NS_OK; - } - pCluster=cCluster=0; - GetGlyphInfo(aString, aLength, GlyphInfo, NULL); - for (gCt=0; gCt < GlyphInfo->num_glyphs; gCt++) { - - if (GlyphInfo->glyphs[gCt].is_cluster_start != GLYPH_COMBINING) - cCluster += GlyphInfo->glyphs[gCt].is_cluster_start; - - if (cCluster >= aIndex) { - *aPrevOffset = pCluster; - pangolite_glyph_string_free(GlyphInfo); - return NS_OK; - } - pCluster = cCluster; - } - *aPrevOffset = pCluster; - pangolite_glyph_string_free(GlyphInfo); - return NS_OK; -} - -// This routine gets the bounds of a cluster given a index -NS_IMETHODIMP -nsULE::GetRangeOfCluster(const PRUnichar *aString, - PRUint32 aLength, - const PRInt32 aIndex, - PRInt32 *aStart, - PRInt32 *aEnd) -{ - PangoliteGlyphString *GlyphInfo=pangolite_glyph_string_new(); - int gCt=0; - - GetGlyphInfo(aString, aLength, GlyphInfo, NULL); - - *aStart=*aEnd=0; - for (gCt=0; gCt < GlyphInfo->num_glyphs; gCt++) { - - if (GlyphInfo->glyphs[gCt].is_cluster_start != GLYPH_COMBINING) - *aEnd += GlyphInfo->glyphs[gCt].is_cluster_start; - - if (*aEnd >= aIndex+1) { - pangolite_glyph_string_free(GlyphInfo); - return NS_OK; - } - *aStart = *aEnd; - } - *aEnd = aLength; - pangolite_glyph_string_free(GlyphInfo); - return NS_OK; -} diff --git a/intl/ctl/src/nsULE.h b/intl/ctl/src/nsULE.h deleted file mode 100644 index d60140f69d0e..000000000000 --- a/intl/ctl/src/nsULE.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * XPCTL : nsULE.h - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Sun Microsystems, Inc. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Prabhat Hegde (prabhat.hegde@sun.com) - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#ifndef nsULE_H -#define nsULE_H - -#include "nscore.h" -#include "prtypes.h" - -#include "nsCtlCIID.h" -#include "nsILE.h" - -#include "pango-types.h" -#include "pango-glyph.h" - -/* Class nsULE : Declaration */ -class nsULE : public nsILE { -public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_ULE_IID) - NS_DEFINE_STATIC_CID_ACCESSOR(NS_ULE_CID) - NS_DECL_ISUPPORTS - - nsULE(void); - virtual ~nsULE(void); - - // Public Methods of nsULE - Used to handle CTL operations including - // A> API used to generate Presentation Forms based on supported fonts - // B> API used by common text operations such as cursor positioning - // and selection - - NS_IMETHOD NeedsCTLFix(const PRUnichar *aString, - const PRInt32 aBeg, - const PRInt32 aEnd, - PRBool *aCTLNeeded); - - NS_IMETHOD GetPresentationForm(const PRUnichar *aString, - PRUint32 aLength, - const char *aFontCharset, - char *aGlyphs, - PRSize *aOutLength, - PRBool aIsWide = PR_FALSE); - - NS_IMETHOD PrevCluster(const PRUnichar *aString, - PRUint32 aLength, - const PRInt32 aIndex, - PRInt32 *aPrevOffset); - - NS_IMETHOD NextCluster(const PRUnichar *aString, - PRUint32 aLength, - const PRInt32 aIndex, - PRInt32 *aNextOffset); - - NS_IMETHOD GetRangeOfCluster(const PRUnichar *aString, - PRUint32 aLength, - const PRInt32 aIndex, - PRInt32 *aStart, - PRInt32 *aEnd); - - private: - const char* GetDefaultFont(const PRUnichar); - PRInt32 GetGlyphInfo(const PRUnichar*, PRInt32, - PangoliteGlyphString*, - const char* = (const char*)NULL); -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsULE, NS_ULE_IID) - -#endif /* !nsULE_H */ diff --git a/intl/ctl/src/nsUnicodeToSunIndic.cpp b/intl/ctl/src/nsUnicodeToSunIndic.cpp deleted file mode 100644 index 080828b96cb2..000000000000 --- a/intl/ctl/src/nsUnicodeToSunIndic.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * ucvhi : nsUnicodeToSunIndic.h - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Sun Microsystems, Inc. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Prabhat Hegde (prabhat.hegde@sun.com) - * Jungshik Shin (jshin@mailmaps.org) - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#include "nsCOMPtr.h" -#include "nsCtlCIID.h" -#include "nsILE.h" -#include "nsULE.h" -#include "nsUnicodeToSunIndic.h" - -NS_IMPL_ISUPPORTS2(nsUnicodeToSunIndic, nsIUnicodeEncoder, nsICharRepresentable) - -NS_IMETHODIMP -nsUnicodeToSunIndic::SetOutputErrorBehavior(PRInt32 aBehavior, - nsIUnicharEncoder *aEncoder, - PRUnichar aChar) -{ - if (aBehavior == kOnError_CallBack && aEncoder == nsnull) - return NS_ERROR_NULL_POINTER; - mErrEncoder = aEncoder; - mErrBehavior = aBehavior; - mErrChar = aChar; - return NS_OK; -} - -// constructor and destructor -nsUnicodeToSunIndic::nsUnicodeToSunIndic() -{ - static NS_DEFINE_CID(kLECID, NS_ULE_CID); - nsresult rv; - - mCtlObj = do_CreateInstance(kLECID, &rv); - if (NS_FAILED(rv)) { - -#ifdef DEBUG_prabhath - // No other error handling needed here since we - // handle absence of mCtlObj in Convert - printf("ERROR: Cannot create instance of component " NS_ULE_PROGID " [%x].\n", rv); -#endif - - NS_WARNING("Indian Text Shaping Will Not Be Supported\n"); - mCtlObj = nsnull; - } -} - -nsUnicodeToSunIndic::~nsUnicodeToSunIndic() -{ - // Maybe convert nsILE to a service - //NS_IF_RELEASE(mCtlObj); -} - -/* - * This method converts the unicode to this font index. - * Note: ConversionBufferFullException is not handled - * since this class is only used for character display. - */ -NS_IMETHODIMP nsUnicodeToSunIndic::Convert(const PRUnichar* input, - PRInt32* aSrcLength, - char* output, - PRInt32* aDestLength) -{ - PRSize outLen; - - if (mCtlObj == nsnull) { -#ifdef DEBUG_prabhath - printf("Debug/Test Case of No Hindi pango shaper Object\n"); - // Comment out mCtlObj == nsnull for test purposes - printf("ERROR: No Hindi Text Layout Implementation"); -#endif - - NS_WARNING("cannot get default converter for Hindi"); - return NS_ERROR_FAILURE; - } - - mCharOff = mByteOff = 0; - mCtlObj->GetPresentationForm(input, *aSrcLength, "sun.unicode.india-0", - &output[mByteOff], &outLen, PR_TRUE); - *aDestLength = outLen; - return NS_OK; -} - -NS_IMETHODIMP nsUnicodeToSunIndic::Finish(char *output, PRInt32 *aDestLength) -{ - // Finish does'nt have to do much as Convert already flushes - // to output buffer - mByteOff = mCharOff = 0; - return NS_OK; -} - -//================================================================ -NS_IMETHODIMP nsUnicodeToSunIndic::Reset() -{ - mByteOff = mCharOff = 0; - return NS_OK; -} - -//================================================================ -NS_IMETHODIMP nsUnicodeToSunIndic::GetMaxLength(const PRUnichar * aSrc, - PRInt32 aSrcLength, - PRInt32 * aDestLength) -{ - *aDestLength = (aSrcLength + 1) * 2; // Each Hindi character can generate - // atmost two presentation forms - return NS_OK; -} - -//================================================================ -NS_IMETHODIMP nsUnicodeToSunIndic::FillInfo(PRUint32* aInfo) -{ - PRUint16 i; - - // 00-0x7f - for (i = 0;i <= 0x7f; i++) - SET_REPRESENTABLE(aInfo, i); - - // \u904, \u90a, \u93b, \u94e, \u94f are Undefined - for (i = 0x0901; i <= 0x0903; i++) - SET_REPRESENTABLE(aInfo, i); - - for (i = 0x0905; i <= 0x0939; i++) - SET_REPRESENTABLE(aInfo, i); - - for (i = 0x093c; i <= 0x094d; i++) - SET_REPRESENTABLE(aInfo, i); - - for (i = 0x0950; i <= 0x0954; i++) - SET_REPRESENTABLE(aInfo, i); - - for (i = 0x0958; i <= 0x0970; i++) - SET_REPRESENTABLE(aInfo, i); - - // ZWJ and ZWNJ support & coverage need to be added. - return NS_OK; -} diff --git a/intl/ctl/src/nsUnicodeToSunIndic.h b/intl/ctl/src/nsUnicodeToSunIndic.h deleted file mode 100644 index 326e91b14d93..000000000000 --- a/intl/ctl/src/nsUnicodeToSunIndic.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * ucvhi : nsUnicodeToSunIndic.h - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Sun Microsystems, Inc. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Prabhat Hegde (prabhat.hegde@sun.com) - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#ifndef nsUnicodeToSunIndic_h___ -#define nsUnicodeToSunIndic_h___ - -#include "nspr.h" -#include "nsIFactory.h" -#include "nsIGenericFactory.h" -#include "nsIServiceManager.h" -#include "nsICharsetConverterManager.h" -#include "nsIModule.h" -#include "nsIUnicodeEncoder.h" -#include "nsICharRepresentable.h" - -#include "nsILE.h" - -//---------------------------------------------------------------------- -// Class nsUnicodeToSunIndic [declaration] - -class nsUnicodeToSunIndic : public nsIUnicodeEncoder, public nsICharRepresentable -{ -NS_DECL_ISUPPORTS - -public: - nsUnicodeToSunIndic(); - virtual ~nsUnicodeToSunIndic(); - - NS_IMETHOD Convert(const PRUnichar * aSrc, PRInt32 * aSrcLength, - char * aDest, PRInt32 * aDestLength); - - NS_IMETHOD Finish(char * aDest, PRInt32 * aDestLength); - - NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength, - PRInt32 * aDestLength); - - NS_IMETHOD Reset(); - - NS_IMETHOD SetOutputErrorBehavior(PRInt32 aBehavior, - nsIUnicharEncoder * aEncoder, - PRUnichar aChar); - - NS_IMETHOD FillInfo(PRUint32* aInfo); - -private: - PRUint8 mState; - PRInt32 mByteOff; - PRInt32 mCharOff; - - nsCOMPtr mCtlObj; - - PRInt32 mErrBehavior; - PRUnichar mErrChar; - nsCOMPtr mErrEncoder; -}; -#endif /* !nsUnicodeToSunIndic_h___ */ diff --git a/intl/ctl/src/nsUnicodeToTIS620.cpp b/intl/ctl/src/nsUnicodeToTIS620.cpp deleted file mode 100644 index f7dd7f46f11c..000000000000 --- a/intl/ctl/src/nsUnicodeToTIS620.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * ucvth : nsUnicodeToTIS620.h - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Sun Microsystems, Inc. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Prabhat Hegde (prabhat.hegde@sun.com) - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#include "nsCOMPtr.h" -#include "nsIServiceManager.h" -#include "nsICharsetConverterManager.h" -#include "nsILanguageAtomService.h" -#include "nsCtlCIID.h" -#include "nsILE.h" -#include "nsULE.h" -#include "nsUnicodeToTIS620.h" - -static NS_DEFINE_CID(kCharSetManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); - -NS_IMPL_ISUPPORTS2(nsUnicodeToTIS620, nsIUnicodeEncoder, nsICharRepresentable) - -NS_IMETHODIMP nsUnicodeToTIS620::SetOutputErrorBehavior(PRInt32 aBehavior, - nsIUnicharEncoder * aEncoder, - PRUnichar aChar) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -nsUnicodeToTIS620::nsUnicodeToTIS620() -{ - static NS_DEFINE_CID(kLECID, NS_ULE_CID); - nsresult rv; - - mCtlObj = do_CreateInstance(kLECID, &rv); - if (NS_FAILED(rv)) { -#ifdef DEBUG_prabhath - // No other error handling needed here since we - // handle absence of mCtlObj in Convert - printf("ERROR: Cannot create instance of component " NS_ULE_PROGID " [%x].\n", rv); -#endif - NS_WARNING("Thai Text Layout Will Not Be Supported\n"); - mCtlObj = nsnull; - } -} - -nsUnicodeToTIS620::~nsUnicodeToTIS620() -{ - // Maybe convert nsILE to a service - // No NS_IF_RELEASE(mCtlObj) of nsCOMPtr; -} - -/* - * This method converts the unicode to this font index. - * Note: ConversionBufferFullException is not handled - * since this class is only used for character display. - */ -NS_IMETHODIMP nsUnicodeToTIS620::Convert(const PRUnichar* input, - PRInt32* aSrcLength, - char* output, - PRInt32* aDestLength) -{ - PRSize outLen = 0; -#ifdef DEBUG_prabhath_no_shaper - printf("Debug/Test Case of No thai pango shaper Object\n"); - // Comment out mCtlObj == nsnull for test purposes -#endif - - if (mCtlObj == nsnull) { -#ifdef DEBUG_prabhath - printf("ERROR: No CTL IMPLEMENTATION - Default Thai Conversion"); - // CP874 is the default converter for thai ; - // In case mCtlObj is absent (no CTL support), use it to convert. -#endif - - nsCOMPtr charsetMgr = - do_GetService(kCharSetManagerCID); - if (!charsetMgr) - return NS_ERROR_FAILURE; - - nsCOMPtr encoder; - charsetMgr->GetUnicodeEncoderRaw("TIS-620", getter_AddRefs(encoder)); - if (!encoder) { - NS_WARNING("cannot get default converter for tis-620"); - return NS_ERROR_FAILURE; - } - - encoder->Convert(input, aSrcLength, output, aDestLength); - return NS_OK; - } - - // CTLized shaping conversion starts here - // No question of starting the conversion from an offset - mCharOff = mByteOff = 0; - - // Charset tis620-0, tis620.2533-1, tis620.2529-1 & iso8859-11 - // are equivalent and have the same presentation forms - - // tis620-2 is hard-coded since we only generate presentation forms - // in Windows-Stye as it is the current defacto-standard for the - // presentation of thai content - mCtlObj->GetPresentationForm(input, *aSrcLength, "tis620-2", - &output[mByteOff], &outLen); - - *aDestLength = outLen; - return NS_OK; -} - -NS_IMETHODIMP nsUnicodeToTIS620::Finish(char * output, PRInt32 * aDestLength) -{ - // Finish does'nt have to do much as Convert already flushes - // to output buffer - mByteOff = mCharOff = 0; - return NS_OK; -} - -//================================================================ -NS_IMETHODIMP nsUnicodeToTIS620::Reset() -{ - mByteOff = mCharOff = 0; - return NS_OK; -} - -//================================================================ -NS_IMETHODIMP nsUnicodeToTIS620::GetMaxLength(const PRUnichar * aSrc, - PRInt32 aSrcLength, - PRInt32 * aDestLength) -{ - *aDestLength = (aSrcLength + 1) * 2; // Each Thai character can generate - // atmost two presentation forms - return NS_OK; -} - -//================================================================ -NS_IMETHODIMP nsUnicodeToTIS620::FillInfo(PRUint32* aInfo) -{ - PRUint16 i; - - // 00-0x7f - for (i = 0;i <= 0x7f; i++) - SET_REPRESENTABLE(aInfo, i); - - // 0x0e01-0x0e7f - for (i = 0x0e01; i <= 0xe3a; i++) - SET_REPRESENTABLE(aInfo, i); - - // U+0E3B - U+0E3E is undefined - // U+0E3F - U+0E5B - for (i = 0x0e3f; i <= 0x0e5b; i++) - SET_REPRESENTABLE(aInfo, i); - - // U+0E5C - U+0E7F Undefined - return NS_OK; -} diff --git a/intl/ctl/src/nsUnicodeToTIS620.h b/intl/ctl/src/nsUnicodeToTIS620.h deleted file mode 100644 index 84c68f5fee80..000000000000 --- a/intl/ctl/src/nsUnicodeToTIS620.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * ucvth : nsUnicodeToTIS620.h - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Sun Microsystems, Inc. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Prabhat Hegde (prabhat.hegde@sun.com) - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#ifndef nsUnicodeToTIS620_h___ -#define nsUnicodeToTIS620_h___ - -#include "nspr.h" -#include "nsIFactory.h" -#include "nsIGenericFactory.h" -#include "nsIServiceManager.h" -#include "nsICharsetConverterManager.h" -#include "nsIModule.h" -#include "nsIUnicodeEncoder.h" -#include "nsICharRepresentable.h" - -#include "nsILE.h" - -//---------------------------------------------------------------------- -// Class nsUnicodeToTIS620 [declaration] - -class nsUnicodeToTIS620 : public nsIUnicodeEncoder, public nsICharRepresentable -{ - -NS_DECL_ISUPPORTS - -public: - /** - * Class constructor. - */ - nsUnicodeToTIS620(); - virtual ~nsUnicodeToTIS620(); - - NS_IMETHOD Convert(const PRUnichar * aSrc, PRInt32 * aSrcLength, - char * aDest, PRInt32 * aDestLength); - - NS_IMETHOD Finish(char * aDest, PRInt32 * aDestLength); - - NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength, - PRInt32 * aDestLength); - - NS_IMETHOD Reset(); - - NS_IMETHOD SetOutputErrorBehavior(PRInt32 aBehavior, - nsIUnicharEncoder * aEncoder, - PRUnichar aChar); - - NS_IMETHOD FillInfo(PRUint32* aInfo); - -private: - PRUint8 mState; - PRInt32 mByteOff; - PRInt32 mCharOff; - - nsCOMPtr mCtlObj; -}; -#endif /* !nsUnicodeToTIS620_h___ */ diff --git a/intl/ctl/src/nsUnicodeToThaiTTF.cpp b/intl/ctl/src/nsUnicodeToThaiTTF.cpp deleted file mode 100644 index f9cbddd42452..000000000000 --- a/intl/ctl/src/nsUnicodeToThaiTTF.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:expandtab:shiftwidth=2:tabstop=2: - */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corp. - * Portions created by the Initial Developer are Copyright (C) 2003 - * the Initial Developer. All Rights Reserved. - * - * XXX : for the table included below. check how to credit... - * Copyright (C) 1999 Red Hat Software - * Author: Owen Taylor - * - * Copyright (C) 2002 NECTEC - * Author: Theppitak Karoonboonyanan - * - * Copyright (c) 1996-2000 by Sun Microsystems, Inc. - * Author: Chookij Vanatham - * - * Contributor(s): - * Jungshik Shin - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "nsMemory.h" -#include "nsUnicodeToThaiTTF.h" - -// tis620-2 to Thai TTF 'custom' font encoding. Actually, most positions -// are regular code points for Thai and general punctuation marks around -// U+2000. Only about one and half dozens of PUA code points are used. -// Copied from Pango Thai shaper (thai-xft.c) - -const static PRUnichar gTIS620ToUnicode[] = { - 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 -}; - -//---------------------------------------------------------------------- -// Class nsUnicodeToThaiTTF [implementation] - -NS_IMPL_ISUPPORTS_INHERITED0(nsUnicodeToThaiTTF, nsUnicodeToTIS620) - - -NS_IMETHODIMP -nsUnicodeToThaiTTF::Convert(const PRUnichar * aSrc, - PRInt32 * aSrcLength, char * aDest, - PRInt32 * aDestLength) -{ - - PRInt32 medLen; - char *med; - - GetMaxLength(aSrc, *aSrcLength, &medLen); - NS_ASSERTION(medLen <= *aDestLength, "Insufficient buffer size"); - - //intermediate encoder(TIS620) is a single byte converter taking half - //the space taken by ThaiTTF encoder. - medLen /= 2; - if (medLen > CHAR_BUFFER_SIZE) - { - med = (char *) nsMemory::Alloc(*aDestLength); - if (!med) - return NS_ERROR_OUT_OF_MEMORY; - } - else - med = mStaticBuffer; - - nsresult rv = nsUnicodeToTIS620::Convert(aSrc, aSrcLength, med, &medLen); - - if (NS_FAILED(rv)) { - if (med != mStaticBuffer) - nsMemory::Free(med); - return rv; - } - - PRInt32 i, j; - - for (i = 0, j = 0; i < medLen; i++) - { - PRUnichar ucs2 = (med[i] & 0x80) ? gTIS620ToUnicode[med[i] & 0x7f] : med[i]; - aDest[j++] = PRUint8((ucs2 & 0xff00) >> 8); - aDest[j++] = PRUint8(ucs2 & 0x00ff); - } - - *aDestLength = j; - - if (med != mStaticBuffer) - nsMemory::Free(med); - - return NS_OK; -} - -NS_IMETHODIMP -nsUnicodeToThaiTTF::GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength, PRInt32 * aDestLength) -{ - // Each Thai character can generate at most two presentation forms, - // but we're 'extending' them to 16bit shorts, which accounts for - // additional factor of 2. - *aDestLength = (aSrcLength + 1) * 4; - - return NS_OK; -} - -NS_IMETHODIMP -nsUnicodeToThaiTTF::SetOutputErrorBehavior(PRInt32 aBehavior, - nsIUnicharEncoder *aEncoder, - PRUnichar aChar) -{ - if (aBehavior == kOnError_CallBack && aEncoder == nsnull) - return NS_ERROR_NULL_POINTER; - mErrEncoder = aEncoder; - mErrBehavior = aBehavior; - mErrChar = aChar; - return NS_OK; -} diff --git a/intl/ctl/src/nsUnicodeToThaiTTF.h b/intl/ctl/src/nsUnicodeToThaiTTF.h deleted file mode 100644 index fee7f68b4166..000000000000 --- a/intl/ctl/src/nsUnicodeToThaiTTF.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:expandtab:shiftwidth=2:tabstop=2: - */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corp. - * Portions created by the Initial Developer are Copyright (C) 1998, 2003 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Jungshik Shin . - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsUnicodeToThaiTTF_h___ -#define nsUnicodeToThaiTTF_h___ - -#include "nsISupports.h" -#include "nsUnicodeToTIS620.h" - -#define CHAR_BUFFER_SIZE 2048 - -//---------------------------------------------------------------------- -// Class nsUnicodeToThaiTTF [declaration] - -class nsUnicodeToThaiTTF : public nsUnicodeToTIS620 -{ - NS_DECL_ISUPPORTS_INHERITED - -public: - nsUnicodeToThaiTTF() : nsUnicodeToTIS620() {}; - virtual ~nsUnicodeToThaiTTF() {}; - - NS_IMETHOD Convert (const PRUnichar * aSrc, PRInt32 * aSrcLength, - char * aDest, PRInt32 * aDestLength); - NS_IMETHOD GetMaxLength (const PRUnichar * aSrc, PRInt32 aSrcLength, - PRInt32 * aDestLength); - - NS_IMETHOD SetOutputErrorBehavior (PRInt32 aBehavior, - nsIUnicharEncoder *aEncoder, - PRUnichar aChar); - -private: - char mStaticBuffer[CHAR_BUFFER_SIZE]; - - PRInt32 mErrBehavior; - PRUnichar mErrChar; - nsCOMPtr mErrEncoder; -}; - -#endif /* nsUnicodeToThaiTTF_h___ */ - diff --git a/intl/ctl/src/pangoLite/Makefile.in b/intl/ctl/src/pangoLite/Makefile.in deleted file mode 100644 index 17a12177a8d2..000000000000 --- a/intl/ctl/src/pangoLite/Makefile.in +++ /dev/null @@ -1,88 +0,0 @@ -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is the Pango Library (www.pango.org). -# -# The Initial Developer of the Original Code is -# Red Hat Software. -# Portions created by the Initial Developer are Copyright (C) 1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -sysconfdir = $(DIST)/bin - -MODULE = mozpango -LIBRARY_NAME = mozpango -EXPORT_LIBRARY = 1 - -CSRCS = \ - glyphstring.c \ - modules.c \ - pango-utils.c \ - pango-coverage.c \ - shape.c \ - $(NULL) - -EXPORTS = \ - modules.h \ - pango-coverage.h \ - pango-engine.h \ - pango-glyph.h \ - pango-modules.h \ - pango-types.h \ - pango-utils.h \ - pango.h \ - $(NULL) - -EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) - -include $(topsrcdir)/config/rules.mk - -ifdef MOZ_ENABLE_GTK2 - CFLAGS += $(MOZ_GTK2_CFLAGS) - CXXFLAGS += $(MOZ_GTK2_CFLAGS) - EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS) -else - CXXFLAGS += $(GLIB_CFLAGS) - CFLAGS += $(GLIB_CFLAGS) - EXTRA_DSO_LDOPTS += $(GLIB_GMODULE_LIBS) -endif - -# Install pango.modules file for Shaping Modules. -libs:: - $(INSTALL) $(srcdir)/pango.modules $(DIST)/bin - -install:: pango.modules - $(SYSINSTALL) $(IFLAGS1) $< $(DESTDIR)$(mozappdir) diff --git a/intl/ctl/src/pangoLite/glyphstring.c b/intl/ctl/src/pangoLite/glyphstring.c deleted file mode 100644 index 5c87c3d7c28e..000000000000 --- a/intl/ctl/src/pangoLite/glyphstring.c +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pango - * glyphstring.c: - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Pango Library (www.pango.org). - * - * The Initial Developer of the Original Code is - * Red Hat Software. - * Portions created by the Initial Developer are Copyright (C) 1999 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include -#include "pango-glyph.h" - -/** - * pangolite_glyph_string_new: - * - * Create a new PangoliteGlyphString. - * - * Returns the new PangoliteGlyphString - */ -PangoliteGlyphString * -pangolite_glyph_string_new(void) -{ - PangoliteGlyphString *string = g_new(PangoliteGlyphString, 1); - - string->num_glyphs = 0; - string->space = 0; - string->glyphs = NULL; - string->log_clusters = NULL; - return string; -} - -/** - * pangolite_glyph_string_set_size: - * @string: a PangoliteGlyphString. - * @new_len: the new length of the string. - * - * Resize a glyph string to the given length. - */ -void -pangolite_glyph_string_set_size(PangoliteGlyphString *string, gint new_len) -{ - g_return_if_fail (new_len >= 0); - - while (new_len > string->space) { - if (string->space == 0) - string->space = 1; - else - string->space *= 2; - - if (string->space < 0) - g_error("%s: glyph string length overflows maximum integer size", - "pangolite_glyph_string_set_size"); - } - - string->glyphs = g_realloc(string->glyphs, - string->space * sizeof(PangoliteGlyphInfo)); - string->log_clusters = g_realloc(string->log_clusters, - string->space * sizeof (gint)); - string->num_glyphs = new_len; -} - -/** - * pangolite_glyph_string_free: - * @string: a PangoliteGlyphString. - * - * Free a glyph string and associated storage. - */ -void -pangolite_glyph_string_free(PangoliteGlyphString *string) -{ - g_free(string->glyphs); - g_free(string->log_clusters); - g_free(string); -} diff --git a/intl/ctl/src/pangoLite/modules.c b/intl/ctl/src/pangoLite/modules.c deleted file mode 100644 index ff6f404ac95a..000000000000 --- a/intl/ctl/src/pangoLite/modules.c +++ /dev/null @@ -1,522 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pango - * modules.c: - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Pango Library (www.pango.org). - * - * The Initial Developer of the Original Code is - * Red Hat Software. - * Portions created by the Initial Developer are Copyright (C) 1999 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#include -#include -#include -#include -#include - -#include - -#include "pango-modules.h" -#include "pango-utils.h" - -typedef struct _PangoliteMapInfo PangoliteMapInfo; -typedef struct _PangoliteEnginePair PangoliteEnginePair; -typedef struct _PangoliteSubmap PangoliteSubmap; - -struct _PangoliteSubmap -{ - gboolean is_leaf; - union { - PangoliteMapEntry entry; - PangoliteMapEntry *leaves; - } d; -}; - -struct _PangoliteMap -{ - gint n_submaps; - PangoliteSubmap submaps[256]; -}; - -struct _PangoliteMapInfo -{ - const gchar *lang; - guint engine_type_id; - guint render_type_id; - PangoliteMap *map; -}; - -struct _PangoliteEnginePair -{ - PangoliteEngineInfo info; - gboolean included; - void *load_info; - PangoliteEngine *engine; -}; - -static GList *maps = NULL; - -static GSList *builtin_engines = NULL; -static GSList *registered_engines = NULL; -static GSList *dlloaded_engines = NULL; - -static void build_map(PangoliteMapInfo *info); -static void init_modules(void); - -/** - * pangolite_find_map: - * @lang: the language tag for which to find the map (in the form - * en or en_US) - * @engine_type_id: the render type for the map to find - * @render_type_id: the engine type for the map to find - * - * Locate a #PangoliteMap for a particular engine type and render - * type. The resulting map can be used to determine the engine - * for each character. - * - * Return value: - **/ -PangoliteMap* -pangolite_find_map(const char *lang, guint engine_type_id, guint render_type_id) -{ - GList *tmp_list = maps; - PangoliteMapInfo *map_info = NULL; - gboolean found_earlier = FALSE; - - while (tmp_list) { - map_info = tmp_list->data; - if (map_info->engine_type_id == engine_type_id && - map_info->render_type_id == render_type_id) { - if (strcmp(map_info->lang, lang) == 0) - break; - else - found_earlier = TRUE; - } - tmp_list = tmp_list->next; - } - - if (!tmp_list) { - map_info = g_new(PangoliteMapInfo, 1); - map_info->lang = g_strdup(lang); - map_info->engine_type_id = engine_type_id; - map_info->render_type_id = render_type_id; - - build_map(map_info); - maps = g_list_prepend(maps, map_info); - } - else if (found_earlier) { - /* Move the found map to the beginning of the list - * for speed next time around if we had to do - * any failing strcmps. - */ - maps = g_list_remove_link(maps, tmp_list); - maps = g_list_prepend(maps, tmp_list->data); - g_list_free_1(tmp_list); - } - return map_info->map; -} - -static PangoliteEngine * -pangolite_engine_pair_get_engine(PangoliteEnginePair *pair) -{ - if (!pair->engine) { - if (pair->included) { - PangoliteIncludedModule *included_module = pair->load_info; - - pair->engine = included_module->load(pair->info.id); - } - else { - GModule *module; - char *module_name = pair->load_info; - PangoliteEngine *(*load)(const gchar *id); - - module = g_module_open(module_name, 0); - if (!module) { - fprintf(stderr, "Cannot load module %s: %s\n", - module_name, g_module_error()); - return NULL; - } - - g_module_symbol(module, "script_engine_load", (gpointer)&load); - if (!load) { - fprintf(stderr, "cannot retrieve script_engine_load from %s: %s\n", - module_name, g_module_error()); - g_module_close(module); - return NULL; - } - - pair->engine = (*load)(pair->info.id); - } - } - return pair->engine; -} - -static void -handle_included_module(PangoliteIncludedModule *module, GSList **engine_list) -{ - PangoliteEngineInfo *engine_info; - int n_engines, i; - - module->list(&engine_info, &n_engines); - - for (i = 0; i < n_engines; i++) { - PangoliteEnginePair *pair = g_new(PangoliteEnginePair, 1); - - pair->info = engine_info[i]; - pair->included = TRUE; - pair->load_info = module; - pair->engine = NULL; - - *engine_list = g_slist_prepend(*engine_list, pair); - } -} - -static gboolean /* Returns true if succeeded, false if failed */ -process_module_file(FILE *module_file) -{ - GString *line_buf = g_string_new(NULL); - GString *tmp_buf = g_string_new(NULL); - gboolean have_error = FALSE; - - while (pangolite_read_line(module_file, line_buf)) { - PangoliteEnginePair *pair = g_new(PangoliteEnginePair, 1); - PangoliteEngineRange *range; - GList *ranges = NULL; - GList *tmp_list; - - const char *p, *q; - int i, start, end; - - pair->included = FALSE; - - p = line_buf->str; - - if (!pangolite_skip_space(&p)) { - g_free(pair); - continue; - } - - i = 0; - while (1) { - if (!pangolite_scan_string(&p, tmp_buf)) { - have_error = TRUE; - goto error; - } - - switch (i) { - case 0: - pair->load_info = g_strdup(tmp_buf->str); - break; - case 1: - pair->info.id = g_strdup(tmp_buf->str); - break; - case 2: - pair->info.engine_type = g_strdup(tmp_buf->str); - break; - case 3: - pair->info.render_type = g_strdup(tmp_buf->str); - break; - default: - range = g_new(PangoliteEngineRange, 1); - if (sscanf(tmp_buf->str, "%d-%d:", &start, &end) != 2) { - fprintf(stderr, "Error reading modules file"); - have_error = TRUE; - goto error; - } - q = strchr(tmp_buf->str, ':'); - if (!q) { - fprintf(stderr, "Error reading modules file"); - have_error = TRUE; - goto error; - } - q++; - range->start = start; - range->end = end; - range->langs = g_strdup(q); - - ranges = g_list_prepend(ranges, range); - } - - if (!pangolite_skip_space(&p)) - break; - i++; - } - - if (i<3) { - fprintf(stderr, "Error reading modules file"); - have_error = TRUE; - goto error; - } - - ranges = g_list_reverse(ranges); - pair->info.n_ranges = g_list_length(ranges); - pair->info.ranges = g_new(PangoliteEngineRange, pair->info.n_ranges); - - tmp_list = ranges; - for (i=0; iinfo.n_ranges; i++) { - pair->info.ranges[i] = *(PangoliteEngineRange *)tmp_list->data; - tmp_list = tmp_list->next; - } - - pair->engine = NULL; - dlloaded_engines = g_slist_prepend(dlloaded_engines, pair); - - error: - g_list_foreach(ranges, (GFunc)g_free, NULL); - g_list_free(ranges); - - if (have_error) { - g_free(pair); - break; - } - } - - g_string_free(line_buf, TRUE); - g_string_free(tmp_buf, TRUE); - return !have_error; -} - -static void -read_modules(void) -{ - FILE *module_file; - char *file_str = pangolite_config_key_get("Pangolite/ModuleFiles"); - char **files; - int n; - - if (!file_str) - file_str = g_strconcat(pangolite_get_sysconf_subdirectory(), - G_DIR_SEPARATOR_S "pango.modules", NULL); - - files = pangolite_split_file_list(file_str); - - n = 0; - while (files[n]) - n++; - - while (n-- > 0) { - module_file = fopen(files[n], "r"); - if (!module_file) - g_warning("Error opening module file '%s': %s\n", files[n], g_strerror(errno)); - else { - process_module_file(module_file); - fclose(module_file); - } - } - - g_strfreev(files); - g_free(file_str); - dlloaded_engines = g_slist_reverse(dlloaded_engines); -} - -static void -set_entry(PangoliteMapEntry *entry, gboolean is_exact, PangoliteEngineInfo *info) -{ - if ((is_exact && !entry->is_exact) || !entry->info) { - entry->is_exact = is_exact; - entry->info = info; - } -} - -static void -init_modules(void) -{ - static gboolean init = FALSE; - - if (init) - return; - else - init = TRUE; - - read_modules(); -} - -static void -map_add_engine(PangoliteMapInfo *info, PangoliteEnginePair *pair) -{ - int i, j, submap; - PangoliteMap *map = info->map; - - for (i=0; iinfo.n_ranges; i++) { - gchar **langs; - gboolean is_exact = FALSE; - - if (pair->info.ranges[i].langs) { - langs = g_strsplit(pair->info.ranges[i].langs, ";", -1); - for (j=0; langs[j]; j++) - if (strcmp(langs[j], "*") == 0 || strcmp(langs[j], info->lang) == 0) { - is_exact = TRUE; - break; - } - g_strfreev(langs); - } - - for (submap = pair->info.ranges[i].start / 256; - submap <= pair->info.ranges[i].end / 256; submap ++) { - gunichar start; - gunichar end; - - if (submap == pair->info.ranges[i].start / 256) - start = pair->info.ranges[i].start % 256; - else - start = 0; - - if (submap == pair->info.ranges[i].end / 256) - end = pair->info.ranges[i].end % 256; - else - end = 255; - - if (map->submaps[submap].is_leaf && start == 0 && end == 255) { - set_entry(&map->submaps[submap].d.entry, is_exact, &pair->info); - } - else { - if (map->submaps[submap].is_leaf) { - map->submaps[submap].is_leaf = FALSE; - map->submaps[submap].d.leaves = g_new(PangoliteMapEntry, 256); - for (j=0; j<256; j++) { - map->submaps[submap].d.leaves[j].info = NULL; - map->submaps[submap].d.leaves[j].is_exact = FALSE; - } - } - - for (j=start; j<=end; j++) - set_entry(&map->submaps[submap].d.leaves[j], is_exact, &pair->info); - } - } - } -} - -static void -map_add_engine_list(PangoliteMapInfo *info, - GSList *engines, - const char *engine_type, - const char *render_type) -{ - GSList *tmp_list = engines; - - while (tmp_list) { - PangoliteEnginePair *pair = tmp_list->data; - tmp_list = tmp_list->next; - - if (strcmp(pair->info.engine_type, engine_type) == 0 && - strcmp(pair->info.render_type, render_type) == 0) { - map_add_engine(info, pair); - } - } -} - -static void -build_map(PangoliteMapInfo *info) -{ - int i; - PangoliteMap *map; - - const char *engine_type = g_quark_to_string(info->engine_type_id); - const char *render_type = g_quark_to_string(info->render_type_id); - - init_modules(); - - info->map = map = g_new(PangoliteMap, 1); - map->n_submaps = 0; - for (i=0; i<256; i++) { - map->submaps[i].is_leaf = TRUE; - map->submaps[i].d.entry.info = NULL; - map->submaps[i].d.entry.is_exact = FALSE; - } - - map_add_engine_list(info, dlloaded_engines, engine_type, render_type); - map_add_engine_list(info, registered_engines, engine_type, render_type); - map_add_engine_list(info, builtin_engines, engine_type, render_type); -} - -/** - * pangolite_map_get_entry: - * @map: a #PangoliteMap - * @wc: an ISO-10646 codepoint - * - * Returns the entry in the map for a given codepoint. The entry - * contains information about engine that should be used for - * the codepoint and also whether the engine matches the language - * tag for the map was created exactly or just approximately. - * - * Return value: the #PangoliteMapEntry for the codepoint. This value - * is owned by the #PangoliteMap and should not be freed. - **/ -PangoliteMapEntry * -pangolite_map_get_entry(PangoliteMap *map, guint32 wc) -{ - PangoliteSubmap *submap = &map->submaps[wc / 256]; - return submap->is_leaf ? &submap->d.entry : &submap->d.leaves[wc % 256]; -} - -/** - * pangolite_map_get_engine: - * @map: a #PangoliteMap - * @wc: an ISO-10646 codepoint - * - * Returns the engine listed in the map for a given codepoint. - * - * Return value: the engine, if one is listed for the codepoint, - * or %NULL. The lookup may cause the engine to be loaded; - * once an engine is loaded - **/ -PangoliteEngine * -pangolite_map_get_engine(PangoliteMap *map, guint32 wc) -{ - PangoliteSubmap *submap = &map->submaps[wc / 256]; - PangoliteMapEntry *entry = submap->is_leaf ? &submap->d.entry : - &submap->d.leaves[wc % 256]; - - if (entry->info) - return pangolite_engine_pair_get_engine((PangoliteEnginePair *)entry->info); - else - return NULL; -} - -/** - * pangolite_module_register: - * @module: a #PangoliteIncludedModule - * - * Registers a statically linked module with Pangolite. The - * #PangoliteIncludedModule structure that is passed in contains the - * functions that would otherwise be loaded from a dynamically loaded - * module. - **/ -void -pangolite_module_register(PangoliteIncludedModule *module) -{ - GSList *tmp_list = NULL; - - handle_included_module(module, &tmp_list); - registered_engines = g_slist_concat(registered_engines, - g_slist_reverse(tmp_list)); -} diff --git a/intl/ctl/src/pangoLite/modules.h b/intl/ctl/src/pangoLite/modules.h deleted file mode 100644 index f32dc46cf578..000000000000 --- a/intl/ctl/src/pangoLite/modules.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pangolite - * modules.h: - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Pango Library (www.pango.org). - * - * The Initial Developer of the Original Code is - * Red Hat Software. - * Portions created by the Initial Developer are Copyright (C) 1999 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include -#include - -#ifndef __MODULES_H__ -#define __MODULES_H__ - -extern PangoliteIncludedModule _pangolite_included_x_modules[]; -extern PangoliteIncludedModule _pangolite_included_xft_modules[]; -extern PangoliteIncludedModule _pangolite_included_ft2_modules[]; -extern PangoliteIncludedModule _pangolite_included_win32_modules[]; - -#endif /* __MODULES_H__ */ diff --git a/intl/ctl/src/pangoLite/pango-coverage.c b/intl/ctl/src/pangoLite/pango-coverage.c deleted file mode 100644 index 8f7a08921d04..000000000000 --- a/intl/ctl/src/pangoLite/pango-coverage.c +++ /dev/null @@ -1,479 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pango - * pango-coverage.c: - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Pango Library (www.pango.org). - * - * The Initial Developer of the Original Code is - * Red Hat Software. - * Portions created by the Initial Developer are Copyright (C) 1999 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include - -#include "pango-coverage.h" - -typedef struct _PangoliteBlockInfo PangoliteBlockInfo; - -#define N_BLOCKS_INCREMENT 256 - -/* The structure of a PangoliteCoverage object is a two-level table, - with blocks of size 256. Each block is stored as a packed array of 2 bit - values for each index, in LSB order. - */ - -struct _PangoliteBlockInfo -{ - guchar *data; - PangoliteCoverageLevel level; /* Used if data == NULL */ -}; - -struct _PangoliteCoverage -{ - guint ref_count; - int n_blocks; - int data_size; - - PangoliteBlockInfo *blocks; -}; - -/** - * pangolite_coverage_new: - * - * Create a new #PangoliteCoverage - * - * Return value: a new PangoliteCoverage object, initialized to - * %PANGO_COVERAGE_NONE with a reference count of 0. - **/ -PangoliteCoverage * -pangolite_coverage_new (void) -{ - PangoliteCoverage *coverage = g_new (PangoliteCoverage, 1); - - coverage->n_blocks = N_BLOCKS_INCREMENT; - coverage->blocks = g_new0 (PangoliteBlockInfo, coverage->n_blocks); - coverage->ref_count = 1; - - return coverage; -} - -/** - * pangolite_coverage_copy: - * @coverage: a #PangoliteCoverage - * - * Copy an existing #PangoliteCoverage. (This function may now be unecessary - * since we refcount the structure. Mail otaylor@redhat.com if you - * use it.) - * - * Return value: a copy of @coverage with a reference count of 1 - **/ -PangoliteCoverage * -pangolite_coverage_copy (PangoliteCoverage *coverage) -{ - int i; - PangoliteCoverage *result; - - g_return_val_if_fail (coverage != NULL, NULL); - - result = g_new (PangoliteCoverage, 1); - result->n_blocks = coverage->n_blocks; - result->blocks = g_new (PangoliteBlockInfo, coverage->n_blocks); - result->ref_count = 1; - - for (i=0; in_blocks; i++) { - if (coverage->blocks[i].data) { - result->blocks[i].data = g_new (guchar, 64); - memcpy (result->blocks[i].data, coverage->blocks[i].data, 64); - } - else - result->blocks[i].data = NULL; - - result->blocks[i].level = coverage->blocks[i].level; - } - - return result; -} - -/** - * pangolite_coverage_ref: - * @coverage: a #PangoliteCoverage - * - * Increase the reference count on the #PangoliteCoverage by one - * - * Returns: @coverage - **/ -PangoliteCoverage * -pangolite_coverage_ref (PangoliteCoverage *coverage) -{ - g_return_val_if_fail (coverage != NULL, NULL); - - coverage->ref_count++; - return coverage; -} - -/** - * pangolite_coverage_unref: - * @coverage: a #PangoliteCoverage - * - * Increase the reference count on the #PangoliteCoverage by one. - * if the result is zero, free the coverage and all associated memory. - **/ -void -pangolite_coverage_unref (PangoliteCoverage *coverage) -{ - int i; - - g_return_if_fail (coverage != NULL); - g_return_if_fail (coverage->ref_count > 0); - - coverage->ref_count--; - - if (coverage->ref_count == 0) { - for (i=0; in_blocks; i++) { - if (coverage->blocks[i].data) - g_free (coverage->blocks[i].data); - } - - g_free (coverage->blocks); - g_free (coverage); - } -} - -/** - * pangolite_coverage_get: - * @coverage: a #PangoliteCoverage - * @index: the index to check - * - * Determine whether a particular index is covered by @coverage - * - * Return value: - **/ -PangoliteCoverageLevel -pangolite_coverage_get (PangoliteCoverage *coverage, int index) -{ - int block_index; - - g_return_val_if_fail (coverage != NULL, PANGO_COVERAGE_NONE); - - block_index = index / 256; - - if (block_index > coverage->n_blocks) - return PANGO_COVERAGE_NONE; - else { - guchar *data = coverage->blocks[block_index].data; - if (data) { - int i = index % 256; - int shift = (i % 4) * 2; - - return (data[i/4] >> shift) & 0x3; - } - else - return coverage->blocks[block_index].level; - } -} - -/** - * pangolite_coverage_set: - * @coverage: a #PangoliteCoverage - * @index: the index to modify - * @level: the new level for @index - * - * Modify a particular index within @coverage - **/ -void pangolite_coverage_set (PangoliteCoverage *coverage, - int index, - PangoliteCoverageLevel level) -{ - int block_index, i; - guchar *data; - - g_return_if_fail (coverage != NULL); - g_return_if_fail (level >= 0 || level <= 3); - - block_index = index / 256; - - if (block_index > coverage->n_blocks) { - int old_n_blocks = coverage->n_blocks; - - coverage->n_blocks = - N_BLOCKS_INCREMENT * ((block_index + N_BLOCKS_INCREMENT - 1) / N_BLOCKS_INCREMENT); - - coverage->blocks = g_renew (PangoliteBlockInfo, coverage->blocks, coverage->n_blocks); - memset (coverage->blocks + old_n_blocks, 0, - sizeof (PangoliteBlockInfo) * (coverage->n_blocks - old_n_blocks)); - } - - data = coverage->blocks[block_index].data; - if (!data) { - guchar byte; - - if (level == coverage->blocks[block_index].level) - return; - - data = g_new (guchar, 64); - coverage->blocks[block_index].data = data; - - byte = coverage->blocks[block_index].level | - (coverage->blocks[block_index].level << 2) | - (coverage->blocks[block_index].level << 4) | - (coverage->blocks[block_index].level << 6); - - memset (data, byte, 64); - } - - i = index % 256; - data[i/4] |= level << ((i % 4) * 2); -} - -/** - * pangolite_coverage_max: - * @coverage: a #PangoliteCoverage - * @other: another #PangoliteCoverage - * - * Set the coverage for each index in @coverage to be the max (better) - * value of the current coverage for the index and the coverage for - * the corresponding index in @other. - **/ -void pangolite_coverage_max (PangoliteCoverage *coverage, PangoliteCoverage *other) -{ - int block_index, i; - int old_blocks; - - g_return_if_fail (coverage != NULL); - - old_blocks = MIN (coverage->n_blocks, other->n_blocks); - - if (other->n_blocks > coverage->n_blocks) { - coverage->n_blocks = other->n_blocks; - coverage->blocks = g_renew (PangoliteBlockInfo, coverage->blocks, coverage->n_blocks); - - for (block_index = old_blocks; block_index < coverage->n_blocks; - block_index++) { - if (other->blocks[block_index].data) { - coverage->blocks[block_index].data = g_new (guchar, 64); - memcpy (coverage->blocks[block_index].data, - other->blocks[block_index].data, 64); - } - else - coverage->blocks[block_index].data = NULL; - - coverage->blocks[block_index].level = other->blocks[block_index].level; - } - } - - for (block_index = 0; block_index < old_blocks; block_index++) { - if (!coverage->blocks[block_index].data && !other->blocks[block_index].data) { - coverage->blocks[block_index].level = MAX (coverage->blocks[block_index].level, other->blocks[block_index].level); - } - else if (coverage->blocks[block_index].data && other->blocks[block_index].data) { - guchar *data = coverage->blocks[block_index].data; - - for (i=0; i<64; i++) { - int byte1 = data[i]; - int byte2 = other->blocks[block_index].data[i]; - - /* There are almost certainly some clever logical ops to do this */ - data[i] = - MAX (byte1 & 0x3, byte2 & 0x3) | - MAX (byte1 & 0xc, byte2 & 0xc) | - MAX (byte1 & 0x30, byte2 & 0x30) | - MAX (byte1 & 0xc0, byte2 & 0xc00); - } - } - else { - guchar *src, *dest; - int level, byte2; - - if (coverage->blocks[block_index].data) { - src = dest = coverage->blocks[block_index].data; - level = other->blocks[block_index].level; - } - else { - src = other->blocks[block_index].data; - dest = g_new (guchar, 64); - coverage->blocks[block_index].data = dest; - level = coverage->blocks[block_index].level; - } - - byte2 = level | (level << 2) | (level << 4) | (level << 6); - - for (i=0; i<64; i++) { - int byte1 = src[i]; - - /* There are almost certainly some clever logical ops to do this */ - dest[i] = - MAX (byte1 & 0x3, byte2 & 0x3) | - MAX (byte1 & 0xc, byte2 & 0xc) | - MAX (byte1 & 0x30, byte2 & 0x30) | - MAX (byte1 & 0xc0, byte2 & 0xc00); - } - } - } -} - -#define PANGO_COVERAGE_MAGIC 0xc89dbd5e - -/** - * pangolite_coverage_to_bytes: - * @coverage: a #PangoliteCoverage - * @bytes: location to store result (must be freed with g_free()) - * @n_bytes: location to store size of result - * - * Convert a PangoliteCoverage structure into a flat binary format - **/ -void -pangolite_coverage_to_bytes(PangoliteCoverage *coverage, - guchar **bytes, - int *n_bytes) -{ - int i, j; - int size = 8 + 4 * coverage->n_blocks; - guchar *data; - int offset; - - for (i=0; in_blocks; i++) { - if (coverage->blocks[i].data) - size += 64; - } - - data = g_malloc (size); - - *(guint32 *)&data[0] = g_htonl (PANGO_COVERAGE_MAGIC); /* Magic */ - *(guint32 *)&data[4] = g_htonl (coverage->n_blocks); - offset = 8; - - for (i=0; in_blocks; i++) { - guint32 header_val; - - /* Check for solid blocks. This is a sort of random place - * to do the optimization, but we care most about getting - * it right when storing it somewhere persistent. - */ - if (coverage->blocks[i].data != NULL) { - guchar *data = coverage->blocks[i].data; - guchar first_val = data[0]; - - for (j = 1 ; j < 64; j++) - if (data[j] != first_val) - break; - - if (j == 64) { - g_free (data); - coverage->blocks[i].data = NULL; - coverage->blocks[i].level = first_val & 0x3; - } - } - - if (coverage->blocks[i].data != NULL) - header_val = (guint32)-1; - else - header_val = coverage->blocks[i].level; - - *(guint32 *)&data[offset] = g_htonl (header_val); - offset += 4; - - if (coverage->blocks[i].data) { - memcpy (data + offset, coverage->blocks[i].data, 64); - offset += 64; - } - } - - *bytes = data; - *n_bytes = size; -} - -static guint32 -pangolite_coverage_get_uint32 (guchar **ptr) -{ - guint32 val; - - memcpy (&val, *ptr, 4); - *ptr += 4; - - return g_ntohl (val); -} - -/** - * pangolite_coverage_from_bytes: - * @bytes: binary data representing a #PangoliteCoverage - * @n_bytes: the size of @bytes in bytes - * - * Convert data generated from pangolite_converage_to_bytes() back - * to a #PangoliteCoverage - * - * Return value: a newly allocated #PangoliteCoverage, or NULL if - * the data was invalid. - **/ -PangoliteCoverage * -pangolite_coverage_from_bytes (guchar *bytes, int n_bytes) -{ - PangoliteCoverage *coverage = g_new0 (PangoliteCoverage, 1); - guchar *ptr = bytes; - int i; - - coverage->ref_count = 1; - - if (n_bytes < 8) - goto error; - - if (pangolite_coverage_get_uint32 (&ptr) != PANGO_COVERAGE_MAGIC) - goto error; - - coverage->n_blocks = pangolite_coverage_get_uint32 (&ptr); - coverage->blocks = g_new0 (PangoliteBlockInfo, coverage->n_blocks); - - for (i = 0; i < coverage->n_blocks; i++) { - guint val; - - if (ptr + 4 > bytes + n_bytes) - goto error; - - val = pangolite_coverage_get_uint32 (&ptr); - if (val == (guint32)-1) { - if (ptr + 64 > bytes + n_bytes) - goto error; - - coverage->blocks[i].data = g_new (guchar, 64); - memcpy (coverage->blocks[i].data, ptr, 64); - ptr += 64; - } - else - coverage->blocks[i].level = val; - } - - return coverage; - - error: - - pangolite_coverage_unref (coverage); - return NULL; -} diff --git a/intl/ctl/src/pangoLite/pango-coverage.h b/intl/ctl/src/pangoLite/pango-coverage.h deleted file mode 100644 index df2836cb2dfa..000000000000 --- a/intl/ctl/src/pangoLite/pango-coverage.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pango - * pango-coverage.h: - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Pango Library (www.pango.org). - * - * The Initial Developer of the Original Code is - * Red Hat Software. - * Portions created by the Initial Developer are Copyright (C) 1999 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef __PANGO_COVERAGE_H__ -#define __PANGO_COVERAGE_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef struct _PangoliteCoverage PangoliteCoverage; - -typedef enum { - PANGO_COVERAGE_NONE, - PANGO_COVERAGE_FALLBACK, - PANGO_COVERAGE_APPROXIMATE, - PANGO_COVERAGE_EXACT -} PangoliteCoverageLevel; - -PangoliteCoverage * pangolite_coverage_new (void); -PangoliteCoverage * pangolite_coverage_ref (PangoliteCoverage *coverage); -void pangolite_coverage_unref (PangoliteCoverage *coverage); -PangoliteCoverage * pangolite_coverage_copy (PangoliteCoverage *coverage); -PangoliteCoverageLevel pangolite_coverage_get (PangoliteCoverage *coverage, - int index); -void pangolite_coverage_set (PangoliteCoverage *coverage, - int index, - PangoliteCoverageLevel level); -void pangolite_coverage_max (PangoliteCoverage *coverage, - PangoliteCoverage *other); - -void pangolite_coverage_to_bytes (PangoliteCoverage *coverage, - guchar **bytes, - int *n_bytes); -PangoliteCoverage *pangolite_coverage_from_bytes (guchar *bytes, - int n_bytes); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __PANGO_COVERAGE_H__ */ - - - - diff --git a/intl/ctl/src/pangoLite/pango-engine.h b/intl/ctl/src/pangoLite/pango-engine.h deleted file mode 100644 index 627b17de1d93..000000000000 --- a/intl/ctl/src/pangoLite/pango-engine.h +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pango - * pango-engine.h: Module handling - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Pango Library (www.pango.org). - * - * The Initial Developer of the Original Code is - * Red Hat Software. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef __PANGO_ENGINE_H__ -#define __PANGO_ENGINE_H__ - -#include "pango-types.h" -#include "pango-glyph.h" -#include "pango-coverage.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* Module API */ - -#define PANGO_ENGINE_TYPE_SHAPE "PangoliteEngineShape" -#define PANGO_RENDER_TYPE_X "PangoliteRenderX" -#define PANGO_RENDER_TYPE_NONE "PangoliteRenderNone" - -typedef struct _PangoliteEngineInfo PangoliteEngineInfo; -typedef struct _PangoliteEngineRange PangoliteEngineRange; -typedef struct _PangoliteEngine PangoliteEngine; - -struct _PangoliteEngineRange -{ - guint32 start; - guint32 end; - gchar *langs; -}; - -struct _PangoliteEngineInfo -{ - gchar *id; - gchar *engine_type; - gchar *render_type; - PangoliteEngineRange *ranges; - gint n_ranges; -}; - -struct _PangoliteEngine -{ - gchar *id; - gchar *type; - gint length; -}; - -struct _PangoliteEngineShape -{ - PangoliteEngine engine; - void (*script_shape) (const char *fontCharset, - const gunichar2 *text, - int length, - PangoliteAnalysis *analysis, - PangoliteGlyphString *glyphs); - PangoliteCoverage *(*get_coverage) (const char *fontCharset, const char *lang); - -}; - -/* A module should export the following functions */ -void script_engine_list(PangoliteEngineInfo **engines, int *n_engines); -PangoliteEngine *script_engine_load(const char *id); -void script_engine_unload(PangoliteEngine *engine); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __PANGO_ENGINE_H__ */ diff --git a/intl/ctl/src/pangoLite/pango-glyph.h b/intl/ctl/src/pangoLite/pango-glyph.h deleted file mode 100644 index 5adcfe07683c..000000000000 --- a/intl/ctl/src/pangoLite/pango-glyph.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pango - * pango-glyph.h: - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Pango Library (www.pango.org). - * - * The Initial Developer of the Original Code is - * Red Hat Software. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef __PANGO_GLYPH_H__ -#define __PANGO_GLYPH_H__ - -#include "pango-types.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef struct _PangoliteGlyphInfo PangoliteGlyphInfo; -typedef struct _PangoliteGlyphString PangoliteGlyphString; - -/* 1000ths of a device unit */ -typedef gint32 PangoliteGlyphUnit; - - -/* A single glyph - */ -struct _PangoliteGlyphInfo -{ - PangoliteGlyph glyph; - gint is_cluster_start; -}; - -/* A string of glyphs with positional information and visual attributes - - * ready for drawing - */ -struct _PangoliteGlyphString { - gint num_glyphs; - - PangoliteGlyphInfo *glyphs; - - /* This is a memory inefficient way of representing the information - * here - each value gives the byte index within the text - * corresponding to the glyph string of the start of the cluster to - * which the glyph belongs. - */ - gint *log_clusters; - - /*< private >*/ - gint space; -}; - -PangoliteGlyphString *pangolite_glyph_string_new(void); -void pangolite_glyph_string_set_size(PangoliteGlyphString *string, gint new_len); -void pangolite_glyph_string_free(PangoliteGlyphString *string); - - - -/* Turn a string of characters into a string of glyphs */ -void pangolite_shape(const gunichar2 *text, - gint length, - PangoliteAnalysis *analysis, - PangoliteGlyphString *glyphs); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __PANGO_GLYPH_H__ */ diff --git a/intl/ctl/src/pangoLite/pango-modules.h b/intl/ctl/src/pangoLite/pango-modules.h deleted file mode 100644 index c0e753c53cf6..000000000000 --- a/intl/ctl/src/pangoLite/pango-modules.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pango - * pango-modules.h: - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Pango Library (www.pango.org). - * - * The Initial Developer of the Original Code is - * Red Hat Software. - * Portions created by the Initial Developer are Copyright (C) 1999 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef __PANGO_MODULES_H__ -#define __PANGO_MODULES_H__ - -#include "pango-engine.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef struct _PangoliteMap PangoliteMap; -typedef struct _PangoliteMapEntry PangoliteMapEntry; - -struct _PangoliteMapEntry -{ - PangoliteEngineInfo *info; - gboolean is_exact; -}; - -typedef struct _PangoliteIncludedModule PangoliteIncludedModule; - -struct _PangoliteIncludedModule -{ - void (*list) (PangoliteEngineInfo **engines, int *n_engines); - PangoliteEngine *(*load) (const char *id); - void (*unload) (PangoliteEngine *engine); -}; - -PangoliteMap *pangolite_find_map(const char *lang, guint engine_type_id, - guint render_type_id); -PangoliteMapEntry *pangolite_map_get_entry(PangoliteMap *map, guint32 wc); -PangoliteEngine *pangolite_map_get_engine(PangoliteMap *map, guint32 wc); -void pangolite_module_register(PangoliteIncludedModule *module); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __PANGO_MODULES_H__ */ diff --git a/intl/ctl/src/pangoLite/pango-types.h b/intl/ctl/src/pangoLite/pango-types.h deleted file mode 100644 index 7c992122a695..000000000000 --- a/intl/ctl/src/pangoLite/pango-types.h +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pango - * pango-types.h: - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Pango Library (www.pango.org). - * - * The Initial Developer of the Original Code is - * Red Hat Software. - * Portions created by the Initial Developer are Copyright (C) 1999 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef __PANGO_TYPES_H__ -#define __PANGO_TYPES_H__ - -#include - -typedef struct _PangoliteLangRange PangoliteLangRange; -typedef struct _PangoliteLogAttr PangoliteLogAttr; - -typedef struct _PangoliteEngineShape PangoliteEngineShape; - -/* A index of a glyph into a font. Rendering system dependent - */ -typedef guint32 PangoliteGlyph; - -/* Information about a segment of text with a consistent - * shaping/language engine and bidirectional level - */ -typedef enum { - PANGO_DIRECTION_LTR, - PANGO_DIRECTION_RTL, - PANGO_DIRECTION_TTB_LTR, - PANGO_DIRECTION_TTB_RTL -} PangoliteDirection; - -/* Language tagging information - */ -struct _PangoliteLangRange -{ - gint start; - gint length; - gchar *lang; -}; - -/* Will be of more use when run information is stored */ -typedef struct _PangoliteAnalysis PangoliteAnalysis; - -struct _PangoliteAnalysis -{ - char *fontCharset; - PangoliteEngineShape *shape_engine; - /* guint8 level; */ - PangoliteDirection aDir; -}; - -#ifndef MOZ_WIDGET_GTK2 -/*glib2 already defined following 2 types*/ -typedef guint32 gunichar; -typedef guint16 gunichar2; -#endif - -#define G_CONST_RETURN const - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __PANGO_TYPES_H__ */ diff --git a/intl/ctl/src/pangoLite/pango-utils.c b/intl/ctl/src/pangoLite/pango-utils.c deleted file mode 100644 index 2db2abc58c97..000000000000 --- a/intl/ctl/src/pangoLite/pango-utils.c +++ /dev/null @@ -1,772 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pango - * pango-utils.c: Utilities for internal functions and modules - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Pango Library (www.pango.org). - * - * The Initial Developer of the Original Code is - * Red Hat Software. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include -#include -#include -#include - -#include "pango-utils.h" - -#ifdef HAVE_FRIBIDI -#include -#endif - -#ifndef HAVE_FLOCKFILE -#define flockfile(f) (void)1 -#define funlockfile(f) (void)1 -#define getc_unlocked(f) getc(f) -#endif /* !HAVE_FLOCKFILE */ - -#ifdef G_OS_WIN32 -#include -#define STRICT -#include -#endif - -#define UTF8_COMPUTE(Char, Mask, Len) \ - if (Char < 128) { \ - Len = 1; \ - Mask = 0x7f; \ - } \ - else if ((Char & 0xe0) == 0xc0) { \ - Len = 2; \ - Mask = 0x1f; \ - } \ - else if ((Char & 0xf0) == 0xe0) { \ - Len = 3; \ - Mask = 0x0f; \ - } \ - else if ((Char & 0xf8) == 0xf0) { \ - Len = 4; \ - Mask = 0x07; \ - } \ - else if ((Char & 0xfc) == 0xf8) { \ - Len = 5; \ - Mask = 0x03; \ - } \ - else if ((Char & 0xfe) == 0xfc) { \ - Len = 6; \ - Mask = 0x01; \ - } \ - else \ - Len = -1; - -#define UTF8_LENGTH(Char) \ - ((Char) < 0x80 ? 1 : \ - ((Char) < 0x800 ? 2 : \ - ((Char) < 0x10000 ? 3 : \ - ((Char) < 0x200000 ? 4 : \ - ((Char) < 0x4000000 ? 5 : 6))))) - -#define UTF8_GET(Result, Chars, Count, Mask, Len) \ - (Result) = (Chars)[0] & (Mask); \ - for ((Count) = 1; (Count) < (Len); ++(Count)) { \ - if (((Chars)[(Count)] & 0xc0) != 0x80) { \ - (Result) = -1; \ - break; \ - } \ - (Result) <<= 6; \ - (Result) |= ((Chars)[(Count)] & 0x3f); \ - } - -#define UNICODE_VALID(Char) \ - ((Char) < 0x110000 && ((Char) < 0xD800 || (Char) >= 0xE000) && \ - (Char) != 0xFFFE && (Char) != 0xFFFF) - -/** - * pangolite_trim_string: - * @str: a string - * - * Trim leading and trailing whitespace from a string. - * - * Return value: A newly allocated string that must be freed with g_free() - **/ -char * -pangolite_trim_string (const char *str) -{ - int len; - - g_return_val_if_fail (str != NULL, NULL); - - while (*str && isspace (*str)) - str++; - - len = strlen (str); - while (len > 0 && isspace (str[len-1])) - len--; - - return g_strndup (str, len); -} - -/** - * pangolite_split_file_list: - * @str: a comma separated list of filenames - * - * Split a G_SEARCHPATH_SEPARATOR-separated list of files, stripping - * white space and subsituting ~/ with $HOME/ - * - * Return value: a list of strings to be freed with g_strfreev() - **/ -char ** -pangolite_split_file_list (const char *str) -{ - int i = 0; - int j; - char **files; - - files = g_strsplit (str, G_SEARCHPATH_SEPARATOR_S, -1); - - while (files[i]) - { - char *file = pangolite_trim_string (files[i]); - - /* If the resulting file is empty, skip it */ - if (file[0] == '\0') - { - g_free(file); - g_free (files[i]); - - for (j = i + 1; files[j]; j++) - files[j - 1] = files[j]; - - files[j - 1] = NULL; - - continue; - } -#ifndef G_OS_WIN32 - /* '~' is a quite normal and common character in file names on - * Windows, especially in the 8.3 versions of long file names, which - * still occur and then. Also, few Windows user are aware of the - * Unix shell convention that '~' stands for the home directory, - * even if they happen to have a home directory. - */ - if (file[0] == '~' && file[1] == G_DIR_SEPARATOR) - { - char *tmp = g_strconcat (g_get_home_dir(), file + 1, NULL); - g_free (file); - file = tmp; - } -#endif - g_free (files[i]); - files[i] = file; - - i++; - } - - return files; -} - -/** - * pangolite_read_line: - * @stream: a stdio stream - * @str: #GString buffer into which to write the result - * - * Read an entire line from a file into a buffer. Lines may - * be delimited with '\n', '\r', '\n\r', or '\r\n'. The delimiter - * is not written into the buffer. Text after a '#' character is treated as - * a comment and skipped. '\' can be used to escape a # character. - * '\' proceding a line delimiter combines adjacent lines. A '\' proceding - * any other character is ignored and written into the output buffer - * unmodified. - * - * Return value: 0 if the stream was already at an EOF character, otherwise - * the number of lines read (this is useful for maintaining - * a line number counter which doesn't combine lines with \) - **/ -gint -pangolite_read_line (FILE *stream, GString *str) -{ - gboolean quoted = FALSE; - gboolean comment = FALSE; - int n_read = 0; - int lines = 1; - - flockfile (stream); - - g_string_truncate (str, 0); - - while (1) - { - int c; - - c = getc_unlocked (stream); - - if (c == EOF) - { - if (quoted) - g_string_append_c (str, '\\'); - - goto done; - } - else - n_read++; - - if (quoted) - { - quoted = FALSE; - - switch (c) - { - case '#': - g_string_append_c (str, '#'); - break; - case '\r': - case '\n': - { - int next_c = getc_unlocked (stream); - - if (!(next_c == EOF || - (c == '\r' && next_c == '\n') || - (c == '\n' && next_c == '\r'))) - ungetc (next_c, stream); - - lines++; - - break; - } - default: - g_string_append_c (str, '\\'); - g_string_append_c (str, c); - } - } - else - { - switch (c) - { - case '#': - comment = TRUE; - break; - case '\\': - if (!comment) - quoted = TRUE; - break; - case '\n': - { - int next_c = getc_unlocked (stream); - - if (!(c == EOF || - (c == '\r' && next_c == '\n') || - (c == '\n' && next_c == '\r'))) - ungetc (next_c, stream); - - goto done; - } - default: - if (!comment) - g_string_append_c (str, c); - } - } - } - - done: - - funlockfile (stream); - - return (n_read > 0) ? lines : 0; -} - -/** - * pangolite_skip_space: - * @pos: in/out string position - * - * Skips 0 or more characters of white space. - * - * Return value: %FALSE if skipping the white space leaves - * the position at a '\0' character. - **/ -gboolean -pangolite_skip_space (const char **pos) -{ - const char *p = *pos; - - while (isspace (*p)) - p++; - - *pos = p; - - return !(*p == '\0'); -} - -/** - * pangolite_scan_word: - * @pos: in/out string position - * @out: a #GString into which to write the result - * - * Scan a word into a #GString buffer. A word consists - * of [A-Za-z_] followed by zero or more [A-Za-z_0-9] - * Leading white space is skipped. - * - * Return value: %FALSE if a parse error occured. - **/ -gboolean -pangolite_scan_word (const char **pos, GString *out) -{ - const char *p = *pos; - - while (isspace (*p)) - p++; - - if (!((*p >= 'A' && *p <= 'Z') || - (*p >= 'a' && *p <= 'z') || - *p == '_')) - return FALSE; - - g_string_truncate (out, 0); - g_string_append_c (out, *p); - p++; - - while ((*p >= 'A' && *p <= 'Z') || - (*p >= 'a' && *p <= 'z') || - (*p >= '0' && *p <= '9') || - *p == '_') - { - g_string_append_c (out, *p); - p++; - } - - *pos = p; - - return TRUE; -} - -/** - * pangolite_scan_string: - * @pos: in/out string position - * @out: a #GString into which to write the result - * - * Scan a string into a #GString buffer. The string may either - * be a sequence of non-white-space characters, or a quoted - * string with '"'. Instead a quoted string, '\"' represents - * a literal quote. Leading white space outside of quotes is skipped. - * - * Return value: %FALSE if a parse error occured. - **/ -gboolean -pangolite_scan_string (const char **pos, GString *out) -{ - const char *p = *pos; - - while (isspace (*p)) - p++; - - if (!*p) - return FALSE; - else if (*p == '"') - { - gboolean quoted = FALSE; - g_string_truncate (out, 0); - - p++; - - while (TRUE) - { - if (quoted) - { - int c = *p; - - switch (c) - { - case '\0': - return FALSE; - case 'n': - c = '\n'; - break; - case 't': - c = '\t'; - break; - } - - quoted = FALSE; - g_string_append_c (out, c); - } - else - { - switch (*p) - { - case '\0': - return FALSE; - case '\\': - quoted = TRUE; - break; - case '"': - p++; - goto done; - default: - g_string_append_c (out, *p); - break; - } - } - p++; - } - done: - ; - } - else - { - g_string_truncate (out, 0); - - while (*p && !isspace (*p)) - { - g_string_append_c (out, *p); - p++; - } - } - - *pos = p; - - return TRUE; -} - -gboolean -pangolite_scan_int (const char **pos, int *out) -{ - int i = 0; - char buf[32]; - const char *p = *pos; - - while (isspace (*p)) - p++; - - if (*p < '0' || *p > '9') - return FALSE; - - while ((*p >= '0') && (*p <= '9') && i < sizeof(buf)) - { - buf[i] = *p; - i++; - p++; - } - - if (i == sizeof(buf)) - return FALSE; - else - buf[i] = '\0'; - - *out = atoi (buf); - - return TRUE; -} - -static GHashTable *config_hash = NULL; - -static void -read_config_file (const char *filename, gboolean enoent_error) -{ - FILE *file; - - GString *line_buffer; - GString *tmp_buffer1; - GString *tmp_buffer2; - char *errstring = NULL; - const char *pos; - char *section = NULL; - int line = 0; - - file = fopen (filename, "r"); - if (!file) - { - if (errno != ENOENT || enoent_error) - fprintf (stderr, "Pangolite:%s: Error opening config file: %s\n", - filename, g_strerror (errno)); - return; - } - - line_buffer = g_string_new (NULL); - tmp_buffer1 = g_string_new (NULL); - tmp_buffer2 = g_string_new (NULL); - - while (pangolite_read_line (file, line_buffer)) - { - line++; - - pos = line_buffer->str; - if (!pangolite_skip_space (&pos)) - continue; - - if (*pos == '[') /* Section */ - { - pos++; - if (!pangolite_skip_space (&pos) || - !pangolite_scan_word (&pos, tmp_buffer1) || - !pangolite_skip_space (&pos) || - *(pos++) != ']' || - pangolite_skip_space (&pos)) - { - errstring = g_strdup ("Error parsing [SECTION] declaration"); - goto error; - } - - section = g_strdup (tmp_buffer1->str); - } - else /* Key */ - { - gboolean empty = FALSE; - gboolean append = FALSE; - char *k, *v; - - if (!section) - { - errstring = g_strdup ("A [SECTION] declaration must occur first"); - goto error; - } - - if (!pangolite_scan_word (&pos, tmp_buffer1) || - !pangolite_skip_space (&pos)) - { - errstring = g_strdup ("Line is not of the form KEY=VALUE or KEY+=VALUE"); - goto error; - } - if (*pos == '+') - { - append = TRUE; - pos++; - } - - if (*(pos++) != '=') - { - errstring = g_strdup ("Line is not of the form KEY=VALUE or KEY+=VALUE"); - goto error; - } - - if (!pangolite_skip_space (&pos)) - { - empty = TRUE; - } - else - { - if (!pangolite_scan_string (&pos, tmp_buffer2)) - { - errstring = g_strdup ("Error parsing value string"); - goto error; - } - if (pangolite_skip_space (&pos)) - { - errstring = g_strdup ("Junk after value string"); - goto error; - } - } - - g_string_prepend_c (tmp_buffer1, '/'); - g_string_prepend (tmp_buffer1, section); - - /* Remove any existing values */ - if (g_hash_table_lookup_extended (config_hash, tmp_buffer1->str, - (gpointer *)&k, (gpointer *)&v)) - { - g_free (k); - if (append) - { - g_string_prepend (tmp_buffer2, v); - g_free (v); - } - } - - if (!empty) - { - g_hash_table_insert (config_hash, - g_strdup (tmp_buffer1->str), - g_strdup (tmp_buffer2->str)); - } - } - } - - if (ferror (file)) - errstring = g_strdup ("g_strerror(errno)"); - - error: - - if (errstring) - { - fprintf (stderr, "Pangolite:%s:%d: %s\n", filename, line, errstring); - g_free (errstring); - } - - g_free (section); - g_string_free (line_buffer, TRUE); - g_string_free (tmp_buffer1, TRUE); - g_string_free (tmp_buffer2, TRUE); - - fclose (file); -} - -static void -read_config () -{ - if (!config_hash) - { - char *filename; - char *home; - - config_hash = g_hash_table_new (g_str_hash, g_str_equal); - filename = g_strconcat (pangolite_get_sysconf_subdirectory (), - G_DIR_SEPARATOR_S "pangoliterc", - NULL); - read_config_file (filename, FALSE); - g_free (filename); - - home = g_get_home_dir (); - if (home && *home) - { - filename = g_strconcat (home, - G_DIR_SEPARATOR_S ".pangoliterc", - NULL); - read_config_file (filename, FALSE); - g_free (filename); - } - - filename = g_getenv ("PANGO_RC_FILE"); - if (filename) - read_config_file (filename, TRUE); - } -} - -/** - * pangolite_config_key_get: - * @key: Key to look up, in the form "SECTION/KEY". - * - * Look up a key in the pangolite config database - * (pseudo-win.ini style, read from $sysconfdir/pangolite/pangoliterc, - * ~/.pangoliterc, and getenv (PANGO_RC_FILE).) - * - * Return value: the value, if found, otherwise %NULL. The value is a - * newly-allocated string and must be freed with g_free(). - **/ -char * -pangolite_config_key_get (const char *key) -{ - g_return_val_if_fail (key != NULL, NULL); - - read_config (); - - return g_strdup (g_hash_table_lookup (config_hash, key)); -} - -G_CONST_RETURN char * -pangolite_get_sysconf_subdirectory (void) -{ -#ifdef G_OS_WIN32 - static gchar *result = NULL; - - if (result == NULL) - result = g_win32_get_package_installation_subdirectory - ("pangolite", g_strdup_printf ("pangolite-%s.dll", PANGO_VERSION), "etc\\pangolite"); - - return result; - // Am open to any other way of doing this - // Bottomline : need to provide path to pango.modules - /* Currently set to dist/bin - Am open to other location */ -#else - char *tmp = getenv("MOZILLA_FIVE_HOME"); - return tmp; -#endif -} - -G_CONST_RETURN char * -pangolite_get_lib_subdirectory (void) -{ -#ifdef G_OS_WIN32 - static gchar *result = NULL; - - if (result == NULL) - result = g_win32_get_package_installation_subdirectory - ("pangolite", g_strdup_printf ("pangolite-%s.dll", PANGO_VERSION), "lib\\pangolite"); - - return result; - // Open to any other way of doing this - // Bottomline : need to provide path to pangolite libraries - // Currently set to dist/bin - Open to other locations -#else - char *tmp = getenv("MOZILLA_FIVE_HOME"); - return tmp; - /* return "/home/prabhath/PROJ/opt/lib"; */ -#endif -} - -/** - * g_utf8_get_char: - * @p: a pointer to unicode character encoded as UTF-8 - * - * Convert a sequence of bytes encoded as UTF-8 to a unicode character. - * - * Return value: the resulting character or (gunichar)-1 if @p does - * not point to a valid UTF-8 encoded unicode character - **/ -gunichar -g_utf8_get_char (const gchar *p) -{ - int i, mask = 0, len; - gunichar result; - unsigned char c = (unsigned char) *p; - - UTF8_COMPUTE (c, mask, len); - if (len == -1) - return (gunichar)-1; - UTF8_GET (result, p, i, mask, len); - - return result; -} - - -#ifdef HAVE_FRIBIDI -void -pangolite_log2vis_get_embedding_levels (gunichar *str, - int len, - PangoliteDirection *pbase_dir, - guint8 *embedding_level_list) -{ - FriBidiCharType fribidi_base_dir; - - fribidi_base_dir = (*pbase_dir == PANGO_DIRECTION_LTR) ? - FRIBIDI_TYPE_L : FRIBIDI_TYPE_R; - - fribidi_log2vis_get_embedding_levels(str, len, &fribidi_base_dir, - embedding_level_list); - - *pbase_dir = (fribidi_base_dir == FRIBIDI_TYPE_L) ? - PANGO_DIRECTION_LTR : PANGO_DIRECTION_RTL; -} - -gboolean -pangolite_get_mirror_char (gunichar ch, gunichar *mirrored_ch) -{ - return fribidi_get_mirror_char (ch, mirrored_ch); -} -#endif /* HAVE_FRIBIDI */ diff --git a/intl/ctl/src/pangoLite/pango-utils.h b/intl/ctl/src/pangoLite/pango-utils.h deleted file mode 100644 index 3f46a97204fe..000000000000 --- a/intl/ctl/src/pangoLite/pango-utils.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pango - * pango-utils.h: Utilities for internal functions and modules - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Pango Library (www.pango.org). - * - * The Initial Developer of the Original Code is - * Red Hat Software. - * Portions created by the Initial Developer are Copyright (C) 2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include -#include - -#include "pango-types.h" - -char *pangolite_trim_string(const char *str); -char **pangolite_split_file_list(const char *str); - -gint pangolite_read_line(FILE *stream, GString *str); - -gboolean pangolite_skip_space(const char **pos); -gboolean pangolite_scan_word(const char **pos, GString *out); -gboolean pangolite_scan_string(const char **pos, GString *out); -gboolean pangolite_scan_int(const char **pos, int *out); - -char * pangolite_config_key_get(const char *key); - -/* On Unix, return the name of the "pangolite" subdirectory of SYSCONFDIR - * (which is set at compile time). On Win32, return the Pangolite - * installation directory (which is set at installation time, and - * stored in the registry). The returned string should not be - * g_free'd. - */ -const char *pangolite_get_sysconf_subdirectory(void); - -/* Ditto for LIBDIR/pangolite. On Win32, use the same Pangolite - * installation directory. This returned string should not be - * g_free'd either. - */ -const char *pangolite_get_lib_subdirectory (void); diff --git a/intl/ctl/src/pangoLite/pango.h b/intl/ctl/src/pangoLite/pango.h deleted file mode 100644 index c8935933c2fb..000000000000 --- a/intl/ctl/src/pangoLite/pango.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pangolite - * pango.h: - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Pango Library (www.pango.org). - * - * The Initial Developer of the Original Code is - * Red Hat Software. - * Portions created by the Initial Developer are Copyright (C) 1999 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef __PANGO_H__ -#define __PANGO_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#include -#include -#include - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __PANGO_H__ */ diff --git a/intl/ctl/src/pangoLite/pango.modules b/intl/ctl/src/pangoLite/pango.modules deleted file mode 100644 index e91facbf12a5..000000000000 --- a/intl/ctl/src/pangoLite/pango.modules +++ /dev/null @@ -1,5 +0,0 @@ -# Pango Modules file -# Automatically generated file, do not edit -# -libmozpango-thaix.so ThaiScriptEngineX PangoliteEngineShape PangoliteRenderX 3585-3675:* -libmozpango-dvngx.so DvngScriptEngineX PangoliteEngineShape PangoliteRenderX 2305-2416:* diff --git a/intl/ctl/src/pangoLite/querymodules.c b/intl/ctl/src/pangoLite/querymodules.c deleted file mode 100644 index 0631c2faa753..000000000000 --- a/intl/ctl/src/pangoLite/querymodules.c +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pango - * querymodules.c: - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Pango Library (www.pango.org). - * - * The Initial Developer of the Original Code is - * Red Hat Software. - * Portions created by the Initial Developer are Copyright (C) 1999 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "config.h" - -#include -#ifdef HAVE_DIRENT_H -#include -#endif -#include -#include "pango-break.h" -#include "pango-context.h" -#include "pango-utils.h" -#include "pango-engine.h" - -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#include - -#ifdef G_OS_WIN32 -#define SOEXT ".dll" -#ifndef PATH_MAX -#include -#define PATH_MAX _MAX_PATH -#endif /* PATH_MAX */ -#include /* for getcwd() with MSVC */ -#include /* for getcwd() with mingw */ -#define getcwd _getcwd -#else -#define SOEXT ".so" -#endif - -void -query_module (const char *dir, const char *name) -{ - void (*list) (PangoliteEngineInfo **engines, gint *n_engines); - PangoliteEngine *(*load) (const gchar *id); - void (*unload) (PangoliteEngine *engine); - - GModule *module; - gchar *path; - - if (name[0] == G_DIR_SEPARATOR) - path = g_strdup (name); - else - path = g_strconcat (dir, G_DIR_SEPARATOR_S, name, NULL); - - module = g_module_open (path, 0); - - if (!module) - fprintf(stderr, "Cannot load module %s: %s\n", path, g_module_error()); - - if (module && - g_module_symbol (module, "script_engine_list", (gpointer)&list) && - g_module_symbol (module, "script_engine_load", (gpointer)&load) && - g_module_symbol (module, "script_engine_unload", (gpointer)&unload)) - { - gint i,j; - PangoliteEngineInfo *engines; - gint n_engines; - - (*list) (&engines, &n_engines); - - for (i=0; id_name); - if (len > 3 && strcmp (dent->d_name + len - strlen (SOEXT), SOEXT) == 0) - query_module (dirs[i], dent->d_name); - } - - closedir (dir); - } - } - } - else - { - getcwd (cwd, PATH_MAX); - - for (i=1; ishape_engine) - analysis->shape_engine->script_shape(analysis->fontCharset, text, length, - analysis, glyphs); - else { - pangolite_glyph_string_set_size (glyphs, 1); - - glyphs->glyphs[0].glyph = 0; - glyphs->log_clusters[0] = 0; - } - - g_assert (glyphs->num_glyphs > 0); -} diff --git a/intl/ctl/src/thaiShaper/Makefile.in b/intl/ctl/src/thaiShaper/Makefile.in deleted file mode 100644 index 8dff4e2422eb..000000000000 --- a/intl/ctl/src/thaiShaper/Makefile.in +++ /dev/null @@ -1,73 +0,0 @@ -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is the Pango Library (www.pango.org). -# -# The Initial Developer of the Original Code is -# Red Hat Software. -# Portions created by the Initial Developer are Copyright (C) 1999 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Prabhat Hegde (prabhat.hegde@sun.com) -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = mozpango-thaix -LIBRARY_NAME = mozpango-thaix -# See bug 201167 ("No CTL support in StaticBuilds") -FORCE_SHARED_LIB = 1 -EXTRA_DSO_LIBS = mozpango - -CSRCS = \ - thai-x.c \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -LOCAL_INCLUDES += \ - -I$(srcdir)/../pangoLite \ - $(NULL) - -ifdef MOZ_ENABLE_GTK2 - CFLAGS += $(MOZ_GTK2_CFLAGS) - EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS) -else - CFLAGS += $(GLIB_CFLAGS) - EXTRA_DSO_LDOPTS += $(GLIB_LIBS) \ - $(GLIB_GMODULE_LIBS) -endif - -EXTRA_DSO_LDOPTS += \ - -L$(DIST)/lib \ - $(EXTRA_DSO_LIBS) \ - $(NULL) diff --git a/intl/ctl/src/thaiShaper/thai-x.c b/intl/ctl/src/thaiShaper/thai-x.c deleted file mode 100644 index 78605bb70668..000000000000 --- a/intl/ctl/src/thaiShaper/thai-x.c +++ /dev/null @@ -1,804 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * Pango - * thai-x.c: - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Pango Library (www.pango.org). - * - * The Initial Developer of the Original Code is - * Red Hat Software. - * Portions created by the Initial Developer are Copyright (C) 1999 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Author: Owen Taylor - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include -#include - -#include "pango-engine.h" -#include "pango-coverage.h" - -#define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) - -#define ucs2tis(wc) (unsigned int)((unsigned int)(wc) - 0x0E00 + 0xA0) -#define tis2uni(c) ((gunichar2)(c) - 0xA0 + 0x0E00) - -#define MAX_CLUSTER_CHRS 256 -#define MAX_GLYPHS 256 -#define GLYPH_COMBINING 256 - -/* 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 BV1 7 -#define BV2 8 -#define BD 9 -#define TONE 10 -#define AD1 11 -#define AD2 12 -#define AD3 13 -#define AV1 14 -#define AV2 15 -#define AV3 16 - -#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 char_class(wc) TAC_char_class[(unsigned int)(wc)] -#define is_char_type(wc, mask) (char_type_table[ucs2tis((wc))] & (mask)) - -#define SCRIPT_ENGINE_NAME "ThaiScriptEngineX" -#define PANGO_RENDER_TYPE_X "PangoliteRenderX" - -typedef guint16 PangoliteXSubfont; -#define PANGO_MOZ_MAKE_GLYPH(index) ((guint32)0 | (index)) - -/* We handle the range U+0e01 to U+0e5b exactly - */ -static PangoliteEngineRange thai_ranges[] = { - { 0x0e01, 0x0e5b, "*" }, /* Thai */ -}; - -static PangoliteEngineInfo script_engines[] = { - { - SCRIPT_ENGINE_NAME, - PANGO_ENGINE_TYPE_SHAPE, - PANGO_RENDER_TYPE_X, - thai_ranges, - G_N_ELEMENTS(thai_ranges) - } -}; - -/* - * X window system script engine portion - */ - -typedef struct _ThaiFontInfo ThaiFontInfo; - -/* The type of encoding that we will use - */ -typedef enum { - THAI_FONT_NONE, - THAI_FONT_XTIS, - THAI_FONT_TIS, - THAI_FONT_TIS_MAC, - THAI_FONT_TIS_WIN, - THAI_FONT_ISO10646 -} ThaiFontType; - -struct _ThaiFontInfo -{ - ThaiFontType type; - PangoliteXSubfont subfont; -}; - -/* All combining marks for Thai fall in the range U+0E30-U+0E50, - * so we confine our data tables to that range, and use - * default values for characters outside those ranges. - */ - -/* Map from code point to group used for rendering with XTIS fonts - * (0 == base character) - */ -static const char groups[32] = { - 0, 1, 0, 0, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2, - 2, 2, 2, 2, 2, 2, 1, 0 -}; - -/* Map from code point to index within group 1 - * (0 == no combining mark from group 1) - */ -static const char group1_map[32] = { - 0, 1, 0, 0, 2, 3, 4, 5, - 6, 7, 8, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* Map from code point to index within group 2 - * (0 == no combining mark from group 2) - */ -static const char group2_map[32] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, - 2, 3, 4, 5, 6, 7, 1, 0 -}; - -static const gint char_type_table[256] = { - /* 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, A, B, C, D, E, F */ - - /*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, - /*20*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - /*30*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - /*40*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - /*50*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - /*60*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - /*70*/ _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - _ND, _ND, _ND, _ND, _ND, _ND, _ND, _ND, - /*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, - - /*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, -}; - -static const gint TAC_char_class[256] = { - /* 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, A, B, C, D, E, F */ - - /*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, - /*20*/ NON, NON, NON, NON, NON, NON, NON, NON, - NON, NON, NON, NON, NON, NON, NON, NON, - /*30*/ NON, NON, NON, NON, NON, NON, NON, NON, - NON, NON, NON, NON, NON, NON, NON, NON, - /*40*/ NON, NON, NON, NON, NON, NON, NON, NON, - NON, NON, NON, NON, NON, NON, NON, NON, - /*50*/ NON, NON, NON, NON, NON, NON, NON, NON, - NON, NON, NON, NON, NON, NON, NON, NON, - /*60*/ NON, NON, NON, NON, NON, NON, NON, NON, - NON, NON, NON, NON, NON, NON, NON, NON, - /*70*/ NON, NON, NON, NON, NON, NON, NON, NON, - NON, NON, NON, NON, NON, NON, NON,CTRL, - /*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, - /*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, FV1, 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, AD1, AD3, NON, - /*F0*/ NON, NON, NON, NON, NON, NON, NON, NON, - NON, NON, NON, NON, NON, NON, NON,CTRL, -}; - -static const gchar TAC_compose_and_input_check_type_table[17][17] = { - /* Cn */ /* 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, A, B, C, D, E, F */ - /* Cn-1 00 */ { 'X', 'A', 'A', 'A', 'A', 'A', 'A', 'R', - 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' }, - /* 10 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', - 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' }, - /* 20 */ { 'X', 'A', 'A', 'A', 'A', 'S', 'A', 'C', - 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C' }, - /* 30 */ {'X', 'S', 'A', 'S', 'S', 'S', 'S', 'R', - 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' }, - /* 40 */ { 'X', 'S', 'A', 'A', 'S', 'S', 'A', 'R', - 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' }, - /* 50 */ { 'X', 'A', 'A', 'A', 'A', 'S', 'A', 'R', - 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' }, - /* 60 */ { 'X', 'A', 'A', 'A', 'S', 'A', 'S', 'R', - 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' }, - /* 70 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', - 'R', 'R', 'C', 'C', 'R', 'R', 'R', 'R', 'R' }, - /* 80 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', - 'R', 'R', 'C', 'R', 'R', 'R', 'R', 'R', 'R' }, - /* 90 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', - 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' }, - /* A0 */ { 'X', 'A', 'A', 'A', 'A', 'A', 'A', 'R', - 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' }, - /* B0 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', - 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' }, - /* C0 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', - 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' }, - /* D0 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', - 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R', 'R' }, - /* E0 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', - 'R', 'R', 'C', 'C', 'R', 'R', 'R', 'R', 'R' }, - /* F0 */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', - 'R', 'R', 'C', 'R', 'R', 'R', 'R', 'R', 'R' }, - /* */ { 'X', 'A', 'A', 'A', 'S', 'S', 'A', 'R', - 'R', 'R', 'C', 'R', 'C', 'R', 'R', 'R', 'R' } -}; - -typedef struct { - gint ShiftDown_TONE_AD[8]; - gint ShiftDownLeft_TONE_AD[8]; - gint ShiftLeft_TONE_AD[8]; - gint ShiftLeft_AV[7]; - gint ShiftDown_BV_BD[3]; - gint TailCutCons[4]; -} ThaiShapeTable; - -#define shiftdown_tone_ad(c,tbl) ((tbl)->ShiftDown_TONE_AD[(c)-0xE7]) -#define shiftdownleft_tone_ad(c,tbl) ((tbl)->ShiftDownLeft_TONE_AD[(c)-0xE7]) -#define shiftleft_tone_ad(c,tbl) ((tbl)->ShiftLeft_TONE_AD[(c)-0xE7]) -#define shiftleft_av(c,tbl) ((tbl)->ShiftLeft_AV[(c)-0xD1]) -#define shiftdown_bv_bd(c,tbl) ((tbl)->ShiftDown_BV_BD[(c)-0xD8]) -#define tailcutcons(c,tbl) ((tbl)->TailCutCons[(c)-0xAD]) - -/* Macintosh - */ -static const ThaiShapeTable Mac_shape_table = { - { 0xE7, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0xED, 0xEE }, - { 0xE7, 0x83, 0x84, 0x85, 0x86, 0x87, 0x8F, 0xEE }, - { 0x93, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x8F, 0xEE }, - { 0x92, 0x00, 0x00, 0x94, 0x95, 0x96, 0x97 }, - { 0xD8, 0xD9, 0xDA }, - { 0xAD, 0x00, 0x00, 0xB0 } -}; - -/* Microsoft Window - */ -static const ThaiShapeTable Win_shape_table = { - { 0xE7, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0xED, 0xEE }, - { 0xE7, 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 } -}; - -/* No adjusted vowel/tonemark glyphs (tis620-0) - */ -static const ThaiShapeTable tis620_0_shape_table = { - { 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 } -}; - -/* Returns a structure with information we will use to rendering given the - * #PangoliteFont. This is computed once per font and cached for later retrieval. - */ -static ThaiFontInfo * -get_font_info (const char *fontCharset) -{ - static const char *charsets[] = { - "tis620-2", - "tis620-1", - "tis620-0", - "xtis620.2529-1", - "xtis-0", - "tis620.2533-1", - "tis620.2529-1", - "iso8859-11", - "iso10646-1", - }; - - static const int charset_types[] = { - THAI_FONT_TIS_WIN, - THAI_FONT_TIS_MAC, - THAI_FONT_TIS, - THAI_FONT_XTIS, - THAI_FONT_XTIS, - THAI_FONT_TIS, - THAI_FONT_TIS, - THAI_FONT_TIS, - THAI_FONT_ISO10646 - }; - - ThaiFontInfo *font_info = g_new(ThaiFontInfo, 1); - guint i; - - font_info->type = THAI_FONT_NONE; - for (i = 0; i < G_N_ELEMENTS(charsets); i++) { - if (strcmp(fontCharset, charsets[i]) == 0) { - font_info->type = (ThaiFontType)charset_types[i]; - font_info->subfont = (PangoliteXSubfont)i; - break; - } - } - return font_info; -} - -static void -add_glyph(ThaiFontInfo *font_info, - PangoliteGlyphString *glyphs, - gint cluster_start, - PangoliteGlyph glyph, - gint combining) -{ - gint index = glyphs->num_glyphs; - - if ((cluster_start == 0) && (index != 0)) - cluster_start++; - - pangolite_glyph_string_set_size(glyphs, index + 1); - glyphs->glyphs[index].glyph = glyph; - glyphs->glyphs[index].is_cluster_start = combining; - glyphs->log_clusters[index] = cluster_start; -} - -static gint -get_adjusted_glyphs_list(ThaiFontInfo *font_info, - gunichar2 *cluster, - gint num_chrs, - PangoliteGlyph *glyph_lists, - const ThaiShapeTable *shaping_table) -{ - switch (num_chrs) { - case 1: - if (is_char_type (cluster[0], BelowVowel|BelowDiac|AboveVowel|AboveDiac|Tone)) { - if (font_info->type == THAI_FONT_TIS) - glyph_lists[0] = PANGO_MOZ_MAKE_GLYPH (0x20); - else - glyph_lists[0] = PANGO_MOZ_MAKE_GLYPH (0x7F); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - return 2; - } - else { - glyph_lists[0] = PANGO_MOZ_MAKE_GLYPH (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] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (0xED); - glyph_lists[2] = PANGO_MOZ_MAKE_GLYPH (0xD2); - return 3; - } - else if (is_char_type (cluster[0], UpTailCons) && - is_char_type (cluster[1], SaraAm)) { - glyph_lists[0] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (shiftleft_tone_ad (0xED, shaping_table)); - glyph_lists[2] = PANGO_MOZ_MAKE_GLYPH (0xD2); - return 3; - } - else if (is_char_type (cluster[0], NoTailCons|BotTailCons|SpltTailCons) && - is_char_type (cluster[1], AboveVowel)) { - glyph_lists[0] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (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] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (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] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (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] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (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] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[1])); - return 2; - } - else if (is_char_type (cluster[0], BotTailCons) && - is_char_type (cluster[1], BelowVowel|BelowDiac)) { - glyph_lists[0] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (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] = PANGO_MOZ_MAKE_GLYPH (tailcutcons (ucs2tis (cluster[0]), shaping_table)); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[1])); - return 2; - } - else { - if (font_info->type == THAI_FONT_TIS) - glyph_lists[0] = PANGO_MOZ_MAKE_GLYPH (0x20); - else - glyph_lists[0] = PANGO_MOZ_MAKE_GLYPH (0x7F); - glyph_lists[1] = - PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[2] = - PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[1])); - return 3; - } - 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] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (0xED); - glyph_lists[2] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[1])); - glyph_lists[3] = PANGO_MOZ_MAKE_GLYPH (0xD2); - 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] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (shiftleft_tone_ad (0xED, shaping_table)); - glyph_lists[2] = PANGO_MOZ_MAKE_GLYPH (shiftleft_tone_ad (ucs2tis (cluster[1]), shaping_table)); - glyph_lists[3] = PANGO_MOZ_MAKE_GLYPH (0xD2); - 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] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (shiftleft_av (ucs2tis (cluster[1]), shaping_table)); - glyph_lists[2] = PANGO_MOZ_MAKE_GLYPH (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] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[1])); - glyph_lists[2] = PANGO_MOZ_MAKE_GLYPH (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] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[1])); - glyph_lists[2] = PANGO_MOZ_MAKE_GLYPH (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] = PANGO_MOZ_MAKE_GLYPH (tailcutcons (ucs2tis (cluster[0]), shaping_table)); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[1])); - glyph_lists[2] = PANGO_MOZ_MAKE_GLYPH (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] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (shiftdown_bv_bd (ucs2tis (cluster[1]), shaping_table)); - glyph_lists[2] = PANGO_MOZ_MAKE_GLYPH (shiftdown_tone_ad (ucs2tis (cluster[2]), shaping_table)); - return 3; - } - else { - glyph_lists[0] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[0])); - glyph_lists[1] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[1])); - glyph_lists[2] = PANGO_MOZ_MAKE_GLYPH (ucs2tis (cluster[2])); - return 3; - } - break; - } - - return 0; -} - -static gint -get_glyphs_list(ThaiFontInfo *font_info, - gunichar2 *cluster, - gint num_chrs, - PangoliteGlyph *glyph_lists) -{ - PangoliteGlyph glyph; - gint xtis_index, i; - - switch (font_info->type) { - case THAI_FONT_NONE: - for (i = 0; i < num_chrs; i++) - /* Change this to remove font dependency */ - glyph_lists[i] = 0; /* pangolite_x_get_unknown_glyph(font_info->font); */ - return num_chrs; - - case THAI_FONT_XTIS: - /* If we are rendering with an XTIS font, we try to find a precomposed - * glyph for the cluster. - */ - xtis_index = 0x100 * (cluster[0] - 0xe00 + 0x20) + 0x30; - if (cluster[1]) - xtis_index +=8 * group1_map[cluster[1] - 0xe30]; - if (cluster[2]) - xtis_index += group2_map[cluster[2] - 0xe30]; - glyph = PANGO_MOZ_MAKE_GLYPH(xtis_index); - /* - if (pangolite_x_has_glyph(font_info->font, glyph)) { - glyph_lists[0] = glyph; - return 1; - } - */ - for (i=0; i < num_chrs; i++) - glyph_lists[i] = PANGO_MOZ_MAKE_GLYPH(0x100 * (cluster[i] - 0xe00 + 0x20) + 0x30); - 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); - - case THAI_FONT_ISO10646: - for (i=0; i < num_chrs; i++) - glyph_lists[i] = PANGO_MOZ_MAKE_GLYPH(cluster[i]); - return num_chrs; - } - - return 0; /* Quiet GCC */ -} - -static void -add_cluster(ThaiFontInfo *font_info, - PangoliteGlyphString *glyphs, - gint cluster_start, - gunichar2 *cluster, - gint num_chrs) - -{ - PangoliteGlyph glyphs_list[MAX_GLYPHS]; - gint i, num_glyphs, ClusterStart=0; - - num_glyphs = get_glyphs_list(font_info, cluster, num_chrs, glyphs_list); - for (i=0; itype != THAI_FONT_NONE) { - gunichar2 wc; - - for (wc = 0xe01; wc <= 0xe3a; wc++) - pangolite_coverage_set(result, wc, PANGO_COVERAGE_EXACT); - for (wc = 0xe3f; wc <= 0xe5b; wc++) - pangolite_coverage_set(result, wc, PANGO_COVERAGE_EXACT); - } - - return result; -} - -static PangoliteEngine * -thai_engine_x_new() -{ - PangoliteEngineShape *result; - - result = g_new(PangoliteEngineShape, 1); - - result->engine.id = SCRIPT_ENGINE_NAME; - result->engine.type = PANGO_ENGINE_TYPE_SHAPE; - result->engine.length = sizeof(result); - result->script_shape = thai_engine_shape; - result->get_coverage = thai_engine_get_coverage; - - return(PangoliteEngine *)result; -} - -/* The following three functions provide the public module API for - * Pangolite. If we are compiling it is a module, then we name the - * entry points script_engine_list, etc. But if we are compiling - * it for inclusion directly in Pangolite, then we need them to - * to have distinct names for this module, so we prepend - * _pangolite_thai_x_ - */ -#ifdef X_MODULE_PREFIX -#define MODULE_ENTRY(func) _pangolite_thai_x_##func -#else -#define MODULE_ENTRY(func) func -#endif - -/* List the engines contained within this module - */ -void -MODULE_ENTRY(script_engine_list)(PangoliteEngineInfo **engines, gint *n_engines) -{ - *engines = script_engines; - *n_engines = G_N_ELEMENTS(script_engines); -} - -/* Load a particular engine given the ID for the engine - */ -PangoliteEngine * -MODULE_ENTRY(script_engine_load)(const char *id) -{ - if (!strcmp(id, SCRIPT_ENGINE_NAME)) - return thai_engine_x_new(); - else - return NULL; -} - -void -MODULE_ENTRY(script_engine_unload)(PangoliteEngine *engine) -{ -} diff --git a/layout/generic/Makefile.in b/layout/generic/Makefile.in index f5b197be75e8..c6478e62c73d 100644 --- a/layout/generic/Makefile.in +++ b/layout/generic/Makefile.in @@ -82,11 +82,6 @@ ifdef ACCESSIBILITY REQUIRES += accessibility endif -# Sun's Complex Text Layout support -ifdef SUNCTL -REQUIRES += ctl -endif - EXPORTS = \ nsFrameList.h \ nsHTMLParts.h \ diff --git a/toolkit/toolkit-makefiles.sh b/toolkit/toolkit-makefiles.sh index 23f904ef3143..0a161f84bde4 100644 --- a/toolkit/toolkit-makefiles.sh +++ b/toolkit/toolkit-makefiles.sh @@ -894,17 +894,6 @@ if [ ! "$MOZ_NATIVE_LCMS" ] ; then " fi -if [ "$SUNCTL" ] ; then - add_makefiles " - intl/ctl/Makefile - intl/ctl/public/Makefile - intl/ctl/src/Makefile - intl/ctl/src/pangoLite/Makefile - intl/ctl/src/thaiShaper/Makefile - intl/ctl/src/hindiShaper/Makefile - " -fi - if [ "$MOZ_UNIVERSALCHARDET" ] ; then add_makefiles " extensions/universalchardet/Makefile