@@ -125,103 +125,6 @@ pub trait LayoutTableExt {
125
125
) -> Option < FeatureIndex > ;
126
126
}
127
127
128
- impl LayoutTableExt for ttf_parser:: opentype_layout:: LayoutTable < ' _ > {
129
- // hb_ot_layout_table_select_script
130
- /// Returns true + index and tag of the first found script tag in the given GSUB or GPOS table
131
- /// or false + index and tag if falling back to a default script.
132
- fn select_script ( & self , script_tags : & [ hb_tag_t ] ) -> Option < ( bool , ScriptIndex , hb_tag_t ) > {
133
- for & tag in script_tags {
134
- if let Some ( index) = self . scripts . index ( tag) {
135
- return Some ( ( true , index, tag) ) ;
136
- }
137
- }
138
-
139
- for & tag in & [
140
- // try finding 'DFLT'
141
- hb_tag_t:: default_script ( ) ,
142
- // try with 'dflt'; MS site has had typos and many fonts use it now :(
143
- hb_tag_t:: default_language ( ) ,
144
- // try with 'latn'; some old fonts put their features there even though
145
- // they're really trying to support Thai, for example :(
146
- hb_tag_t:: from_bytes ( b"latn" ) ,
147
- ] {
148
- if let Some ( index) = self . scripts . index ( tag) {
149
- return Some ( ( false , index, tag) ) ;
150
- }
151
- }
152
-
153
- None
154
- }
155
-
156
- // hb_ot_layout_script_select_language
157
- /// Returns the index of the first found language tag in the given GSUB or GPOS table,
158
- /// underneath the specified script index.
159
- fn select_script_language (
160
- & self ,
161
- script_index : ScriptIndex ,
162
- lang_tags : & [ hb_tag_t ] ,
163
- ) -> Option < LanguageIndex > {
164
- let script = self . scripts . get ( script_index) ?;
165
-
166
- for & tag in lang_tags {
167
- if let Some ( index) = script. languages . index ( tag) {
168
- return Some ( index) ;
169
- }
170
- }
171
-
172
- // try finding 'dflt'
173
- if let Some ( index) = script. languages . index ( hb_tag_t:: default_language ( ) ) {
174
- return Some ( index) ;
175
- }
176
-
177
- None
178
- }
179
-
180
- // hb_ot_layout_language_get_required_feature
181
- /// Returns the index and tag of a required feature in the given GSUB or GPOS table,
182
- /// underneath the specified script and language.
183
- fn get_required_language_feature (
184
- & self ,
185
- script_index : ScriptIndex ,
186
- lang_index : Option < LanguageIndex > ,
187
- ) -> Option < ( FeatureIndex , hb_tag_t ) > {
188
- let script = self . scripts . get ( script_index) ?;
189
- let sys = match lang_index {
190
- Some ( index) => script. languages . get ( index) ?,
191
- None => script. default_language ?,
192
- } ;
193
- let idx = sys. required_feature ?;
194
- let tag = self . features . get ( idx) ?. tag ;
195
- Some ( ( idx, tag) )
196
- }
197
-
198
- // hb_ot_layout_language_find_feature
199
- /// Returns the index of a given feature tag in the given GSUB or GPOS table,
200
- /// underneath the specified script and language.
201
- fn find_language_feature (
202
- & self ,
203
- script_index : ScriptIndex ,
204
- lang_index : Option < LanguageIndex > ,
205
- feature_tag : hb_tag_t ,
206
- ) -> Option < FeatureIndex > {
207
- let script = self . scripts . get ( script_index) ?;
208
- let sys = match lang_index {
209
- Some ( index) => script. languages . get ( index) ?,
210
- None => script. default_language ?,
211
- } ;
212
-
213
- for i in 0 ..sys. feature_indices . len ( ) {
214
- if let Some ( index) = sys. feature_indices . get ( i) {
215
- if self . features . get ( index) . map ( |v| v. tag ) == Some ( feature_tag) {
216
- return Some ( index) ;
217
- }
218
- }
219
- }
220
-
221
- None
222
- }
223
- }
224
-
225
128
/// Called before substitution lookups are performed, to ensure that glyph
226
129
/// class and other properties are set on the glyphs in the buffer.
227
130
pub fn hb_ot_layout_substitute_start ( face : & hb_font_t , buffer : & mut hb_buffer_t ) {
0 commit comments