Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Enumerations | Functions | Variables
thai-x.c File Reference
#include <glib.h>
#include <string.h>
#include "pango-engine.h"
#include "pango-coverage.h"

Go to the source code of this file.

Classes

struct  _ThaiFontInfo
struct  ThaiShapeTable

Defines

#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 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"
#define PANGO_MOZ_MAKE_GLYPH(index)   ((guint32)0 | (index))
#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])
#define MODULE_ENTRY(func)   func

Typedefs

typedef guint16 PangoliteXSubfont
typedef struct _ThaiFontInfo

Enumerations

enum  ThaiFontType {
  THAI_FONT_NONE, THAI_FONT_XTIS, THAI_FONT_TIS, THAI_FONT_TIS_MAC,
  THAI_FONT_TIS_WIN, THAI_FONT_ISO10646
}

Functions

static ThaiFontInfo * get_font_info (const char *fontCharset)
static void add_glyph (ThaiFontInfo *font_info, PangoliteGlyphString *glyphs, gint cluster_start, PangoliteGlyph glyph, gint combining)
static gint get_adjusted_glyphs_list (ThaiFontInfo *font_info, gunichar2 *cluster, gint num_chrs, PangoliteGlyph *glyph_lists, const ThaiShapeTable *shaping_table)
static gint get_glyphs_list (ThaiFontInfo *font_info, gunichar2 *cluster, gint num_chrs, PangoliteGlyph *glyph_lists)
static void add_cluster (ThaiFontInfo *font_info, PangoliteGlyphString *glyphs, gint cluster_start, gunichar2 *cluster, gint num_chrs)
static gboolean is_wtt_composible (gunichar2 cur_wc, gunichar2 nxt_wc)
static const gunichar2get_next_cluster (const gunichar2 *text, gint length, gunichar2 *cluster, gint *num_chrs)
static void thai_engine_shape (const char *fontCharset, const gunichar2 *text, gint length, PangoliteAnalysis *analysis, PangoliteGlyphString *glyphs)
static PangoliteCoverage * thai_engine_get_coverage (const char *fontCharset, const char *lang)
static PangoliteEngine * thai_engine_x_new ()
void MODULE_ENTRY() script_engine_list (PangoliteEngineInfo **engines, gint *n_engines)
PangoliteEngine *MODULE_ENTRY() script_engine_load (const char *id)
void MODULE_ENTRY() script_engine_unload (PangoliteEngine *engine)

Variables

static PangoliteEngineRange thai_ranges []
static PangoliteEngineInfo script_engines []
static const char groups [32]
static const char group1_map [32]
static const char group2_map [32]
static const gint char_type_table [256]
static const gint TAC_char_class [256]
static const gchar TAC_compose_and_input_check_type_table [17][17]
static const ThaiShapeTable Mac_shape_table
static const ThaiShapeTable Win_shape_table
static const ThaiShapeTable tis620_0_shape_table

Class Documentation

struct _ThaiFontInfo

Definition at line 142 of file thai-x.c.

Class Members
PangoliteXSubfont subfont
ThaiFontType type
struct ThaiShapeTable

Definition at line 299 of file thai-x.c.

Class Members
gint ShiftDown_BV_BD
gint ShiftDown_TONE_AD
gint ShiftDownLeft_TONE_AD
gint ShiftLeft_AV
gint ShiftLeft_TONE_AD
gint TailCutCons

Define Documentation

#define _AD   (1<<7)

Definition at line 84 of file thai-x.c.

#define _AM   (1<<9)

Definition at line 86 of file thai-x.c.

#define _AV   (1<<4)

Definition at line 81 of file thai-x.c.

#define _BC   (1<<2)

Definition at line 79 of file thai-x.c.

#define _BD   (1<<8)

Definition at line 85 of file thai-x.c.

#define _BV   (1<<5)

Definition at line 82 of file thai-x.c.

#define _NC   1

Definition at line 77 of file thai-x.c.

#define _ND   0

Definition at line 76 of file thai-x.c.

#define _SC   (1<<3)

Definition at line 80 of file thai-x.c.

#define _TN   (1<<6)

Definition at line 83 of file thai-x.c.

#define _UC   (1<<1)

Definition at line 78 of file thai-x.c.

Definition at line 96 of file thai-x.c.

Definition at line 93 of file thai-x.c.

#define AD1   11

Definition at line 69 of file thai-x.c.

#define AD2   12

Definition at line 70 of file thai-x.c.

#define AD3   13

Definition at line 71 of file thai-x.c.

#define AV1   14

Definition at line 72 of file thai-x.c.

#define AV2   15

Definition at line 73 of file thai-x.c.

#define AV3   16

Definition at line 74 of file thai-x.c.

#define BD   9

Definition at line 67 of file thai-x.c.

Definition at line 97 of file thai-x.c.

Definition at line 94 of file thai-x.c.

Definition at line 90 of file thai-x.c.

#define BV1   7

Definition at line 65 of file thai-x.c.

#define BV2   8

Definition at line 66 of file thai-x.c.

