harfbuzz-open.h 7.8 KB
Newer Older
1 2 3
/*
 * Copyright (C) 1998-2004  David Turner and Werner Lemberg
 * Copyright (C) 2006  Behdad Esfahbod
4 5 6
 *
 *  This is part of HarfBuzz, an OpenType Layout engine library.
 *
7 8 9 10 11
 * Permission is hereby granted, without written agreement and without
 * license or royalty fees, to use, copy, modify, and distribute this
 * software and its documentation for any purpose, provided that the
 * above copyright notice and the following two paragraphs appear in
 * all copies of this software.
12
 *
13 14 15 16 17 18 19 20 21 22 23 24 25
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 *
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 */

26 27 28
#ifndef HARFBUZZ_OPEN_H
#define HARFBUZZ_OPEN_H

29 30 31
#include "harfbuzz-global.h"

HB_BEGIN_HEADER
32 33 34 35 36 37 38 39 40 41 42 43 44

/* Use this if a feature applies to all glyphs */
#define HB_ALL_GLYPHS                    0xFFFF

#define HB_DEFAULT_LANGUAGE              0xFFFF

#define HB_MAX_NESTING_LEVEL             100


/* Script list related structures */

struct  HB_LangSys_
{
45 46 47 48
  HB_UShort   LookupOrderOffset;      /* always 0 for TT Open 1.0  */
  HB_UShort   ReqFeatureIndex;        /* required FeatureIndex     */
  HB_UShort   FeatureCount;           /* number of Feature indices */
  HB_UShort*  FeatureIndex;           /* array of Feature indices  */
49 50 51 52 53 54 55
};

typedef struct HB_LangSys_  HB_LangSys;


struct  HB_LangSysRecord_
{
56
  HB_UInt     LangSysTag;            /* LangSysTag identifier */
57 58 59 60 61 62
  HB_LangSys  LangSys;               /* LangSys table         */
};

typedef struct HB_LangSysRecord_  HB_LangSysRecord;


63
struct  HB_ScriptTable_
64 65
{
  HB_LangSys         DefaultLangSys; /* DefaultLangSys table     */
66
  HB_UShort           LangSysCount;   /* number of LangSysRecords */
67 68 69
  HB_LangSysRecord*  LangSysRecord;  /* array of LangSysRecords  */
};

70
typedef struct HB_ScriptTable_  HB_ScriptTable;
71 72 73 74


struct  HB_ScriptRecord_
{
75
  HB_UInt    ScriptTag;              /* ScriptTag identifier */
76
  HB_ScriptTable  Script;                 /* Script table         */
77 78 79 80 81 82 83
};

typedef struct HB_ScriptRecord_  HB_ScriptRecord;


struct  HB_ScriptList_
{
84
  HB_UShort          ScriptCount;     /* number of ScriptRecords */
85 86 87 88 89 90 91 92 93 94
  HB_ScriptRecord*  ScriptRecord;    /* array of ScriptRecords  */
};

typedef struct HB_ScriptList_  HB_ScriptList;


/* Feature list related structures */

struct HB_Feature_
{
95 96 97
  HB_UShort   FeatureParams;          /* always 0 for TT Open 1.0     */
  HB_UShort   LookupListCount;        /* number of LookupList indices */
  HB_UShort*  LookupListIndex;        /* array of LookupList indices  */
98 99 100 101 102 103 104
};

typedef struct HB_Feature_  HB_Feature;


struct  HB_FeatureRecord_
{
105
  HB_UInt     FeatureTag;            /* FeatureTag identifier */
106 107 108 109 110 111 112 113
  HB_Feature  Feature;               /* Feature table         */
};

typedef struct HB_FeatureRecord_  HB_FeatureRecord;


struct  HB_FeatureList_
{
114
  HB_UShort           FeatureCount;   /* number of FeatureRecords */
115
  HB_FeatureRecord*  FeatureRecord;  /* array of FeatureRecords  */
116 117
  HB_UShort*		ApplyOrder;	/* order to apply features */
  HB_UShort		ApplyCount;	/* number of elements in ApplyOrder */
118 119 120 121 122 123 124 125 126 127 128 129
};

typedef struct HB_FeatureList_  HB_FeatureList;


/* Lookup list related structures */

typedef struct HB_SubTable_  HB_SubTable;


struct  HB_Lookup_
{
130 131 132
  HB_UShort      LookupType;          /* Lookup type         */
  HB_UShort      LookupFlag;          /* Lookup qualifiers   */
  HB_UShort      SubTableCount;       /* number of SubTables */
133 134 135 136 137 138 139 140 141 142 143 144 145 146
  HB_SubTable*  SubTable;            /* array of SubTables  */
};

typedef struct HB_Lookup_  HB_Lookup;


/* The `Properties' field is not defined in the OpenType specification but
   is needed for processing lookups.  If properties[n] is > 0, the
   functions HB_GSUB_Apply_String() resp. HB_GPOS_Apply_String() will
   process Lookup[n] for glyphs which have the specific bit not set in
   the `properties' field of the input string object.                  */

