Debian Codegraph @

texk/web2c/xetexdir/XeTeXLayoutInterface.h

raw
1 /****************************************************************************\
2 Part of the XeTeX typesetting system
3 Copyright (c) 1994-2008 by SIL International
4 Copyright (c) 2009 by Jonathan Kew
5 Copyright (c) 2012-2015 by Khaled Hosny
6
7 SIL Author(s): Jonathan Kew
8
9 Permission is hereby granted, free of charge, to any person obtaining
10 a copy of this software and associated documentation files (the
11 "Software"), to deal in the Software without restriction, including
12 without limitation the rights to use, copy, modify, merge, publish,
13 distribute, sublicense, and/or sell copies of the Software, and to
14 permit persons to whom the Software is furnished to do so, subject to
15 the following conditions:
16
17 The above copyright notice and this permission notice shall be
18 included in all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
24 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
25 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
28 Except as contained in this notice, the name of the copyright holders
29 shall not be used in advertising or otherwise to promote the sale,
30 use or other dealings in this Software without prior written
31 authorization from the copyright holders.
32 \****************************************************************************/
33
34 #ifndef XETEX_LAYOUT_INTERFACE_H
35 #define XETEX_LAYOUT_INTERFACE_H 1
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 typedef struct XeTeXFont_rec* XeTeXFont;
41 typedef struct XeTeXLayoutEngine_rec* XeTeXLayoutEngine;
42 #ifdef __cplusplus
43 };
44 #endif
45
46 #include <ft2build.h>
47 #include FT_FREETYPE_H
48 #include FT_TRUETYPE_TABLES_H
49
50 #include <hb.h>
51 #include <hb-ot.h>
52
53 #include "XeTeX_ext.h"
54 #include "XeTeXFontMgr.h"
55
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59
60 extern char gPrefEngine;
61
62 int getCachedGlyphBBox(uint16_t fontID, uint16_t glyphID, GlyphBBox* bbox);
63 void cacheGlyphBBox(uint16_t fontID, uint16_t glyphID, const GlyphBBox* bbox);
64
65 void terminatefontmanager();
66
67 XeTeXFont createFont(PlatformFontRef fontRef, Fixed pointSize);
68 XeTeXFont createFontFromFile(const char* filename, int index, Fixed pointSize);
69
70 void setFontLayoutDir(XeTeXFont font, int vertical);
71
72 PlatformFontRef findFontByName(const char* name, char* var, double size);
73
74 char getReqEngine();
75 void setReqEngine(char reqEngine);
76 const char* getFullName(PlatformFontRef fontRef);
77
78 char* getFontFilename(XeTeXLayoutEngine engine, uint32_t* index);
79
80 double getDesignSize(XeTeXFont font);
81
82 void deleteFont(XeTeXFont font);
83
84 void* getFontTablePtr(XeTeXFont font, uint32_t tableTag);
85
86 Fixed getSlant(XeTeXFont font);
87
88 unsigned int countScripts(XeTeXFont font);
89 unsigned int countLanguages(XeTeXFont font, hb_tag_t script);
90 unsigned int countFeatures(XeTeXFont font, hb_tag_t script, hb_tag_t language);
91 unsigned int countGlyphs(XeTeXFont font);
92
93 hb_tag_t getIndScript(XeTeXFont font, unsigned int index);
94 hb_tag_t getIndLanguage(XeTeXFont font, hb_tag_t script, unsigned int index);
95 hb_tag_t getIndFeature(XeTeXFont font, hb_tag_t script, hb_tag_t language, unsigned int index);
96
97 float getGlyphWidth(XeTeXFont font, uint32_t gid);
98
99 XeTeXLayoutEngine createLayoutEngine(PlatformFontRef fontRef, XeTeXFont font, hb_tag_t script, char *language,
100 hb_feature_t* features, int nFeatures, char **shapers, uint32_t rgbValue,
101 float extend, float slant, float embolden);
102
103 void deleteLayoutEngine(XeTeXLayoutEngine engine);
104
105 XeTeXFont getFont(XeTeXLayoutEngine engine);
106 PlatformFontRef getFontRef(XeTeXLayoutEngine engine);
107
108 float getExtendFactor(XeTeXLayoutEngine engine);
109 float getSlantFactor(XeTeXLayoutEngine engine);
110 float getEmboldenFactor(XeTeXLayoutEngine engine);
111
112 int layoutChars(XeTeXLayoutEngine engine, uint16_t* chars, int32_t offset, int32_t count, int32_t max,
113 bool rightToLeft);
114
115 void getGlyphs(XeTeXLayoutEngine engine, uint32_t* glyphs);
116 void getGlyphAdvances(XeTeXLayoutEngine engine, float *advances);
117 void getGlyphPositions(XeTeXLayoutEngine engine, FloatPoint* positions);
118
119 float getPointSize(XeTeXLayoutEngine engine);
120
121 void getAscentAndDescent(XeTeXLayoutEngine engine, float* ascent, float* descent);
122 void getCapAndXHeight(XeTeXLayoutEngine engine, float* capheight, float* xheight);
123
124 int getDefaultDirection(XeTeXLayoutEngine engine);
125
126 uint32_t getRgbValue(XeTeXLayoutEngine engine);
127
128 void getGlyphBounds(XeTeXLayoutEngine engine, uint32_t glyphID, GlyphBBox* bbox);
129
130 float getGlyphWidthFromEngine(XeTeXLayoutEngine engine, uint32_t glyphID);
131
132 void getGlyphHeightDepth(XeTeXLayoutEngine engine, uint32_t glyphID, float* height, float* depth);
133
134 void getGlyphSidebearings(XeTeXLayoutEngine engine, uint32_t glyphID, float* lsb, float* rsb);
135
136 float getGlyphItalCorr(XeTeXLayoutEngine engine, uint32_t glyphID);
137
138 uint32_t mapCharToGlyph(XeTeXLayoutEngine engine, uint32_t charCode);
139
140 int mapGlyphToIndex(XeTeXLayoutEngine engine, const char* glyphName);
141
142 const char* getGlyphName(XeTeXFont font, uint16_t gid, int* len);
143
144 int getFontCharRange(XeTeXLayoutEngine engine, int reqFirst);
145
146 /* graphite interface functions... */
147 bool initGraphiteBreaking(XeTeXLayoutEngine engine, const uint16_t* txtPtr, int txtLen);
148 int findNextGraphiteBreak(void);
149
150 bool usingOpenType(XeTeXLayoutEngine engine);
151 bool usingGraphite(XeTeXLayoutEngine engine);
152 bool isOpenTypeMathFont(XeTeXLayoutEngine engine);
153
154 bool findGraphiteFeature(XeTeXLayoutEngine engine, const char* s, const char* e, hb_tag_t* f, int* v);
155
156 uint32_t countGraphiteFeatures(XeTeXLayoutEngine engine);
157 uint32_t getGraphiteFeatureCode(XeTeXLayoutEngine engine, uint32_t index);
158 uint32_t countGraphiteFeatureSettings(XeTeXLayoutEngine engine, uint32_t feature);
159 uint32_t getGraphiteFeatureSettingCode(XeTeXLayoutEngine engine, uint32_t feature, uint32_t index);
160 uint32_t getGraphiteFeatureDefaultSetting(XeTeXLayoutEngine engine, uint32_t feature);
161 char* getGraphiteFeatureLabel(XeTeXLayoutEngine engine, uint32_t feature);
162 char* getGraphiteFeatureSettingLabel(XeTeXLayoutEngine engine, uint32_t feature, uint32_t setting);
163 long findGraphiteFeatureNamed(XeTeXLayoutEngine engine, const char* name, int namelength);
164 long findGraphiteFeatureSettingNamed(XeTeXLayoutEngine engine, uint32_t feature, const char* name, int namelength);
165
166 #ifdef __cplusplus
167 };
168 #endif
169
170 #endif /* XETEX_LAYOUT_INTERFACE_H */
171