164aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod/*
22409d5f8d7dd8b535ce5ea29e933f7db27d33793Behdad Esfahbod * Copyright © 2007,2008,2009  Red Hat, Inc.
30ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod * Copyright © 2010,2011,2012  Google, Inc.
464aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod *
5c755cb3e3ac55156d0d2ec05adea7a650b97cc41Behdad Esfahbod *  This is part of HarfBuzz, a text shaping library.
664aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod *
764aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * Permission is hereby granted, without written agreement and without
864aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this
964aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * software and its documentation for any purpose, provided that the
1064aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * above copyright notice and the following two paragraphs appear in
1164aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * all copies of this software.
1264aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod *
1364aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
1464aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
1564aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
1664aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
1764aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * DAMAGE.
1864aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod *
1964aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
2064aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2164aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
2264aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
2364aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
2464aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod *
2564aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * Red Hat Author(s): Behdad Esfahbod
2698370e89d1bff248737b482d129c2a4deb8bfd95Behdad Esfahbod * Google Author(s): Behdad Esfahbod
2764aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod */
2864aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod
297a750ac33ec482e2c4856c19ea607f3563741c24Behdad Esfahbod#ifndef HB_OT_LAYOUT_GDEF_TABLE_HH
307a750ac33ec482e2c4856c19ea607f3563741c24Behdad Esfahbod#define HB_OT_LAYOUT_GDEF_TABLE_HH
315b3f7702a64fe0513d08a67bdb72704e46fd7cd4Behdad Esfahbod
325f5b24f99f52bbc922e238b65c06061ba07c8548Behdad Esfahbod#include "hb-ot-layout-common-private.hh"
335b3f7702a64fe0513d08a67bdb72704e46fd7cd4Behdad Esfahbod
34c57d454accff66e5f2c58006e8fb40bc020b6182Behdad Esfahbod#include "hb-font-private.hh"
3523c86aa0009324433e78fcd0c47f2c0ff14b1949Behdad Esfahbod
36acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbod
377c8e844d92aa604fc4b396343721ea90eb83adb8Behdad Esfahbodnamespace OT {
387c8e844d92aa604fc4b396343721ea90eb83adb8Behdad Esfahbod
3912360f7c159826ae72271b34486dee59d96aa8caBehdad Esfahbod
401f437e6f47fb6c15761021bd2078f31778f2179cBehdad Esfahbod/*
411f437e6f47fb6c15761021bd2078f31778f2179cBehdad Esfahbod * Attachment List Table
421f437e6f47fb6c15761021bd2078f31778f2179cBehdad Esfahbod */
434c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod
44e4efdd80a8fa4edbcdec9cd84f35f5f4521943c2Behdad Esfahbodtypedef ArrayOf<USHORT> AttachPoint;	/* Array of contour point indices--in
451f437e6f47fb6c15761021bd2078f31778f2179cBehdad Esfahbod					 * increasing numerical order */
46303fe62824d4e99df554b6bfaacba05d068522fbBehdad Esfahbod
4760d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbodstruct AttachList
4860d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbod{
49e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod  inline unsigned int get_attach_points (hb_codepoint_t glyph_id,
50e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod					 unsigned int start_offset,
51e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod					 unsigned int *point_count /* IN/OUT */,
52e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod					 unsigned int *point_array /* OUT */) const
53855720ca47bf5a7a44eb5b84dce9f7da6e7156bdBehdad Esfahbod  {
54b67881b171a7cf865af58df146da52fc1e27b160Behdad Esfahbod    unsigned int index = (this+coverage).get_coverage (glyph_id);
5562964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod    if (index == NOT_COVERED)
5662964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod    {
57e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod      if (point_count)
58e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod	*point_count = 0;
59e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod      return 0;
6062964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod    }
61e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod
6279420ad9caf2d5fc94c3693e8292edfa27060b2dBehdad Esfahbod    const AttachPoint &points = this+attachPoint[index];
6379420ad9caf2d5fc94c3693e8292edfa27060b2dBehdad Esfahbod
64e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod    if (point_count) {
654f5f1c34dda1e0629bfa6d7b0ffa2e1ce003b7c7Behdad Esfahbod      const USHORT *array = points.sub_array (start_offset, point_count);
6648de3730cdf91b9f6473509e22260a902ccec992Behdad Esfahbod      unsigned int count = *point_count;
67e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod      for (unsigned int i = 0; i < count; i++)
68e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod	point_array[i] = array[i];
69e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod    }
7062964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod
71e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod    return points.len;
72855720ca47bf5a7a44eb5b84dce9f7da6e7156bdBehdad Esfahbod  }
734c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod
74d7cfb3b2d1dd2e9fdae2b3e540bbe313660895e8Behdad Esfahbod  inline bool sanitize (hb_sanitize_context_t *c) {
75be218c688cbb037a99c8c64bb835f3c980040c0bBehdad Esfahbod    TRACE_SANITIZE (this);
760ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    return TRACE_RETURN (coverage.sanitize (c, this) && attachPoint.sanitize (c, this));
77e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod  }
78e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod
79ec8d2494694275dfbbac2dd0d33ca2894b0463d6Behdad Esfahbod  protected:
803d54bd1293069fc3d3bdeeea8ad45036f3ee65f3Behdad Esfahbod  OffsetTo<Coverage>
813d54bd1293069fc3d3bdeeea8ad45036f3ee65f3Behdad Esfahbod		coverage;		/* Offset to Coverage table -- from
824c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod					 * beginning of AttachList table */
835f810363acc3ad3cba631a68620e3d37e54c95c4Behdad Esfahbod  OffsetArrayOf<AttachPoint>
845f810363acc3ad3cba631a68620e3d37e54c95c4Behdad Esfahbod		attachPoint;		/* Array of AttachPoint tables
855f810363acc3ad3cba631a68620e3d37e54c95c4Behdad Esfahbod					 * in Coverage Index order */
86b3651231bf80bb7009214547a75ed90e21815c68Behdad Esfahbod  public:
870eb9fc6e37935707dba2bf4b3705de2161a08cb7Behdad Esfahbod  DEFINE_SIZE_ARRAY (4, attachPoint);
884c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod};
894c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod
904c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod/*
914c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod * Ligature Caret Table
924c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod */
934c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod
9460d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbodstruct CaretValueFormat1
9560d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbod{
967586089c6fa8185cad8387869d3703c637e5cbb1Behdad Esfahbod  friend struct CaretValue;
977586089c6fa8185cad8387869d3703c637e5cbb1Behdad Esfahbod
987586089c6fa8185cad8387869d3703c637e5cbb1Behdad Esfahbod  private:
9960fbb36096e344e9af79409ce8cfe3f1f7b0d321Behdad Esfahbod  inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id HB_UNUSED) const
10060d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbod  {
101b6f902a1a9c8b72b5d6a241a14a7bacfaea3a56aBehdad Esfahbod    return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_x (coordinate) : font->em_scale_y (coordinate);
1024c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod  }
103303fe62824d4e99df554b6bfaacba05d068522fbBehdad Esfahbod
104d7cfb3b2d1dd2e9fdae2b3e540bbe313660895e8Behdad Esfahbod  inline bool sanitize (hb_sanitize_context_t *c) {
105be218c688cbb037a99c8c64bb835f3c980040c0bBehdad Esfahbod    TRACE_SANITIZE (this);
1060ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    return TRACE_RETURN (c->check_struct (this));
107e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod  }
108e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod
109ec8d2494694275dfbbac2dd0d33ca2894b0463d6Behdad Esfahbod  protected:
110303fe62824d4e99df554b6bfaacba05d068522fbBehdad Esfahbod  USHORT	caretValueFormat;	/* Format identifier--format = 1 */
111303fe62824d4e99df554b6bfaacba05d068522fbBehdad Esfahbod  SHORT		coordinate;		/* X or Y value, in design units */
112b3651231bf80bb7009214547a75ed90e21815c68Behdad Esfahbod  public:
113b3651231bf80bb7009214547a75ed90e21815c68Behdad Esfahbod  DEFINE_SIZE_STATIC (4);
1144c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod};
1154c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod
11660d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbodstruct CaretValueFormat2
11760d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbod{
1187586089c6fa8185cad8387869d3703c637e5cbb1Behdad Esfahbod  friend struct CaretValue;
1197586089c6fa8185cad8387869d3703c637e5cbb1Behdad Esfahbod
1207586089c6fa8185cad8387869d3703c637e5cbb1Behdad Esfahbod  private:
12160fbb36096e344e9af79409ce8cfe3f1f7b0d321Behdad Esfahbod  inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
12260d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbod  {
1236f729b45b04243c42ad7201b67cda9d5e5c363f1Behdad Esfahbod    hb_position_t x, y;
1248fbfda920e0b3bb4ab7afb732826026964b79be9Behdad Esfahbod    if (font->get_glyph_contour_point_for_origin (glyph_id, caretValuePoint, direction, &x, &y))
1253357d145f81cb7b746c910018fe3a0dfab00972cBehdad Esfahbod      return HB_DIRECTION_IS_HORIZONTAL (direction) ? x : y;
1266f729b45b04243c42ad7201b67cda9d5e5c363f1Behdad Esfahbod    else
1276f729b45b04243c42ad7201b67cda9d5e5c363f1Behdad Esfahbod      return 0;
1284c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod  }
129303fe62824d4e99df554b6bfaacba05d068522fbBehdad Esfahbod
130d7cfb3b2d1dd2e9fdae2b3e540bbe313660895e8Behdad Esfahbod  inline bool sanitize (hb_sanitize_context_t *c) {
131be218c688cbb037a99c8c64bb835f3c980040c0bBehdad Esfahbod    TRACE_SANITIZE (this);
1320ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    return TRACE_RETURN (c->check_struct (this));
133e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod  }
134e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod
135ec8d2494694275dfbbac2dd0d33ca2894b0463d6Behdad Esfahbod  protected:
136303fe62824d4e99df554b6bfaacba05d068522fbBehdad Esfahbod  USHORT	caretValueFormat;	/* Format identifier--format = 2 */
137303fe62824d4e99df554b6bfaacba05d068522fbBehdad Esfahbod  USHORT	caretValuePoint;	/* Contour point index on glyph */
138b3651231bf80bb7009214547a75ed90e21815c68Behdad Esfahbod  public:
139b3651231bf80bb7009214547a75ed90e21815c68Behdad Esfahbod  DEFINE_SIZE_STATIC (4);
1404c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod};
1414c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod
14260d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbodstruct CaretValueFormat3
14360d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbod{
1447586089c6fa8185cad8387869d3703c637e5cbb1Behdad Esfahbod  friend struct CaretValue;
1457586089c6fa8185cad8387869d3703c637e5cbb1Behdad Esfahbod
146b9452bfc1696457e156e79037c863903da5454fcBehdad Esfahbod  inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id HB_UNUSED) const
14760d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbod  {
1483357d145f81cb7b746c910018fe3a0dfab00972cBehdad Esfahbod    return HB_DIRECTION_IS_HORIZONTAL (direction) ?
149b6f902a1a9c8b72b5d6a241a14a7bacfaea3a56aBehdad Esfahbod           font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font) :
150b6f902a1a9c8b72b5d6a241a14a7bacfaea3a56aBehdad Esfahbod           font->em_scale_y (coordinate) + (this+deviceTable).get_y_delta (font);
151303fe62824d4e99df554b6bfaacba05d068522fbBehdad Esfahbod  }
152303fe62824d4e99df554b6bfaacba05d068522fbBehdad Esfahbod
153d7cfb3b2d1dd2e9fdae2b3e540bbe313660895e8Behdad Esfahbod  inline bool sanitize (hb_sanitize_context_t *c) {
154be218c688cbb037a99c8c64bb835f3c980040c0bBehdad Esfahbod    TRACE_SANITIZE (this);
1550ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    return TRACE_RETURN (c->check_struct (this) && deviceTable.sanitize (c, this));
156e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod  }
157e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod
158ec8d2494694275dfbbac2dd0d33ca2894b0463d6Behdad Esfahbod  protected:
1594c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod  USHORT	caretValueFormat;	/* Format identifier--format = 3 */
1604c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod  SHORT		coordinate;		/* X or Y value, in design units */
161263bbef7670b59aa88ef9ba910579dfa51226524Behdad Esfahbod  OffsetTo<Device>
162263bbef7670b59aa88ef9ba910579dfa51226524Behdad Esfahbod		deviceTable;		/* Offset to Device table for X or Y
1634c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod					 * value--from beginning of CaretValue
1644c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod					 * table */
165b3651231bf80bb7009214547a75ed90e21815c68Behdad Esfahbod  public:
166b3651231bf80bb7009214547a75ed90e21815c68Behdad Esfahbod  DEFINE_SIZE_STATIC (6);
1674c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod};
1684c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod
16960d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbodstruct CaretValue
17060d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbod{
17160fbb36096e344e9af79409ce8cfe3f1f7b0d321Behdad Esfahbod  inline hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph_id) const
17260d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbod  {
173f8dc67b3c24dfc805da756a73cb217b36e16b4b8Behdad Esfahbod    switch (u.format) {
174abcfe9b59b4475eb02dd679aac4bc59616713b28Behdad Esfahbod    case 1: return u.format1.get_caret_value (font, direction, glyph_id);
175abcfe9b59b4475eb02dd679aac4bc59616713b28Behdad Esfahbod    case 2: return u.format2.get_caret_value (font, direction, glyph_id);
176abcfe9b59b4475eb02dd679aac4bc59616713b28Behdad Esfahbod    case 3: return u.format3.get_caret_value (font, direction, glyph_id);
1774c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod    default:return 0;
1784c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod    }
1794c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod  }
1804c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod
181d7cfb3b2d1dd2e9fdae2b3e540bbe313660895e8Behdad Esfahbod  inline bool sanitize (hb_sanitize_context_t *c) {
182be218c688cbb037a99c8c64bb835f3c980040c0bBehdad Esfahbod    TRACE_SANITIZE (this);
1830ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    if (!u.format.sanitize (c)) return TRACE_RETURN (false);
184e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod    switch (u.format) {
1850ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    case 1: return TRACE_RETURN (u.format1.sanitize (c));
1860ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    case 2: return TRACE_RETURN (u.format2.sanitize (c));
1870ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    case 3: return TRACE_RETURN (u.format3.sanitize (c));
1880ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    default:return TRACE_RETURN (true);
189e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod    }
190e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod  }
191e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod
192ec8d2494694275dfbbac2dd0d33ca2894b0463d6Behdad Esfahbod  protected:
1934c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod  union {
194f8dc67b3c24dfc805da756a73cb217b36e16b4b8Behdad Esfahbod  USHORT		format;		/* Format identifier */
195dacebcadae36b35531d635d81df2afb937677b7aBehdad Esfahbod  CaretValueFormat1	format1;
196dacebcadae36b35531d635d81df2afb937677b7aBehdad Esfahbod  CaretValueFormat2	format2;
197dacebcadae36b35531d635d81df2afb937677b7aBehdad Esfahbod  CaretValueFormat3	format3;
1984c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod  } u;
199ed07422c33bbb52ff4d79e65986171e3f07697d8Behdad Esfahbod  public:
200596e471aa5053d955fb5d5b5923088c8814469b1Behdad Esfahbod  DEFINE_SIZE_UNION (2, format);
2014c2556cb4c38a56c3a5087deb54aa6262ab3aff9Behdad Esfahbod};
2021f437e6f47fb6c15761021bd2078f31778f2179cBehdad Esfahbod
20360d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbodstruct LigGlyph
20460d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbod{
205abcfe9b59b4475eb02dd679aac4bc59616713b28Behdad Esfahbod  inline unsigned int get_lig_carets (hb_font_t *font,
2063357d145f81cb7b746c910018fe3a0dfab00972cBehdad Esfahbod				      hb_direction_t direction,
207e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod				      hb_codepoint_t glyph_id,
208e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod				      unsigned int start_offset,
209e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod				      unsigned int *caret_count /* IN/OUT */,
21060fbb36096e344e9af79409ce8cfe3f1f7b0d321Behdad Esfahbod				      hb_position_t *caret_array /* OUT */) const
21162964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod  {
212e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod    if (caret_count) {
2134f5f1c34dda1e0629bfa6d7b0ffa2e1ce003b7c7Behdad Esfahbod      const OffsetTo<CaretValue> *array = carets.sub_array (start_offset, caret_count);
21448de3730cdf91b9f6473509e22260a902ccec992Behdad Esfahbod      unsigned int count = *caret_count;
215e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod      for (unsigned int i = 0; i < count; i++)
216abcfe9b59b4475eb02dd679aac4bc59616713b28Behdad Esfahbod	caret_array[i] = (this+array[i]).get_caret_value (font, direction, glyph_id);
217e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod    }
21862964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod
219e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod    return carets.len;
22062964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod  }
2217586089c6fa8185cad8387869d3703c637e5cbb1Behdad Esfahbod
222d7cfb3b2d1dd2e9fdae2b3e540bbe313660895e8Behdad Esfahbod  inline bool sanitize (hb_sanitize_context_t *c) {
223be218c688cbb037a99c8c64bb835f3c980040c0bBehdad Esfahbod    TRACE_SANITIZE (this);
2240ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    return TRACE_RETURN (carets.sanitize (c, this));
225e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod  }
226e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod
227ec8d2494694275dfbbac2dd0d33ca2894b0463d6Behdad Esfahbod  protected:
2285f810363acc3ad3cba631a68620e3d37e54c95c4Behdad Esfahbod  OffsetArrayOf<CaretValue>
2293564ee5216004d45d30b0ded61184cf8dde5dd89Behdad Esfahbod		carets;			/* Offset array of CaretValue tables
230e4efdd80a8fa4edbcdec9cd84f35f5f4521943c2Behdad Esfahbod					 * --from beginning of LigGlyph table
231e4efdd80a8fa4edbcdec9cd84f35f5f4521943c2Behdad Esfahbod					 * --in increasing coordinate order */
232b3651231bf80bb7009214547a75ed90e21815c68Behdad Esfahbod  public:
2330eb9fc6e37935707dba2bf4b3705de2161a08cb7Behdad Esfahbod  DEFINE_SIZE_ARRAY (2, carets);
2341f437e6f47fb6c15761021bd2078f31778f2179cBehdad Esfahbod};
235b9d7688fb3d45894901484b74095c4f11cab6196Behdad Esfahbod
23660d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbodstruct LigCaretList
23760d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbod{
238abcfe9b59b4475eb02dd679aac4bc59616713b28Behdad Esfahbod  inline unsigned int get_lig_carets (hb_font_t *font,
2393357d145f81cb7b746c910018fe3a0dfab00972cBehdad Esfahbod				      hb_direction_t direction,
240e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod				      hb_codepoint_t glyph_id,
241e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod				      unsigned int start_offset,
242e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod				      unsigned int *caret_count /* IN/OUT */,
24360fbb36096e344e9af79409ce8cfe3f1f7b0d321Behdad Esfahbod				      hb_position_t *caret_array /* OUT */) const
244855720ca47bf5a7a44eb5b84dce9f7da6e7156bdBehdad Esfahbod  {
245b67881b171a7cf865af58df146da52fc1e27b160Behdad Esfahbod    unsigned int index = (this+coverage).get_coverage (glyph_id);
24662964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod    if (index == NOT_COVERED)
24762964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod    {
248e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod      if (caret_count)
249e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod	*caret_count = 0;
250e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod      return 0;
25162964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod    }
25262964afcecd96038cfaa8bc2bc931f43ee83be7eBehdad Esfahbod    const LigGlyph &lig_glyph = this+ligGlyph[index];
253abcfe9b59b4475eb02dd679aac4bc59616713b28Behdad Esfahbod    return lig_glyph.get_lig_carets (font, direction, glyph_id, start_offset, caret_count, caret_array);
254855720ca47bf5a7a44eb5b84dce9f7da6e7156bdBehdad Esfahbod  }
25512360f7c159826ae72271b34486dee59d96aa8caBehdad Esfahbod
256d7cfb3b2d1dd2e9fdae2b3e540bbe313660895e8Behdad Esfahbod  inline bool sanitize (hb_sanitize_context_t *c) {
257be218c688cbb037a99c8c64bb835f3c980040c0bBehdad Esfahbod    TRACE_SANITIZE (this);
2580ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    return TRACE_RETURN (coverage.sanitize (c, this) && ligGlyph.sanitize (c, this));
259e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod  }
260e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod
261ec8d2494694275dfbbac2dd0d33ca2894b0463d6Behdad Esfahbod  protected:
2623d54bd1293069fc3d3bdeeea8ad45036f3ee65f3Behdad Esfahbod  OffsetTo<Coverage>
2633d54bd1293069fc3d3bdeeea8ad45036f3ee65f3Behdad Esfahbod		coverage;		/* Offset to Coverage table--from
26412360f7c159826ae72271b34486dee59d96aa8caBehdad Esfahbod					 * beginning of LigCaretList table */
2655f810363acc3ad3cba631a68620e3d37e54c95c4Behdad Esfahbod  OffsetArrayOf<LigGlyph>
2665f810363acc3ad3cba631a68620e3d37e54c95c4Behdad Esfahbod		ligGlyph;		/* Array of LigGlyph tables
2675f810363acc3ad3cba631a68620e3d37e54c95c4Behdad Esfahbod					 * in Coverage Index order */
268b3651231bf80bb7009214547a75ed90e21815c68Behdad Esfahbod  public:
2690eb9fc6e37935707dba2bf4b3705de2161a08cb7Behdad Esfahbod  DEFINE_SIZE_ARRAY (4, ligGlyph);
27012360f7c159826ae72271b34486dee59d96aa8caBehdad Esfahbod};
27112360f7c159826ae72271b34486dee59d96aa8caBehdad Esfahbod
272e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod
273e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbodstruct MarkGlyphSetsFormat1
274e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod{
275e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod  inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
276e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod  { return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; }
277e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod
278d7cfb3b2d1dd2e9fdae2b3e540bbe313660895e8Behdad Esfahbod  inline bool sanitize (hb_sanitize_context_t *c) {
279be218c688cbb037a99c8c64bb835f3c980040c0bBehdad Esfahbod    TRACE_SANITIZE (this);
2800ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    return TRACE_RETURN (coverage.sanitize (c, this));
281e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod  }
282e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod
283ec8d2494694275dfbbac2dd0d33ca2894b0463d6Behdad Esfahbod  protected:
284e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod  USHORT	format;			/* Format identifier--format = 1 */
285e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod  LongOffsetArrayOf<Coverage>
286e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod		coverage;		/* Array of long offsets to mark set
287e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod					 * coverage tables */
288b3651231bf80bb7009214547a75ed90e21815c68Behdad Esfahbod  public:
2890eb9fc6e37935707dba2bf4b3705de2161a08cb7Behdad Esfahbod  DEFINE_SIZE_ARRAY (4, coverage);
290e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod};
291e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod
292e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbodstruct MarkGlyphSets
293e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod{
294e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod  inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
295e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod  {
296e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod    switch (u.format) {
297dacebcadae36b35531d635d81df2afb937677b7aBehdad Esfahbod    case 1: return u.format1.covers (set_index, glyph_id);
298e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod    default:return false;
299e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod    }
300e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod  }
301e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod
302d7cfb3b2d1dd2e9fdae2b3e540bbe313660895e8Behdad Esfahbod  inline bool sanitize (hb_sanitize_context_t *c) {
303be218c688cbb037a99c8c64bb835f3c980040c0bBehdad Esfahbod    TRACE_SANITIZE (this);
3040ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    if (!u.format.sanitize (c)) return TRACE_RETURN (false);
305e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod    switch (u.format) {
3060ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    case 1: return TRACE_RETURN (u.format1.sanitize (c));
3070ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    default:return TRACE_RETURN (true);
308e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod    }
309e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod  }
310e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod
311ec8d2494694275dfbbac2dd0d33ca2894b0463d6Behdad Esfahbod  protected:
312e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod  union {
313e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod  USHORT		format;		/* Format identifier */
314dacebcadae36b35531d635d81df2afb937677b7aBehdad Esfahbod  MarkGlyphSetsFormat1	format1;
315e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod  } u;
316ed07422c33bbb52ff4d79e65986171e3f07697d8Behdad Esfahbod  public:
317596e471aa5053d955fb5d5b5923088c8814469b1Behdad Esfahbod  DEFINE_SIZE_UNION (2, format);
318e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod};
319e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod
320e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod
3211f437e6f47fb6c15761021bd2078f31778f2179cBehdad Esfahbod/*
322ae9877dea6a1aed3566d9b87a75ede84259deacaBehdad Esfahbod * GDEF -- The Glyph Definition Table
3231f437e6f47fb6c15761021bd2078f31778f2179cBehdad Esfahbod */
324b9d7688fb3d45894901484b74095c4f11cab6196Behdad Esfahbod
32560d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbodstruct GDEF
32660d77cf05fddc5304b4b1fc19cdedba15cbee1e9Behdad Esfahbod{
327a328d66e6a8122f7d4d71941449d4d0136203e08Behdad Esfahbod  static const hb_tag_t Tag	= HB_OT_TAG_GDEF;
328600e5eb80f553ea8eb862e6784133574c74ca513Behdad Esfahbod
329c6035cf802c60f0526f421f39a55886061df94eeBehdad Esfahbod  enum GlyphClasses {
3304fa77d3c4305a76b956de8c1a9b83a961d035a80Behdad Esfahbod    UnclassifiedGlyph	= 0,
3314fa77d3c4305a76b956de8c1a9b83a961d035a80Behdad Esfahbod    BaseGlyph		= 1,
3324fa77d3c4305a76b956de8c1a9b83a961d035a80Behdad Esfahbod    LigatureGlyph	= 2,
3334fa77d3c4305a76b956de8c1a9b83a961d035a80Behdad Esfahbod    MarkGlyph		= 3,
3348f034d5849627ee95a5889fa34c9ba294fff13caBehdad Esfahbod    ComponentGlyph	= 4
3354fa77d3c4305a76b956de8c1a9b83a961d035a80Behdad Esfahbod  };
336aff831ed6787abe8e24a977e34d97ff2e0b7dc21Behdad Esfahbod
3377f97d2cd904ea999c099c73c52187c5d65aeec67Behdad Esfahbod  inline bool has_glyph_classes (void) const { return glyphClassDef != 0; }
33898370e89d1bff248737b482d129c2a4deb8bfd95Behdad Esfahbod  inline unsigned int get_glyph_class (hb_codepoint_t glyph) const
33979420ad9caf2d5fc94c3693e8292edfa27060b2dBehdad Esfahbod  { return (this+glyphClassDef).get_class (glyph); }
34089ca8eeb83fedde06727d386369a0a39d410f12bBehdad Esfahbod  inline void get_glyphs_in_class (unsigned int klass, hb_set_t *glyphs) const
34189ca8eeb83fedde06727d386369a0a39d410f12bBehdad Esfahbod  { (this+glyphClassDef).add_class (glyphs, klass); }
342b9d7688fb3d45894901484b74095c4f11cab6196Behdad Esfahbod
3437f97d2cd904ea999c099c73c52187c5d65aeec67Behdad Esfahbod  inline bool has_mark_attachment_types (void) const { return markAttachClassDef != 0; }
34498370e89d1bff248737b482d129c2a4deb8bfd95Behdad Esfahbod  inline unsigned int get_mark_attachment_type (hb_codepoint_t glyph) const
34579420ad9caf2d5fc94c3693e8292edfa27060b2dBehdad Esfahbod  { return (this+markAttachClassDef).get_class (glyph); }
34679420ad9caf2d5fc94c3693e8292edfa27060b2dBehdad Esfahbod
3477f97d2cd904ea999c099c73c52187c5d65aeec67Behdad Esfahbod  inline bool has_attach_points (void) const { return attachList != 0; }
348e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod  inline unsigned int get_attach_points (hb_codepoint_t glyph_id,
349e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod					 unsigned int start_offset,
350e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod					 unsigned int *point_count /* IN/OUT */,
351e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod					 unsigned int *point_array /* OUT */) const
352e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod  { return (this+attachList).get_attach_points (glyph_id, start_offset, point_count, point_array); }
353b9d7688fb3d45894901484b74095c4f11cab6196Behdad Esfahbod
3547f97d2cd904ea999c099c73c52187c5d65aeec67Behdad Esfahbod  inline bool has_lig_carets (void) const { return ligCaretList != 0; }
355abcfe9b59b4475eb02dd679aac4bc59616713b28Behdad Esfahbod  inline unsigned int get_lig_carets (hb_font_t *font,
3563357d145f81cb7b746c910018fe3a0dfab00972cBehdad Esfahbod				      hb_direction_t direction,
357e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod				      hb_codepoint_t glyph_id,
358e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod				      unsigned int start_offset,
359e21899bc3593aa0d3adf64cee21c5de2ea219783Behdad Esfahbod				      unsigned int *caret_count /* IN/OUT */,
36060fbb36096e344e9af79409ce8cfe3f1f7b0d321Behdad Esfahbod				      hb_position_t *caret_array /* OUT */) const
361abcfe9b59b4475eb02dd679aac4bc59616713b28Behdad Esfahbod  { return (this+ligCaretList).get_lig_carets (font, direction, glyph_id, start_offset, caret_count, caret_array); }
362b9d7688fb3d45894901484b74095c4f11cab6196Behdad Esfahbod
3634f28fbdd804fabeec57a98fe267d892ab58b3a6dBehdad Esfahbod  inline bool has_mark_sets (void) const { return version.to_int () >= 0x00010002 && markGlyphSetsDef[0] != 0; }
364e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod  inline bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const
3654f28fbdd804fabeec57a98fe267d892ab58b3a6dBehdad Esfahbod  { return version.to_int () >= 0x00010002 && (this+markGlyphSetsDef[0]).covers (set_index, glyph_id); }
366e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod
367d7cfb3b2d1dd2e9fdae2b3e540bbe313660895e8Behdad Esfahbod  inline bool sanitize (hb_sanitize_context_t *c) {
368be218c688cbb037a99c8c64bb835f3c980040c0bBehdad Esfahbod    TRACE_SANITIZE (this);
3690ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod    return TRACE_RETURN (version.sanitize (c) &&
3700ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod			 likely (version.major == 1) &&
3710ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod			 glyphClassDef.sanitize (c, this) &&
3720ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod			 attachList.sanitize (c, this) &&
3730ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod			 ligCaretList.sanitize (c, this) &&
3740ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod			 markAttachClassDef.sanitize (c, this) &&
3750ab8c8621712d33e1e91dfdb4ad0b335e3d2a3fbBehdad Esfahbod			 (version.to_int () < 0x00010002 || markGlyphSetsDef[0].sanitize (c, this)));
376e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod  }
377e49a84c9e37c08808880e74e94c8160731ababa1Behdad Esfahbod
378bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod
379bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod  /* glyph_props is a 16-bit integer where the lower 8-bit have bits representing
380bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod   * glyph class and other bits, and high 8-bit gthe mark attachment type (if any).
381bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod   * Not to be confused with lookup_props which is very similar. */
382bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod  inline unsigned int get_glyph_props (hb_codepoint_t glyph) const
383bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod  {
384bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod    unsigned int klass = get_glyph_class (glyph);
385bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod
386bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod    switch (klass) {
387bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod    default:
3885a08ecf9200a6ac9b4ebb7ec5c13dcb42d8820ceBehdad Esfahbod    case UnclassifiedGlyph:	return HB_OT_LAYOUT_GLYPH_PROPS_UNCLASSIFIED;
3895a08ecf9200a6ac9b4ebb7ec5c13dcb42d8820ceBehdad Esfahbod    case BaseGlyph:		return HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH;
3905a08ecf9200a6ac9b4ebb7ec5c13dcb42d8820ceBehdad Esfahbod    case LigatureGlyph:		return HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE;
3915a08ecf9200a6ac9b4ebb7ec5c13dcb42d8820ceBehdad Esfahbod    case ComponentGlyph:	return HB_OT_LAYOUT_GLYPH_PROPS_COMPONENT;
392bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod    case MarkGlyph:
393bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod	  klass = get_mark_attachment_type (glyph);
3945a08ecf9200a6ac9b4ebb7ec5c13dcb42d8820ceBehdad Esfahbod	  return HB_OT_LAYOUT_GLYPH_PROPS_MARK | (klass << 8);
395bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod    }
396bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod  }
397bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod
398bf94b3ad22b2fe4730d4e64d673c63154fc5b5feBehdad Esfahbod
399ec8d2494694275dfbbac2dd0d33ca2894b0463d6Behdad Esfahbod  protected:
400e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod  FixedVersion	version;		/* Version of the GDEF table--currently
401e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod					 * 0x00010002 */
4029e4d9d7b2721859172bc9c59c1aea27b01eb9c07Behdad Esfahbod  OffsetTo<ClassDef>
4039e4d9d7b2721859172bc9c59c1aea27b01eb9c07Behdad Esfahbod		glyphClassDef;		/* Offset to class definition table
404b9d7688fb3d45894901484b74095c4f11cab6196Behdad Esfahbod					 * for glyph type--from beginning of
4051f437e6f47fb6c15761021bd2078f31778f2179cBehdad Esfahbod					 * GDEF header (may be Null) */
4069e4d9d7b2721859172bc9c59c1aea27b01eb9c07Behdad Esfahbod  OffsetTo<AttachList>
4079e4d9d7b2721859172bc9c59c1aea27b01eb9c07Behdad Esfahbod		attachList;		/* Offset to list of glyphs with
408b9d7688fb3d45894901484b74095c4f11cab6196Behdad Esfahbod					 * attachment points--from beginning
4091f437e6f47fb6c15761021bd2078f31778f2179cBehdad Esfahbod					 * of GDEF header (may be Null) */
4109e4d9d7b2721859172bc9c59c1aea27b01eb9c07Behdad Esfahbod  OffsetTo<LigCaretList>
4119e4d9d7b2721859172bc9c59c1aea27b01eb9c07Behdad Esfahbod		ligCaretList;		/* Offset to list of positioning points
412b9d7688fb3d45894901484b74095c4f11cab6196Behdad Esfahbod					 * for ligature carets--from beginning
4131f437e6f47fb6c15761021bd2078f31778f2179cBehdad Esfahbod					 * of GDEF header (may be Null) */
4149e4d9d7b2721859172bc9c59c1aea27b01eb9c07Behdad Esfahbod  OffsetTo<ClassDef>
4159e4d9d7b2721859172bc9c59c1aea27b01eb9c07Behdad Esfahbod		markAttachClassDef;	/* Offset to class definition table for
416b9d7688fb3d45894901484b74095c4f11cab6196Behdad Esfahbod					 * mark attachment type--from beginning
4171f437e6f47fb6c15761021bd2078f31778f2179cBehdad Esfahbod					 * of GDEF header (may be Null) */
418e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod  OffsetTo<MarkGlyphSets>
419d3480ba37fbb5d4be75b094060f5b2f1ce98fb53Behdad Esfahbod		markGlyphSetsDef[VAR];	/* Offset to the table of mark set
420e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod					 * definitions--from beginning of GDEF
421e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod					 * header (may be NULL).  Introduced
422e4b92b85a7750bd4271ad607b3c41f0184e89febBehdad Esfahbod					 * in version 00010002. */
423569da92bc6956f42d9b2d65c784e184fb6380efeBehdad Esfahbod  public:
4240eb9fc6e37935707dba2bf4b3705de2161a08cb7Behdad Esfahbod  DEFINE_SIZE_ARRAY (12, markGlyphSetsDef);
425b9d7688fb3d45894901484b74095c4f11cab6196Behdad Esfahbod};
426b9d7688fb3d45894901484b74095c4f11cab6196Behdad Esfahbod
4276f20f72e9c58ba23db2e31afa5d331acfea3d77eBehdad Esfahbod
4287d52e6601f0e695690cd168a288466746cf25300Behdad Esfahbod} /* namespace OT */
4297c8e844d92aa604fc4b396343721ea90eb83adb8Behdad Esfahbod
430acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbod
4317a750ac33ec482e2c4856c19ea607f3563741c24Behdad Esfahbod#endif /* HB_OT_LAYOUT_GDEF_TABLE_HH */
432