Closed Bug 84394 Opened 24 years ago Closed 23 years ago

Need a hook to the Thai shaper for rendering thai

Categories

(Core :: Internationalization, defect)

Sun
Solaris
defect
Not set
normal

Tracking

()

VERIFIED FIXED
Future

People

(Reporter: prabhat.hegde, Assigned: roland.mainz)

References

(Blocks 1 open bug)

Details

(Keywords: intl)

Thai web-pages are not rendered properly on *nix platforms in mozilla. This is
because gfx does not perform contect sensitive shaping before rendering.

A hook in one of gfx or nsIUnicodeEncoder is needed to to the same:

Diffs to perform shaping via gfx is as below. However, as per frank's 
suggestion a better (and proper i believe) way is to do it using
nsIUnicodeEncoder and nsCharRepresentible. 

I am working on it now.

For the record, diffs to enable shaping using gfx is as below.

===================================================================
RCS file: /cvsroot/mozilla/gfx/src/gtk/Makefile.in,v
retrieving revision 1.50
diff -u -r1.50 Makefile.in
--- gfx/src/gtk/Makefile.in 2001/05/26 20:01:41 1.50
+++ gfx/src/gtk/Makefile.in 2001/06/06 22:50:51
@@ -32,6 +32,10 @@
 IS_COMPONENT   = 1
 REQUIRES   = xpcom string img widget view util dom pref js uconv necko unichar
util gfx2 mozcomps windowwatcher locale intl
 
+ifdef SUNCTL
+REQUIRES += ctl
+endif
+
 CSRCS      = nsPrintdGTK.c
 
 ifdef HAVE_XIE
@@ -110,6 +114,10 @@
 
 ifdef MOZ_ENABLE_XPRINT
 DEFINES        += -DUSE_XPRINT
+endif
+
+ifdef SUNCTL
+DEFINES += -DSUNCTL
 endif
 
 INCLUDES   += \
Index: gfx/src/gtk/nsFontMetricsGTK.cpp
===================================================================
RCS file: /cvsroot/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp,v
retrieving revision 1.144
diff -u -r1.144 nsFontMetricsGTK.cpp
--- gfx/src/gtk/nsFontMetricsGTK.cpp    2001/05/23 05:18:58 1.144
+++ gfx/src/gtk/nsFontMetricsGTK.cpp    2001/06/06 22:50:51
@@ -41,6 +41,11 @@
 
 #include <X11/Xatom.h>
 
+#ifdef SUNCTL
+#include "nsCtlCIID.h"
+#include "nsILE.h"
+#endif
+
 #define UCS2_NOMAPPING 0XFFFD
 
 #undef USER_DEFINED
@@ -166,6 +171,21 @@
   nsFontStretch* mStretches[9];
 };
 
