[HB] Move direction to buffer
[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_hinting (hb_ot_layout_t *layout,
119                           hb_bool_t hinted)
120 {
121   layout->gpos_info.dvi = !hinted;
122 }
123
124 void
125 hb_ot_layout_set_scale (hb_ot_layout_t *layout,
126                         hb_16dot16_t x_scale, hb_16dot16_t y_scale)
127 {
128   layout->gpos_info.x_scale = x_scale;
129   layout->gpos_info.y_scale = y_scale;
130 }
131
132 void
133 hb_ot_layout_set_ppem (hb_ot_layout_t *layout,
134                        unsigned int x_ppem, unsigned int y_ppem)
135 {
136   layout->gpos_info.x_ppem = x_ppem;
137   layout->gpos_info.y_ppem = y_ppem;
138 }
139
140
141 /*
142  * GDEF
143  */
144
145 /* TODO the public class_t is a mess */
146
147 hb_bool_t
148 hb_ot_layout_has_font_glyph_classes (hb_ot_layout_t *layout)
149 {
150   return layout->gdef->has_glyph_classes ();
151 }
152
153 HB_INTERNAL hb_bool_t
154 _hb_ot_layout_has_new_glyph_classes (hb_ot_layout_t *layout)
155 {
156   return layout->new_gdef.len > 0;
157 }
158
159 HB_INTERNAL unsigned int
160 _hb_ot_layout_get_glyph_property (hb_ot_layout_t *layout,
161                                   hb_codepoint_t  glyph)
162 {
163   hb_ot_layout_class_t klass;
164
165   klass = layout->gdef->get_glyph_class (glyph);
166
167   if (!klass && glyph < layout->new_gdef.len)
168     klass = layout->new_gdef.klasses[glyph];
169
170   switch (klass) {
171   default:
172   case GDEF::UnclassifiedGlyph: return HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED;
173   case GDEF::BaseGlyph:         return HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH;
174   case GDEF::LigatureGlyph:     return HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE;
175   case GDEF::ComponentGlyph:    return HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT;
176   case GDEF::MarkGlyph:
177         /* TODO old harfbuzz doesn't always parse mark attachments as it says it was
178          * introduced without a version bump, so it may not be safe */
179         klass = layout->gdef->get_mark_attachment_type (glyph);
180         return HB_OT_LAYOUT_GLYPH_CLASS_MARK + (klass << 8);
181   }
182 }
183
184 HB_INTERNAL hb_bool_t
185 _hb_ot_layout_check_glyph_property (hb_ot_layout_t  *layout,
186                                     hb_glyph_info_t *ginfo,
187                                     unsigned int     lookup_flags,
188                                     unsigned int    *property_out)
189 {
190   unsigned int property;
191
192   if (ginfo->gproperty == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN)
193     ginfo->gproperty = _hb_ot_layout_get_glyph_property (layout, ginfo->gindex);
194   property = ginfo->gproperty;
195   if (property_out)
196     *property_out = property;
197
198   /* Not covered, if, for example, glyph class is ligature and
199    * lookup_flags includes LookupFlags::IgnoreLigatures
200    */
201   if (property & lookup_flags)
202     return false;
203
204   if (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)
205   {
206     /* If using mark filtering sets, the high short of
207      * lookup_flags has the set index.
208      */
209     if (lookup_flags & LookupFlag::UseMarkFilteringSet)
210       return layout->gdef->mark_set_covers (lookup_flags >> 16, ginfo->gindex);
211
212     /* The second byte of lookup_flags has the meaning
213      * "ignore marks of attachment type different than
214      * the attachment type specified."
215      */
216     if (lookup_flags & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType)
217       return (lookup_flags & LookupFlag::MarkAttachmentType) == (property & LookupFlag::MarkAttachmentType);
218   }
219
220   return true;
221 }
222
223 HB_INTERNAL hb_bool_t
224 _hb_ot_layout_skip_mark (hb_ot_layout_t  *layout,
225                          hb_glyph_info_t *ginfo,
226                          unsigned int     lookup_flags,
227                          unsigned int    *property_out)
228 {
229   unsigned int property;
230
231   if (ginfo->gproperty == HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN)
232     ginfo->gproperty = _hb_ot_layout_get_glyph_property (layout, ginfo->gindex);
233   property = ginfo->gproperty;
234   if (property_out)
235     *property_out = property;
236
237   if (property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)
238   {
239     /* Skip mark if lookup_flags includes LookupFlags::IgnoreMarks */
240     if (lookup_flags & LookupFlag::IgnoreMarks)
241       return true;
242
243     /* If using mark filtering sets, the high short of lookup_flags has the set index. */
244     if (lookup_flags & LookupFlag::UseMarkFilteringSet)
245       return !layout->gdef->mark_set_covers (lookup_flags >> 16, ginfo->gindex);
246
247     /* The second byte of lookup_flags has the meaning "ignore marks of attachment type
248      * different than the attachment type specified." */
249     if (lookup_flags & LookupFlag::MarkAttachmentType && property & LookupFlag::MarkAttachmentType)
250       return (lookup_flags & LookupFlag::MarkAttachmentType) != (property & LookupFlag::MarkAttachmentType);
251   }
252
253   return false;
254 }
255
256 HB_INTERNAL void
257 _hb_ot_layout_set_glyph_property (hb_ot_layout_t *layout,
258                                   hb_codepoint_t  glyph,
259                                   unsigned int    property)
260 { hb_ot_layout_set_glyph_class (layout, glyph, (hb_ot_layout_glyph_class_t) (property & 0xff)); }
261
262
263 hb_ot_layout_glyph_class_t
264 hb_ot_layout_get_glyph_class (hb_ot_layout_t *layout,
265                               hb_codepoint_t  glyph)
266 { return (hb_ot_layout_glyph_class_t) (_hb_ot_layout_get_glyph_property (layout, glyph) & 0xff); }
267
268 void
269 hb_ot_layout_set_glyph_class (hb_ot_layout_t             *layout,
270                               hb_codepoint_t              glyph,
271                               hb_ot_layout_glyph_class_t  klass)
272 {
273   /* TODO optimize this, similar to old harfbuzz code for example */
274
275   hb_ot_layout_class_t gdef_klass;
276   int len = layout->new_gdef.len;
277
278   if (HB_UNLIKELY (glyph > 65535))
279     return;
280
281   if (glyph >= len) {
282     int new_len;
283     unsigned char *new_klasses;
284
285     new_len = len == 0 ? 120 : 2 * len;
286     if (new_len > 65535)
287       new_len = 65535;
288     new_klasses = (unsigned char *) realloc (layout->new_gdef.klasses, new_len * sizeof (unsigned char));
289
290     if (HB_UNLIKELY (!new_klasses))
291       return;
292
293     memset (new_klasses + len, 0, new_len - len);
294
295     layout->new_gdef.klasses = new_klasses;
296     layout->new_gdef.len = new_len;
297   }
298
299   switch (klass) {
300   default:
301   case HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED:   gdef_klass = GDEF::UnclassifiedGlyph;   break;
302   case HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH:     gdef_klass = GDEF::BaseGlyph;           break;
303   case HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE:       gdef_klass = GDEF::LigatureGlyph;       break;
304   case HB_OT_LAYOUT_GLYPH_CLASS_MARK:           gdef_klass = GDEF::MarkGlyph;           break;
305   case HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT:      gdef_klass = GDEF::ComponentGlyph;      break;
306   }
307
308   layout->new_gdef.klasses[glyph] = gdef_klass;
309   return;
310 }
311
312 void
313 hb_ot_layout_build_glyph_classes (hb_ot_layout_t *layout,
314                                   uint16_t        num_total_glyphs,
315                                   hb_codepoint_t *glyphs,
316                                   unsigned char  *klasses,
317                                   uint16_t        count)
318 {
319   if (HB_UNLIKELY (!count || !glyphs || !klasses))
320     return;
321
322   if (layout->new_gdef.len == 0) {
323     layout->new_gdef.klasses = (unsigned char *) calloc (num_total_glyphs, sizeof (unsigned char));
324     layout->new_gdef.len = count;
325   }
326
327   for (unsigned int i = 0; i < count; i++)
328     hb_ot_layout_set_glyph_class (layout, glyphs[i], (hb_ot_layout_glyph_class_t) klasses[i]);
329 }
330
331 hb_bool_t
332 hb_ot_layout_get_attach_points (hb_ot_layout_t *layout,
333                                 hb_codepoint_t  glyph,
334                                 unsigned int   *point_count /* IN/OUT */,
335                                 unsigned int   *point_array /* OUT */)
336 {
337   return layout->gdef->get_attach_points (glyph, point_count, point_array);
338 }
339
340 hb_bool_t
341 hb_ot_layout_get_lig_carets (hb_ot_layout_t *layout,
342                              hb_codepoint_t  glyph,
343                              unsigned int   *caret_count /* IN/OUT */,
344                              int            *caret_array /* OUT */)
345 {
346   return layout->gdef->get_lig_carets (layout, glyph, caret_count, caret_array);
347 }
348
349 /*
350  * GSUB/GPOS
351  */
352
353 static const GSUBGPOS&
354 get_gsubgpos_table (hb_ot_layout_t            *layout,
355                     hb_ot_layout_table_type_t  table_type)
356 {
357   switch (table_type) {
358     case HB_OT_LAYOUT_TABLE_TYPE_GSUB: return *(layout->gsub);
359     case HB_OT_LAYOUT_TABLE_TYPE_GPOS: return *(layout->gpos);
360     default:                           return Null(GSUBGPOS);
361   }
362 }
363
364
365 unsigned int
366 hb_ot_layout_table_get_script_count (hb_ot_layout_t            *layout,
367                                      hb_ot_layout_table_type_t  table_type)
368 {
369   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
370
371   return g.get_script_count ();
372 }
373
374 hb_tag_t
375 hb_ot_layout_table_get_script_tag (hb_ot_layout_t            *layout,
376                                    hb_ot_layout_table_type_t  table_type,
377                                    unsigned int               script_index)
378 {
379   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
380
381   return g.get_script_tag (script_index);
382 }
383
384 hb_bool_t
385 hb_ot_layout_table_find_script (hb_ot_layout_t            *layout,
386                                 hb_ot_layout_table_type_t  table_type,
387                                 hb_tag_t                   script_tag,
388                                 unsigned int              *script_index)
389 {
390   ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX);
391   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
392
393   if (g.find_script_index (script_tag, script_index))
394     return TRUE;
395
396   /* try finding 'DFLT' */
397   if (g.find_script_index (HB_OT_LAYOUT_TAG_DEFAULT_SCRIPT, script_index))
398     return FALSE;
399
400   /* try with 'dflt'; MS site has had typos and many fonts use it now :( */
401   if (g.find_script_index (HB_OT_LAYOUT_TAG_DEFAULT_LANGUAGE, script_index))
402     return FALSE;
403
404   if (script_index) *script_index = HB_OT_LAYOUT_NO_SCRIPT_INDEX;
405   return FALSE;
406 }
407
408 unsigned int
409 hb_ot_layout_table_get_feature_count (hb_ot_layout_t            *layout,
410                                       hb_ot_layout_table_type_t  table_type)
411 {
412   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
413
414   return g.get_feature_count ();
415 }
416
417 hb_tag_t
418 hb_ot_layout_table_get_feature_tag (hb_ot_layout_t            *layout,
419                                     hb_ot_layout_table_type_t  table_type,
420                                     unsigned int               feature_index)
421 {
422   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
423
424   return g.get_feature_tag (feature_index);
425 }
426
427 hb_bool_t
428 hb_ot_layout_table_find_feature (hb_ot_layout_t            *layout,
429                                  hb_ot_layout_table_type_t  table_type,
430                                  hb_tag_t                   feature_tag,
431                                  unsigned int              *feature_index)
432 {
433   ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX);
434   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
435
436   if (g.find_feature_index (feature_tag, feature_index))
437     return TRUE;
438
439   if (feature_index) *feature_index = HB_OT_LAYOUT_NO_FEATURE_INDEX;
440   return FALSE;
441 }
442
443 unsigned int
444 hb_ot_layout_table_get_lookup_count (hb_ot_layout_t            *layout,
445                                      hb_ot_layout_table_type_t  table_type)
446 {
447   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
448
449   return g.get_lookup_count ();
450 }
451
452
453 unsigned int
454 hb_ot_layout_script_get_language_count (hb_ot_layout_t            *layout,
455                                         hb_ot_layout_table_type_t  table_type,
456                                         unsigned int               script_index)
457 {
458   const Script &s = get_gsubgpos_table (layout, table_type).get_script (script_index);
459
460   return s.get_lang_sys_count ();
461 }
462
463 hb_tag_t
464 hb_ot_layout_script_get_language_tag (hb_ot_layout_t            *layout,
465                                       hb_ot_layout_table_type_t  table_type,
466                                       unsigned int               script_index,
467                                       unsigned int               language_index)
468 {
469   const Script &s = get_gsubgpos_table (layout, table_type).get_script (script_index);
470
471   return s.get_lang_sys_tag (language_index);
472 }
473
474 hb_bool_t
475 hb_ot_layout_script_find_language (hb_ot_layout_t            *layout,
476                                    hb_ot_layout_table_type_t  table_type,
477                                    unsigned int               script_index,
478                                    hb_tag_t                   language_tag,
479                                    unsigned int              *language_index)
480 {
481   ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX);
482   const Script &s = get_gsubgpos_table (layout, table_type).get_script (script_index);
483
484   if (s.find_lang_sys_index (language_tag, language_index))
485     return TRUE;
486
487   /* try with 'dflt'; MS site has had typos and many fonts use it now :( */
488   if (s.find_lang_sys_index (HB_OT_LAYOUT_TAG_DEFAULT_LANGUAGE, language_index))
489     return FALSE;
490
491   if (language_index) *language_index = HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX;
492   return FALSE;
493 }
494
495 hb_bool_t
496 hb_ot_layout_language_get_required_feature_index (hb_ot_layout_t            *layout,
497                                                   hb_ot_layout_table_type_t  table_type,
498                                                   unsigned int               script_index,
499                                                   unsigned int               language_index,
500                                                   unsigned int              *feature_index)
501 {
502   const LangSys &l = get_gsubgpos_table (layout, table_type).get_script (script_index).get_lang_sys (language_index);
503
504   if (feature_index) *feature_index = l.get_required_feature_index ();
505
506   return l.has_required_feature ();
507 }
508
509 unsigned int
510 hb_ot_layout_language_get_feature_count (hb_ot_layout_t            *layout,
511                                          hb_ot_layout_table_type_t  table_type,
512                                          unsigned int               script_index,
513                                          unsigned int               language_index)
514 {
515   const LangSys &l = get_gsubgpos_table (layout, table_type).get_script (script_index).get_lang_sys (language_index);
516
517   return l.get_feature_count ();
518 }
519
520 unsigned int
521 hb_ot_layout_language_get_feature_index (hb_ot_layout_t            *layout,
522                                          hb_ot_layout_table_type_t  table_type,
523                                          unsigned int               script_index,
524                                          unsigned int               language_index,
525                                          unsigned int               num_feature)
526 {
527   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
528   const LangSys &l = g.get_script (script_index).get_lang_sys (language_index);
529
530   return l.get_feature_index (num_feature);
531 }
532
533 hb_tag_t
534 hb_ot_layout_language_get_feature_tag (hb_ot_layout_t            *layout,
535                                        hb_ot_layout_table_type_t  table_type,
536                                        unsigned int               script_index,
537                                        unsigned int               language_index,
538                                        unsigned int               num_feature)
539 {
540   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
541   const LangSys &l = g.get_script (script_index).get_lang_sys (language_index);
542   unsigned int feature_index = l.get_feature_index (num_feature);
543
544   return g.get_feature_tag (feature_index);
545 }
546
547
548 hb_bool_t
549 hb_ot_layout_language_find_feature (hb_ot_layout_t            *layout,
550                                     hb_ot_layout_table_type_t  table_type,
551                                     unsigned int               script_index,
552                                     unsigned int               language_index,
553                                     hb_tag_t                   feature_tag,
554                                     unsigned int              *feature_index)
555 {
556   ASSERT_STATIC (NO_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX);
557   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
558   const LangSys &l = g.get_script (script_index).get_lang_sys (language_index);
559
560   unsigned int num_features = l.get_feature_count ();
561   for (unsigned int i = 0; i < num_features; i++) {
562     unsigned int f_index = l.get_feature_index (i);
563
564     if (feature_tag == g.get_feature_tag (f_index)) {
565       if (feature_index) *feature_index = f_index;
566       return TRUE;
567     }
568   }
569
570   if (feature_index) *feature_index = HB_OT_LAYOUT_NO_FEATURE_INDEX;
571   return FALSE;
572 }
573
574 unsigned int
575 hb_ot_layout_feature_get_lookup_count (hb_ot_layout_t            *layout,
576                                        hb_ot_layout_table_type_t  table_type,
577                                        unsigned int               feature_index)
578 {
579   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
580   const Feature &f = g.get_feature (feature_index);
581
582   return f.get_lookup_count ();
583 }
584
585 unsigned int
586 hb_ot_layout_feature_get_lookup_index (hb_ot_layout_t            *layout,
587                                        hb_ot_layout_table_type_t  table_type,
588                                        unsigned int               feature_index,
589                                        unsigned int               num_lookup)
590 {
591   const GSUBGPOS &g = get_gsubgpos_table (layout, table_type);
592   const Feature &f = g.get_feature (feature_index);
593
594   return f.get_lookup_index (num_lookup);
595 }
596
597 /*
598  * GSUB
599  */
600
601 hb_bool_t
602 hb_ot_layout_substitute_lookup (hb_ot_layout_t              *layout,
603                                 hb_buffer_t                 *buffer,
604                                 unsigned int                 lookup_index,
605                                 hb_ot_layout_feature_mask_t  mask)
606 {
607   return layout->gsub->substitute_lookup (layout, buffer, lookup_index, mask);
608 }
609
610 /*
611  * GPOS
612  */
613
614 hb_bool_t
615 hb_ot_layout_position_lookup   (hb_ot_layout_t              *layout,
616                                 hb_buffer_t                 *buffer,
617                                 unsigned int                 lookup_index,
618                                 hb_ot_layout_feature_mask_t  mask)
619 {
620   return layout->gpos->position_lookup (layout, buffer, lookup_index, mask);
621 }