Back to index

texmacs  1.0.7.15
cff_types.h
Go to the documentation of this file.
00001 /*  $Header: /home/cvsroot/dvipdfmx/src/cff_types.h,v 1.3 2002/10/30 02:27:05 chofchof 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 _CFF_TYPES_H_
00024 #define _CFF_TYPES_H_
00025 
00026 /* CFF Data Types */
00027 
00028 #define CFF_TYPE_UNKNOWN 0
00029 #define CFF_TYPE_INTEGER (1 << 0)
00030 #define CFF_TYPE_REAL    (1 << 1)
00031 #define CFF_TYPE_NUMBER  (CFF_TYPE_INTEGER|CFF_TYPE_REAL)
00032 #define CFF_TYPE_BOOLEAN (1 << 2)
00033 #define CFF_TYPE_SID     (1 << 3)
00034 #define CFF_TYPE_ARRAY   (1 << 4)
00035 #define CFF_TYPE_DELTA   (1 << 5)
00036 
00037 /* SID SID number */
00038 #define CFF_TYPE_ROS     (1 << 6)
00039 /* offset(0) */
00040 #define CFF_TYPE_OFFSET  (1 << 7)
00041 /* size offset(0) */
00042 #define CFF_TYPE_SZOFF   (1 << 8)
00043 
00044 typedef unsigned char  card8;     /* 1-byte unsigned number */
00045 typedef unsigned short card16;    /* 2-byte unsigned number */
00046 typedef unsigned char  c_offsize; /* 1-byte unsigned number specifies the size
00047                                  of an Offset field or fields, range 1-4 */
00048 typedef unsigned long  l_offset;  /* 1, 2, 3, or 4-byte offset */
00049 typedef unsigned short s_SID;       /* 2-byte string identifier  */
00050 
00051 typedef unsigned long  l_size;
00052 
00053 typedef struct {
00054   card16    count;   /* number of objects stored in INDEX */
00055   c_offsize offsize; /* Offset array element size, 1-4    */
00056   l_offset  *offset; /* Offset array, count + 1 offsets   */
00057   card8     *data;   /* Object data                       */
00058 } cff_index;
00059 
00060 typedef struct {
00061   card8     major;    /* format major version (starting at 1) */
00062   card8     minor;    /* format minor version (starting at 0) */
00063   card8     hdr_size; /* Header size (bytes)                  */
00064   c_offsize offsize;  /* Absolute offset (0) size             */
00065 } cff_header;
00066 
00067 
00068 /* Dictionary */
00069 typedef struct {
00070   int     id;     /* encoded data value (as card8 or card16) */
00071   char   *key;    /* opname                                  */
00072   int     count;  /* number of values                        */
00073   double *values; /* values                                  */
00074 } cff_dict_entry;
00075 
00076 typedef struct {
00077   int    max;
00078   int    count;
00079   cff_dict_entry *entries;
00080 } cff_dict;
00081 
00082 /* Encoding, Charset and FDSelect */
00083 typedef struct
00084 {
00085   s_SID   first;  /* SID or CID, or card8 for Encoding  */
00086   card8 n_left; /* no. of remaining gids/codes in this range */
00087 } cff_range1;
00088 
00089 typedef struct
00090 {
00091   s_SID    first;  /* SID or CID (card16)      */
00092   card16 n_left; /* card16-version of range1 */
00093 } cff_range2;
00094 
00095 typedef struct
00096 {
00097   card8 code;
00098   s_SID   glyph;
00099 } cff_map;
00100 
00101 typedef struct
00102 {
00103   card8 format;       /* if (format & 0x80) then have supplement */
00104   card8 num_entries;  /* number of entries */
00105   union {
00106     card8 *codes;       /* format 0 */
00107     cff_range1 *range1; /* format 1 */
00108   } data;
00109   card8 num_supps; /* number of supplementary data */
00110   cff_map *supp;   /* supplement */
00111 } cff_encoding;
00112 
00113 typedef struct
00114 {
00115   card8 format;
00116   card16 num_entries;
00117   union {
00118     s_SID *glyphs;        /* format 0 */
00119     cff_range1 *range1; /* format 1 */
00120     cff_range2 *range2; /* format 2 */
00121   } data;
00122 } cff_charsets;
00123 
00124 /* CID-Keyed font specific */
00125 typedef struct
00126 {
00127   card16 first;
00128   card8  fd;
00129 } cff_range3;
00130 
00131 typedef struct
00132 {
00133   card8 format;
00134   card16 num_entries; /* number of glyphs/ranges */
00135   union {
00136     card8      *fds;    /* format 0 */
00137     cff_range3 *ranges; /* format 3 */
00138   } data;
00139   /* card16 sentinel; */ /* format 3 only, must be equals to num_glyphs */
00140 } cff_fdselect;
00141 
00142 #endif /* _CFF_TYPES_H_ */