+#ifdef SUNCTL
+struct textRun {
+  PRInt32         length; /* Length of a chunk */  
+  PRBool          isOther; /* Outside the range */
+  const PRUnichar *start; /* Address of start offset */
+  struct textRun  *next;
+};
+
+typedef struct {
+  struct textRun *head;
+  struct textRun *cur;
+  PRInt32        numRuns;
+} textRunList;
+#endif
+
 static NS_DEFINE_CID(kCharSetManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
 static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
 static NS_DEFINE_CID(kSaveAsCharsetCID, NS_SAVEASCHARSET_CID);
@@ -203,6 +223,15 @@
 static gint ISO10646Convert(nsFontCharSetInfo* aSelf, XFontStruct* aFont,
   const PRUnichar* aSrcBuf, PRInt32 aSrcLen, char* aDestBuf, PRInt32 aDestLen);
 
+#ifdef SUNCTL
+// beg and end denote ranges and may need to be expanded in the future to
+// handle discontinous ranges
+static gint Itemize(PRInt32 beg, PRInt32 end, const PRUnichar* aSrcBuf, 
+                    PRInt32 aSrcLen, textRunList *aRunList);
+static gint TISConvert(nsFontCharSetInfo* aSelf, XFontStruct* aFont,
+  const PRUnichar* aSrcBuf, PRInt32 aSrcLen, char* aDestBuf, PRInt32 aDestLen);
+#endif
+
 static nsFontCharSetInfo Unknown = { nsnull };
 static nsFontCharSetInfo Special = { nsnull };
 
@@ -239,8 +268,13 @@
   { "KOI8-R", SingleByteConvert, 0 };
 static nsFontCharSetInfo KOI8U =
   { "KOI8-U", SingleByteConvert, 0 };
+#ifdef SUNCTL
+static nsFontCharSetInfo TIS6200 =
+  { "TIS-620", TISConvert, 0 };
+#else
 static nsFontCharSetInfo TIS620 =
   { "TIS-620", SingleByteConvert, 0 };
+#endif
 
 static nsFontCharSetInfo Big5 =
   { "x-x-big5", DoubleByteConvert, 1 };
@@ -453,11 +487,19 @@
   { "sun-fontspecific",   &FLG_NONE,    &Unknown       },
   { "sunolcursor-1",      &FLG_NONE,    &Unknown       },
   { "sunolglyph-1",       &FLG_NONE,    &Unknown       },
+#ifdef SUNCTL
+  { "tis620.2529-1",      &FLG_NONE,    &TIS6200       },
+  { "tis620.2533-0",      &FLG_NONE,    &TIS6200       },
+  { "tis620-0",           &FLG_NONE,    &TIS6200       },
+  { "iso8859-11",         &FLG_NONE,    &TIS6200       },
+  { "tis620.2533-1",      &FLG_NONE,    &TIS6200       },
+#else
   { "tis620.2529-1",      &FLG_NONE,    &TIS620        },
   { "tis620.2533-0",      &FLG_NONE,    &TIS620        },
   { "tis620.2533-1",      &FLG_NONE,    &TIS620        },
   { "tis620-0",           &FLG_NONE,    &TIS620        },
   { "iso8859-11",         &FLG_NONE,    &TIS620        },
+#endif
   { "ucs2.cjk-0",         &FLG_NONE,    &Unknown       },
   { "ucs2.cjk_japan-0",   &FLG_NONE,    &Unknown       },
   { "ucs2.cjk_taiwan-0",  &FLG_NONE,    &Unknown       },
@@ -1507,6 +1549,124 @@
 
   return (gint) aSrcLen * 2;
 }
+
+#ifdef SUNCTL
+static gint 
+Itemize(PRUnichar beg,  PRUnichar end, const PRUnichar* aSrcBuf, 
+        PRInt32 aSrcLen, textRunList *aRunList) 
+{
+  gint           ct = 0, start = 0;
+  PRBool         isTis = False;
+  struct textRun *tmpChunk;
+
+  for (ct = 0; ct < aSrcLen;) {
+    tmpChunk = new textRun;
+
+    if (aRunList->numRuns == 0)
+      aRunList->head = tmpChunk;
+    else
+      aRunList->cur->next = tmpChunk;
+    aRunList->cur = tmpChunk;
+    aRunList->numRuns++;
+    
+    tmpChunk->start = &aSrcBuf[ct];
+    start = ct;
+    isTis = (aSrcBuf[ct] >= beg && aSrcBuf[ct] <= end);
+
+    if (isTis) {
+      while (isTis && ct < aSrcLen) {
+        isTis = (aSrcBuf[ct] >= beg && aSrcBuf[ct] <= end);
+        if (isTis)
+          ct++;
+      }
+      tmpChunk->isOther = False;
+    }
+    else {
+      while (!isTis && ct < aSrcLen) {
+        isTis = (aSrcBuf[ct] >= beg && aSrcBuf[ct] <= end);
+        if (!isTis)
+          ct++;
+      }
+      tmpChunk->isOther = True;
+    }
+    
+    tmpChunk->length = ct - start;
+  }
+  return (gint)aRunList->numRuns;
+}
+
+static gint
+TISConvert(nsFontCharSetInfo* aSelf, XFontStruct* aFont,
+           const PRUnichar* aSrcBuf, PRInt32 aSrcLen, 
+           char* aDestBuf, PRInt32 aDestLen)
+{
+  nsCOMPtr<nsILE> mCtlObj;
+  static          NS_DEFINE_CID(kLECID, NS_ULE_CID);
+  nsresult        rv;
+  textRunList     txtRuns;
+  PRInt32         numConsumed = 0;
+  textRun         *aPtr, *aTmpPtr;
+
+  mCtlObj = do_CreateInstance(kLECID, &rv);
+  if (NS_FAILED(rv)) {
+    printf("ERROR: Cannot create instance of component " NS_ULE_PROGID "
[%x].\n",
 
+           rv);
+    printf("Thai Text Layout Will Not Be Supported\n");
+  }
+
+  txtRuns.numRuns = 0;
+  PRUnichar startThai = 3585; // 0x0e01;
+  PRUnichar endThai = 3675; // 0x0e5b;
+  
+  Itemize(startThai, endThai, aSrcBuf, aSrcLen, &txtRuns);
+
+  numConsumed = 0;
+  
+  aPtr = txtRuns.head;
+  for (int i = 0; i < txtRuns.numRuns; i++) {   
+    char            *tmpDestBuf = aDestBuf + numConsumed;
+    PRInt32         tmpDestLen = aDestLen - numConsumed;
+    PRInt32         tmpSrcLen = aPtr->length;
+    
+    if (aPtr->isOther) {
+      // Pass it to SingleByteConvert as PangoShaper does not handle it
+      if (aSelf->mConverter) {
+        aSelf->mConverter->Convert(aPtr->start, &tmpSrcLen, tmpDestBuf, 
+                                   &tmpDestLen);
+        numConsumed += tmpDestLen;
+      }
+    }
+    else { 
+      PRUint32 outBuf[512]; // SIZE > 512 will screw us up
+      PRSize   outLen = 512;
+      // Charset tis620-0, tis620.2533-1, tis620.2529-1 & iso8859-11
+      // are equivalent and have the same presentation forms
+      mCtlObj->GetPresentationForm(aPtr->start, tmpSrcLen, "tis620-2",
+                                   &outBuf[0], &outLen);
+      XChar2b* dest = (XChar2b*)tmpDestBuf;
+      for (int j = 0; j < outLen; j++) {
+        dest[j].byte1 = (outBuf[j] & 0x0000FFFF) >> 8;
+        dest[j].byte2 = outBuf[j] & 0xFF;
+      }
+      numConsumed += (outLen * 2);
+    }
+    aPtr = aPtr->next;
+  }
+  
+  // Check for free nsILE or convert nsILE to a service
+  // NS_IF_RELEASE(mCtlObj);
+
+  // Cleanup Run Info;
+  aPtr = txtRuns.head;
+  for (int i = 0; i < txtRuns.numRuns; i++) {
+    aTmpPtr = aPtr;
+    aPtr = aPtr->next;
+    delete aTmpPtr;
+  }
+      
+  return (gint)numConsumed;
+}
+#endif
 
 #ifdef DEBUG
