2 |
- |
1 |
/* Copyright (C) 2003 Aladdin Enterprises. All rights reserved.
|
|
|
2 |
|
|
|
3 |
This software is provided AS-IS with no warranty, either express or
|
|
|
4 |
implied.
|
|
|
5 |
|
|
|
6 |
This software is distributed under license and may not be copied,
|
|
|
7 |
modified or distributed except as expressly authorized under the terms
|
|
|
8 |
of the license contained in the file LICENSE in this distribution.
|
|
|
9 |
|
|
|
10 |
For more information about licensing, please refer to
|
|
|
11 |
http://www.ghostscript.com/licensing/. For information on
|
|
|
12 |
commercial licensing, go to http://www.artifex.com/licensing/ or
|
|
|
13 |
contact Artifex Software, Inc., 101 Lucas Valley Road #110,
|
|
|
14 |
San Rafael, CA 94903, U.S.A., +1(415)492-9861.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
/* $Id: ttload.h,v 1.1 2003/10/01 13:44:56 igor Exp $ */
|
|
|
18 |
|
|
|
19 |
/* Changes after FreeType: cut out the TrueType instruction interpreter. */
|
|
|
20 |
|
|
|
21 |
/*******************************************************************
|
|
|
22 |
*
|
|
|
23 |
* ttload.h 1.1
|
|
|
24 |
*
|
|
|
25 |
* TrueType Tables Loader.
|
|
|
26 |
*
|
|
|
27 |
* Copyright 1996-1998 by
|
|
|
28 |
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
|
29 |
*
|
|
|
30 |
* This file is part of the FreeType project, and may only be used
|
|
|
31 |
* modified and distributed under the terms of the FreeType project
|
|
|
32 |
* license, LICENSE.TXT. By continuing to use, modify, or distribute
|
|
|
33 |
* this file you indicate that you have read the license and
|
|
|
34 |
* understand and accept it fully.
|
|
|
35 |
*
|
|
|
36 |
*
|
|
|
37 |
* Changes between 1.1 and 1.0 :
|
|
|
38 |
*
|
|
|
39 |
* - add function Load_TrueType_Any used by TT_Get_Font_Data
|
|
|
40 |
*
|
|
|
41 |
******************************************************************/
|
|
|
42 |
|
|
|
43 |
#ifndef TTLOAD_H
|
|
|
44 |
#define TTLOAD_H
|
|
|
45 |
|
|
|
46 |
#include "ttcommon.h"
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
#ifdef __cplusplus
|
|
|
50 |
extern "C" {
|
|
|
51 |
#endif
|
|
|
52 |
|
|
|
53 |
Int LookUp_TrueType_Table( PFace face,
|
|
|
54 |
Long tag );
|
|
|
55 |
|
|
|
56 |
TT_Error Load_TrueType_Directory ( PFace face,
|
|
|
57 |
int faceIndex );
|
|
|
58 |
|
|
|
59 |
TT_Error Load_TrueType_MaxProfile ( PFace face );
|
|
|
60 |
TT_Error Load_TrueType_Gasp ( PFace face );
|
|
|
61 |
TT_Error Load_TrueType_Header ( PFace face );
|
|
|
62 |
TT_Error Load_TrueType_Horizontal_Header( PFace face );
|
|
|
63 |
TT_Error Load_TrueType_Locations ( PFace face );
|
|
|
64 |
TT_Error Load_TrueType_Names ( PFace face );
|
|
|
65 |
TT_Error Load_TrueType_CVT ( PFace face );
|
|
|
66 |
TT_Error Load_TrueType_CMap ( PFace face );
|
|
|
67 |
TT_Error Load_TrueType_HMTX ( PFace face );
|
|
|
68 |
TT_Error Load_TrueType_Programs ( PFace face );
|
|
|
69 |
TT_Error Load_TrueType_OS2 ( PFace face );
|
|
|
70 |
TT_Error Load_TrueType_PostScript ( PFace face );
|
|
|
71 |
TT_Error Load_TrueType_Hdmx ( PFace face );
|
|
|
72 |
|
|
|
73 |
TT_Error Load_TrueType_Any( PFace face,
|
|
|
74 |
Long tag,
|
|
|
75 |
Long offset,
|
|
|
76 |
void* buffer,
|
|
|
77 |
Long* length );
|
|
|
78 |
|
|
|
79 |
|
|
|
80 |
TT_Error Free_TrueType_Names( PFace face );
|
|
|
81 |
TT_Error Free_TrueType_Hdmx ( PFace face );
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
/* The following macros are defined to simplify the writing of */
|
|
|
85 |
/* the various table and glyph loaders. */
|
|
|
86 |
|
|
|
87 |
/* For examples see the code in ttload.c, ttgload.c etc. */
|
|
|
88 |
|
|
|
89 |
#define USE_Stream( original, duplicate ) \
|
|
|
90 |
( error = TT_Use_Stream( original, &duplicate ) )
|
|
|
91 |
|
|
|
92 |
#define DONE_Stream( _stream ) \
|
|
|
93 |
TT_Done_Stream( &_stream )
|
|
|
94 |
|
|
|
95 |
/* Define a file frame -- use it only when needed */
|
|
|
96 |
#define DEFINE_A_FRAME TFileFrame frame = TT_Null_FileFrame
|
|
|
97 |
|
|
|
98 |
/* Define a stream -- use it only when needed */
|
|
|
99 |
#define DEFINE_A_STREAM TT_Stream stream
|
|
|
100 |
|
|
|
101 |
#define GET_Byte() ttfReader__Byte (r)
|
|
|
102 |
#define GET_UShort() ttfReader__UShort(r)
|
|
|
103 |
#define GET_Short() ttfReader__Short (r)
|
|
|
104 |
#define GET_Long() ttfReader__Int (r)
|
|
|
105 |
#define GET_ULong() ttfReader__UInt(r)
|
|
|
106 |
|
|
|
107 |
#ifdef TT_CONFIG_REENTRANT /* re-entrant implementation */
|
|
|
108 |
|
|
|
109 |
/* The following macros define the necessary local */
|
|
|
110 |
/* variables used to access streams and frames. */
|
|
|
111 |
|
|
|
112 |
/* Define stream locals with frame */
|
|
|
113 |
#define DEFINE_STREAM_LOCALS \
|
|
|
114 |
TT_Error error; \
|
|
|
115 |
DEFINE_A_STREAM; \
|
|
|
116 |
DEFINE_A_FRAME
|
|
|
117 |
|
|
|
118 |
/* Define stream locals without frame */
|
|
|
119 |
#define DEFINE_STREAM_LOCALS_WO_FRAME \
|
|
|
120 |
TT_Error error; \
|
|
|
121 |
DEFINE_A_STREAM
|
|
|
122 |
|
|
|
123 |
/* Define locals with a predefined stream in reentrant mode -- see ttload.c */
|
|
|
124 |
#define DEFINE_LOAD_LOCALS( STREAM ) \
|
|
|
125 |
TT_Error error; \
|
|
|
126 |
DEFINE_A_STREAM = (STREAM); \
|
|
|
127 |
DEFINE_A_FRAME
|
|
|
128 |
|
|
|
129 |
/* Define locals without frame with a predefined stream - see ttload.c */
|
|
|
130 |
#define DEFINE_LOAD_LOCALS_WO_FRAME( STREAM ) \
|
|
|
131 |
TT_Error error; \
|
|
|
132 |
DEFINE_A_STREAM = (STREAM)
|
|
|
133 |
|
|
|
134 |
/* Define all locals necessary to access a font file */
|
|
|
135 |
#define DEFINE_ALL_LOCALS \
|
|
|
136 |
TT_Error error; \
|
|
|
137 |
DEFINE_A_STREAM; \
|
|
|
138 |
DEFINE_A_FRAME
|
|
|
139 |
|
|
|
140 |
|
|
|
141 |
#define ACCESS_Frame( _size_ ) \
|
|
|
142 |
( error = TT_Access_Frame( stream, &frame, _size_ ) )
|
|
|
143 |
#define CHECK_ACCESS_Frame( _size_ ) \
|
|
|
144 |
( error = TT_Check_And_Access_Frame( stream, &frame, _size_ ) )
|
|
|
145 |
#define FORGET_Frame() \
|
|
|
146 |
( error = TT_Forget_Frame( &frame ) )
|
|
|
147 |
|
|
|
148 |
#define FILE_Pos() TT_File_Pos ( stream )
|
|
|
149 |
|
|
|
150 |
#define FILE_Seek( _position_ ) \
|
|
|
151 |
( error = TT_Seek_File( stream, _position_ ) )
|
|
|
152 |
#define FILE_Skip( _distance_ ) \
|
|
|
153 |
( error = TT_Skip_File( stream, _distance_ ) )
|
|
|
154 |
#define FILE_Read( buffer, count ) \
|
|
|
155 |
( error = TT_Read_File ( stream, buffer, count ) )
|
|
|
156 |
#define FILE_Read_At( pos, buffer, count ) \
|
|
|
157 |
( error = TT_Read_At_File( stream, pos, buffer, count ) )
|
|
|
158 |
|
|
|
159 |
#else /* thread-safe implementation */
|
|
|
160 |
|
|
|
161 |
/* Define stream locals with frame -- nothing in thread-safe mode */
|
|
|
162 |
#define DEFINE_STREAM_LOCALS \
|
|
|
163 |
TT_Error error
|
|
|
164 |
|
|
|
165 |
/* Define stream locals without frame -- nothing in thread-safe mode */
|
|
|
166 |
#define DEFINE_STREAM_LOCALS_WO_FRAME \
|
|
|
167 |
TT_Error error
|
|
|
168 |
|
|
|
169 |
/* Define locals with a predefined stream in reentrant mode -- see ttload.c */
|
|
|
170 |
#define DEFINE_LOAD_LOCALS( STREAM ) \
|
|
|
171 |
TT_Error error
|
|
|
172 |
|
|
|
173 |
/* Define locals without frame with a predefined stream - see ttload.c */
|
|
|
174 |
#define DEFINE_LOAD_LOCALS_WO_FRAME( STREAM ) \
|
|
|
175 |
TT_Error error
|
|
|
176 |
|
|
|
177 |
/* Define all locals necessary to access a font file */
|
|
|
178 |
#define DEFINE_ALL_LOCALS \
|
|
|
179 |
TT_Error error; \
|
|
|
180 |
DEFINE_A_STREAM
|
|
|
181 |
|
|
|
182 |
|
|
|
183 |
#define ACCESS_Frame( _size_ ) \
|
|
|
184 |
( error = TT_Access_Frame( _size_ ) )
|
|
|
185 |
#define CHECK_ACCESS_Frame( _size_ ) \
|
|
|
186 |
( error = TT_Check_And_Access_Frame( _size_ ) )
|
|
|
187 |
#define FORGET_Frame() \
|
|
|
188 |
( error = TT_Forget_Frame() )
|
|
|
189 |
|
|
|
190 |
#define GET_Tag4() TT_Get_Long ()
|
|
|
191 |
|
|
|
192 |
#define FILE_Pos() TT_File_Pos()
|
|
|
193 |
|
|
|
194 |
#define FILE_Seek( _position_ ) \
|
|
|
195 |
( error = TT_Seek_File( _position_ ) )
|
|
|
196 |
#define FILE_Skip( _distance_ ) \
|
|
|
197 |
( error = TT_Skip_File( _distance_ ) )
|
|
|
198 |
#define FILE_Read( buffer, count ) \
|
|
|
199 |
( error = TT_Read_File ( buffer, count ) )
|
|
|
200 |
#define FILE_Read_At( pos, buffer, count ) \
|
|
|
201 |
( error = TT_Read_At_File( pos, buffer, count ) )
|
|
|
202 |
|
|
|
203 |
#endif /* TT_CONFIG_REENTRANT */
|
|
|
204 |
|
|
|
205 |
#ifdef __cplusplus
|
|
|
206 |
}
|
|
|
207 |
#endif
|
|
|
208 |
|
|
|
209 |
#endif /* TTLOAD_H */
|
|
|
210 |
|
|
|
211 |
|
|
|
212 |
/* END */
|