Back to index

texmacs  1.0.7.15
Defines | Typedefs | Functions
cmap.h File Reference
#include "cid.h"
#include <sys/types.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define CID_MAX_CID   65535
#define CID_MAX   CID_MAX_CID
#define CID_NOTDEF_CHAR   "\0\0"
#define CID_NOTDEF   0
#define UCS_NOTDEF_CHAR   "\377\375"
#define UCS_NOTDEF   0xfffd
#define CMAP_TYPE_IDENTITY   0
#define CMAP_TYPE_CODE_TO_CID   1
#define CMAP_TYPE_TO_UNICODE   2
#define CMAP_TYPE_CID_TO_CODE   3
#define CMAP_PROF_TYPE_INBYTES_MIN   0
#define CMAP_PROF_TYPE_INBYTES_MAX   1
#define CMAP_PROF_TYPE_OUTBYTES_MIN   2
#define CMAP_PROF_TYPE_OUTBYTES_MAX   3

Typedefs

typedef unsigned short CID
typedef unsigned short UCV16
typedef struct CMap

Functions

void CMap_set_verbose (void)
void CMap_set_silent (int value)
CMapCMap_new (void)
void CMap_release (CMap *cmap)
int CMap_is_valid (CMap *cmap)
int CMap_is_Identity (CMap *cmap)
int CMap_get_profile (CMap *cmap, int type)
char * CMap_get_name (CMap *cmap)
int CMap_get_type (CMap *cmap)
int CMap_get_wmode (CMap *cmap)
CIDSysInfoCMap_get_CIDSysInfo (CMap *cmap)
void CMap_set_name (CMap *cmap, const char *name)
void CMap_set_type (CMap *cmap, int type)
void CMap_set_wmode (CMap *cmap, int wmode)
void CMap_set_usecmap (CMap *cmap, CMap *ucmap)
void CMap_set_CIDSysInfo (CMap *cmap, const CIDSysInfo *csi)
int CMap_add_bfchar (CMap *cmap, const unsigned char *src, int srcdim, const unsigned char *dest, int destdim)
int CMap_add_cidchar (CMap *cmap, const unsigned char *src, int srcdim, CID dest)
int CMap_add_bfrange (CMap *cmap, const unsigned char *srclo, const unsigned char *srchi, int srcdim, const unsigned char *dest, int destdim)
int CMap_add_cidrange (CMap *cmap, const unsigned char *srclo, const unsigned char *hi, int srcdim, CID base)
int CMap_add_notdefchar (CMap *cmap, const unsigned char *src, int srcdim, CID dst)
int CMap_add_notdefrange (CMap *cmap, const unsigned char *srclo, const unsigned char *srchi, int srcdim, CID dst)
int CMap_add_codespacerange (CMap *cmap, const unsigned char *codelo, const unsigned char *codehi, int dim)
int CMap_match_codespace (CMap *cmap, const unsigned char *c, int dim)
void CMap_decode_char (CMap *cmap, const unsigned char **inbuf, long *inbytesleft, unsigned char **outbuf, long *outbytesleft)
long CMap_decode (CMap *cmap, const unsigned char **inbuf, long *inbytesleft, unsigned char **outbuf, long *outbytesleft)
void CMap_cache_init (void)
CMapCMap_cache_get (int id)
int CMap_cache_find (const char *cmap_name)
void CMap_cache_close (void)
int CMap_cache_add (CMap *cmap)

Define Documentation

#define CID_MAX   CID_MAX_CID

Definition at line 35 of file cmap.h.

#define CID_MAX_CID   65535

Definition at line 34 of file cmap.h.

#define CID_NOTDEF   0

Definition at line 38 of file cmap.h.

#define CID_NOTDEF_CHAR   "\0\0"

Definition at line 37 of file cmap.h.

Definition at line 52 of file cmap.h.

Definition at line 51 of file cmap.h.

Definition at line 54 of file cmap.h.

Definition at line 53 of file cmap.h.

#define CMAP_TYPE_CID_TO_CODE   3

Definition at line 49 of file cmap.h.

#define CMAP_TYPE_CODE_TO_CID   1

Definition at line 47 of file cmap.h.

#define CMAP_TYPE_IDENTITY   0