Blocks: thai
Blocks: 79284
Reassign to ftang, cc to bstell.
Assignee: nhotta → ftang
Keywords: intl
Additional info regarding the hook that you may already know:

A> Once enabled, this hook is not expected to affect thai rendering on 
   non unix platforms.
B> The change is quite isolated and not expected to regress/affect
   rendering of charsets other than thai.
C> Expected footprint of component is ~35k.
mark it assign and mark moz1.0.
Prabhat. I do not agree with your propose change in gfx. I believe you don't need 
to add that many code in gfx. You should use nsIUnicodeEncoder as other fonts and 
push what you need to do into that implementation instead put in gfx. 
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.0
hi frank,

Agreed - the above change was just for record as in proposal. The change will 
be as below (I am testing out the official patch that i will attach, but i
need help with the following before i do that):

location: Currently, its at uconv/ucvth, is this OK.
hooks   : Location of other registries besides connecting the new encoder
          in nsFontMetrics.cpp.


/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * ucvth : nsUnicodeToTIS620.h
 *
 * 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 SUN are Copyright (C) 2000 SUN
 * Microsystems, Inc. All Rights Reserved.
 *
 * This module ucvth is based on the Thai Shaper in Pango by
 * Red Hat Software. Portions created by Redhat are Copyright (C) 
 * 1999 Red Hat Software.
 * 
 * Contributor(s): 
 */

#include "nsUnicodeToTIS620.h"

// XPCOM stuff
NS_IMPL_ADDREF(nsUnicodeToTIS620);
NS_IMPL_RELEASE(nsUnicodeToTIS620);

static gint 
Itemize(const PRUnichar* aSrcBuf, PRInt32 aSrcLen, textRunList *aRunList) 
{
  gint           ct = 0, start = 0;
  PRBool         isTis = False;
  struct textRun *tmpChunk;

  // Handle Simple Case Now : Multiple Ranges later
  PRUnichar thaiBeg = 3585; // U+0x0E01;
  PRUnichar thaiEnd = 3675; // U+0x0E5b

  for (ct = 0; ct < aSrcLen;) {
    tmpChunk = new textRun;

    if (aRunList->numRuns == 0)
      aRunList->head = tmpChunk;
    else
      aRunList->cur->next = tmpChunk;
    aRunList->cur = tmpChunk;
    aRunList->numRuns++;
    
    tmpChunk->start = &aSrcBuf[ct];
    start = ct;
    isTis = (aSrcBuf[ct] >= thaiBeg && aSrcBuf[ct] <= thaiEnd);

    if (isTis) {
      while (isTis && ct < aSrcLen) {
        isTis = (aSrcBuf[ct] >= thaiBeg && aSrcBuf[ct] <= thaiEnd);
        if (isTis)
          ct++;
      }
      tmpChunk->isOther = False;
    }
    else {
      while (!isTis && ct < aSrcLen) {
        isTis = (aSrcBuf[ct] >= thaiBeg && aSrcBuf[ct] <= thaiEnd);
        if (!isTis)
          ct++;
      }
      tmpChunk->isOther = True;
    }
    
    tmpChunk->length = ct - start;
  }
  return (gint)aRunList->numRuns;
}

nsresult nsUnicodeToTIS620::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
  if (NULL == aInstancePtr) {
    return NS_ERROR_NULL_POINTER;
  }

  *aInstancePtr = NULL;
  
  static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);

  if (aIID.Equals(NS_GET_IID(nsIUnicodeEncoder))) {
    *aInstancePtr = (void*) ((nsIUnicodeEncoder*)this);
    NS_ADDREF_THIS();
    return NS_OK;
  }

  if (aIID.Equals(NS_GET_IID(nsICharRepresentable))) {
    *aInstancePtr = (void*) ((nsICharRepresentable*)this);
    NS_ADDREF_THIS();
    return NS_OK;
  }

  if (aIID.Equals(kISupportsIID)) {
    *aInstancePtr = (void*) ((nsISupports*)((nsIUnicodeEncoder*)this));
    NS_ADDREF_THIS();
    return NS_OK;
  }

  return NS_NOINTERFACE;
}

NS_IMETHODIMP nsUnicodeToTIS620::SetOutputErrorBehavior(PRInt32 aBehavior,
                                                        nsIUnicharEncoder *
aEncoder, 
                                                        PRUnichar aChar)
{
  return NS_ERROR_NOT_IMPLEMENTED;
}

// constructor and destroctor

nsUnicodeToTIS620::nsUnicodeToTIS620()
{
  NS_INIT_REFCNT();
}

nsUnicodeToTIS620::~nsUnicodeToTIS620()
{
}

/*
 * 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)
{
  int             i = 0;
  nsCOMPtr<nsILE> mCtlObj;
  static          NS_DEFINE_CID(kLECID, NS_ULE_CID);
  nsresult        rv;
  textRunList     txtRuns;
  textRun         *aPtr, *aTmpPtr;

  // No question of starting the conversion from an offset
  charOff = byteOff = 0;

  mCtlObj = do_CreateInstance(kLECID, &rv);
  if (NS_FAILED(rv)) {
    printf("ERROR: Cannot create instance of component " NS_ULE_PROGID "
[%x].\n", 
           rv);
    printf("Thai Text Layout Will Not Be Supported\n");
  }

  txtRuns.numRuns = 0;  
  Itemize(input, aSrcLength, &txtRuns);

  aPtr = txtRuns.head;
  for (i = 0; i < txtRuns.numRuns; i++) {   
    char    *tmpDestBuf = output + byteOff;
    PRInt32 tmpDestLen = *aDestLength - byteOff;
    PRInt32 tmpSrcLen = aPtr->length;
    
    if (aPtr->isOther) {
      // PangoThaiShaper does not handle ASCII + thai in same shaper
      for (i = 0; i < tmpSrcLen; i++)
        output[i + byteOff] = (char)input[aPtr->start + i];
      byteOff += tmpSrcLen;
    }
    else {
      PRSize outLen = *aDestLength;
      // 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(aPtr->start, tmpSrcLen, "tis620-2",
                                   output, &outLen);
      byteOff += outLen;
    }
    aPtr = aPtr->next;
  }
  
  // Check for free nsILE or convert nsILE to a service
  // NS_IF_RELEASE(mCtlObj);

  // Cleanup Run Info;
  aPtr = txtRuns.head;
  for (int i = 0; i < txtRuns.numRuns; i++) {
    aTmpPtr = aPtr;
    aPtr = aPtr->next;
    delete aTmpPtr;
  }

  *aDestLength = byteOff;
  return NS_OK;
}

NS_IMETHODIMP nsUnicodeToTIS620::Finish(char * output, PRInt32 * aDestLength)
{
  byteOff = 0;
  PRInt32 len = 0;

  if ( state != START ) {
    /* Thai Shape */
    len = byteOff;
  }
  
  byteOff = charOff = 0;
  *aDestLength = len;

  return NS_OK;
}

