📄 t1lib.h
字号:
/*-------------------------------------------------------------------------- ----- File: t1lib.h ----- Author: Rainer Menzner (Rainer.Menzner@web.de) ----- Date: 2001-10-03 ----- Description: This file is part of the t1-library. It must be included by the user of the t1lib. It contains function declarations and some basic data types, the user must deal with. ----- Copyright: t1lib is copyrighted (c) Rainer Menzner, 1996-2001. As of version 0.5, t1lib is distributed under the GNU General Public Library Lincense. The conditions can be found in the files LICENSE and LGPL, which should reside in the toplevel directory of the distribution. Please note that there are parts of t1lib that are subject to other licenses: The parseAFM-package is copyrighted by Adobe Systems Inc. The type1 rasterizer is copyrighted by IBM and the X11-consortium. ----- Warranties: Of course, there's NO WARRANTY OF ANY KIND :-) ----- Credits: I want to thank IBM and the X11-consortium for making their rasterizer freely available. Also thanks to Piet Tutelaers for his ps2pk, from which I took the rasterizer sources in a format independent from X11. Thanks to all people who make free software living!--------------------------------------------------------------------------*/#ifndef T1LIB_H_INCLUDED#define T1LIB_H_INCLUDED/* type definitions, needed by the user: */#if defined(__cplusplus) || defined(c_plusplus)extern "C" {#endif/* the data structure which contains the character bitmap description */typedef struct{ char *bits; /* A pointer to the characters local bitmap */ struct /* A struct containing diverse metric information */ { int ascent; int descent; int leftSideBearing; int rightSideBearing; int advanceX; int advanceY; } metrics; void *pFontCacheInfo; unsigned long bpp;} GLYPH;/* A structure representing a matrix */typedef struct{ double cxx; double cyx; double cxy; double cyy;} T1_TMATRIX;/* the bounding box data structure: */typedef struct{ int llx; /* lower left x-position */ int lly; /* lower left y-position */ int urx; /* upper right x-position */ int ury; /* upper right y-position */} BBox;/* A data that makes most important information available to user. */typedef struct{ int width; /* The glyph's width */ BBox bbox; /* The glyph's bounding box */ int numchars; /* The number of characters in the glyph (string) */ int *charpos; /* A pointer to an integer array were the horizontal positions in (afm units) of the individual characters in the string are stored */} METRICSINFO;#define PAD(bits, pad) (((bits)+(pad)-1)&-(pad))/* def's for T1_InitLib() */#define NO_LOGFILE 0x0#define LOGFILE 0x1#define IGNORE_FONTDATABASE 0x2 /* Default is to read database */#define IGNORE_CONFIGFILE 0x4 /* Default is to read config file */#define T1_AA_CACHING 0x8 /* Cache aa-bytes */#define T1_NO_AFM 0x10 /* Do not load or generate AFM data *//* common 'yes'/'no' */#define T1_YES 0x1#define T1_NO 0x0/* logfile levels: */#define T1LOG_ERROR 1#define T1LOG_WARNING 2#define T1LOG_STATISTIC 3#define T1LOG_DEBUG 4/* #define's for manipulating searchpaths */#define T1_PFAB_PATH 0x01#define T1_AFM_PATH 0x02#define T1_ENC_PATH 0x04#define T1_FDB_PATH 0x08#define T1_APPEND_PATH 0x00#define T1_PREPEND_PATH 0x01/* #define's for character/string properties (not all implemented) */#define T1_DEFAULT 0x0000#define T1_UNDERLINE 0x0001#define T1_OVERLINE 0x0002#define T1_OVERSTRIKE 0x0004#define T1_DOUBLEOVERSTRIKE 0x0008#define T1_RIGHT_TO_LEFT 0x0010#define T1_SUBSCRIPT 0x0100#define T1_SUPERSCRIPT 0x0200#define T1_STROKED 0x1000#define T1_KERNING 0x2000/* Setting the subsampling value */#define T1_AA_NONE 1#define T1_AA_LOW 2#define T1_AA_HIGH 4/* Error handling: */extern int T1_errno;/* These are from scanning a font file */#define T1ERR_SCAN_FONT_FORMAT -5#define T1ERR_SCAN_FILE_OPEN_ERR -4#define T1ERR_SCAN_OUT_OF_MEMORY -3#define T1ERR_SCAN_ERROR -2#define T1ERR_SCAN_FILE_EOF -1/* These are from generating paths */#define T1ERR_PATH_ERROR 1#define T1ERR_PARSE_ERROR 2#define T1ERR_TYPE1_ABORT 3/* These are from t1lib */#define T1ERR_INVALID_FONTID 10#define T1ERR_INVALID_PARAMETER 11#define T1ERR_OP_NOT_PERMITTED 12#define T1ERR_ALLOC_MEM 13#define T1ERR_FILE_OPEN_ERR 14#define T1ERR_UNSPECIFIED 15#define T1ERR_NO_AFM_DATA 16#define T1ERR_X11 17#define T1ERR_COMPOSITE_CHAR 18/* Flags to control the rasterizer */#define T1_IGNORE_FORCEBOLD 0x0001#define T1_IGNORE_FAMILYALIGNMENT 0x0002#define T1_IGNORE_HINTING 0x0004#define T1_DEBUG_LINE 0x0100#define T1_DEBUG_REGION 0x0200#define T1_DEBUG_PATH 0x0400#define T1_DEBUG_FONT 0x0800#define T1_DEBUG_HINT 0x1000/* definitions for outline handling */#define FRACTBITS 16 /* number of fractional bits in 'fractpel' *//* From/to conversion of pels/fractpels */#define T1_TOPATHPOINT(p) (((long)p)<<FRACTBITS)#define PPHALF (1<<(FRACTBITS-1))#define T1_NEARESTPOINT(fp) (((fp)+PPHALF)>>FRACTBITS)/* A fractional point */typedef struct { long x; long y;} T1_PATHPOINT;/* A straight outline segment, stroked or not stroked */typedef struct pathsegment { char type; /* type of segment (line or move) */ unsigned char flag; /* type1 rasterizer internal stuff */ short references; /* type1 rasterizer internal stuff */ unsigned char size; /* size of the structure */ unsigned char context; /* index to device context */ struct pathsegment *link; /* pointer to next structure in linked list */ struct pathsegment *last; /* pointer to last structure in list */ T1_PATHPOINT dest; /* relative ending location of path segment */} T1_PATHSEGMENT;/* A third order bezier segment */typedef struct bezierpathsegment { char type; /* type of segment (bezier) */ unsigned char flag; /* type1 rasterizer internal stuff */ short references; /* type1 rasterizer internal stuff */ unsigned char size; /* as with any 'segment' type */ unsigned char context; /* as with any 'segment' type */ T1_PATHSEGMENT *link; /* as with any 'segment' type */ T1_PATHSEGMENT *last; /* as with any 'segment' type */ T1_PATHPOINT dest; /* ending point (D) */ T1_PATHPOINT B; /* control point B */ T1_PATHPOINT C; /* control point C */} T1_BEZIERSEGMENT;typedef T1_PATHSEGMENT T1_OUTLINE;#define T1_PATHTYPE_LINE 0x10#define T1_PATHTYPE_BEZIER 0x12#define T1_PATHTYPE_MOVE 0x15
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -