7 /*************************************************************
12 * The base table of most OpenType Layout sub-tables.
13 * Provides a simple way to scan a table for script,
14 * languages, features and lookups..
17 * num_scripts :: number of scripts in table's script list
18 * script_tags :: array of tags for each table script
20 * max_languages :: max number of languages for any script in
22 * num_languages :: number of languages available for current script
23 * language_tags :: tags of all languages available for current script.
25 * max_features :: total number of features in table
26 * feature_tags :: tags of all features for current script/language
27 * features :: selection flags for all features in current script/lang
29 * max_lookups :: total number of lookups in table
30 * lookups :: selection flags for all lookups for current
33 ****************************************************************/
35 typedef enum OTL_Type_
47 typedef struct OTL_Table_
56 TT_Tag* language_tags;
65 TT_Byte* scripts_table;
68 TT_Byte* features_table;
69 TT_Long* features_len;
71 TT_Byte* lookups_table;
74 TT_Byte* cur_script; /* current script */
75 TT_Byte* cur_language; /* current language */
77 TT_Byte* cur_base_values;
85 typedef struct OTL_BaseCoord_
96 typedef struct OTL_ValueRecord_
101 TT_Byte* device_pla_x;
102 TT_Byte* device_pla_y;
103 TT_Byte* device_adv_x;
104 TT_Byte* device_adv_y;
109 typedef struct OTL_Anchor_
113 TT_UInt anchor_point;
120 TT_Error OTL_Table_Init( OTL_Table* table,
124 TT_Error OTL_Table_Set_Scripts( OTL_Table* table,
130 TT_Error OTL_Table_Set_Features( OTL_Table* table,
135 TT_Error OTL_Table_Set_Lookups( OTL_Table* table,
140 void OTL_Table_Done( OTL_Table* table );
144 /*****************************************************
148 * - after OTL_Table_Set_Scripts have been called :
150 * table->script_tags contains the list of tags of all
151 * scripts defined for this table.
153 * table->num_scripts is the number of scripts
157 /********************************************************
159 * - after calling OTL_Table_Set_Features:
161 * table->max_features is the number of all features
164 * table->feature_tags is the list of tags of all
165 * features in the table
167 * table->features[] is an array of boolean used to
168 * indicate which feature is active for a given script/language
169 * it is empty (zero-filled) by default.
173 /*******************************************************************
175 * - after calling OTL_Get_Languages_List(script_tag):
177 * table->num_languages is the number of language systems
178 * available for the script, including the default
179 * langsys if there is one
181 * table->language_tags contains the list of tags of all
182 * languages for the script. Note that the default langsys
183 * has tag "0" and is always placed first in "language_tags".
189 void OTL_Get_Languages_List( OTL_Table* table,
190 TT_ULong script_tag );
193 /*******************************************************************
195 * - after calling OTL_Get_Features_List(language_tag):
197 * table->features[] is an array of booleans used to indicate
198 * which features are active for the current script/language
200 * note that this function must be called after OTL_Get_Languages
201 * which remembers the last "script_tag" used..
203 * A client application can change the table->features[] array
204 * to add or remove features from the list.
210 void OTL_Get_Features_List( OTL_Table* table,
211 TT_ULong language_tag );
214 void OTL_Get_Baseline_Values( OTL_Table* table,
215 TT_ULong language_tag );
218 void OTL_Get_Justification( OTL_Table* table,
219 TT_ULong language_tag );
221 /*******************************************************************
223 * - after calling OTL_Get_Lookups_List():
225 * The function uses the table->features[] array of boolean
226 * to determine which lookups must be processed.
228 * It fills the table->lookups[] array accordingly. It is also
229 * an array of booleans (one for each lookup).
235 void OTL_Get_Lookups_List( OTL_Table* table );
238 /***************************************************************
240 * So the whole thing looks like:
243 * 1. A client specifies a given script and requests available
244 * language through OTL_Get_Languages_List()
246 * 2. It selects the language tag it needs, then calls
247 * OTL_Get_Features_List()
249 * 3. It updates the list of active features if it needs to
251 * 4. It calls OTL_Get_Lookups_List()
252 * It now has a list of active lookups in "table->lookups[]"
254 * 5. The lookups are processed according to the table's type..
262 TT_Long OTL_Get_Coverage_Index( TT_Byte* coverage,
266 TT_UInt OTL_Get_Glyph_Class( TT_Byte* class_def,
270 TT_Int OTL_Get_Device_Adjustment( TT_Byte* device,
274 void OTL_Get_Base_Coordinate( TT_Byte* base_coord,
275 OTL_BaseCoord* coord );
279 TT_Int OTL_ValueRecord_Size( TT_UShort value_format );
283 void OTL_Get_ValueRecord( TT_Byte* value_record,
284 TT_UShort value_format,
286 OTL_ValueRecord* record );
290 void OTL_Get_Anchor( TT_Byte* anchor_table,
291 OTL_Anchor* anchor );
295 void OTL_Get_Mark( TT_Byte* mark_array,
298 OTL_Anchor* anchor );
302 #define OTL_Byte(p) (p++, p[-1])
304 #define OTL_UShort(p) (p+=2, ((TT_UShort)p[-2] << 8) | p[-1])
306 #define OTL_ULong(p) (p+=4, ((TT_ULong)p[-4] << 24) | \
307 ((TT_ULong)p[-3] << 16) | \
308 ((TT_ULong)p[-2] << 8 ) | p[-1] )
310 #endif /* OLTYPES_H */