Back to index

texmacs  1.0.7.15
Defines | Typedefs | Functions
tt_gsub.h File Reference
#include "sfnt.h"
#include "otl_opt.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define OTL_GSUB_TYPE_SINGLE   1
#define OTL_GSUB_TYPE_MULTIPLE   2
#define OTL_GSUB_TYPE_ALTERNATE   3
#define OTL_GSUB_TYPE_LIGATURE   4
#define OTL_GSUB_TYPE_CONTEXT   5
#define OTL_GSUB_TYPE_CCONTEXT   6
#define OTL_GSUB_TYPE_ESUBST   7

Typedefs

typedef struct otl_gsub

Functions

void otl_gsub_set_verbose (void)
otl_gsubotl_gsub_new (void)
void otl_gsub_release (otl_gsub *gsub_list)
int otl_gsub_select (otl_gsub *gsub_list, const char *script, const char *language, const char *feature)
int otl_gsub_add_feat (otl_gsub *gsub_list, const char *script, const char *language, const char *feature, sfnt *sfont)
int otl_gsub_apply (otl_gsub *gsub_list, USHORT *gid)
int otl_gsub_apply_alt (otl_gsub *gsub_list, USHORT alt_idx, USHORT *gid)
int otl_gsub_apply_lig (otl_gsub *gsub_list, USHORT *gid_in, USHORT num_gids, USHORT *gid_out)

Define Documentation

#define OTL_GSUB_TYPE_ALTERNATE   3

Definition at line 36 of file tt_gsub.h.

#define OTL_GSUB_TYPE_CCONTEXT   6

Definition at line 39 of file tt_gsub.h.

#define OTL_GSUB_TYPE_CONTEXT   5

Definition at line 38 of file tt_gsub.h.

#define OTL_GSUB_TYPE_ESUBST   7

Definition at line 40 of file tt_gsub.h.

#define OTL_GSUB_TYPE_LIGATURE   4

Definition at line 37 of file tt_gsub.h.

#define OTL_GSUB_TYPE_MULTIPLE   2

Definition at line 35 of file tt_gsub.h.

#define OTL_GSUB_TYPE_SINGLE   1

Definition at line 34 of file tt_gsub.h.


Typedef Documentation

typedef struct otl_gsub

Definition at line 31 of file tt_gsub.h.


Function Documentation

int otl_gsub_add_feat ( otl_gsub gsub_list,
const char *  script,
const char *  language,
const char *  feature,
sfnt sfont 
)

Definition at line 1290 of file tt_gsub.c.

