• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_GPOS_H
27 #define HARFBUZZ_GPOS_H
28 
29 #include "harfbuzz-gdef.h"
30 #include "harfbuzz-buffer.h"
31 
32 HB_BEGIN_HEADER
33 
34 
35 /* Lookup types for glyph positioning */
36 
37 #define HB_GPOS_LOOKUP_SINGLE     1
38 #define HB_GPOS_LOOKUP_PAIR       2
39 #define HB_GPOS_LOOKUP_CURSIVE    3
40 #define HB_GPOS_LOOKUP_MARKBASE   4
41 #define HB_GPOS_LOOKUP_MARKLIG    5
42 #define HB_GPOS_LOOKUP_MARKMARK   6
43 #define HB_GPOS_LOOKUP_CONTEXT    7
44 #define HB_GPOS_LOOKUP_CHAIN      8
45 #define HB_GPOS_LOOKUP_EXTENSION  9
46 
47 /* A pointer to a function which accesses the PostScript interpreter.
48    Multiple Master fonts need this interface to convert a metric ID
49    (as stored in an OpenType font version 1.2 or higher) `metric_id'
50    into a metric value (returned in `metric_value').
51 
52    `data' points to the user-defined structure specified during a
53    call to HB_GPOS_Register_MM_Function().
54 
55    `metric_value' must be returned as a scaled value (but shouldn't
56    be rounded).                                                       */
57 
58 typedef HB_Error  (*HB_MMFunction)(HB_Font       font,
59 				    HB_UShort    metric_id,
60 				    HB_Fixed*      metric_value,
61 				    void*        data );
62 
63 
64 struct  HB_GPOSHeader_
65 {
66   HB_16Dot16           Version;
67 
68   HB_ScriptList     ScriptList;
69   HB_FeatureList    FeatureList;
70   HB_LookupList     LookupList;
71 
72   HB_GDEFHeader*    gdef;
73 
74   /* this is OpenType 1.2 -- Multiple Master fonts need this
75      callback function to get various metric values from the
76      PostScript interpreter.                                 */
77 
78   HB_MMFunction     mmfunc;
79   void*              data;
80 };
81 
82 typedef struct HB_GPOSHeader_  HB_GPOSHeader;
83 typedef HB_GPOSHeader* HB_GPOS;
84 
85 
86 HB_Error  HB_Load_GPOS_Table( HB_Stream stream,
87                               HB_GPOSHeader** gpos,
88 			      HB_GDEFHeader*  gdef,
89                               HB_Stream       gdefStream );
90 
91 
92 HB_Error  HB_Done_GPOS_Table( HB_GPOSHeader* gpos );
93 
94 
95 HB_Error  HB_GPOS_Select_Script( HB_GPOSHeader*  gpos,
96 				 HB_UInt         script_tag,
97 				 HB_UShort*       script_index );
98 
99 HB_Error  HB_GPOS_Select_Language( HB_GPOSHeader*  gpos,
100 				   HB_UInt         language_tag,
101 				   HB_UShort        script_index,
102 				   HB_UShort*       language_index,
103 				   HB_UShort*       req_feature_index );
104 
105 HB_Error  HB_GPOS_Select_Feature( HB_GPOSHeader*  gpos,
106 				  HB_UInt         feature_tag,
107 				  HB_UShort        script_index,
108 				  HB_UShort        language_index,
109 				  HB_UShort*       feature_index );
110 
111 
112 HB_Error  HB_GPOS_Query_Scripts( HB_GPOSHeader*  gpos,
113 				 HB_UInt**       script_tag_list );
114 
115 HB_Error  HB_GPOS_Query_Languages( HB_GPOSHeader*  gpos,
116 				   HB_UShort        script_index,
117 				   HB_UInt**       language_tag_list );
118 
119 HB_Error  HB_GPOS_Query_Features( HB_GPOSHeader*  gpos,
120 				  HB_UShort        script_index,
121 				  HB_UShort        language_index,
122 				  HB_UInt**       feature_tag_list );
123 
124 
125 HB_Error  HB_GPOS_Add_Feature( HB_GPOSHeader*  gpos,
126 			       HB_UShort        feature_index,
127 			       HB_UInt          property );
128 
129 HB_Error  HB_GPOS_Clear_Features( HB_GPOSHeader*  gpos );
130 
131 
132 HB_Error  HB_GPOS_Register_MM_Function( HB_GPOSHeader*  gpos,
133 					HB_MMFunction   mmfunc,
134 					void*            data );
135 
136 /* If `dvi' is TRUE, glyph contour points for anchor points and device
137    tables are ignored -- you will get device independent values.         */
138 
139 
140 HB_Error  HB_GPOS_Apply_String( HB_Font           font,
141 				HB_GPOSHeader*   gpos,
142 				HB_UShort         load_flags,
143 				HB_Buffer        buffer,
144 				HB_Bool           dvi,
145 				HB_Bool           r2l );
146 
147 HB_END_HEADER
148 
149 #endif /* HARFBUZZ_GPOS_H */
150