//================================================================
NS_IMETHODIMP nsUnicodeToTIS620::Reset()
{
  byteOff = charOff = 0;
  state = START;
  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(info, i);

  // U+0E5C - U+0E7F Undefined
  return NS_OK;
}
Changing QA contact to katakai@japan.sun.com for now.
QA Contact: andreasb → katakai
frank, brian

As suggested, i've attached the nsIUnicodeEncoder based implementation of
thai shaping. Please let me know how to hook it up (some of the files
that i think need changing say that their use is depreciated, for ex

charsetalias.properties
unixcharset.properties

What i would like to do is :

A> Associate nsUnicodeToTIS620.cpp encoder with thai charset tis620.
B> Create a new entry TIS6200 in gfx/gtk/nsFontMetricsGTK.cpp as
   below :

   static nsFontCharSetInfo TIS6200 =
    { "tis620", SingleByteConvert, 0 };

   Associate font-charsets, tis620.2533-0 and tis620-0 with the new
   encoder.

   #ifdef SUNCTL
   { "tis620.2533-0",      &FLG_NONE,    &TIS6200   },
   { "tis620-0",       &FLG_NONE,    &TIS6200       },
   #else
   { "tis620.2533-0",      &FLG_NONE,    &TIS620    },
   { "tis620-0",       &FLG_NONE,    &TIS620        },
   #endif

   means essentially 6 line change in gfx.

C> Enable using both converter and gfx changes using --enable-ctl.

Please advise/correct as fit.

prabhat
1. I think you unicode encoder should be put into extensions/ctl. the 
nsIUnicodeEncoder should be the only public interface in extensions/ctl for now. 
If you put your converter into intl/uconv/ucvth then you need to publish other 
interface in extensions/ctl which is the thing we don't want to see for now. 
Put that encoder into extensions/ctl and hide your current public interface as 
private untill we really need it.
2. There are already a unicode encoder use the name "TIS-620" in the build. You 
probably should use "tis620.2533-0" instead. 
hi frank,

Diffs to enable Thai shaping follows. As you can see code is meant to 
switch to CP874 (original converter for thai) in-case shaper is not
present.

Please review the change and let me know. 

thanks,
prabhat.


Index: gfx/src/gtk/nsFontMetricsGTK.cpp
===================================================================
RCS file: /cvsroot/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp,v
retrieving revision 1.162
diff -c -r1.162 nsFontMetricsGTK.cpp
*** gfx/src/gtk/nsFontMetricsGTK.cpp    2001/07/25 01:05:17 1.162
--- gfx/src/gtk/nsFontMetricsGTK.cpp    2001/08/05 04:06:52
***************
*** 230,235 ****
--- 230,237 ----

  static gint SingleByteConvert(nsFontCharSetInfo* aSelf, XFontStruct* aFont,
    const PRUnichar* aSrcBuf, PRInt32 aSrcLen, char* aDestBuf, PRInt32 aDestLen)
;
+ static gint TISConvert(nsFontCharSetInfo* aSelf, XFontStruct* aFont,
+   const PRUnichar* aSrcBuf, PRInt32 aSrcLen, char* aDestBuf, PRInt32 aDestLen)
;
  static gint DoubleByteConvert(nsFontCharSetInfo* aSelf, XFontStruct* aFont,
    const PRUnichar* aSrcBuf, PRInt32 aSrcLen, char* aDestBuf, PRInt32 aDestLen)
;
  static gint ISO10646Convert(nsFontCharSetInfo* aSelf, XFontStruct* aFont,
***************
*** 272,278 ****
  static nsFontCharSetInfo KOI8U =
    { "KOI8-U", SingleByteConvert, 0 };
  static nsFontCharSetInfo TIS620 =
!   { "TIS-620", SingleByteConvert, 0 };

  static nsFontCharSetInfo Big5 =
    { "x-x-big5", DoubleByteConvert, 1 };
--- 274,280 ----
  static nsFontCharSetInfo KOI8U =
    { "KOI8-U", SingleByteConvert, 0 };
  static nsFontCharSetInfo TIS620 =
!   { "TIS-620", TISConvert, 0 };

  static nsFontCharSetInfo Big5 =
    { "x-x-big5", DoubleByteConvert, 1 };
***************
*** 1531,1536 ****
--- 1533,1560 ----
  count = aDestLen;
    }

+   return count;
+ }
+
+ static gint
+ TISConvert(nsFontCharSetInfo* aSelf, XFontStruct* aFont,
+   const PRUnichar* aSrcBuf, PRInt32 aSrcLen, char* aDestBuf, PRInt32 aDestLen)
+ {
+   gint count = 0;
+   nsresult res;
+
+   nsCOMPtr<nsIAtom> charset = getter_AddRefs(NS_NewAtom("tis620-2"));
+   if (charset) {
+ nsIUnicodeEncoder* tisShaper = nsnull;
+ res = gCharSetManager->GetUnicodeEncoder(charset, &tisShaper);
+ if (NS_SUCCEEDED(res)) { // Have implementation for a shaper
+   // Replace Converter with tis620-2 shaper
+   aSelf->mConverter = tisShaper;
+ }
+   }
+
+   // Default converter for thai is CP874
+   count = SingleByteConvert(aSelf, aFont, aSrcBuf, aSrcLen, aDestBuf, aDestLen
);
    return count;
  }

I think we should do a simple change in gtk:
 static nsFontCharSetInfo KOI8U =
    { "KOI8-U", SingleByteConvert, 0 };
  static nsFontCharSetInfo TIS620 =
!   { "TIS-620", SingleByteConvert, 0 };

  static nsFontCharSetInfo Big5 =
    { "x-x-big5", DoubleByteConvert, 1 };
--- 274,280 ----
  static nsFontCharSetInfo KOI8U =
    { "KOI8-U", SingleByteConvert, 0 };
  static nsFontCharSetInfo TIS620 =
!   { "tis-620-2", SingleByteConvert, 0 };

  static nsFontCharSetInfo Big5 =
    { "x-x-big5", DoubleByteConvert, 1 };

In the case the "tis-620-2" converter is not presented, we should not support
Thai. We don't want to end up to have two different version of Thai support. 

frank, new diff file follows below - as you noted, a single line change:

Index: gfx/src/gtk/nsFontMetricsGTK.cpp
===================================================================
RCS file: /cvsroot/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp,v
retrieving revision 1.171
diff -u -r1.171 nsFontMetricsGTK.cpp
--- gfx/src/gtk/nsFontMetricsGTK.cpp    2001/09/06 14:22:08 1.171
+++ gfx/src/gtk/nsFontMetricsGTK.cpp    2001/09/17 20:31:50
@@ -276,9 +276,11 @@
   { "KOI8-R", SingleByteConvert, 0 };
 static nsFontCharSetInfo KOI8U =
   { "KOI8-U", SingleByteConvert, 0 };
+// prabhath - Change From
+// { "TIS-620", SingleByteConvert, 0 };
+// To support context sensitive shaping
 static nsFontCharSetInfo TIS620 =
-  { "TIS-620", SingleByteConvert, 0 };
-
+  { "tis620-2", SingleByteConvert, 0 };
 static nsFontCharSetInfo Big5 =
   { "x-x-big5", DoubleByteConvert, 1 };
 static nsFontCharSetInfo CNS116431 =

Could you please review and let me know who to approach for sr=? thanks.
prabhat.
prabhat- please follow mozilla rule to submit patch.
Keywords: mozilla1.0
push off the list . Future it.
Target Milestone: mozilla1.0 → Future
Thanks to Roland Mainz this fix has been putback into trunk as part of #84380.
pradhat:
Can we CLOSE this bug ?
I think this can be closed.
prabhat.
Stealing from ftang for closing this bug... :-)
Assignee: ftang → Roland.Mainz
Status: ASSIGNED → NEW
Closing per comment 15, this bug has been fixed as part of bug 84380.

Marking bug as FIXED.

prabhat/katakai, can you verify, please ?
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
hi roland,

Rendering is fixed, verified by myself, arthit, katakai-san.
Marking VERIFIED per comment #18.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.