#define char_class (   wc)    TAC_char_class[(unsigned int)(wc)]

Definition at line 100 of file thai-x.c.

#define CONS   2

Definition at line 60 of file thai-x.c.

Definition at line 92 of file thai-x.c.

#define CTRL   0

Definition at line 58 of file thai-x.c.

#define FV1   4

Definition at line 62 of file thai-x.c.

#define FV2   5

Definition at line 63 of file thai-x.c.

#define FV3   6

Definition at line 64 of file thai-x.c.

#define G_N_ELEMENTS (   arr)    (sizeof (arr) / sizeof ((arr)[0]))

Definition at line 48 of file thai-x.c.

Definition at line 55 of file thai-x.c.

#define is_char_type (   wc,
  mask 
)    (char_type_table[ucs2tis((wc))] & (mask))

Definition at line 101 of file thai-x.c.

#define LV   3

Definition at line 61 of file thai-x.c.

Definition at line 53 of file thai-x.c.

#define MAX_GLYPHS   256

Definition at line 54 of file thai-x.c.

#define MODULE_ENTRY (   func)    func

Definition at line 778 of file thai-x.c.

#define NON   1

Definition at line 59 of file thai-x.c.

Definition at line 88 of file thai-x.c.

#define PANGO_MOZ_MAKE_GLYPH (   index)    ((guint32)0 | (index))

Definition at line 107 of file thai-x.c.

#define PANGO_RENDER_TYPE_X   "PangoliteRenderX"

Definition at line 104 of file thai-x.c.

#define SaraAm   _AM

Definition at line 98 of file thai-x.c.

#define SCRIPT_ENGINE_NAME   "ThaiScriptEngineX"

Definition at line 103 of file thai-x.c.

#define shiftdown_bv_bd (   c,
  tbl 
)    ((tbl)->ShiftDown_BV_BD[(c)-0xD8])

Definition at line 312 of file thai-x.c.

#define shiftdown_tone_ad (   c,
  tbl 
)    ((tbl)->ShiftDown_TONE_AD[(c)-0xE7])

Definition at line 308 of file thai-x.c.

#define shiftdownleft_tone_ad (   c,
  tbl 
)    ((tbl)->ShiftDownLeft_TONE_AD[(c)-0xE7])

Definition at line 309 of file thai-x.c.

#define shiftleft_av (   c,
  tbl 
)    ((tbl)->ShiftLeft_AV[(c)-0xD1])

Definition at line 311 of file thai-x.c.

#define shiftleft_tone_ad (   c,
  tbl 
)    ((tbl)->ShiftLeft_TONE_AD[(c)-0xE7])

Definition at line 310 of file thai-x.c.

Definition at line 91 of file thai-x.c.

#define tailcutcons (   c,
  tbl 
)    ((tbl)->TailCutCons[(c)-0xAD])

Definition at line 313 of file thai-x.c.

#define tis2uni (   c)    ((gunichar2)(c) - 0xA0 + 0x0E00)

Definition at line 51 of file thai-x.c.

#define TONE   10

Definition at line 68 of file thai-x.c.

#define Tone   _TN

Definition at line 95 of file thai-x.c.

#define ucs2tis (   wc)    (unsigned int)((unsigned int)(wc) - 0x0E00 + 0xA0)

Definition at line 50 of file thai-x.c.

Definition at line 89 of file thai-x.c.


Typedef Documentation

typedef struct _ThaiFontInfo

Definition at line 129 of file thai-x.c.

typedef guint16 PangoliteXSubfont

Definition at line 106 of file thai-x.c.


Enumeration Type Documentation

Enumerator:
THAI_FONT_NONE 
THAI_FONT_XTIS 
THAI_FONT_TIS 
THAI_FONT_TIS_MAC 
THAI_FONT_TIS_WIN 
THAI_FONT_ISO10646 

Definition at line 133 of file thai-x.c.


Function Documentation

static void add_cluster ( ThaiFontInfo *  font_info,
PangoliteGlyphString *  glyphs,
gint  cluster_start,
gunichar2 cluster,
gint  num_chrs 
) [static]

Definition at line 638 of file thai-x.c.

{
  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; i<num_glyphs; i++) {
    ClusterStart = (gint)GLYPH_COMBINING;
    if (i == 0)
      ClusterStart = num_chrs;

    add_glyph(font_info, glyphs, cluster_start, glyphs_list[i], ClusterStart);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void add_glyph ( ThaiFontInfo *  font_info,
PangoliteGlyphString *  glyphs,
gint  cluster_start,
PangoliteGlyph  glyph,
gint  combining 
) [static]

Definition at line 393 of file thai-x.c.

{
  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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static gint get_adjusted_glyphs_list ( ThaiFontInfo *  font_info,
gunichar2 cluster,
gint  num_chrs,
PangoliteGlyph glyph_lists,
const ThaiShapeTable shaping_table 
) [static]

Definition at line 411 of file thai-x.c.

{
  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;
}

Here is the caller graph for this function:

static ThaiFontInfo* get_font_info ( const char *  fontCharset) [static]

Definition at line 352 of file thai-x.c.

{
  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;
}

Here is the caller graph for this function:

static gint get_glyphs_list ( ThaiFontInfo *  font_info,
gunichar2 cluster,
gint  num_chrs,
PangoliteGlyph glyph_lists 
) [static]

Definition at line 575 of file thai-x.c.

{
  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 */
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const gunichar2* get_next_cluster ( const gunichar2 text,
gint  length,
gunichar2 cluster,
gint *  num_chrs 
) [static]

Definition at line 678 of file thai-x.c.

{
  const gunichar2 *p;
  gint  n_chars = 0;
  
  p = text;
  while (p < text + length && n_chars < 3) {
    gunichar2 current = *p;
    
    if (n_chars == 0 ||
        is_wtt_composible ((gunichar2)(cluster[n_chars - 1]), current) ||
        (n_chars == 1 &&
         is_char_type (cluster[0], Cons) &&
         is_char_type (current, SaraAm)) ||
        (n_chars == 2 &&
         is_char_type (cluster[0], Cons) &&
         is_char_type (cluster[1], Tone) &&
         is_char_type (current, SaraAm))) {
      cluster[n_chars++] = current;
  p++;
    }
    else
      break;
  }
  
  *num_chrs = n_chars;
  return p;
} 

Here is the call graph for this function:

Here is the caller graph for this function:

static gboolean is_wtt_composible ( gunichar2  cur_wc,
gunichar2  nxt_wc 
) [static]

Definition at line 659 of file thai-x.c.

{
  switch (TAC_compose_and_input_check_type_table[char_class(ucs2tis(cur_wc))]
          [char_class(ucs2tis(nxt_wc))]) {
  case 'A':
  case 'S':
  case 'R':
  case 'X':
    return FALSE;
    
  case 'C':
    return TRUE;
  }
  
  g_assert_not_reached();
  return FALSE;
}

Here is the caller graph for this function:

void MODULE_ENTRY() script_engine_list ( PangoliteEngineInfo **  engines,
gint *  n_engines 
)

Definition at line 784 of file thai-x.c.

{
  *engines = script_engines;
  *n_engines = G_N_ELEMENTS(script_engines);
}
PangoliteEngine* MODULE_ENTRY() script_engine_load ( const char *  id)

Definition at line 793 of file thai-x.c.

{
  if (!strcmp(id, SCRIPT_ENGINE_NAME))
    return thai_engine_x_new();
  else
    return NULL;
}

Here is the call graph for this function:

void MODULE_ENTRY() script_engine_unload ( PangoliteEngine *  engine)

Definition at line 802 of file thai-x.c.

{
}
static PangoliteCoverage* thai_engine_get_coverage ( const char *  fontCharset,
const char *  lang 
) [static]

Definition at line 734 of file thai-x.c.

{
  PangoliteCoverage *result = pangolite_coverage_new();  
  ThaiFontInfo *font_info = get_font_info(fontCharset);
  
  if (font_info->type != 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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void thai_engine_shape ( const char *  fontCharset,
const gunichar2 text,
gint  length,
PangoliteAnalysis *  analysis,
PangoliteGlyphString *  glyphs 
) [static]

Definition at line 711 of file thai-x.c.

{
  ThaiFontInfo   *font_info;
  const gunichar2 *p;
  const gunichar2 *log_cluster;
  gunichar2       cluster[MAX_CLUSTER_CHRS];
  gint           num_chrs;

  font_info = get_font_info(fontCharset);

  p = text;
  while (p < text + length) {
    log_cluster = p;
    p = get_next_cluster(p, text + length - p, cluster, &num_chrs);
    add_cluster(font_info, glyphs, log_cluster - text, cluster, num_chrs);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PangoliteEngine* thai_engine_x_new ( ) [static]

Definition at line 753 of file thai-x.c.

{
  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;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const gint char_type_table[256] [static]

Definition at line 183 of file thai-x.c.

const char group1_map[32] [static]
Initial value:
 {
  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
}

Definition at line 166 of file thai-x.c.

const char group2_map[32] [static]
Initial value:
 {
  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
}

Definition at line 176 of file thai-x.c.

const char groups[32] [static]
Initial value:
 {
  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
}

Definition at line 156 of file thai-x.c.

Initial value:
 {
  { 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 }
}

Definition at line 317 of file thai-x.c.

PangoliteEngineInfo script_engines[] [static]
Initial value:

Definition at line 115 of file thai-x.c.

const gint TAC_char_class[256] [static]

Definition at line 222 of file thai-x.c.

Definition at line 260 of file thai-x.c.

PangoliteEngineRange thai_ranges[] [static]
Initial value:
 {
  { 0x0e01, 0x0e5b, "*" },  
}

Definition at line 111 of file thai-x.c.

Initial value:
 {
  { 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 }
}

Definition at line 339 of file thai-x.c.

Initial value:
 {
    { 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 }
}

Definition at line 328 of file thai-x.c.