b6dcadcf88700af96ece51581531d9aabc0afb68
[profile/ivi/org.tizen.video-player.git] / include / harfbuzz-gdef.h
1 /*
2  * Copyright (C) 1998-2004  David Turner and Werner Lemberg
3  * Copyright (C) 2006  Behdad Esfahbod
4  *
5  * This is part of HarfBuzz, an OpenType Layout engine library.
6  *
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.
12  *
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
17  * DAMAGE.
18  *
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.
24  */
25
26 #ifndef HARFBUZZ_GDEF_H
27 #define HARFBUZZ_GDEF_H
28
29 #include "harfbuzz-open.h"
30 #include "harfbuzz-stream.h"
31
32 HB_BEGIN_HEADER
33
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
40
41
42 typedef struct HB_AttachPoint_  HB_AttachPoint;
43
44
45 struct  HB_AttachList_
46 {
47   HB_Bool           loaded;
48
49   HB_Coverage       Coverage;         /* Coverage table              */
50   HB_UShort         GlyphCount;       /* number of glyphs with
51                                          attachments                 */
52   HB_AttachPoint*   AttachPoint;      /* array of AttachPoint tables */
53 };
54
55 typedef struct HB_AttachList_  HB_AttachList;
56
57 typedef struct HB_LigGlyph_  HB_LigGlyph;
58
59 struct  HB_LigCaretList_
60 {
61   HB_Bool        loaded;
62
63   HB_Coverage    Coverage;            /* Coverage table            */
64   HB_UShort      LigGlyphCount;       /* number of ligature glyphs */
65   HB_LigGlyph*   LigGlyph;            /* array of LigGlyph tables  */
66 };
67
68 typedef struct HB_LigCaretList_  HB_LigCaretList;
69
70
71
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.
80
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).
84
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.      */
91
92 struct  HB_GDEFHeader_
93 {
94   HB_UInt             offset;
95
96   HB_16Dot16             Version;
97
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 */
103
104   HB_UShort            LastGlyph;
105   HB_UShort**          NewGlyphClasses;
106 };
107
108 typedef struct HB_GDEFHeader_   HB_GDEFHeader;
109 typedef struct HB_GDEFHeader_*  HB_GDEF;
110
111
112 HB_Error  HB_New_GDEF_Table( HB_GDEFHeader** retptr );
113       
114
115 HB_Error  HB_Load_GDEF_Table( HB_Stream       stream,
116                               HB_GDEFHeader** gdef );
117
118
119 HB_Error  HB_Done_GDEF_Table ( HB_GDEFHeader* gdef );
120
121
122 HB_Error  HB_GDEF_Get_Glyph_Property( HB_GDEFHeader*  gdef,
123                                       HB_UShort        glyphID,
124                                       HB_UShort*       property );
125
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 );
131
132
133 HB_END_HEADER
134
135 #endif /* HARFBUZZ_GDEF_H */