1fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod/*
22409d5f8d7dd8b535ce5ea29e933f7db27d33793Behdad Esfahbod * Copyright © 2007,2008,2009  Red Hat, Inc.
3469524692bd0a258b28e63294c984e677a9c2477Behdad Esfahbod * Copyright © 2012,2013  Google, Inc.
4fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod *
5c755cb3e3ac55156d0d2ec05adea7a650b97cc41Behdad Esfahbod *  This is part of HarfBuzz, a text shaping library.
6fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod *
7fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * Permission is hereby granted, without written agreement and without
8fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this
9fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * software and its documentation for any purpose, provided that the
10fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * above copyright notice and the following two paragraphs appear in
11fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * all copies of this software.
12fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod *
13fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
17fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * DAMAGE.
18fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod *
19fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
22fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod *
25fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod * Red Hat Author(s): Behdad Esfahbod
26f860366456d9e59b139a940da6d89c3c4fb9e96eBehdad Esfahbod * Google Author(s): Behdad Esfahbod
27fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod */
28fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod
290f0cd9d361f1bb614aa3fd4616160d027062370eBehdad Esfahbod#ifndef HB_OT_LAYOUT_PRIVATE_HH
300f0cd9d361f1bb614aa3fd4616160d027062370eBehdad Esfahbod#define HB_OT_LAYOUT_PRIVATE_HH
31fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod
32c57d454accff66e5f2c58006e8fb40bc020b6182Behdad Esfahbod#include "hb-private.hh"
332c80296aa5991ad67483889147f5c84fefe54af2Behdad Esfahbod
34c57d454accff66e5f2c58006e8fb40bc020b6182Behdad Esfahbod#include "hb-font-private.hh"
3522da7fd94d6318c52df69d70470a85464ffc533dBehdad Esfahbod#include "hb-buffer-private.hh"
361336ecdf8e4e9879b96b26ecfbf5c9ba6c49e2b9Behdad Esfahbod#include "hb-set-private.hh"
37fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod
3823c86aa0009324433e78fcd0c47f2c0ff14b1949Behdad Esfahbod
392e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod/*
402e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod * GDEF
412e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod */
422e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
4305ad6b50ac0a1b9a8da10d2ee2238068b7811e7dBehdad Esfahbodtypedef enum
4405ad6b50ac0a1b9a8da10d2ee2238068b7811e7dBehdad Esfahbod{
452e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  /* The following three match LookupFlags::Ignore* numbers. */
462e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH	= 0x02u,
472e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE	= 0x04u,
4805ad6b50ac0a1b9a8da10d2ee2238068b7811e7dBehdad Esfahbod  HB_OT_LAYOUT_GLYPH_PROPS_MARK		= 0x08u,
4905ad6b50ac0a1b9a8da10d2ee2238068b7811e7dBehdad Esfahbod
5005ad6b50ac0a1b9a8da10d2ee2238068b7811e7dBehdad Esfahbod  /* The following are used internally; not derived from GDEF. */
5109675a8115b9d77261c33940401aa919cede8662Behdad Esfahbod  HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED	= 0x10u,
5209675a8115b9d77261c33940401aa919cede8662Behdad Esfahbod  HB_OT_LAYOUT_GLYPH_PROPS_LIGATED	= 0x20u,
53832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbod  HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED	= 0x40u,
542e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
5509675a8115b9d77261c33940401aa919cede8662Behdad Esfahbod  HB_OT_LAYOUT_GLYPH_PROPS_PRESERVE     = HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED |
56832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbod					  HB_OT_LAYOUT_GLYPH_PROPS_LIGATED |
57832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbod					  HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED
582e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod} hb_ot_layout_glyph_class_mask_t;
592e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
602e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
612e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod/*
622e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod * GSUB/GPOS
632e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod */
642e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
652e96d2c6ee34142375373be07217c9953e7822ccBehdad EsfahbodHB_INTERNAL hb_bool_t
662e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbodhb_ot_layout_lookup_would_substitute_fast (hb_face_t            *face,
672e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod					   unsigned int          lookup_index,
682e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod					   const hb_codepoint_t *glyphs,
692e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod					   unsigned int          glyphs_length,
702e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod					   hb_bool_t             zero_context);
712e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
722e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
732e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod/* Should be called before all the substitute_lookup's are done. */
742e96d2c6ee34142375373be07217c9953e7822ccBehdad EsfahbodHB_INTERNAL void
752e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbodhb_ot_layout_substitute_start (hb_font_t    *font,
762e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod			       hb_buffer_t  *buffer);
772e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
782e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
792e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbodstruct hb_ot_layout_lookup_accelerator_t;
802e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
812e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbodnamespace OT {
822e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  struct hb_apply_context_t;
832e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  struct SubstLookup;
842e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod}
852e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
862e96d2c6ee34142375373be07217c9953e7822ccBehdad EsfahbodHB_INTERNAL void
872e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbodhb_ot_layout_substitute_lookup (OT::hb_apply_context_t *c,
882e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod				const OT::SubstLookup &lookup,
892e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod				const hb_ot_layout_lookup_accelerator_t &accel);
902e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
912e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
922e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod/* Should be called after all the substitute_lookup's are done */
932e96d2c6ee34142375373be07217c9953e7822ccBehdad EsfahbodHB_INTERNAL void
942e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbodhb_ot_layout_substitute_finish (hb_font_t    *font,
952e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod				hb_buffer_t  *buffer);
962e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
972e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
982e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod/* Should be called before all the position_lookup's are done.  Resets positions to zero. */
992e96d2c6ee34142375373be07217c9953e7822ccBehdad EsfahbodHB_INTERNAL void
1002e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbodhb_ot_layout_position_start (hb_font_t    *font,
1012e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod			     hb_buffer_t  *buffer);
1022e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1032e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod/* Should be called after all the position_lookup's are done */
1042e96d2c6ee34142375373be07217c9953e7822ccBehdad EsfahbodHB_INTERNAL void
1052e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbodhb_ot_layout_position_finish (hb_font_t    *font,
1062e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod			      hb_buffer_t  *buffer);
1072e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1082e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1092e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1102e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod/*
1112e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod * hb_ot_layout_t
1122e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod */
1132e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1142e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbodnamespace OT {
1152e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  struct GDEF;
1162e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  struct GSUB;
1172e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  struct GPOS;
1182e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod}
1192e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1202e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbodstruct hb_ot_layout_lookup_accelerator_t
1212e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod{
1222e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  template <typename TLookup>
1232e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  inline void init (const TLookup &lookup)
1242e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  {
1252e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod    digest.init ();
1262e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod    lookup.add_coverage (&digest);
1272e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  }
1282e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1292e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  template <typename TLookup>
1307e8c38954649c0bf2e6051d84ca08dce090ec169Behdad Esfahbod  inline void fini (const TLookup &lookup HB_UNUSED)
1312e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  {
1322e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  }
1332e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1342e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  hb_set_digest_t digest;
1352e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod};
1362e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1372e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbodstruct hb_ot_layout_t
1382e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod{
1392e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  hb_blob_t *gdef_blob;
1402e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  hb_blob_t *gsub_blob;
1412e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  hb_blob_t *gpos_blob;
1422e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1432e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  const struct OT::GDEF *gdef;
1442e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  const struct OT::GSUB *gsub;
1452e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  const struct OT::GPOS *gpos;
1462e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1472e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  unsigned int gsub_lookup_count;
1482e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  unsigned int gpos_lookup_count;
1492e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1502e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  hb_ot_layout_lookup_accelerator_t *gsub_accels;
1512e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod  hb_ot_layout_lookup_accelerator_t *gpos_accels;
1522e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod};
1532e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1542e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1552e96d2c6ee34142375373be07217c9953e7822ccBehdad EsfahbodHB_INTERNAL hb_ot_layout_t *
1562e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod_hb_ot_layout_create (hb_face_t *face);
1572e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1582e96d2c6ee34142375373be07217c9953e7822ccBehdad EsfahbodHB_INTERNAL void
1592e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod_hb_ot_layout_destroy (hb_ot_layout_t *layout);
1602e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1612e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1622e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod#define hb_ot_layout_from_face(face) ((hb_ot_layout_t *) face->shaper_data.ot)
1632e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1642e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1652e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod/*
1662e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod * Buffer var routines.
1672e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod */
1682e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
169101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod/* buffer var allocations, used during the entire shaping process */
170101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod#define unicode_props0()	var2.u8[0]
171101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod#define unicode_props1()	var2.u8[1]
172101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
173101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod/* buffer var allocations, used during the GSUB/GPOS processing */
174101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod#define glyph_props()		var1.u16[0] /* GDEF glyph properties */
175101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod#define lig_props()		var1.u8[2] /* GSUB/GPOS ligature tracking */
176101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod#define syllable()		var1.u8[3] /* GSUB/GPOS shaping boundaries */
177101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
1782e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod/* unicode_props */
1792e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod
1801a31f9f820c4538015ddaf4ca2b790649c5997edBehdad Esfahbodenum {
18111fb16cb849285a178d9e80991b1d60a960326eeBehdad Esfahbod  MASK0_ZWJ       = 0x20u,
18211fb16cb849285a178d9e80991b1d60a960326eeBehdad Esfahbod  MASK0_ZWNJ      = 0x40u,
18311fb16cb849285a178d9e80991b1d60a960326eeBehdad Esfahbod  MASK0_IGNORABLE = 0x80u,
18411fb16cb849285a178d9e80991b1d60a960326eeBehdad Esfahbod  MASK0_GEN_CAT   = 0x1Fu
1851a31f9f820c4538015ddaf4ca2b790649c5997edBehdad Esfahbod};
1861a31f9f820c4538015ddaf4ca2b790649c5997edBehdad Esfahbod
1876faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline void
188607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod_hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *unicode)
189607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod{
1900f3fe37fccfb540437adf13dd580f2c5164a0b1fBehdad Esfahbod  /* XXX This shouldn't be inlined, or at least not while is_default_ignorable() is inline. */
191607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod  info->unicode_props0() = ((unsigned int) unicode->general_category (info->codepoint)) |
1921a31f9f820c4538015ddaf4ca2b790649c5997edBehdad Esfahbod			   (unicode->is_default_ignorable (info->codepoint) ? MASK0_IGNORABLE : 0) |
1937627100f428ac0ec8509d961d368d2d25d8f0b6eBehdad Esfahbod			   (info->codepoint == 0x200Cu ? MASK0_ZWNJ : 0) |
1947627100f428ac0ec8509d961d368d2d25d8f0b6eBehdad Esfahbod			   (info->codepoint == 0x200Du ? MASK0_ZWJ : 0);
195607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod  info->unicode_props1() = unicode->modified_combining_class (info->codepoint);
196607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod}
197607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod
1986faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline void
1993ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod_hb_glyph_info_set_general_category (hb_glyph_info_t *info,
2003ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod				     hb_unicode_general_category_t gen_cat)
2017e08f1258da229dfaf7e1c4b5c41e5bb83906cb0Behdad Esfahbod{
2021a31f9f820c4538015ddaf4ca2b790649c5997edBehdad Esfahbod  info->unicode_props0() = (unsigned int) gen_cat | ((info->unicode_props0()) & ~MASK0_GEN_CAT);
2037e08f1258da229dfaf7e1c4b5c41e5bb83906cb0Behdad Esfahbod}
2047e08f1258da229dfaf7e1c4b5c41e5bb83906cb0Behdad Esfahbod
2056faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline hb_unicode_general_category_t
206607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod_hb_glyph_info_get_general_category (const hb_glyph_info_t *info)
207607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod{
2081a31f9f820c4538015ddaf4ca2b790649c5997edBehdad Esfahbod  return (hb_unicode_general_category_t) (info->unicode_props0() & MASK0_GEN_CAT);
209607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod}
210607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod
2116faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline void
2123ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod_hb_glyph_info_set_modified_combining_class (hb_glyph_info_t *info,
2133ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod					     unsigned int modified_class)
214607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod{
215607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod  info->unicode_props1() = modified_class;
216607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod}
217607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod
2186faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline unsigned int
219607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod_hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info)
220607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod{
221607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod  return info->unicode_props1();
222607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod}
223607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod
2246faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline hb_bool_t
225607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod_hb_glyph_info_is_default_ignorable (const hb_glyph_info_t *info)
226607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod{
2271a31f9f820c4538015ddaf4ca2b790649c5997edBehdad Esfahbod  return !!(info->unicode_props0() & MASK0_IGNORABLE);
228607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod}
229607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod
2306faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline hb_bool_t
231607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod_hb_glyph_info_is_zwnj (const hb_glyph_info_t *info)
232607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod{
2331a31f9f820c4538015ddaf4ca2b790649c5997edBehdad Esfahbod  return !!(info->unicode_props0() & MASK0_ZWNJ);
234607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod}
235607feb7cff0e50f8738d2e49ca463fc9d7d494deBehdad Esfahbod
2366faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline hb_bool_t
2370b45479198d61d5135dad771e9c68408eb13f930Behdad Esfahbod_hb_glyph_info_is_zwj (const hb_glyph_info_t *info)
2380b45479198d61d5135dad771e9c68408eb13f930Behdad Esfahbod{
2391a31f9f820c4538015ddaf4ca2b790649c5997edBehdad Esfahbod  return !!(info->unicode_props0() & MASK0_ZWJ);
2400b45479198d61d5135dad771e9c68408eb13f930Behdad Esfahbod}
2410b45479198d61d5135dad771e9c68408eb13f930Behdad Esfahbod
2426faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline void
243c52ddab72e025d1bee8274c8f3416208b12f68f1Behdad Esfahbod_hb_glyph_info_flip_joiners (hb_glyph_info_t *info)
244c52ddab72e025d1bee8274c8f3416208b12f68f1Behdad Esfahbod{
245c52ddab72e025d1bee8274c8f3416208b12f68f1Behdad Esfahbod  info->unicode_props0() ^= MASK0_ZWNJ | MASK0_ZWJ;
246c52ddab72e025d1bee8274c8f3416208b12f68f1Behdad Esfahbod}
247c52ddab72e025d1bee8274c8f3416208b12f68f1Behdad Esfahbod
2482e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod/* lig_props: aka lig_id / lig_comp
249a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod *
250a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod * When a ligature is formed:
251a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod *
2525d874d566fe5d2cc4cfaf02c79b663d8a626ca1eBehdad Esfahbod *   - The ligature glyph and any marks in between all the same newly allocated
2535d874d566fe5d2cc4cfaf02c79b663d8a626ca1eBehdad Esfahbod *     lig_id,
2544751dec8be05883483fd5f6b474ebd22583ae566Behdad Esfahbod *   - The ligature glyph will get lig_num_comps set to the number of components
255a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod *   - The marks get lig_comp > 0, reflecting which component of the ligature
256a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod *     they were applied to.
257a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod *   - This is used in GPOS to attach marks to the right component of a ligature
2582e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod *     in MarkLigPos,
2592e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod *   - Note that when marks are ligated together, much of the above is skipped
2602e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod *     and the current lig_id reused.
261a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod *
262a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod * When a multiple-substitution is done:
263a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod *
264a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod *   - All resulting glyphs will have lig_id = 0,
265a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod *   - The resulting glyphs will have lig_comp = 0, 1, 2, ... respectively.
2665d874d566fe5d2cc4cfaf02c79b663d8a626ca1eBehdad Esfahbod *   - This is used in GPOS to attach marks to the first component of a
267a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod *     multiple substitution in MarkBasePos.
268a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod *
269a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod * The numbers are also used in GPOS to do mark-to-mark positioning only
2702e96d2c6ee34142375373be07217c9953e7822ccBehdad Esfahbod * to marks that belong to the same component of the same ligature.
271a3313e54008167e415b72c780ca7b9cda958d07eBehdad Esfahbod */
272101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
273101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbodstatic inline void
274101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod_hb_glyph_info_clear_lig_props (hb_glyph_info_t *info)
275101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod{
276101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  info->lig_props() = 0;
277101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod}
278101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
2794751dec8be05883483fd5f6b474ebd22583ae566Behdad Esfahbod#define IS_LIG_BASE 0x10
280101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
28149c5ec51444f27f33e1eb6aa1959c61b08fa89c0Behdad Esfahbodstatic inline void
2823ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod_hb_glyph_info_set_lig_props_for_ligature (hb_glyph_info_t *info,
2833ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod					   unsigned int lig_id,
2843ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod					   unsigned int lig_num_comps)
2852ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbod{
2863ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod  info->lig_props() = (lig_id << 5) | IS_LIG_BASE | (lig_num_comps & 0x0F);
2872ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbod}
288101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
2892ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbodstatic inline void
2903ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod_hb_glyph_info_set_lig_props_for_mark (hb_glyph_info_t *info,
2913ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod				       unsigned int lig_id,
2923ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod				       unsigned int lig_comp)
2932ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbod{
2943ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod  info->lig_props() = (lig_id << 5) | (lig_comp & 0x0F);
2952ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbod}
296101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
2972ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbodstatic inline void
2983ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod_hb_glyph_info_set_lig_props_for_component (hb_glyph_info_t *info, unsigned int comp)
2992ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbod{
3003ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod  _hb_glyph_info_set_lig_props_for_mark (info, 0, comp);
3012ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbod}
3022ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbod
30349c5ec51444f27f33e1eb6aa1959c61b08fa89c0Behdad Esfahbodstatic inline unsigned int
3043ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod_hb_glyph_info_get_lig_id (const hb_glyph_info_t *info)
30549c5ec51444f27f33e1eb6aa1959c61b08fa89c0Behdad Esfahbod{
3063ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod  return info->lig_props() >> 5;
30749c5ec51444f27f33e1eb6aa1959c61b08fa89c0Behdad Esfahbod}
308101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
3094751dec8be05883483fd5f6b474ebd22583ae566Behdad Esfahbodstatic inline bool
310a1f7b2856184959e965c9c2b80363f9f46d486a7Behdad Esfahbod_hb_glyph_info_ligated_internal (const hb_glyph_info_t *info)
3114751dec8be05883483fd5f6b474ebd22583ae566Behdad Esfahbod{
3123ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod  return !!(info->lig_props() & IS_LIG_BASE);
3134751dec8be05883483fd5f6b474ebd22583ae566Behdad Esfahbod}
314101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
31549c5ec51444f27f33e1eb6aa1959c61b08fa89c0Behdad Esfahbodstatic inline unsigned int
3163ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod_hb_glyph_info_get_lig_comp (const hb_glyph_info_t *info)
31749c5ec51444f27f33e1eb6aa1959c61b08fa89c0Behdad Esfahbod{
318a1f7b2856184959e965c9c2b80363f9f46d486a7Behdad Esfahbod  if (_hb_glyph_info_ligated_internal (info))
3192ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbod    return 0;
3202ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbod  else
3213ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod    return info->lig_props() & 0x0F;
3222ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbod}
323101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
3242ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbodstatic inline unsigned int
3253ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod_hb_glyph_info_get_lig_num_comps (const hb_glyph_info_t *info)
3262ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbod{
3273ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod  if ((info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE) &&
328a1f7b2856184959e965c9c2b80363f9f46d486a7Behdad Esfahbod      _hb_glyph_info_ligated_internal (info))
3293ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod    return info->lig_props() & 0x0F;
3302ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbod  else
3312ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbod    return 1;
33249c5ec51444f27f33e1eb6aa1959c61b08fa89c0Behdad Esfahbod}
33349c5ec51444f27f33e1eb6aa1959c61b08fa89c0Behdad Esfahbod
3343ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbodstatic inline uint8_t
3353ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod_hb_allocate_lig_id (hb_buffer_t *buffer) {
3362ec3ba46a3c24469096e901750e38f6ee555479aBehdad Esfahbod  uint8_t lig_id = buffer->next_serial () & 0x07;
33749c5ec51444f27f33e1eb6aa1959c61b08fa89c0Behdad Esfahbod  if (unlikely (!lig_id))
3383ddf892b5328b74afb6e7d9da727d8771ca5d288Behdad Esfahbod    lig_id = _hb_allocate_lig_id (buffer); /* in case of overflow */
33949c5ec51444f27f33e1eb6aa1959c61b08fa89c0Behdad Esfahbod  return lig_id;
34049c5ec51444f27f33e1eb6aa1959c61b08fa89c0Behdad Esfahbod}
34149c5ec51444f27f33e1eb6aa1959c61b08fa89c0Behdad Esfahbod
34291689de2603e4151e2a2d3a3852c61667f0c6264Behdad Esfahbod/* glyph_props: */
34391689de2603e4151e2a2d3a3852c61667f0c6264Behdad Esfahbod
3446faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline void
34591689de2603e4151e2a2d3a3852c61667f0c6264Behdad Esfahbod_hb_glyph_info_set_glyph_props (hb_glyph_info_t *info, unsigned int props)
34691689de2603e4151e2a2d3a3852c61667f0c6264Behdad Esfahbod{
34791689de2603e4151e2a2d3a3852c61667f0c6264Behdad Esfahbod  info->glyph_props() = props;
34891689de2603e4151e2a2d3a3852c61667f0c6264Behdad Esfahbod}
34991689de2603e4151e2a2d3a3852c61667f0c6264Behdad Esfahbod
3506faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline unsigned int
351101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod_hb_glyph_info_get_glyph_props (const hb_glyph_info_t *info)
352101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod{
353101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  return info->glyph_props();
354101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod}
355101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
3566faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline bool
357101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod_hb_glyph_info_is_base_glyph (const hb_glyph_info_t *info)
358101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod{
359101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH);
360101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod}
361101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
3626faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline bool
363101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod_hb_glyph_info_is_ligature (const hb_glyph_info_t *info)
364101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod{
365101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE);
366101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod}
367101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
3686faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline bool
369101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod_hb_glyph_info_is_mark (const hb_glyph_info_t *info)
370101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod{
371101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK);
372101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod}
373101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
374a1f7b2856184959e965c9c2b80363f9f46d486a7Behdad Esfahbodstatic inline bool
375857027341423f15fd6084c7563cc355b06e7cbddBehdad Esfahbod_hb_glyph_info_substituted (const hb_glyph_info_t *info)
376857027341423f15fd6084c7563cc355b06e7cbddBehdad Esfahbod{
377857027341423f15fd6084c7563cc355b06e7cbddBehdad Esfahbod  return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_SUBSTITUTED);
378857027341423f15fd6084c7563cc355b06e7cbddBehdad Esfahbod}
379857027341423f15fd6084c7563cc355b06e7cbddBehdad Esfahbod
380857027341423f15fd6084c7563cc355b06e7cbddBehdad Esfahbodstatic inline bool
381a1f7b2856184959e965c9c2b80363f9f46d486a7Behdad Esfahbod_hb_glyph_info_ligated (const hb_glyph_info_t *info)
382a1f7b2856184959e965c9c2b80363f9f46d486a7Behdad Esfahbod{
383a1f7b2856184959e965c9c2b80363f9f46d486a7Behdad Esfahbod  return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_LIGATED);
384832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbod}
385832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbod
386832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbodstatic inline bool
387832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbod_hb_glyph_info_multiplied (const hb_glyph_info_t *info)
388832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbod{
389832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbod  return !!(info->glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED);
390832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbod}
391832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbod
392832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbodstatic inline bool
393832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbod_hb_glyph_info_ligated_and_didnt_multiply (const hb_glyph_info_t *info)
394832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbod{
395832a6f99b34f334b1e82b8e3a7ad137e823d203cBehdad Esfahbod  return _hb_glyph_info_ligated (info) && !_hb_glyph_info_multiplied (info);
396a1f7b2856184959e965c9c2b80363f9f46d486a7Behdad Esfahbod}
397a1f7b2856184959e965c9c2b80363f9f46d486a7Behdad Esfahbod
39804dc52fa15f5b7f9eb5f448ea43e7ef1b2269e88Behdad Esfahbodstatic inline void
39904dc52fa15f5b7f9eb5f448ea43e7ef1b2269e88Behdad Esfahbod_hb_glyph_info_clear_ligated_and_multiplied (hb_glyph_info_t *info)
40004dc52fa15f5b7f9eb5f448ea43e7ef1b2269e88Behdad Esfahbod{
40104dc52fa15f5b7f9eb5f448ea43e7ef1b2269e88Behdad Esfahbod  info->glyph_props() &= ~(HB_OT_LAYOUT_GLYPH_PROPS_LIGATED |
40204dc52fa15f5b7f9eb5f448ea43e7ef1b2269e88Behdad Esfahbod			   HB_OT_LAYOUT_GLYPH_PROPS_MULTIPLIED);
40304dc52fa15f5b7f9eb5f448ea43e7ef1b2269e88Behdad Esfahbod}
40404dc52fa15f5b7f9eb5f448ea43e7ef1b2269e88Behdad Esfahbod
40504dc52fa15f5b7f9eb5f448ea43e7ef1b2269e88Behdad Esfahbod
406101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod/* Allocation / deallocation. */
407101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
4086faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline void
409101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod_hb_buffer_allocate_unicode_vars (hb_buffer_t *buffer)
410101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod{
411101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props0);
412101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  HB_BUFFER_ALLOCATE_VAR (buffer, unicode_props1);
413101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod}
414101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
4156faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline void
416101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod_hb_buffer_deallocate_unicode_vars (hb_buffer_t *buffer)
417101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod{
418101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props0);
419101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  HB_BUFFER_DEALLOCATE_VAR (buffer, unicode_props1);
420101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod}
421101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
4226faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline void
423101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod_hb_buffer_allocate_gsubgpos_vars (hb_buffer_t *buffer)
424101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod{
425101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  HB_BUFFER_ALLOCATE_VAR (buffer, glyph_props);
426101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  HB_BUFFER_ALLOCATE_VAR (buffer, lig_props);
427101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  HB_BUFFER_ALLOCATE_VAR (buffer, syllable);
428101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod}
429101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod
4306faff8e4132197ba06f0e685b82efe35b546cf64Behdad Esfahbodstatic inline void
431101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod_hb_buffer_deallocate_gsubgpos_vars (hb_buffer_t *buffer)
432101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod{
433101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  HB_BUFFER_DEALLOCATE_VAR (buffer, syllable);
434101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  HB_BUFFER_DEALLOCATE_VAR (buffer, lig_props);
435101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod  HB_BUFFER_DEALLOCATE_VAR (buffer, glyph_props);
436101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod}
43791689de2603e4151e2a2d3a3852c61667f0c6264Behdad Esfahbod
438101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod/* Make sure no one directly touches our props... */
439101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod#undef unicode_props0
440101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod#undef unicode_props1
441101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod#undef lig_props
442101303dbf7cf15d044bf2518f14b3aec65970feaBehdad Esfahbod#undef glyph_props
44349c5ec51444f27f33e1eb6aa1959c61b08fa89c0Behdad Esfahbod
444fd92a3dde32fd10df30c9eeb97641bc3c15b1e9bBehdad Esfahbod
4450f0cd9d361f1bb614aa3fd4616160d027062370eBehdad Esfahbod#endif /* HB_OT_LAYOUT_PRIVATE_HH */
446