{
  int    retval = -1;
  int    i;
  struct otl_gsub_tab *gsub;

  if (gsub_list->num_gsubs > GSUB_LIST_MAX) {
    ERROR("Too many GSUB features...");
    return -1;
  }
  for (i = 0; i < gsub_list->num_gsubs; i++) {
    gsub = &(gsub_list->gsubs[i]);
    if (!strcmp(script,   gsub->script)   &&
        !strcmp(language, gsub->language) &&
        !strcmp(feature,  gsub->feature)) {
      gsub_list->select = i;
      return 0;
    }
  }
  gsub = &gsub_list->gsubs[i];

  gsub->script   = NEW(strlen(script)  +1, char);
  strcpy(gsub->script,   script);
  gsub->language = NEW(strlen(language)+1, char);
  strcpy(gsub->language, language);
  gsub->feature  = NEW(strlen(feature) +1, char);
  strcpy(gsub->feature,  feature);

  if(verbose > VERBOSE_LEVEL_MIN) {
    MESG("\n");
    MESG("otl_gsub>> Reading \"%s.%s.%s\"...\n", script, language, feature);
  }

  retval = otl_gsub_read_feat(gsub, sfont);
  if (retval >= 0) {
    gsub_list->select = i;
    gsub_list->num_gsubs++;
  } else {
    if(verbose > VERBOSE_LEVEL_MIN) {
      MESG("otl_gsub>> Failed\n");
    }
    RELEASE(gsub->script);
    RELEASE(gsub->language);
    RELEASE(gsub->feature);
  }
  
  return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int otl_gsub_apply ( otl_gsub gsub_list,
USHORT gid 
)

Definition at line 1387 of file tt_gsub.c.

{
  int    retval = -1;
  struct otl_gsub_tab    *gsub;
  struct otl_gsub_subtab *subtab;
  int    i, j;

  if (!gsub_list || !gid)
    return retval;

  i = gsub_list->select;
  if (i < 0 || i >= gsub_list->num_gsubs) {
    ERROR("GSUB not selected...");
    return -1;
  }
  gsub = &(gsub_list->gsubs[i]);

  for (j = 0;
       retval < 0 && j < gsub->num_subtables; j++) {
    subtab = &(gsub->subtables[j]);
    switch ((int) subtab->LookupType){
    case OTL_GSUB_TYPE_SINGLE:
      retval = otl_gsub_apply_single(subtab, gid);
      break;
    default:
      break;
    }
  }

  return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int otl_gsub_apply_alt ( otl_gsub gsub_list,
USHORT  alt_idx,
USHORT gid 
)

Definition at line 1420 of file tt_gsub.c.

{
  int    retval = -1;
  struct otl_gsub_tab    *gsub;
  struct otl_gsub_subtab *subtab;
  int    i, j;

  if (!gsub_list || !gid)
    return retval;

  i = gsub_list->select;
  if (i < 0 || i >= gsub_list->num_gsubs) {
    ERROR("GSUB not selected...");
    return -1;
  }
  gsub = &(gsub_list->gsubs[i]);

  for (j = 0;
       retval < 0 && j < gsub->num_subtables; j++) {
    subtab = &(gsub->subtables[j]);
    switch ((int) subtab->LookupType){
    case OTL_GSUB_TYPE_ALTERNATE:
      retval = otl_gsub_apply_alternate(subtab, alt_idx, gid);
      break;
    default:
      break;
    }
  }

  return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int otl_gsub_apply_lig ( otl_gsub gsub_list,
USHORT gid_in,
USHORT  num_gids,
USHORT gid_out 
)

Definition at line 1453 of file tt_gsub.c.

{
  int    retval = -1;
  struct otl_gsub_tab    *gsub;
  struct otl_gsub_subtab *subtab;
  int    i, j;

  if (!gsub_list || !gid_out)
    return retval;

  i = gsub_list->select;
  if (i < 0 || i >= gsub_list->num_gsubs) {
    ERROR("GSUB not selected...");
    return -1;
  }
  gsub = &(gsub_list->gsubs[i]);

  for (j = 0;
       retval < 0 && j < gsub->num_subtables; j++) {
    subtab = &(gsub->subtables[j]);
    switch ((int) subtab->LookupType){
    case OTL_GSUB_TYPE_LIGATURE:
      retval = otl_gsub_apply_ligature(subtab,
                                       gid_in, num_gids, gid_out);
      break;
    default:
      break;
    }
  }

  return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

otl_gsub* otl_gsub_new ( void  )

Definition at line 1278 of file tt_gsub.c.

{
  struct otl_gsub *gsub_list;

  gsub_list = NEW(1, struct otl_gsub);
  gsub_list->num_gsubs = 0;
  gsub_list->select    = -1;

  return (otl_gsub *) gsub_list;
}

Here is the caller graph for this function:

void otl_gsub_release ( otl_gsub gsub_list)

Definition at line 1344 of file tt_gsub.c.

{
  struct otl_gsub_tab    *gsub;
  struct otl_gsub_subtab *subtab;
  int    i, j;

  if (!gsub_list)
    return;

  for (i = 0; i < gsub_list->num_gsubs; i++) {
    gsub = &(gsub_list->gsubs[i]);

    if (gsub->script)
      RELEASE(gsub->script);
    if (gsub->language)
      RELEASE(gsub->language);
    if (gsub->feature)
      RELEASE(gsub->feature);

    for (j = 0; j < gsub->num_subtables; j++) {
      subtab = &(gsub->subtables[j]);
      switch ((int) subtab->LookupType) {
      case OTL_GSUB_TYPE_SINGLE:
        otl_gsub_release_single(subtab);
        break;
      case OTL_GSUB_TYPE_ALTERNATE:
        otl_gsub_release_alternate(subtab);
        break;
      case OTL_GSUB_TYPE_LIGATURE:
        otl_gsub_release_ligature(subtab);
        break;
      default:
        ERROR("???");
        break;
      }
    }
    RELEASE(gsub->subtables);
  }

  RELEASE(gsub_list);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int otl_gsub_select ( otl_gsub gsub_list,
const char *  script,
const char *  language,
const char *  feature 
)

Definition at line 1488 of file tt_gsub.c.

{
  int    i;
  struct otl_gsub_tab *gsub;

  for (i = 0; i < gsub_list->num_gsubs; i++) {
    gsub = &(gsub_list->gsubs[i]);
    if (!strcmp(gsub->script,   script)   &&
        !strcmp(gsub->language, language) &&
        !strcmp(gsub->feature,  feature)) {
      gsub_list->select = i;
      return i;
    }
  }

  gsub_list->select = -1;

  return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void otl_gsub_set_verbose ( void  )

Definition at line 41 of file tt_gsub.c.

{
  verbose++;
}

Here is the caller graph for this function: