2 * Copyright (C) 1998-2004 David Turner and Werner Lemberg
3 * Copyright (C) 2006 Behdad Esfahbod
5 * This is part of HarfBuzz, an OpenType Layout engine library.
7 * Permission is hereby granted, without written agreement and without
8 * license or royalty fees, to use, copy, modify, and distribute this
9 * software and its documentation for any purpose, provided that the
10 * above copyright notice and the following two paragraphs appear in
11 * all copies of this software.
13 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
19 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
22 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
26 #ifndef HARFBUZZ_GDEF_H
27 #define HARFBUZZ_GDEF_H
29 #include "harfbuzz-open.h"
30 #include "harfbuzz-stream.h"
34 /* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding
35 * flag in the LookupFlag field. */
36 #define HB_GDEF_BASE_GLYPH 0x0002
37 #define HB_GDEF_LIGATURE 0x0004
38 #define HB_GDEF_MARK 0x0008
39 #define HB_GDEF_COMPONENT 0x0010
42 typedef struct HB_AttachPoint_ HB_AttachPoint;
49 HB_Coverage Coverage; /* Coverage table */
50 HB_UShort GlyphCount; /* number of glyphs with
52 HB_AttachPoint* AttachPoint; /* array of AttachPoint tables */
55 typedef struct HB_AttachList_ HB_AttachList;
57 typedef struct HB_LigGlyph_ HB_LigGlyph;
59 struct HB_LigCaretList_
63 HB_Coverage Coverage; /* Coverage table */
64 HB_UShort LigGlyphCount; /* number of ligature glyphs */
65 HB_LigGlyph* LigGlyph; /* array of LigGlyph tables */
68 typedef struct HB_LigCaretList_ HB_LigCaretList;
72 /* The `NewGlyphClasses' field is not defined in the TTO specification.
73 We use it for fonts with a constructed `GlyphClassDef' structure
74 (i.e., which don't have a GDEF table) to collect glyph classes
75 assigned during the lookup process. The number of arrays in this
76 pointer array is GlyphClassDef->cd.cd2.ClassRangeCount+1; the nth
77 array then contains the glyph class values of the glyphs not covered
78 by the ClassRangeRecords structures with index n-1 and n. We store
79 glyph class values for four glyphs in a single array element.
81 `LastGlyph' is identical to the number of glyphs minus one in the
82 font; we need it only if `NewGlyphClasses' is not NULL (to have an
83 upper bound for the last array).
85 Note that we first store the file offset to the `MarkAttachClassDef'
86 field (which has been introduced in OpenType 1.2) -- since the
87 `Version' field value hasn't been increased to indicate that we have
88 one more field for some obscure reason, we must parse the GSUB table
89 to find out whether class values refer to this table. Only then we
90 can finally load the MarkAttachClassDef structure if necessary. */
98 HB_ClassDefinition GlyphClassDef;
99 HB_AttachList AttachList;
100 HB_LigCaretList LigCaretList;
101 HB_UInt MarkAttachClassDef_offset;
102 HB_ClassDefinition MarkAttachClassDef; /* new in OT 1.2 */
105 HB_UShort** NewGlyphClasses;
108 typedef struct HB_GDEFHeader_ HB_GDEFHeader;
109 typedef struct HB_GDEFHeader_* HB_GDEF;
112 HB_Error HB_New_GDEF_Table( HB_GDEFHeader** retptr );
115 HB_Error HB_Load_GDEF_Table( HB_Stream stream,
116 HB_GDEFHeader** gdef );
119 HB_Error HB_Done_GDEF_Table ( HB_GDEFHeader* gdef );
122 HB_Error HB_GDEF_Get_Glyph_Property( HB_GDEFHeader* gdef,
124 HB_UShort* property );
126 HB_Error HB_GDEF_Build_ClassDefinition( HB_GDEFHeader* gdef,
127 HB_UShort num_glyphs,
128 HB_UShort glyph_count,
129 HB_UShort* glyph_array,
130 HB_UShort* class_array );
135 #endif /* HARFBUZZ_GDEF_H */