Back to index

tetex-bin  3.0
t1misc.h
Go to the documentation of this file.
00001 /*--------------------------------------------------------------------------
00002   ----- File:        t1misc.h
00003   ----- Author:      Rainer Menzner (Rainer.Menzner@web.de)
00004   ----- Date:        2004-03-03
00005   ----- Description: This file is part of the t1-library. It contains
00006                      some miscellaneous definitions.
00007   ----- Copyright:   t1lib is copyrighted (c) Rainer Menzner, 1996-2004.
00008                      As of version 0.5, t1lib is distributed under the
00009                    GNU General Public Library Lincense. The
00010                    conditions can be found in the files LICENSE and
00011                    LGPL, which should reside in the toplevel
00012                    directory of the distribution.  Please note that 
00013                    there are parts of t1lib that are subject to
00014                    other licenses:
00015                    The parseAFM-package is copyrighted by Adobe Systems
00016                    Inc.
00017                    The type1 rasterizer is copyrighted by IBM and the
00018                    X11-consortium.
00019   ----- Warranties:  Of course, there's NO WARRANTY OF ANY KIND :-)
00020   ----- Credits:     I want to thank IBM and the X11-consortium for making
00021                      their rasterizer freely available.
00022                    Also thanks to Piet Tutelaers for his ps2pk, from
00023                    which I took the rasterizer sources in a format
00024                    independent from X11.
00025                      Thanks to all people who make free software living!
00026 --------------------------------------------------------------------------*/
00027   
00028 
00029 #include <setjmp.h>
00030 
00031 #define LINE_BUF 512
00032 #define BUF_SIZE 512
00033 #define NULLPTR  (void *) 0
00034 
00035 
00036 /* t1lib-glyphs are padded to this value by default: */
00037 #define T1GLYPH_PAD   8
00038 #define T1GLYPH_BIT   0 
00039 #define T1GLYPH_BYTE  0 
00040 #define PAD(bits, pad)  (((bits)+(pad)-1)&-(pad))
00041 
00042 
00043 /* For debugging purposes: */
00044 #define SLEEP for(j=0; j<50; j++){for (k=0; k<65536; k++);}
00045 
00046 
00047 #define KERN_FLAG      0x01
00048 #define LIGATURE_FLAG  0x02
00049 
00050 
00051 /* common 'yes'/'no' */
00052 #define T1_YES              0x1
00053 #define T1_NO               0x0
00054 
00055 
00056 /* The maximum length of a PostScript name of a font: */
00057 #define MAXPSNAMELEN 256
00058 #define MAXPATHLEN   4096
00059 
00060 /* The default resolution used by the library */
00061 #define DEFAULT_RES           72.0
00062 #define BIGPOINTSPERINCH      72.0
00063 
00064 /* Defaults for configuration file searching: */
00065 /* (Note: The directory where the global config will be located is
00066    determined by configure at compile time) */
00067 #define T1_CONFIGFILENAME    ".t1librc"
00068 #define ENV_CONF_STRING      "T1LIB_CONFIG"
00069 #define GLOBAL_CONFIG_FILE   "t1lib.config"
00070 /* Directory separator is operating system dependent */
00071 #if defined(VMS)
00072 # define DIRECTORY_SEP        "]"
00073 # define DIRECTORY_SEP_CHAR   ']'
00074 #elif defined(MSDOS) | defined(_WIN32) | defined(_MSC_VER)
00075 # define DIRECTORY_SEP        "\\"
00076 # define DIRECTORY_SEP_CHAR   '\\'
00077 #else
00078 # define DIRECTORY_SEP        "/"
00079 # define DIRECTORY_SEP_CHAR   '/'
00080 #endif
00081 /* For EMX-, WIN32-, MSDOS-environment, we define the default path separator to
00082    be ';' instead of ':' */
00083 #if defined(MSDOS) | defined(_WIN32) | defined(__EMX__) | defined(_MSC_VER) | defined(VMS) 
00084 #define PATH_SEP             ";"
00085 #define PATH_SEP_CHAR        ';'
00086 #else
00087 #define PATH_SEP             ":"
00088 #define PATH_SEP_CHAR        ':'
00089 #endif
00090 /* This non printable character is used internally */
00091 #define INTERNAL_PATH_SEP            "\001"
00092 #define INTERNAL_PATH_SEP_CHAR       '\1'
00093 
00094 
00095 /* Default name for t1lib-logfile: */
00096 #define ENV_LOG_STRING    "T1LIB_LOGMODE"
00097 #define T1_LOG_FILE       "t1lib.log"
00098 /* logfile levels: */
00099 #define T1LOG_ERROR     1
00100 #define T1LOG_WARNING   2
00101 #define T1LOG_STATISTIC 3
00102 #define T1LOG_DEBUG     4
00103 
00104 
00105 /* def's for T1_InitLib() */
00106 #define NO_LOGFILE          0x0
00107 #define LOGFILE             0x1
00108 #define IGNORE_FONTDATABASE 0x2  /* Default is to read database */
00109 #define IGNORE_CONFIGFILE   0x4  /* Default is to read config file */
00110 #define T1_AA_CACHING       0x8  /* Cache aa-bytes */
00111 #define T1_NO_AFM           0x10 /* Don't load AFM files or generate AFM data */
00112 
00113 
00114 /* How may ligatures a character may have at maximum: */
00115 #define MAX_LIGS 20
00116 
00117 
00118 /* The maximum number of gray-levels in antialiasing */
00119 #define AAMAXPLANES 17
00120 #define T1_AA_NONE  1
00121 #define T1_AA_LOW   2
00122 #define T1_AA_HIGH  4
00123 
00124 /* The default limits for no/low/high AA */
00125 #define T1_AA_SMARTLIMIT1       20.0
00126 #define T1_AA_SMARTLIMIT2       60.0
00127 
00128 /* How much to advance the number of FONTPRIVATE structures when
00129    reallocating for new fonts? */
00130 #define ADVANCE_FONTPRIVATE   10
00131 
00132 #define NO_ANTIALIAS 0
00133 #define ANTIALIAS    1
00134 
00135 
00136 /* #define's for manipulating searchpaths */
00137 #define T1_PFAB_PATH        0x01
00138 #define T1_AFM_PATH         0x02
00139 #define T1_ENC_PATH         0x04
00140 #define T1_FDB_PATH         0x08
00141 #define T1_APPEND_PATH      0x00
00142 #define T1_PREPEND_PATH     0x01
00143 
00144 
00145 /* #define's for character/string properties (not all implemented) */
00146 #define T1_DEFAULT             0x0000
00147 #define T1_UNDERLINE           0x0001
00148 #define T1_OVERLINE            0x0002
00149 #define T1_OVERSTRIKE          0x0004
00150 #define T1_DOUBLEOVERSTRIKE    0x0008
00151 #define T1_RIGHT_TO_LEFT       0x0010
00152 #define T1_SUBSCRIPT           0x0100
00153 #define T1_SUPERSCRIPT         0x0200
00154 #define T1_STROKED             0x1000
00155 #define T1_KERNING             0x2000
00156 
00157 
00158 /* Error handling: */
00159 /* These are from scanning a font file */
00160 #define T1ERR_SCAN_FONT_FORMAT       -5
00161 #define T1ERR_SCAN_FILE_OPEN_ERR     -4
00162 #define T1ERR_SCAN_OUT_OF_MEMORY     -3
00163 #define T1ERR_SCAN_ERROR             -2
00164 #define T1ERR_SCAN_FILE_EOF          -1
00165 /* These are from generating paths */
00166 #define T1ERR_PATH_ERROR              1
00167 #define T1ERR_PARSE_ERROR             2
00168 #define T1ERR_TYPE1_ABORT             3
00169 /* These are from t1lib */
00170 #define T1ERR_INVALID_FONTID          10
00171 #define T1ERR_INVALID_PARAMETER       11
00172 #define T1ERR_OP_NOT_PERMITTED        12
00173 #define T1ERR_ALLOC_MEM               13
00174 #define T1ERR_FILE_OPEN_ERR           14
00175 #define T1ERR_UNSPECIFIED             15
00176 #define T1ERR_NO_AFM_DATA             16
00177 #define T1ERR_X11                     17
00178 #define T1ERR_COMPOSITE_CHAR          18
00179 #define T1ERR_SCAN_ENCODING           19
00180 
00181 
00182 /* The info_flags meaning */
00183 #define AFM_SUCCESS               (short)0x0001
00184 #define AFM_SLOPPY_SUCCESS        (short)0x0002
00185 #define AFM_SELFGEN_SUCCESS       (short)0x0004
00186 #define USES_STANDARD_ENCODING    (short)0x0008
00187 #define RASTER_STROKED            (short)0x0010
00188 #define CACHE_STROKED             (short)0x0020
00189 #define FONT_NOCACHING            (short)0x0100
00190 
00191 #ifndef PI
00192 #define PI 3.1415927
00193 #endif
00194 
00195 
00196 /* Flags to control the rasterizer */
00197 #define T1_IGNORE_FORCEBOLD           0x0001
00198 #define T1_IGNORE_FAMILYALIGNMENT     0x0002
00199 #define T1_IGNORE_HINTING             0x0004
00200 
00201 #define T1_DEBUG_LINE                 0x0100
00202 #define T1_DEBUG_REGION               0x0200
00203 #define T1_DEBUG_PATH                 0x0400
00204 #define T1_DEBUG_FONT                 0x0800
00205 #define T1_DEBUG_HINT                 0x1000
00206 
00207 
00208 /*   */
00209 #define DO_RASTER                     0x1
00210 #define DO_NOT_RASTER                 0x0
00211 
00212 
00213 /* this definition reports a character substitution from fontfcn */
00214 #define FF_NOTDEF_SUBST               -1