16c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod/*
26c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * Copyright © 2013  Google, Inc.
36c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod *
46c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod *  This is part of HarfBuzz, a text shaping library.
56c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod *
66c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * Permission is hereby granted, without written agreement and without
76c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this
86c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * software and its documentation for any purpose, provided that the
96c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * above copyright notice and the following two paragraphs appear in
106c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * all copies of this software.
116c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod *
126c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
136c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
146c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
156c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
166c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * DAMAGE.
176c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod *
186c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
196c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
206c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
216c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
226c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
236c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod *
246c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * Google Author(s): Behdad Esfahbod
256c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod */
266c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
276c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod#ifndef HB_OT_LAYOUT_JSTF_TABLE_HH
286c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod#define HB_OT_LAYOUT_JSTF_TABLE_HH
296c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
306c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod#include "hb-open-type-private.hh"
316c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod#include "hb-ot-layout-gpos-table.hh"
326c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
336c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
346c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbodnamespace OT {
356c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
366c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
376c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod/*
386c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * JstfModList -- Justification Modification List Tables
396c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod */
406c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
416c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbodtypedef IndexArray JstfModList;
426c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
436c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
446c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod/*
456c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * JstfMax -- Justification Maximum Table
466c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod */
476c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
486c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbodtypedef OffsetListOf<PosLookup> JstfMax;
496c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
506c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
516c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod/*
526c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * JstfPriority -- Justification Priority Table
536c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod */
546c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
556c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbodstruct JstfPriority
566c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod{
576c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline bool sanitize (hb_sanitize_context_t *c) {
586c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod    TRACE_SANITIZE (this);
596c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod    return TRACE_RETURN (c->check_struct (this) &&
606c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			 shrinkageEnableGSUB.sanitize (c, this) &&
616c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			 shrinkageDisableGSUB.sanitize (c, this) &&
626c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			 shrinkageEnableGPOS.sanitize (c, this) &&
636c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			 shrinkageDisableGPOS.sanitize (c, this) &&
646c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			 shrinkageJstfMax.sanitize (c, this) &&
656c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			 extensionEnableGSUB.sanitize (c, this) &&
666c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			 extensionDisableGSUB.sanitize (c, this) &&
676c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			 extensionEnableGPOS.sanitize (c, this) &&
686c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			 extensionDisableGPOS.sanitize (c, this) &&
696c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			 extensionJstfMax.sanitize (c, this));
706c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  }
716c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
726c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  protected:
736c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  OffsetTo<JstfModList>
746c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod		shrinkageEnableGSUB;	/* Offset to Shrinkage Enable GSUB
756c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfModList table--from beginning of
766c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfPriority table--may be NULL */
776c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  OffsetTo<JstfModList>
786c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod		shrinkageDisableGSUB;	/* Offset to Shrinkage Disable GSUB
796c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfModList table--from beginning of
806c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfPriority table--may be NULL */
816c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  OffsetTo<JstfModList>
826c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod		shrinkageEnableGPOS;	/* Offset to Shrinkage Enable GPOS
836c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfModList table--from beginning of
846c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfPriority table--may be NULL */
856c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  OffsetTo<JstfModList>
866c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod		shrinkageDisableGPOS;	/* Offset to Shrinkage Disable GPOS
876c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfModList table--from beginning of
886c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfPriority table--may be NULL */
896c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  OffsetTo<JstfMax>
906c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod		shrinkageJstfMax;	/* Offset to Shrinkage JstfMax table--
916c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * from beginning of JstfPriority table
926c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * --may be NULL */
936c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  OffsetTo<JstfModList>
946c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod		extensionEnableGSUB;	/* Offset to Extension Enable GSUB
956c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfModList table--from beginning of
966c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfPriority table--may be NULL */
976c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  OffsetTo<JstfModList>
986c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod		extensionDisableGSUB;	/* Offset to Extension Disable GSUB
996c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfModList table--from beginning of
1006c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfPriority table--may be NULL */
1016c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  OffsetTo<JstfModList>
1026c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod		extensionEnableGPOS;	/* Offset to Extension Enable GPOS
1036c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfModList table--from beginning of
1046c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfPriority table--may be NULL */
1056c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  OffsetTo<JstfModList>
1066c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod		extensionDisableGPOS;	/* Offset to Extension Disable GPOS
1076c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfModList table--from beginning of
1086c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * JstfPriority table--may be NULL */
1096c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  OffsetTo<JstfMax>
1106c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod		extensionJstfMax;	/* Offset to Extension JstfMax table--
1116c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * from beginning of JstfPriority table
1126c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 * --may be NULL */
1136c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1146c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  public:
1156c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  DEFINE_SIZE_STATIC (20);
1166c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod};
1176c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1186c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1196c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod/*
1206c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * JstfLangSys -- Justification Language System Table
1216c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod */
1226c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1236c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbodstruct JstfLangSys : OffsetListOf<JstfPriority>
1246c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod{
1256c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline bool sanitize (hb_sanitize_context_t *c,
1266c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			const Record<JstfLangSys>::sanitize_closure_t * = NULL) {
1276c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod    TRACE_SANITIZE (this);
1286c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod    return TRACE_RETURN (OffsetListOf<JstfPriority>::sanitize (c));
1296c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  }
1306c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod};
1316c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1326c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1336c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod/*
1346c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * ExtenderGlyphs -- Extender Glyph Table
1356c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod */
1366c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1376c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbodtypedef SortedArrayOf<GlyphID> ExtenderGlyphs;
1386c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1396c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1406c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod/*
1416c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * JstfScript -- The Justification Table
1426c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod */
1436c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1446c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbodstruct JstfScript
1456c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod{
1466c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline unsigned int get_lang_sys_count (void) const
1476c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  { return langSys.len; }
1486c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline const Tag& get_lang_sys_tag (unsigned int i) const
1496c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  { return langSys.get_tag (i); }
1506c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline unsigned int get_lang_sys_tags (unsigned int start_offset,
1516c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 unsigned int *lang_sys_count /* IN/OUT */,
1526c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod					 hb_tag_t     *lang_sys_tags /* OUT */) const
1536c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  { return langSys.get_tags (start_offset, lang_sys_count, lang_sys_tags); }
1546c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline const JstfLangSys& get_lang_sys (unsigned int i) const
1556c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  {
1566c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod    if (i == Index::NOT_FOUND_INDEX) return get_default_lang_sys ();
1576c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod    return this+langSys[i].offset;
1586c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  }
1596c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline bool find_lang_sys_index (hb_tag_t tag, unsigned int *index) const
1606c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  { return langSys.find_index (tag, index); }
1616c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1626c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline bool has_default_lang_sys (void) const { return defaultLangSys != 0; }
1636c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline const JstfLangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
1646c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1656c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline bool sanitize (hb_sanitize_context_t *c,
1666c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			const Record<JstfScript>::sanitize_closure_t * = NULL) {
1676c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod    TRACE_SANITIZE (this);
1686c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod    return TRACE_RETURN (extenderGlyphs.sanitize (c, this) &&
1696c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			 defaultLangSys.sanitize (c, this) &&
1706c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			 langSys.sanitize (c, this));
1716c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  }
1726c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1736c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  protected:
1746c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  OffsetTo<ExtenderGlyphs>
1756c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod		extenderGlyphs;	/* Offset to ExtenderGlyph table--from beginning
1766c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod				 * of JstfScript table-may be NULL */
1776c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  OffsetTo<JstfLangSys>
1786c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod		defaultLangSys;	/* Offset to DefaultJstfLangSys table--from
1796c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod				 * beginning of JstfScript table--may be Null */
1806c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  RecordArrayOf<JstfLangSys>
1816c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod		langSys;	/* Array of JstfLangSysRecords--listed
1826c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod				 * alphabetically by LangSysTag */
1836c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  public:
1846c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  DEFINE_SIZE_ARRAY (6, langSys);
1856c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod};
1866c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1876c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1886c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod/*
1896c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod * JSTF -- The Justification Table
1906c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod */
1916c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1926c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbodstruct JSTF
1936c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod{
1946c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  static const hb_tag_t tableTag	= HB_OT_TAG_JSTF;
1956c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
1966c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline unsigned int get_script_count (void) const
1976c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  { return scriptList.len; }
1986c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline const Tag& get_script_tag (unsigned int i) const
1996c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  { return scriptList.get_tag (i); }
2006c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline unsigned int get_script_tags (unsigned int start_offset,
2016c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod				       unsigned int *script_count /* IN/OUT */,
2026c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod				       hb_tag_t     *script_tags /* OUT */) const
2036c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  { return scriptList.get_tags (start_offset, script_count, script_tags); }
2046c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline const JstfScript& get_script (unsigned int i) const
2056c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  { return this+scriptList[i].offset; }
2066c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline bool find_script_index (hb_tag_t tag, unsigned int *index) const
2076c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  { return scriptList.find_index (tag, index); }
2086c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
2096c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  inline bool sanitize (hb_sanitize_context_t *c) {
2106c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod    TRACE_SANITIZE (this);
2116c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod    return TRACE_RETURN (version.sanitize (c) && likely (version.major == 1) &&
2126c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod			 scriptList.sanitize (c, this));
2136c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  }
2146c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
2156c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  protected:
2166c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  FixedVersion	version;	/* Version of the JSTF table--initially set
2177627100f428ac0ec8509d961d368d2d25d8f0b6eBehdad Esfahbod				 * to 0x00010000u */
2186c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  RecordArrayOf<JstfScript>
2196c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod		scriptList;  	/* Array of JstfScripts--listed
2206c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod				 * alphabetically by ScriptTag */
2216c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  public:
2226c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod  DEFINE_SIZE_ARRAY (6, scriptList);
2236c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod};
2246c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
2256c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
2266c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod} /* namespace OT */
2276c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
2286c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod
2296c48f20eea22c6e686416ab4ec8388be3e8cd0b5Behdad Esfahbod#endif /* HB_OT_LAYOUT_JSTF_TABLE_HH */
230