Definition at line 46 of file cmap.h.

#define CMAP_TYPE_TO_UNICODE   2

Definition at line 48 of file cmap.h.

#define UCS_NOTDEF   0xfffd

Definition at line 41 of file cmap.h.

#define UCS_NOTDEF_CHAR   "\377\375"

Definition at line 40 of file cmap.h.


Typedef Documentation

typedef unsigned short CID

Definition at line 30 of file cmap.h.

typedef struct CMap

Definition at line 56 of file cmap.h.

typedef unsigned short UCV16

Definition at line 31 of file cmap.h.


Function Documentation

int CMap_add_bfchar ( CMap cmap,
const unsigned char *  src,
int  srcdim,
const unsigned char *  dest,
int  destdim 
)

Definition at line 600 of file cmap.c.

{
  return CMap_add_bfrange(cmap, src, src, srcdim, dst, dstdim);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int CMap_add_bfrange ( CMap cmap,
const unsigned char *  srclo,
const unsigned char *  srchi,
int  srcdim,
const unsigned char *  dest,
int  destdim 
)

Definition at line 608 of file cmap.c.

{
  int     c, last_byte, i;
  mapDef *cur;

  ASSERT(cmap);
  if (check_range(cmap, srclo, srchi, srcdim, base, dstdim) < 0)
    return -1;

  if (cmap->mapTbl == NULL)
    cmap->mapTbl = mapDef_new();

  cur = cmap->mapTbl;
  if (locate_tbl(&cur, srclo, srcdim) < 0)
    return -1;

  for (c = srclo[srcdim-1]; c <= srchi[srcdim-1]; c++) {
    /* According to 5014.CIDFont_Spec.pdf (p.52),
     * Code mappings (unlike codespace ranges) may overlap,
     * but succeeding maps superceded preceding maps.
     * (reported and patched by Luo Jie on 2007/12/2)
     */
    if (!MAP_DEFINED(cur[c].flag) || cur[c].len < dstdim) {
      cur[c].flag = (MAP_LOOKUP_END|MAP_IS_CODE);
      cur[c].code = get_mem(cmap, dstdim);
    }
    /*
     * We assume restriction to code ranges also applied here.
     * Addition <00FF> + 1 is undefined.
     *
     * Changed on 2004-03-20:
     *
     *  Should be treated as <0100> in Acrobat's "ToUnicode" CMap.
     */
    cur[c].len = dstdim;
    memcpy(cur[c].code, base, dstdim);

    last_byte = c - srclo[srcdim-1] + base[dstdim-1];
    cur[c].code[dstdim-1] = (last_byte & 0xFF);
    for (i = dstdim - 2; i >= 0 && last_byte > 255; i--) {
      last_byte = cur[c].code[i] + 1;
      cur[c].code[i] = (last_byte & 0xFF);
    }
  }

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int CMap_add_cidchar ( CMap cmap,
const unsigned char *  src,
int  srcdim,
CID  dest 
)

Definition at line 659 of file cmap.c.

{
  return CMap_add_cidrange(cmap, src, src, srcdim, dst);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int CMap_add_cidrange ( CMap cmap,
const unsigned char *  srclo,
const unsigned char *  hi,
int  srcdim,
CID  base 
)

Definition at line 665 of file cmap.c.

{
  int     c;
  mapDef *cur;

  ASSERT(cmap);
  /* base not used here */
  if (check_range(cmap, srclo, srchi, srcdim, (const unsigned char *)&base, 2) < 0) /* FIXME */
    return -1;

  if (cmap->mapTbl == NULL )
    cmap->mapTbl = mapDef_new();

  cur = cmap->mapTbl;
  if (locate_tbl(&cur, srclo, srcdim) < 0)
    return -1;

  for (c = srclo[srcdim-1]; c <= srchi[srcdim-1]; c++) {
    if (cur[c].flag != 0) {
      if (!__silent)
       WARN("Trying to redefine already defined CID mapping. (ignored)");
    } else {
      cur[c].flag = (MAP_LOOKUP_END|MAP_IS_CID);
      cur[c].len  = 2;
      cur[c].code = get_mem(cmap, 2);
      cur[c].code[0] = base >> 8;
      cur[c].code[1] = base & 0xff;
    }
    if (base >= CID_MAX)
      WARN("CID number too large.");
    base++;
  }

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int CMap_add_codespacerange ( CMap cmap,
const unsigned char *  codelo,
const unsigned char *  codehi,
int  dim 
)

Definition at line 510 of file cmap.c.

{
  rangeDef *csr = NULL;
  int       i;

  ASSERT(cmap && dim > 0);

  for (i = 0; i < cmap->codespace.num; i++) {
    int j, overlap = 1;
    csr = cmap->codespace.ranges + i;
    for (j = 0; j < MIN(csr->dim, dim) && overlap; j++) {
      if ((codelo[j] >= csr->codeLo[j] && codelo[j] <= csr->codeHi[j]) ||
         (codehi[j] >= csr->codeLo[j] && codehi[j] <= csr->codeHi[j]))
       overlap = 1;
      else
       overlap = 0;
    }
    if (overlap) {
      WARN("Overlapping codespace found. (ingored)");
      return -1;
    }
  }

  if (dim < cmap->profile.minBytesIn)
    cmap->profile.minBytesIn = dim;
  if (dim > cmap->profile.maxBytesIn)
    cmap->profile.maxBytesIn = dim;

  if (cmap->codespace.num + 1 > cmap->codespace.max) {
    cmap->codespace.max += 10;
    cmap->codespace.ranges = RENEW(cmap->codespace.ranges, cmap->codespace.max, struct rangeDef);
  }

  csr = cmap->codespace.ranges + cmap->codespace.num;
  csr->dim    = dim;
  csr->codeHi = get_mem(cmap, dim);
  csr->codeLo = get_mem(cmap, dim);
  memcpy(csr->codeHi, codehi, dim);
  memcpy(csr->codeLo, codelo, dim);

  (cmap->codespace.num)++;

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int CMap_add_notdefchar ( CMap cmap,
const unsigned char *  src,
int  srcdim,
CID  dst 
)

Definition at line 557 of file cmap.c.

{
  return CMap_add_notdefrange(cmap, src, src, srcdim, dst);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int CMap_add_notdefrange ( CMap cmap,
const unsigned char *  srclo,
const unsigned char *  srchi,
int  srcdim,
CID  dst 
)

Definition at line 563 of file cmap.c.

{
  int     c;
  mapDef *cur;

  ASSERT(cmap);
  /* dst not used here */
  /* FIXME */
  if (check_range(cmap, srclo, srchi, srcdim, (const unsigned char *)&dst, 2) < 0)
    return -1;
    
  if (cmap->mapTbl == NULL )
    cmap->mapTbl = mapDef_new();

  cur = cmap->mapTbl;
  if (locate_tbl(&cur, srclo, srcdim) < 0)
    return -1;

  for (c = srclo[srcdim-1]; c <= srchi[srcdim-1]; c++) {
    if (MAP_DEFINED(cur[c].flag)) {
      if (!__silent)
       WARN("Trying to redefine already defined code mapping. (ignored)");
    } else {
      cur[c].flag = (MAP_LOOKUP_END|MAP_IS_NOTDEF);
      cur[c].code = get_mem(cmap, 2);
      cur[c].len  = 2;
      cur[c].code[0] = dst >> 8;
      cur[c].code[1] = dst & 0xff;
    }
    /* Do not do dst++ for notdefrange  */
  }

  return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int CMap_cache_add ( CMap cmap)

Definition at line 955 of file cmap.c.

{
  int   id;
  char *cmap_name0, *cmap_name1;

  if (!CMap_is_valid(cmap))
    ERROR("%s: Invalid CMap.", CMAP_DEBUG_STR);

  for (id = 0; id < __cache->num; id++) {
    cmap_name0 = CMap_get_name(cmap);
    cmap_name1 = CMap_get_name(__cache->cmaps[id]);
    if (!strcmp(cmap_name0, cmap_name1)) {
      ERROR("%s: CMap \"%s\" already defined.",
           CMAP_DEBUG_STR, cmap_name0);
      return -1;
    }
  }

  if (__cache->num >= __cache->max) {
    __cache->max   += CMAP_CACHE_ALLOC_SIZE;
    __cache->cmaps = RENEW(__cache->cmaps, __cache->max, CMap *);
  }
  id = __cache->num;
  (__cache->num)++;
  __cache->cmaps[id] = cmap;

  return id;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CMap_cache_close ( void  )

Definition at line 985 of file cmap.c.

{
  if (__cache) {
    int id;
    for (id = 0; id < __cache->num; id++) {
      CMap_release(__cache->cmaps[id]);
    }
    RELEASE(__cache->cmaps);
    RELEASE(__cache);
    __cache = NULL;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int CMap_cache_find ( const char *  cmap_name)

Definition at line 905 of file cmap.c.

{
  int   id = 0;
  FILE *fp = NULL;

  if (!__cache)
    CMap_cache_init();
  ASSERT(__cache);

  for (id = 0; id < __cache->num; id++) {
    char *name = NULL;
    /* CMapName may be undefined when processing usecmap. */
    name = CMap_get_name(__cache->cmaps[id]);
    if (name && strcmp(cmap_name, name) == 0) {
      return id;
    }
  }

  fp = DPXFOPEN(cmap_name, DPX_RES_TYPE_CMAP);
  if (!fp)
    return -1;

  if (CMap_parse_check_sig(fp) < 0) {
    DPXFCLOSE(fp);
    return -1;
  }
     
  if (__verbose)
    MESG("(CMap:%s", cmap_name);

  if (__cache->num >= __cache->max) {
    __cache->max   += CMAP_CACHE_ALLOC_SIZE;
    __cache->cmaps = RENEW(__cache->cmaps, __cache->max, CMap *);
  }
  id = __cache->num;
  (__cache->num)++;
  __cache->cmaps[id] = CMap_new();

  if (CMap_parse(__cache->cmaps[id], fp) < 0)
    ERROR("%s: Parsing CMap file failed.", CMAP_DEBUG_STR);

  DPXFCLOSE(fp);

  if (__verbose)
    MESG(")");

  return id;
}

Here is the call graph for this function:

Here is the caller graph for this function:

CMap* CMap_cache_get ( int  id)

Definition at line 898 of file cmap.c.

{
  CHECK_ID(id);
  return __cache->cmaps[id];
}

Here is the caller graph for this function:

void CMap_cache_init ( void  )

Definition at line 865 of file cmap.c.

{
  static unsigned char range_min[2] = {0x00, 0x00};
  static unsigned char range_max[2] = {0xff, 0xff};

  if (__cache)
    ERROR("%s: Already initialized.", CMAP_DEBUG_STR);

  __cache = NEW(1, struct CMap_cache);

  __cache->max   = CMAP_CACHE_ALLOC_SIZE;
  __cache->cmaps = NEW(__cache->max, CMap *);
  __cache->num   = 0;

  /* Create Identity mapping */
  __cache->cmaps[0] = CMap_new();
  CMap_set_name (__cache->cmaps[0], "Identity-H");
  CMap_set_type (__cache->cmaps[0], CMAP_TYPE_IDENTITY);
  CMap_set_wmode(__cache->cmaps[0], 0);
  CMap_set_CIDSysInfo(__cache->cmaps[0], &CSI_IDENTITY);
  CMap_add_codespacerange(__cache->cmaps[0], range_min, range_max, 2);

  __cache->cmaps[1] = CMap_new();
  CMap_set_name (__cache->cmaps[1], "Identity-V");
  CMap_set_type (__cache->cmaps[1], CMAP_TYPE_IDENTITY);
  CMap_set_wmode(__cache->cmaps[1], 1);
  CMap_set_CIDSysInfo(__cache->cmaps[1], &CSI_IDENTITY);
  CMap_add_codespacerange(__cache->cmaps[1], range_min, range_max, 2);

  __cache->num += 2;
}

Here is the call graph for this function:

Here is the caller graph for this function:

long CMap_decode ( CMap cmap,
const unsigned char **  inbuf,
long *  inbytesleft,
unsigned char **  outbuf,
long *  outbytesleft 
)

Definition at line 349 of file cmap.c.

{
  int count;

  ASSERT(cmap && inbuf && outbuf);
  ASSERT(inbytesleft && outbytesleft);
  for (count = 0;*inbytesleft > 0 && *outbytesleft > 0; count++)
    CMap_decode_char(cmap, inbuf, inbytesleft, outbuf, outbytesleft);

  return count;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CMap_decode_char ( CMap cmap,
const unsigned char **  inbuf,
long *  inbytesleft,
unsigned char **  outbuf,
long *  outbytesleft 
)

Definition at line 252 of file cmap.c.

{
  mapDef *t;
  unsigned char *p, c = 0, *save;
  long    count = 0;

  p = save = (unsigned char *) *inbuf;
  /*
   * First handle some special cases:
   */
  if (cmap->type == CMAP_TYPE_IDENTITY) {
    if ((*inbytesleft) % 2)
      ERROR("%s: Invalid/truncated input string.", CMAP_DEBUG_STR);
    if (*outbytesleft < 2)
      ERROR("%s: Buffer overflow.", CMAP_DEBUG_STR);
    memcpy(*outbuf, *inbuf, 2);
    *inbuf  += 2;
    *outbuf += 2;
    *outbytesleft -= 2;
    *inbytesleft  -= 2;
    return;
  } else if (!cmap->mapTbl) {
    if (cmap->useCMap) {
      CMap_decode_char(cmap->useCMap, inbuf, inbytesleft, outbuf, outbytesleft);
      return;
    } else {
      /* no mapping available in this CMap */
      WARN("No mapping available for this character.");
      handle_undefined(cmap, inbuf, inbytesleft, outbuf, outbytesleft);
      return;
    }
  }

  ASSERT(cmap->mapTbl);
  t = cmap->mapTbl;
  while (count < *inbytesleft) {
    c = *p++;
    count++;
    if (LOOKUP_END(t[c].flag))
      break;
    t = t[c].next;
  }
  if (LOOKUP_CONTINUE(t[c].flag)) /* need more bytes */
    ERROR("%s: Premature end of input string.", CMAP_DEBUG_STR);
  else if (!MAP_DEFINED(t[c].flag)) {
    if (cmap->useCMap) {
      CMap_decode_char(cmap->useCMap, inbuf, inbytesleft, outbuf, outbytesleft);
      return;
    } else {
      /* no mapping available in this CMap */
      WARN("No character mapping available.");
      MESG(" CMap name: %s\n", CMap_get_name(cmap));
      MESG(" input str: ");
      MESG("<");
      while (save < p) {
        MESG("%02x", *save);
        save++;
      }
      MESG(">\n");
      /*
       * We know partial match found up to `count' bytes,
       * but we will not use this information for the sake of simplicity.
       */ 
      handle_undefined(cmap, inbuf, inbytesleft, outbuf, outbytesleft);
      return;
    }
  } else {
    switch (MAP_TYPE(t[c].flag)) {
    case MAP_IS_NOTDEF:
      WARN("Character mapped to .notdef found.");
      /* continue */
    case MAP_IS_CID: case MAP_IS_CODE:
      if (*outbytesleft >= t[c].len)
       memcpy(*outbuf, t[c].code, t[c].len);
      else
       ERROR("%s: Buffer overflow.", CMAP_DEBUG_STR);
      *outbuf       += t[c].len;
      *outbytesleft -= t[c].len;
      break;
    case MAP_IS_NAME:
      ERROR("%s: CharName mapping not supported.", CMAP_DEBUG_STR);
      break;
    default:
      ERROR("%s: Unknown mapping type.", CMAP_DEBUG_STR);
    }
    if (inbytesleft)
      *inbytesleft -= count;
    *inbuf = p;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 385 of file cmap.c.

{
  ASSERT(cmap);
  return cmap->CSI;
}

Here is the caller graph for this function:

char* CMap_get_name ( CMap cmap)

Definition at line 364 of file cmap.c.

{
  ASSERT(cmap);
  return cmap->name;
}

Here is the caller graph for this function:

int CMap_get_profile ( CMap cmap,
int  type 
)

Definition at line 192 of file cmap.c.

{
  int value = 0;

  ASSERT(cmap);
  switch (type) {
  case CMAP_PROF_TYPE_INBYTES_MIN:
    value = cmap->profile.minBytesIn;
    break;
  case CMAP_PROF_TYPE_INBYTES_MAX:
    value = cmap->profile.maxBytesIn;
    break;
  case CMAP_PROF_TYPE_OUTBYTES_MIN:
    value = cmap->profile.maxBytesOut;
    break;
  case CMAP_PROF_TYPE_OUTBYTES_MAX:
    value = cmap->profile.maxBytesOut;
    break;
  default:
    ERROR("%s: Unrecognized profile type %d.", CMAP_DEBUG_STR, type);
  }

  return value;
}

Here is the caller graph for this function:

int CMap_get_type ( CMap cmap)

Definition at line 371 of file cmap.c.

{
  ASSERT(cmap);
  return cmap->type;
}

Here is the caller graph for this function:

int CMap_get_wmode ( CMap cmap)

Definition at line 378 of file cmap.c.

{
  ASSERT(cmap);
  return cmap->wmode;
}

Here is the caller graph for this function:

int CMap_is_Identity ( CMap cmap)

Definition at line 149 of file cmap.c.

{
  ASSERT(cmap);
  if (!strcmp(cmap->name, "Identity-H") || !strcmp(cmap->name, "Identity-V"))
    return 1;
  else
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int CMap_is_valid ( CMap cmap)

Definition at line 168 of file cmap.c.

{
  /* Quick check */
  if (!cmap || !(cmap->name) || cmap->type < CMAP_TYPE_IDENTITY ||
      cmap->type > CMAP_TYPE_CID_TO_CODE || cmap->codespace.num < 1 ||
      (cmap->type != CMAP_TYPE_IDENTITY && !cmap->mapTbl))
    return 0;

  if (cmap->useCMap) {
    CIDSysInfo *csi1, *csi2;
    csi1 = CMap_get_CIDSysInfo(cmap);
    csi2 = CMap_get_CIDSysInfo(cmap->useCMap);
    if (strcmp(csi1->registry, csi2->registry) ||
       strcmp(csi1->ordering, csi2->ordering)) {
      WARN("CIDSystemInfo mismatched %s <--> %s",
          CMap_get_name(cmap), CMap_get_name(cmap->useCMap));
      return 0;
    }
  }

  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int CMap_match_codespace ( CMap cmap,
const unsigned char *  c,
int  dim 
)

Definition at line 486 of file cmap.c.

{
  int i, pos;

  ASSERT(cmap);
  for (i = 0; i < cmap->codespace.num; i++) {
    rangeDef *csr = cmap->codespace.ranges + i;
    if (csr->dim != dim)
      continue;
    for (pos = 0; pos < dim; pos++) {
      if (c[pos] > csr->codeHi[pos] || c[pos] < csr->codeLo[pos])
       break;
    }
    if (pos == dim)
      return 0; /* Valid */
  }

  return -1; /* Invalid */
}

Here is the caller graph for this function:

CMap* CMap_new ( void  )

Definition at line 85 of file cmap.c.

{
  CMap *cmap;

  cmap = NEW(1, struct CMap);
  cmap->name     = NULL;
  cmap->type     = CMAP_TYPE_CODE_TO_CID;
  cmap->wmode    = 0;
  cmap->useCMap  = NULL;
  cmap->CSI      = NULL;

  cmap->profile.minBytesIn  = 2;
  cmap->profile.maxBytesIn  = 2;
  cmap->profile.minBytesOut = 2;
  cmap->profile.maxBytesOut = 2;

  cmap->flags = 0;

  cmap->codespace.num    = 0;
  cmap->codespace.max    = 10;
  cmap->codespace.ranges = NEW(10, struct rangeDef);

  cmap->mapTbl  = NULL;

  cmap->mapData = NEW(1, struct mapData);
  cmap->mapData->prev = NULL;
  cmap->mapData->pos  = 0;
  cmap->mapData->data = NEW(MEM_ALLOC_SIZE, unsigned char);

  return cmap;
}

Here is the caller graph for this function:

void CMap_release ( CMap cmap)

Definition at line 118 of file cmap.c.

{
  if (!cmap)
    return;

  if (cmap->name)
    RELEASE(cmap->name);
  if (cmap->CSI) {
    if (cmap->CSI->registry) RELEASE(cmap->CSI->registry);
    if (cmap->CSI->ordering) RELEASE(cmap->CSI->ordering);
    RELEASE(cmap->CSI);
  }
  if (cmap->codespace.ranges)
    RELEASE(cmap->codespace.ranges);
  if (cmap->mapTbl)
    mapDef_release(cmap->mapTbl);
  {
    mapData *map = cmap->mapData;
    while (map != NULL) {
      mapData *prev = map->prev;
      if (map->data != NULL)
       RELEASE(map->data);
      RELEASE(map);
      map = prev;
    }
  }

  RELEASE(cmap);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CMap_set_CIDSysInfo ( CMap cmap,
const CIDSysInfo csi 
)

Definition at line 416 of file cmap.c.

{
  ASSERT(cmap);

  if (cmap->CSI) {
    if (cmap->CSI->registry)
      RELEASE(cmap->CSI->registry);
    if (cmap->CSI->ordering)
      RELEASE(cmap->CSI->ordering);
    RELEASE(cmap->CSI);
  }

  if (csi && csi->registry && csi->ordering) {
    cmap->CSI = NEW(1, CIDSysInfo);
    cmap->CSI->registry = NEW(strlen(csi->registry)+1, char);
    strcpy(cmap->CSI->registry, csi->registry);
    cmap->CSI->ordering = NEW(strlen(csi->ordering)+1, char);
    strcpy(cmap->CSI->ordering, csi->ordering);
    cmap->CSI->supplement = csi->supplement;
  } else {
    WARN("Invalid CIDSystemInfo.");
    cmap->CSI = NULL;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CMap_set_name ( CMap cmap,
const char *  name 
)

Definition at line 392 of file cmap.c.

{
  ASSERT(cmap);
  if (cmap->name)
    RELEASE(cmap->name);
  cmap->name = NEW(strlen(name)+1, char);
  strcpy(cmap->name, name);
}

Here is the caller graph for this function:

void CMap_set_silent ( int  value)

Definition at line 64 of file cmap.c.

{
  __silent = value ? 1 : 0;
}

Here is the caller graph for this function:

void CMap_set_type ( CMap cmap,
int  type 
)

Definition at line 402 of file cmap.c.

{
  ASSERT(cmap);
  cmap->type = type;
}

Here is the caller graph for this function:

void CMap_set_usecmap ( CMap cmap,
CMap ucmap 
)

Definition at line 445 of file cmap.c.

{
  int i;

  ASSERT(cmap);
  ASSERT(ucmap); /* Maybe if (!ucmap) ERROR() is better for this. */

  if (cmap == ucmap)
    ERROR("%s: Identical CMap object cannot be used for usecmap CMap: 0x%p=0x%p",
         CMAP_DEBUG_STR, cmap, ucmap);

  /* Check if ucmap have neccesary information. */
  if (!CMap_is_valid(ucmap))
    ERROR("%s: Invalid CMap.", CMAP_DEBUG_STR);

  /*
   *  CMapName of cmap can be undefined when usecmap is executed in CMap parsing.
   *  And it is also possible CSI is not defined at that time.
   */
  if (cmap->name && strcmp(cmap->name, ucmap->name) == 0)
    ERROR("%s: CMap refering itself not allowed: CMap %s --> %s",
         CMAP_DEBUG_STR, cmap->name, ucmap->name);

  if (cmap->CSI && cmap->CSI->registry && cmap->CSI->ordering) {
    if (strcmp(cmap->CSI->registry, ucmap->CSI->registry) ||
       strcmp(cmap->CSI->ordering, ucmap->CSI->ordering))
      ERROR("%s: CMap %s required by %s have different CSI.",
           CMAP_DEBUG_STR, CMap_get_name(cmap), CMap_get_name(ucmap));
  }

  /* We must copy codespaceranges. */
  for (i = 0; i < ucmap->codespace.num; i++) {
    rangeDef *csr = ucmap->codespace.ranges + i;
    CMap_add_codespacerange(cmap, csr->codeLo, csr->codeHi, csr->dim);
  }

  cmap->useCMap = ucmap;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CMap_set_verbose ( void  )

Definition at line 58 of file cmap.c.

{
  __verbose++;
}

Here is the caller graph for this function:

void CMap_set_wmode ( CMap cmap,
int  wmode 
)

Definition at line 409 of file cmap.c.

{
  ASSERT(cmap);
  cmap->wmode = wmode;
}

Here is the caller graph for this function: