Re: A little polish of Thai shaper



On Mon, Jun 18, 2001 at 04:55:07PM -0700, Chookij Vanatham wrote:

> So, I think, seems to be we all agree to have ClearlyU font fixed for Thai.
> Then, we need to change Thai Pango Shaper to handle iso10646 for Thai
> non-spacing vowels/tonemarks as similar as others (Thai MS/MAC).

Since I don't have writing permission to the CVS, I can just _wait_
for this to happen.. :-b

I've just checked out pango today and found no change in the module.
So, may I explain my previous patch..

(You may remove the lines with ### at the beginning to get the actual
patch.)

--- thai-x.c	Fri Jun 15 03:38:23 2001
+++ thai-x.c.new	Wed Jul 18 15:40:55 2001
@@ -309,7 +309,7 @@
  */
 static const ThaiShapeTable Mac_shape_table = {
   { 0xE7, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0xED, 0xEE },
-  { 0xE7, 0x83, 0x84, 0x85, 0x86, 0x87, 0x8F, 0xEE },
+  { 0x93, 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 },
@@ -320,7 +320,7 @@
  */
 static const ThaiShapeTable Win_shape_table = {
     { 0xE7, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0xED, 0xEE },
-    { 0xE7, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x99, 0xEE },
+    { 0x9A, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x99, 0xEE },
     { 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, 0x99, 0xEE },
     { 0x98, 0x00, 0x00, 0x81, 0x82, 0x83, 0x84 },
     { 0xFC, 0xFD, 0xFE },
###
### These ones are for fixing the codes for MAI TAIKHU shifted left.
###
@@ -423,30 +423,21 @@
 
   if (combining)
     {
-      if (font_info->type == THAI_FONT_TIS ||
-	  font_info->type == THAI_FONT_TIS_MAC ||
-	  font_info->type == THAI_FONT_TIS_WIN)
-	{
-          glyphs->glyphs[index].geometry.width =
-		logical_rect.width + glyphs->glyphs[index - 1].geometry.width;
-          if (logical_rect.width > 0)
-	      glyphs->glyphs[index].geometry.x_offset = glyphs->glyphs[index - 1].geometry.width;
-          else
-	      glyphs->glyphs[index].geometry.x_offset = glyphs->glyphs[index].geometry.width;
###
### Assuming that logical_rect.width can never be negative (i.e. >= 0),
### the previous assignments are equivalent to:
###
###    glyphs->glyphs[index].geometry.width =
###        logical_rect.width + glyphs->glyphs[index - 1].geometry.width;
###    glyphs->glyphs[index].geometry.x_offset =
###        glyphs->glyphs[index - 1].geometry.width;
###
### So, the 'if' statement can be reduced.
###
-	  glyphs->glyphs[index - 1].geometry.width = 0;
-	}
-      else
-        {
-	  glyphs->glyphs[index].geometry.width =
-		MAX (logical_rect.width, glyphs->glyphs[index - 1].geometry.width);
-	  glyphs->glyphs[index - 1].geometry.width = 0;
-	  glyphs->glyphs[index].geometry.x_offset = 0;
###
### Assuming the ClearlyU font to be fixed, this 'else' block should
### behave in the same manner as that in the 'then' block.
###
-        }
+      glyphs->glyphs[index].geometry.x_offset =
+          glyphs->glyphs[index - 1].geometry.width;
+      glyphs->glyphs[index].geometry.width =
+          logical_rect.width + glyphs->glyphs[index - 1].geometry.width;
+      glyphs->glyphs[index - 1].geometry.width = 0;
###
### In summary, we get these three assignments.
###
     }
   else
     {
-      glyphs->glyphs[index].geometry.x_offset = 0;
-      glyphs->glyphs[index].geometry.width = logical_rect.width;
+      if (logical_rect.width > 0) {
+        glyphs->glyphs[index].geometry.x_offset = 0;
+        glyphs->glyphs[index].geometry.width = logical_rect.width;
+      } else {
+        glyphs->glyphs[index].geometry.x_offset = ink_rect.width + 1;
+        glyphs->glyphs[index].geometry.width = ink_rect.width + 2;
+      }
###
### This last one is quite irrelevant. It's for rendering ill-formed
### combining characters as individual cells, according to WTT 2.0.
### (The spaces of one-pixel width are added before and after the
### ink_rect to separate the glyphs' ink.)
###
     }
   
   glyphs->glyphs[index].geometry.y_offset = 0;

Regards,
-Thep.
-- 
Theppitak Karoonboonyanan
Information Research and Development Division, NECTEC
(Was: Software and Language Engineering Laboratory)
http://www.links.nectec.or.th/~thep/  mailto:theppitak nectec or th




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]