struct  HB_LookupList_
{
147
  HB_UShort    LookupCount;           /* number of Lookups       */
148
  HB_Lookup*  Lookup;                /* array of Lookup records */
149
  HB_UInt*     Properties;            /* array of flags          */
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
};

typedef struct HB_LookupList_  HB_LookupList;


/* Possible LookupFlag bit masks.  `HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS' comes from the
   OpenType 1.2 specification; HB_LOOKUP_FLAG_RIGHT_TO_LEFT has been (re)introduced in
   OpenType 1.3 -- if set, the last glyph in a cursive attachment
   sequence has to be positioned on the baseline -- regardless of the
   writing direction.                                                    */

#define HB_LOOKUP_FLAG_RIGHT_TO_LEFT         0x0001
#define HB_LOOKUP_FLAG_IGNORE_BASE_GLYPHS    0x0002
#define HB_LOOKUP_FLAG_IGNORE_LIGATURES      0x0004
#define HB_LOOKUP_FLAG_IGNORE_MARKS          0x0008
#define HB_LOOKUP_FLAG_IGNORE_SPECIAL_MARKS  0xFF00


struct  HB_CoverageFormat1_
{
170 171
  HB_UShort   GlyphCount;             /* number of glyphs in GlyphArray */
  HB_UShort*  GlyphArray;             /* array of glyph IDs             */
172 173 174 175 176 177 178
};

typedef struct HB_CoverageFormat1_  HB_CoverageFormat1;


struct HB_RangeRecord_
{
179 180 181
  HB_UShort  Start;                   /* first glyph ID in the range */
  HB_UShort  End;                     /* last glyph ID in the range  */
  HB_UShort  StartCoverageIndex;      /* coverage index of first
182 183 184 185 186 187 188 189
					 glyph ID in the range       */
};

typedef struct HB_RangeRecord_  HB_RangeRecord;


struct  HB_CoverageFormat2_
{
190
  HB_UShort         RangeCount;       /* number of RangeRecords */
191 192 193 194 195 196 197 198
  HB_RangeRecord*  RangeRecord;      /* array of RangeRecords  */
};

typedef struct HB_CoverageFormat2_  HB_CoverageFormat2;


struct  HB_Coverage_
{
199
  HB_UShort  CoverageFormat;          /* 1 or 2 */
200 201 202 203 204 205 206 207 208 209 210 211 212

  union
  {
    HB_CoverageFormat1  cf1;
    HB_CoverageFormat2  cf2;
  } cf;
};

typedef struct HB_Coverage_  HB_Coverage;


struct  HB_ClassDefFormat1_
{
213
  HB_UShort   StartGlyph;             /* first glyph ID of the
214
					 ClassValueArray             */
215 216
  HB_UShort   GlyphCount;             /* size of the ClassValueArray */
  HB_UShort*  ClassValueArray;        /* array of class values       */
217 218 219 220 221 222 223
};

typedef struct HB_ClassDefFormat1_  HB_ClassDefFormat1;


struct  HB_ClassRangeRecord_
{
224 225 226
  HB_UShort  Start;                   /* first glyph ID in the range    */
  HB_UShort  End;                     /* last glyph ID in the range     */
  HB_UShort  Class;                   /* applied to all glyphs in range */
227 228 229 230 231 232 233
};

typedef struct HB_ClassRangeRecord_  HB_ClassRangeRecord;


struct  HB_ClassDefFormat2_
{
234
  HB_UShort              ClassRangeCount;
235 236 237 238 239 240 241 242 243 244
				      /* number of ClassRangeRecords */
  HB_ClassRangeRecord*  ClassRangeRecord;
				      /* array of ClassRangeRecords  */
};

typedef struct HB_ClassDefFormat2_  HB_ClassDefFormat2;


struct  HB_ClassDefinition_
{
245
  HB_Bool    loaded;
246

247
  HB_UShort  ClassFormat;             /* 1 or 2                      */
248 249 250 251 252 253 254 255 256 257 258 259 260

  union
  {
    HB_ClassDefFormat1  cd1;
    HB_ClassDefFormat2  cd2;
  } cd;
};

typedef struct HB_ClassDefinition_  HB_ClassDefinition;


struct HB_Device_
{
261 262 263
  HB_UShort   StartSize;              /* smallest size to correct      */
  HB_UShort   EndSize;                /* largest size to correct       */
  HB_UShort   DeltaFormat;            /* DeltaValue array data format:
264
					 1, 2, or 3                    */
265
  HB_UShort*  DeltaValue;             /* array of compressed data      */
266 267 268 269 270 271 272 273 274 275 276 277 278 279
};

typedef struct HB_Device_  HB_Device;


enum  HB_Type_
{
  HB_Type_GSUB,
  HB_Type_GPOS
};

typedef enum HB_Type_  HB_Type;


280
HB_END_HEADER
281 282

#endif /* HARFBUZZ_OPEN_H */