Hash :
24d7024c
Author :
Date :
2000-08-17T01:09:06
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
#ifndef OLTYPES_H
#define OLTYPES_H
#include <freetype/internal/ftobjs.h>
/*************************************************************
*
* <Struct> OTL_Table
*
* <Description>
* The base table of most OpenType Layout sub-tables.
* Provides a simple way to scan a table for script,
* languages, features and lookups..
*
* <Fields>
* num_scripts :: number of scripts in table's script list
* script_tags :: array of tags for each table script
*
* max_languages :: max number of languages for any script in
* the table.
* num_languages :: number of languages available for current script
* language_tags :: tags of all languages available for current script.
*
* max_features :: total number of features in table
* feature_tags :: tags of all features for current script/language
* features :: selection flags for all features in current script/lang
*
* max_lookups :: total number of lookups in table
* lookups :: selection flags for all lookups for current
* feature list.
*
****************************************************************/
typedef enum OTL_Type_
{
otl_type_none = 0,
otl_type_base,
otl_type_gdef,
otl_type_gpos,
otl_type_gsub,
otl_type_jstf
} OTL_Type;
typedef struct OTL_Table_
{
FT_Memory memory;
FT_Int num_scripts;
FT_Tag* script_tags;
FT_Int max_languages;
FT_Int num_languages;
FT_Tag* language_tags;
FT_Int max_features;
FT_Tag* feature_tags;
FT_Bool* features;
FT_Int max_lookups;
FT_Bool* lookups;
FT_Byte* scripts_table;
FT_Long scripts_len;
FT_Byte* features_table;
FT_Long* features_len;
FT_Byte* lookups_table;
FT_Byte* lookups_len;
FT_Byte* cur_script; /* current script */
FT_Byte* cur_language; /* current language */
FT_Byte* cur_base_values;
FT_Byte* cur_min_max;
OTL_Type otl_type;
} OTL_Table;
typedef struct OTL_BaseCoord_
{
FT_UShort format;
FT_Short coordinate;
FT_UShort ref_glyph;
FT_UShort ref_point;
FT_Byte* device;
} OTL_BaseCoord;
typedef struct OTL_ValueRecord_
{
FT_Vector placement;
FT_Vector advance;
FT_Byte* device_pla_x;
FT_Byte* device_pla_y;
FT_Byte* device_adv_x;
FT_Byte* device_adv_y;
} OTL_ValueRecord;
typedef struct OTL_Anchor_
{
FT_UInt format;
FT_Vector coord;
FT_UInt anchor_point;
FT_Byte* device_x;
FT_Byte* device_y;
} OTL_Anchor;
LOCAL_DEF
FT_Error OTL_Table_Init( OTL_Table* table,
FT_Memory memory );
LOCAL_DEF
void OTL_Table_Done( OTL_Table* table );
/*****************************************************
*
* Typical uses:
*
* - after OTL_Table_Set_Scripts have been called :
*
* table->script_tags contains the list of tags of all
* scripts defined for this table.
*
* table->num_scripts is the number of scripts
*
*/
LOCAL_DEF
FT_Error OTL_Table_Set_Scripts( OTL_Table* table,
FT_Byte* bytes,
FT_Long len,
OTL_Type otl_type );
/********************************************************
*
* - after calling OTL_Table_Set_Features:
*
* table->max_features is the number of all features
* in the table
*
* table->feature_tags is the list of tags of all
* features in the table
*
* table->features[] is an array of boolean used to
* indicate which feature is active for a given script/language
* it is empty (zero-filled) by default.
*
*/
LOCAL_DEF
FT_Error OTL_Table_Set_Features( OTL_Table* table,
FT_Byte* bytes,
FT_Long len );
LOCAL_DEF
FT_Error OTL_Table_Set_Lookups( OTL_Table* table,
FT_Byte* bytes,
FT_Long len );
/*******************************************************************
*
* - after calling OTL_Get_Languages_List(script_tag):
*
* table->num_languages is the number of language systems
* available for the script, including the default
* langsys if there is one
*
* table->language_tags contains the list of tags of all
* languages for the script. Note that the default langsys
* has tag "0" and is always placed first in "language_tags".
*
*
*
*/
LOCAL_DEF
void OTL_Get_Languages_List( OTL_Table* table,
FT_ULong script_tag );
/*******************************************************************
*
* - after calling OTL_Get_Features_List(language_tag):
*
* table->features[] is an array of booleans used to indicate
* which features are active for the current script/language
*
* note that this function must be called after OTL_Get_Languages
* which remembers the last "script_tag" used..
*
* A client application can change the table->features[] array
* to add or remove features from the list.
*
*
*
*/
LOCAL_DEF
void OTL_Get_Features_List( OTL_Table* table,
FT_ULong language_tag );
LOCAL_DEF
void OTL_Get_Baseline_Values( OTL_Table* table,
FT_ULong language_tag );
LOCAL_DEF
void OTL_Get_Justification( OTL_Table* table,
FT_ULong language_tag );
/*******************************************************************
*
* - after calling OTL_Get_Lookups_List():
*
* The function uses the table->features[] array of boolean
* to determine which lookups must be processed.
*
* It fills the table->lookups[] array accordingly. It is also
* an array of booleans (one for each lookup).
*
*
*/
LOCAL_DEF
void OTL_Get_Lookups_List( OTL_Table* table );
/***************************************************************
*
* So the whole thing looks like:
*
*
* 1. A client specifies a given script and requests available
* language through OTL_Get_Languages_List()
*
* 2. It selects the language tag it needs, then calls
* OTL_Get_Features_List()
*
* 3. It updates the list of active features if it needs to
*
* 4. It calls OTL_Get_Lookups_List()
* It now has a list of active lookups in "table->lookups[]"
*
* 5. The lookups are processed according to the table's type..
*
*/
LOCAL_DEF
FT_Long OTL_Get_Coverage_Index( FT_Byte* coverage,
FT_UInt glyph_id );
LOCAL_DEF
FT_UInt OTL_Get_Glyph_Class( FT_Byte* class_def,
FT_UInt glyph_id );
LOCAL_DEF
FT_Int OTL_Get_Device_Adjustment( FT_Byte* device,
FT_UInt size );
LOCAL_DEF
void OTL_Get_Base_Coordinate( FT_Byte* base_coord,
OTL_BaseCoord* coord );
LOCAL_DEF
FT_Int OTL_ValueRecord_Size( FT_UShort value_format );
LOCAL_DEF
void OTL_Get_ValueRecord( FT_Byte* value_record,
FT_UShort value_format,
FT_Byte* pos_table,
OTL_ValueRecord* record );
LOCAL_DEF
void OTL_Get_Anchor( FT_Byte* anchor_table,
OTL_Anchor* anchor );
LOCAL_DEF
void OTL_Get_Mark( FT_Byte* mark_array,
FT_UInt index,
FT_UShort* clazz,
OTL_Anchor* anchor );
#define OTL_Byte(p) (p++, p[-1])
#define OTL_UShort(p) (p+=2, ((FT_UShort)p[-2] << 8) | p[-1])
#define OTL_ULong(p) (p+=4, ((FT_ULong)p[-4] << 24) | \
((FT_ULong)p[-3] << 16) | \
((FT_ULong)p[-2] << 8 ) | p[-1] )
#endif /* OLTYPES_H */