Back to index

texmacs  1.0.7.15
cmap_p.h
Go to the documentation of this file.
00001 /*  $Header: /home/cvsroot/dvipdfmx/src/cmap_p.h,v 1.4 2004/08/15 15:37:08 hirata Exp $
00002 
00003     This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
00004 
00005     Copyright (C) 2002 by Jin-Hwan Cho and Shunsaku Hirata,
00006     the dvipdfmx project team <dvipdfmx@project.ktug.or.kr>
00007 
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with this program; if not, write to the Free Software
00020     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00021 */
00022 
00023 #ifndef _CMAP_P_H_
00024 #define _CMAP_P_H_
00025 
00026 #include "cid.h"
00027 
00028 /* Mapping types, MAP_IS_NAME is not supported. */
00029 #define MAP_IS_CID      (1 << 0)
00030 #define MAP_IS_NAME     (1 << 1)
00031 #define MAP_IS_CODE     (1 << 2)
00032 #define MAP_IS_NOTDEF   (1 << 3)
00033 
00034 #define MAP_IS_UNDEF    0
00035 #define MAP_TYPE_MASK   0x00f
00036 
00037 #define MAP_DEFINED(e)  (((e) & MAP_TYPE_MASK) != MAP_IS_UNDEF ? 1 : 0)
00038 #define MAP_TYPE(e)     ((e) & MAP_TYPE_MASK)
00039 
00040 /* Lookup flags */
00041 #define MAP_LOOKUP_END      0
00042 #define MAP_LOOKUP_CONTINUE (1 << 4)
00043 #define LOOKUP_CONTINUE(f) ((f) & MAP_LOOKUP_CONTINUE)
00044 #define LOOKUP_END(f)      (!LOOKUP_CONTINUE((f)))
00045 
00046 /* DEBUG */
00047 #define CMAP_DEBUG_STR "CMap"
00048 #define CMAP_DEBUG     3
00049 
00050 /* Codespacerange */
00051 typedef struct rangeDef {
00052   int dim;               /* Dimension of this codespacerange */
00053   unsigned char *codeLo; /* Lower bounds of valid input code */
00054   unsigned char *codeHi; /* Upper bounds of valid input code */
00055 } rangeDef;
00056 
00057 typedef struct mapDef {
00058   int            flag;
00059   int            len;  /* 2 for CID, variable for Code..  */
00060   unsigned char *code; /* CID (as 16-bit BE), Code ...    */
00061   struct mapDef *next; /* Next Subtbl for LOOKUP_CONTINUE */
00062 } mapDef;
00063 
00064 #define MEM_ALLOC_SIZE  4096
00065 typedef struct mapData {
00066   long            pos;  /* Position of next free data segment */
00067   unsigned char  *data; /* CID, Code... MEM_ALLOC_SIZE bytes  */
00068   struct mapData *prev; /* Previous mapData data segment      */
00069 } mapData;
00070 
00071 struct CMap {
00072   char  *name;
00073   int    type;     /* CMapType: 1 for usual CMaps,
00074                   *           2 for ToUnicode CMaps,
00075                   *           0 for IDENTITY is also defined for convenience.
00076                   */
00077   int    wmode;    /* WMode: 0 for Horizontal, 1 for Vertical. */
00078   CIDSysInfo *CSI; /* CIDSystemInfo */
00079 
00080   struct CMap *useCMap;
00081 
00082   struct {
00083     int        num;
00084     int        max;
00085     rangeDef  *ranges;
00086   } codespace;
00087 
00088   mapDef  *mapTbl;  /* First 256 segment of mapping table */
00089   mapData *mapData; /* Storage for actual CMap data       */
00090 
00091   /* Additional data used by cmap.c, etc. */
00092 
00093   int flags; /* Decoder flags Not used yet. */
00094 
00095   struct {
00096     int minBytesIn;
00097     int maxBytesIn;
00098     int minBytesOut;
00099     int maxBytesOut;
00100   } profile;
00101 
00102 };
00103 
00104 #endif /* _CMAP_P_H_ */