[OT] Match struct with HB's
[framework/uifw/harfbuzz.git] / src / hb-ot-layout.cc
1 /*
2  * Copyright (C) 1998-2004  David Turner and Werner Lemberg
3  * Copyright (C) 2006  Behdad Esfahbod
4  * Copyright (C) 2007,2008,2009  Red Hat, Inc.
5  *
6  *  This is part of HarfBuzz, an OpenType Layout engine library.
7  *
8  * Permission is hereby granted, without written agreement and without
9  * license or royalty fees, to use, copy, modify, and distribute this
10  * software and its documentation for any purpose, provided that the
11  * above copyright notice and the following two paragraphs appear in
12  * all copies of this software.
13  *
14  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
15  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
17  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18  * DAMAGE.
19  *
20  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
21  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
23  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
24  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25  *
26  * Red Hat Author(s): Behdad Esfahbod
27  */
28
29 #define HB_OT_LAYOUT_CC
30
31 /* XXX */
32 #include "hb-buffer-private.h"
33
34 #include "hb-ot-layout.h"
35 #include "hb-ot-layout-private.h"
36
37 #include "hb-ot-layout-open-private.h"
38 #include "hb-ot-layout-gdef-private.h"
39 #include "hb-ot-layout-gsub-private.h"
40 #include "hb-ot-layout-gpos-private.h"
41
42
43 #include <stdlib.h>
44 #include <string.h>
45
46
47 hb_ot_layout_t *
48 hb_ot_layout_create (void)
49 {
50   hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t));
51
52   layout->gdef = &Null(GDEF);
53   layout->gsub = &Null(GSUB);
54   layout->gpos = &Null(GPOS);
55
56   return layout;
57 }
58
59 hb_bool_t
60 hb_ot_layout_has_substitution (hb_ot_layout_t *layout)
61 {
62   return layout->gsub != &Null(GSUB);
63 }
64
65 hb_bool_t
66 hb_ot_layout_has_positioning (hb_ot_layout_t *layout)
67 {
68   return layout->gpos != &Null(GPOS);
69 }
70
71 hb_ot_layout_t *
72 hb_ot_layout_create_for_data (const char *font_data,
73                               int         face_index)
74 {
75   hb_ot_layout_t *layout;
76
77   if (HB_UNLIKELY (font_data == NULL))
78     return hb_ot_layout_create ();
79
80   layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t));
81
82   const OpenTypeFontFile &font = OpenTypeFontFile::get_for_data (font_data);
83   const OpenTypeFontFace &face = font.get_face (face_index);
84
85   layout->gdef = &GDEF::get_for_data (font.get_table_data (face.get_table_by_tag (GDEF::Tag)));
86   layout->gsub = &GSUB::get_for_data (font.get_table_data (face.get_table_by_tag (GSUB::Tag)));
87   layout->gpos = &GPOS::get_for_data (font.get_table_data (face.get_table_by_tag (GPOS::Tag)));
88
89   return layout;
90 }
91
92 hb_ot_layout_t *
93 hb_ot_layout_create_for_tables (const char *gdef_data,
94                                 const char *gsub_data,
95                                 const char *gpos_data)
96 {
97   hb_ot_layout_t *layout;
98
99   if (HB_UNLIKELY (gdef_data == NULL && gsub_data == NULL && gpos_data == NULL))
100     return hb_ot_layout_create ();
101
102   layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t));
103
104   layout->gdef = &GDEF::get_for_data (gdef_data);
105   layout->gsub = &GSUB::get_for_data (gsub_data);
106   layout->gpos = &GPOS::get_for_data (gpos_data);
107
108   return layout;
109 }
110
111 void
112 hb_ot_layout_destroy (hb_ot_layout_t *layout)
113 {
114   free (layout);
115 }
116
117 void
118 hb_ot_layout_set_scale (hb_ot_layout_t *layout,
119                         hb_16dot16_t x_scale, hb_16dot16_t y_scale)
120 {
121   layout->gpos_info.x_scale = x_scale;
122   layout->gpos_info.y_scale = y_scale;
123 }
124
125 void
126 hb_ot_layout_set_ppem (hb_ot_layout_t *layout,
127                        unsigned int x_ppem, unsigned int y_ppem)
128 {
129   layout->gpos_info.x_ppem = x_ppem;
130   layout->gpos_info.y_ppem = y_ppem;
131 }
132
133
134 /*
135  * GDEF
136  */
137
138 /* TODO the public class_t is a mess */
139
140 hb_bool_t
141 hb_ot_layout_has_font_glyph_classes (hb_ot_layout_t *layout)
142 {
143   return layout->gdef->has_glyph_classes ();
144 }
145
146 HB_INTERNAL hb_bool_t
147 _hb_ot_layout_has_new_glyph_classes (hb_ot_layout_t *layout)
148 {
149   return layout->new_gdef.len > 0;
150 }
151
152 HB_INTERNAL unsigned int
153 _hb_ot_layout_get_glyph_property (hb_ot_layout_t *layout,
154                                   hb_codepoint_t  glyph)
155 {
156   hb_ot_layout_class_t klass;
157
158   klass = layout->gdef->get_glyph_class (glyph);
159
160   if (!klass && glyph < layout->new_gdef.len)
161     klass = layout->new_gdef.klasses[glyph];
162
163   switch (klass) {
164   default:
165   case GDEF::UnclassifiedGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED;
166   case GDEF::BaseGlyph:         return HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
167   case GDEF::LigatureGlyph:     return HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE;
168   case GDEF::ComponentGlyph:    return HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT;
169   case GDEF::MarkGlyph:
170         /* TODO old harfbuzz doesn't always parse mark attachments as it says it was
171          * introduced without a version bump, so it may not be safe */
172         klass = layout->gdef->get_mark_attachment_type (glyph);
173         return HB_OT_LAYOUT_GLYPH_CLASS_MARK + (klass << 8);
174   }
175 }
176
177 HB_INTERNAL hb_bool_t
178 _hb_ot_layout_check_glyph_property (hb_ot_layout_t  *layout,
179                                     hb_glyph_info_t *ginfo,
180                                     unsigned int     lookup_flags,
181                                     unsigned int    *property_out)
182 {
183   unsigned int property;
184
185   if (ginfo->internal == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN)
186     ginfo->internal = _hb_ot_layout_get_glyph_property (layout, ginfo->gindex);
187   property = ginfo->internal;
188   if (property_out)
189     *property_out = property;
190
191   /* Not covered, if, for example, glyph class is ligature and
192    * lookup_flags includes LookupFlags::IgnoreLigatures
193    */
194   if (property & lookup_flags)
195     return false;
196
197   if (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)
198   {
199     /* If using mark filtering sets, the high short of
200      * lookup_flags has the set index.
201      */
202     if (lookup_flags & LookupFlag::UseMarkFilteringSet)
203       return layout->gdef->mark_set_covers (lookup_flags >> 16, ginfo->gindex);
204
205     /* The second byte of lookup_flags has the meaning
206      * "ignore marks of attachment type different than
207      * the attachment type specified."
208      */
209     if (lookup_flags & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType)
210       return (lookup_flags & LookupFlag::MarkAttachmentType) == (property & LookupFlag::MarkAttachmentType);
211   }
212
213   return true;
214 }
215
216 HB_INTERNAL hb_bool_t
217 _hb_ot_layout_skip_mark (hb_ot_layout_t  *layout,
218                          hb_glyph_info_t *ginfo,
219                          unsigned int     lookup_flags,
220                          unsigned int    *property_out)
221 {
222   unsigned int property;
223
224   if (ginfo->internal == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN)
225     ginfo->internal = _hb_ot_layout_get_glyph_property (layout, ginfo->gindex);
226   property = ginfo->internal;
227   if (property_out)
228     *property_out = property;
229
230   if (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)
231   {
232     /* Skip mark if lookup_flags includes LookupFlags::IgnoreMarks */
233     if (lookup_flags & LookupFlag::IgnoreMarks)
234       return true;
235
236     /* If using mark filtering sets, the high short of lookup_flags has the set index. */
237     if (lookup_flags & LookupFlag::UseMarkFilteringSet)
238       return !layout->gdef->mark_set_covers (lookup_flags >> 16, ginfo->gindex);
239
240     /* The second byte of lookup_flags has the meaning "ignore marks of attachment type
241      * different than the attachment type specified." */
242     if (lookup_flags & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType)
243       return (lookup_flags & LookupFlag::MarkAttachmentType) != (property & LookupFlag::MarkAttachmentType);
244   }
245
246   return false;
247 }
248
249 HB_INTERNAL void
250 _hb_ot_layout_set_glyph_property (hb_ot_layout_t *layout,
251                                   hb_codepoint_t  glyph,
252                                   unsigned int    property)
253 { hb_ot_layout_set_glyph_class (layout, glyph, (hb_ot_layout_glyph_class_t) (property & 0xff)); }
254
255
256 hb_ot_layout_glyph_class_t
257 hb_ot_layout_get_glyph_class (hb_ot_layout_t *layout,
258                               hb_codepoint_t  glyph)
259 { return (hb_ot_layout_glyph_class_t) (_hb_ot_layout_get_glyph_property (layout, glyph) & 0xff); }
260
261 void
262 hb_ot_layout_set_glyph_class (hb_ot_layout_t             *layout,
263                               hb_codepoint_t              glyph,
264                               hb_ot_layout_glyph_class_t  klass)
265 {
266   /* TODO optimize this, similar to old harfbuzz code for example */
267
268   hb_ot_layout_class_t gdef_klass;
269   int len = layout->new_gdef.len;
270
271   if (HB_UNLIKELY (glyph > 65535))
272     return;
273
274   if (glyph >= len) {
275     int new_len;
276     unsigned char *new_klasses;
277
278     new_len = len == 0 ? 120 : 2 * len;
279     if (new_len > 65535)
280       new_len = 65535;
281     new_klasses = (unsigned char *) realloc (layout->new_gdef.klasses, new_len * sizeof (unsigned char));
282
283     if (HB_UNLIKELY (!new_klasses))
284       return;
285
286     memset (new_klasses + len, 0, new_len - len);
287
288     layout->new_gdef.klasses = new_klasses;
289     layout->new_gdef.len = new_len;
290   }
291
292   switch (klass) {
293   default:
294   case HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED:   gdef_klass = GDEF::UnclassifiedGlyph;   break;
295   case HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH:     gdef_klass = GDEF::BaseGlyph;           break;
296   case HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE:       gdef_klass = GDEF::LigatureGlyph;       break;
297   case HB_OT_LAYOUT_GLYPH_CLASS_MARK:           gdef_klass = GDEF::MarkGlyph;           break;
298   case HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT:      gdef_klass = GDEF::ComponentGlyph;      break;
299   }
300
301   layout->new_gdef.klasses[glyph] = gdef_klass;
302   return;
303 }
304
305 void
306 hb_ot_layout_build_glyph_classes (hb_ot_layout_t *layout,
307                                   uint16_t        num_total_glyphs,
308                                   hb_codepoint_t *glyphs,
309                                   unsigned char  *klasses,
310                                   uint16_t        count)
311 {
312   if (HB_UNLIKELY (!count || !glyphs || !klasses))
313     return;
314
315   if (layout->new_gdef.len == 0) {
316     layout->new_gdef.klasses = (unsigned char *) calloc (num_total_glyphs, sizeof (unsigned char));
317     layout->new_gdef.len = count;
318   }
319
320   for (unsigned int i = 0; i < count; i++)
321     hb_ot_layout_set_glyph_class (layout, glyphs[i], (hb_ot_layout_glyph_class_t) klasses[i]);
322 }
323
324 hb_bool_t
325 hb_ot_layout_get_attach_points (hb_ot_layout_t *layout,
326                                 hb_codepoint_t  glyph,
327                                 unsigned int   *point_count /* IN/OUT */,
328                                 unsigned int   *point_array /* OUT */)
329 {
330   return layout->gdef->get_attach_points (glyph, point_count, point_array);
331 }
332
333 hb_bool_t
334 hb_ot_layout_get_lig_carets (hb_ot_layout_t *layout,
335                              hb_codepoint_t  glyph,
336                              unsigned int   *caret_count /* IN/OUT */,
337                              int            *caret_array /* OUT */)
338 {
339   return layout->gdef->get_lig_carets (layout, glyph, caret_count, caret_array);
340 }
341
342 /*
343  * GSUB/GPOS
344  */
345
346 static const GSUBGPOS&
347 get_gsubgpos_table (hb_ot_layout_t            *layout,
348                     hb_ot_layout_table_type_t  table_type)
349 {
350   switch (table_type) {
351     case HB_OT_LAYOUT_TABLE_TYPE_GSUB: return *(layout->gsub);
352     case HB_OT_LAYOUT_TABLE_TYPE_GPOS: return *(layout->gpos);
353     default:                           return Null(GSUBGPOS);
354   }
355 }
356
357
358 unsigned int
359 hb_ot_layout_table_get_script_count (hb_ot_layout_t            *layout,
360                                      hb_ot_layout_table_type_t  table_type)
361 {
362   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
363
364   return g.get_script_count ();
365 }
366
367 hb_tag_t
368 hb_ot_layout_table_get_script_tag (hb_ot_layout_t            *layout,
369                                    hb_ot_layout_table_type_t  table_type,
370                                    unsigned int               script_index)
371 {
372   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
373
374   return g.get_script_tag (script_index);
375 }
376
377 hb_bool_t
378 hb_ot_layout_table_find_script (hb_ot_layout_t            *layout,
379                                 hb_ot_layout_table_type_t  table_type,
380                                 hb_tag_t                   script_tag,
381                                 unsigned int              *script_index)
382 {
383   ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX);
384   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
385
386   if (g.find_script_index (script_tag, script_index))
387     return TRUE;
388
389   /* try finding 'DFLT' */
390   if (g.find_script_index (HB_OT_LAYOUT_TAG_DEFAULT_SCRIPT, script_index))
391     return FALSE;
392
393   /* try with 'dflt'; MS site has had typos and many fonts use it now :( */
394   if (g.find_script_index (HB_OT_LAYOUT_TAG_DEFAULT_LANGUAGE, script_index))
395     return FALSE;
396
397   if (script_index) *script_index = HB_OT_LAYOUT_NO_SCRIPT_INDEX;
398   return FALSE;
399 }
400
401 unsigned int
402 hb_ot_layout_table_get_feature_count (hb_ot_layout_t            *layout,
403                                       hb_ot_layout_table_type_t  table_type)
404 {
405   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
406
407   return g.get_feature_count ();
408 }
409
410 hb_tag_t
411 hb_ot_layout_table_get_feature_tag (hb_ot_layout_t            *layout,
412                                     hb_ot_layout_table_type_t  table_type,
413                                     unsigned int               feature_index)
414 {
415   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
416
417   return g.get_feature_tag (feature_index);
418 }
419
420 hb_bool_t
421 hb_ot_layout_table_find_feature (hb_ot_layout_t            *layout,
422                                  hb_ot_layout_table_type_t  table_type,
423                                  hb_tag_t                   feature_tag,
424                                  unsigned int              *feature_index)
425 {
426   ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX);
427   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
428
429   if (g.find_feature_index (feature_tag, feature_index))
430     return TRUE;
431
432   if (feature_index) *feature_index = HB_OT_LAYOUT_NO_FEATURE_INDEX;
433   return FALSE;
434 }
435
436 unsigned int
437 hb_ot_layout_table_get_lookup_count (hb_ot_layout_t            *layout,
438                                      hb_ot_layout_table_type_t  table_type)
439 {
440   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
441
442   return g.get_lookup_count ();
443 }
444
445
446 unsigned int
447 hb_ot_layout_script_get_language_count (hb_ot_layout_t            *layout,
448                                         hb_ot_layout_table_type_t  table_type,
449                                         unsigned int               script_index)
450 {
451   const Script &s = get_gsubgpos_table (layout, table_type).get_script (script_index);
452
453   return s.get_lang_sys_count ();
454 }
455
456 hb_tag_t
457 hb_ot_layout_script_get_language_tag (hb_ot_layout_t            *layout,
458                                       hb_ot_layout_table_type_t  table_type,
459                                       unsigned int               script_index,
460                                       unsigned int               language_index)
461 {
462   const Script &s = get_gsubgpos_table (layout, table_type).get_script (script_index);
463
464   return s.get_lang_sys_tag (language_index);
465 }
466
467 hb_bool_t
468 hb_ot_layout_script_find_language (hb_ot_layout_t            *layout,
469                                    hb_ot_layout_table_type_t  table_type,
470                                    unsigned int               script_index,
471                                    hb_tag_t                   language_tag,
472                                    unsigned int              *language_index)
473 {
474   ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX);
475   const Script &s = get_gsubgpos_table (layout, table_type).get_script (script_index);
476
477   if (s.find_lang_sys_index (language_tag, language_index))
478     return TRUE;
479
480   /* try with 'dflt'; MS site has had typos and many fonts use it now :( */
481   if (s.find_lang_sys_index (HB_OT_LAYOUT_TAG_DEFAULT_LANGUAGE, language_index))
482     return FALSE;
483
484   if (language_index) *language_index = HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX;
485   return FALSE;
486 }
487
488 hb_bool_t
489 hb_ot_layout_language_get_required_feature_index (hb_ot_layout_t            *layout,
490                                                   hb_ot_layout_table_type_t  table_type,
491                                                   unsigned int               script_index,
492                                                   unsigned int               language_index,
493                                                   unsigned int              *feature_index)
494 {
495   const LangSys &l = get_gsubgpos_table (layout, table_type).get_script (script_index).get_lang_sys (language_index);
496
497   if (feature_index) *feature_index = l.get_required_feature_index ();
498
499   return l.has_required_feature ();
500 }
501
502 unsigned int
503 hb_ot_layout_language_get_feature_count (hb_ot_layout_t            *layout,
504                                          hb_ot_layout_table_type_t  table_type,
505                                          unsigned int               script_index,
506                                          unsigned int               language_index)
507 {
508   const LangSys &l = get_gsubgpos_table (layout, table_type).get_script (script_index).get_lang_sys (language_index);
509
510   return l.get_feature_count ();
511 }
512
513 unsigned int
514 hb_ot_layout_language_get_feature_index (hb_ot_layout_t            *layout,
515                                          hb_ot_layout_table_type_t  table_type,
516                                          unsigned int               script_index,
517                                          unsigned int               language_index,
518                                          unsigned int               num_feature)
519 {
520   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
521   const LangSys &l = g.get_script (script_index).get_lang_sys (language_index);
522
523   return l.get_feature_index (num_feature);
524 }
525
526 hb_tag_t
527 hb_ot_layout_language_get_feature_tag (hb_ot_layout_t            *layout,
528                                        hb_ot_layout_table_type_t  table_type,
529                                        unsigned int               script_index,
530                                        unsigned int               language_index,
531                                        unsigned int               num_feature)
532 {
533   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
534   const LangSys &l = g.get_script (script_index).get_lang_sys (language_index);
535   unsigned int feature_index = l.get_feature_index (num_feature);
536
537   return g.get_feature_tag (feature_index);
538 }
539
540
541 hb_bool_t
542 hb_ot_layout_language_find_feature (hb_ot_layout_t            *layout,
543                                     hb_ot_layout_table_type_t  table_type,
544                                     unsigned int               script_index,
545                                     unsigned int               language_index,
546                                     hb_tag_t                   feature_tag,
547                                     unsigned int              *feature_index)
548 {
549   ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX);
550   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
551   const LangSys &l = g.get_script (script_index).get_lang_sys (language_index);
552
553   unsigned int num_features = l.get_feature_count ();
554   for (unsigned int i = 0; i < num_features; i++) {
555     unsigned int f_index = l.get_feature_index (i);
556
557     if (feature_tag == g.get_feature_tag (f_index)) {
558       if (feature_index) *feature_index = f_index;
559       return TRUE;
560     }
561   }
562
563   if (feature_index) *feature_index = HB_OT_LAYOUT_NO_FEATURE_INDEX;
564   return FALSE;
565 }
566
567 unsigned int
568 hb_ot_layout_feature_get_lookup_count (hb_ot_layout_t            *layout,
569                                        hb_ot_layout_table_type_t  table_type,
570                                        unsigned int               feature_index)
571 {
572   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
573   const Feature &f = g.get_feature (feature_index);
574
575   return f.get_lookup_count ();
576 }
577
578 unsigned int
579 hb_ot_layout_feature_get_lookup_index (hb_ot_layout_t            *layout,
580                                        hb_ot_layout_table_type_t  table_type,
581                                        unsigned int               feature_index,
582                                        unsigned int               num_lookup)
583 {
584   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
585   const Feature &f = g.get_feature (feature_index);
586
587   return f.get_lookup_index (num_lookup);
588 }
589
590 /*
591  * GSUB
592  */
593
594 hb_bool_t
595 hb_ot_layout_substitute_lookup (hb_ot_layout_t              *layout,
596                                 hb_buffer_t                 *buffer,
597                                 unsigned int                 lookup_index,
598                                 hb_ot_layout_feature_mask_t  mask)
599 {
600   return layout->gsub->substitute_lookup (layout, buffer, lookup_index, mask);
601 }
602
603 /*
604  * GPOS
605  */
606
607 hb_bool_t
608 hb_ot_layout_position_lookup   (hb_ot_layout_t              *layout,
609                                 hb_buffer_t                 *buffer,
610                                 unsigned int                 lookup_index,
611                                 hb_ot_layout_feature_mask_t  mask)
612 {
613   return layout->gpos->position_lookup (layout, buffer, lookup_index, mask);
614 }