Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1002)

Side by Side Diff: third_party/harfbuzz/src/harfbuzz-shaper.h

Issue 12413010: Remove unused harfbuzz. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/harfbuzz/src/harfbuzz-shape.h ('k') | third_party/harfbuzz/src/harfbuzz-shaper.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
3 *
4 * This is part of HarfBuzz, an OpenType Layout engine library.
5 *
6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software.
11 *
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16 * DAMAGE.
17 *
18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23 */
24
25 #ifndef HARFBUZZ_SHAPER_H
26 #define HARFBUZZ_SHAPER_H
27
28 #include "harfbuzz-global.h"
29 #include "harfbuzz-gdef.h"
30 #include "harfbuzz-gpos.h"
31 #include "harfbuzz-gsub.h"
32 #include "harfbuzz-external.h"
33 #include "harfbuzz-stream-private.h"
34
35 HB_BEGIN_HEADER
36
37 #ifdef HB_USE_PACKED_STRUCTS
38 #pragma pack(push, 1)
39 #endif
40
41 /*
42 using anything else than signed or unsigned for bitfields in C is non standar d,
43 but accepted by almost all compilers. And it gives a significant reduction in
44 memory consumption as HB_CharAttributes and HB_GlyphAttributes will not have
45 a 4 byte alignment
46 */
47 #ifdef __xlC__
48 typedef unsigned hb_bitfield;
49 #else
50 typedef hb_uint8 hb_bitfield;
51 #endif
52
53 typedef enum {
54 HB_Script_Common,
55 HB_Script_Greek,
56 HB_Script_Cyrillic,
57 HB_Script_Armenian,
58 HB_Script_Hebrew,
59 HB_Script_Arabic,
60 HB_Script_Syriac,
61 HB_Script_Thaana,
62 HB_Script_Devanagari,
63 HB_Script_Bengali,
64 HB_Script_Gurmukhi,
65 HB_Script_Gujarati,
66 HB_Script_Oriya,
67 HB_Script_Tamil,
68 HB_Script_Telugu,
69 HB_Script_Kannada,
70 HB_Script_Malayalam,
71 HB_Script_Sinhala,
72 HB_Script_Thai,
73 HB_Script_Lao,
74 HB_Script_Tibetan,
75 HB_Script_Myanmar,
76 HB_Script_Georgian,
77 HB_Script_Hangul,
78 HB_Script_Ogham,
79 HB_Script_Runic,
80 HB_Script_Khmer,
81 HB_Script_Nko,
82 HB_Script_Inherited,
83 HB_ScriptCount = HB_Script_Inherited
84 /*
85 HB_Script_Latin = Common,
86 HB_Script_Ethiopic = Common,
87 HB_Script_Cherokee = Common,
88 HB_Script_CanadianAboriginal = Common,
89 HB_Script_Mongolian = Common,
90 HB_Script_Hiragana = Common,
91 HB_Script_Katakana = Common,
92 HB_Script_Bopomofo = Common,
93 HB_Script_Han = Common,
94 HB_Script_Yi = Common,
95 HB_Script_OldItalic = Common,
96 HB_Script_Gothic = Common,
97 HB_Script_Deseret = Common,
98 HB_Script_Tagalog = Common,
99 HB_Script_Hanunoo = Common,
100 HB_Script_Buhid = Common,
101 HB_Script_Tagbanwa = Common,
102 HB_Script_Limbu = Common,
103 HB_Script_TaiLe = Common,
104 HB_Script_LinearB = Common,
105 HB_Script_Ugaritic = Common,
106 HB_Script_Shavian = Common,
107 HB_Script_Osmanya = Common,
108 HB_Script_Cypriot = Common,
109 HB_Script_Braille = Common,
110 HB_Script_Buginese = Common,
111 HB_Script_Coptic = Common,
112 HB_Script_NewTaiLue = Common,
113 HB_Script_Glagolitic = Common,
114 HB_Script_Tifinagh = Common,
115 HB_Script_SylotiNagri = Common,
116 HB_Script_OldPersian = Common,
117 HB_Script_Kharoshthi = Common,
118 HB_Script_Balinese = Common,
119 HB_Script_Cuneiform = Common,
120 HB_Script_Phoenician = Common,
121 HB_Script_PhagsPa = Common,
122 */
123 } HB_Script;
124
125 typedef struct
126 {
127 hb_uint32 pos;
128 hb_uint32 length;
129 HB_Script script;
130 hb_uint8 bidiLevel;
131 } HB_ScriptItem;
132
133 typedef enum {
134 HB_NoBreak,
135 HB_SoftHyphen,
136 HB_Break,
137 HB_ForcedBreak
138 } HB_LineBreakType;
139
140
141 typedef struct {
142 /*HB_LineBreakType*/ hb_bitfield lineBreakType :2;
143 /*HB_Bool*/ hb_bitfield whiteSpace :1; /* A unicode whitesp ace character, except NBSP, ZWNBSP */
144 /*HB_Bool*/ hb_bitfield charStop :1; /* Valid cursor posi tion (for left/right arrow) */
145 /*HB_Bool*/ hb_bitfield wordBoundary :1;
146 /*HB_Bool*/ hb_bitfield sentenceBoundary :1;
147 hb_bitfield unused :2;
148 } HB_CharAttributes;
149
150 void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength,
151 const HB_ScriptItem *items, hb_uint32 numItems,
152 HB_CharAttributes *attributes);
153
154 /* requires HB_GetCharAttributes to be called before */
155 void HB_GetWordBoundaries(const HB_UChar16 *string, hb_uint32 stringLength,
156 const HB_ScriptItem *items, hb_uint32 numItems,
157 HB_CharAttributes *attributes);
158
159 /* requires HB_GetCharAttributes to be called before */
160 void HB_GetSentenceBoundaries(const HB_UChar16 *string, hb_uint32 stringLength,
161 const HB_ScriptItem *items, hb_uint32 numItems,
162 HB_CharAttributes *attributes);
163
164
165 typedef enum {
166 HB_LeftToRight = 0,
167 HB_RightToLeft = 1
168 } HB_StringToGlyphsFlags;
169
170 typedef enum {
171 HB_ShaperFlag_Default = 0,
172 HB_ShaperFlag_NoKerning = 1,
173 HB_ShaperFlag_UseDesignMetrics = 1 << 1,
174 /* Arabic vowels in some fonts (Times New Roman, at least) have
175 non-zero advances, when they should be zero. Setting this shaper
176 flag causes us to zero out the advances for mark glyphs. */
177 HB_ShaperFlag_ForceMarksToZeroWidth = 1 << 2
178 } HB_ShaperFlag;
179
180 /*
181 highest value means highest priority for justification. Justification is done by first inserting kashidas
182 starting with the highest priority positions, then stretching spaces, afterwa rds extending inter char
183 spacing, and last spacing between arabic words.
184 NoJustification is for example set for arabic where no Kashida can be inserte d or for diacritics.
185 */
186 typedef enum {
187 HB_NoJustification= 0, /* Justification can't be applied after this glyph */
188 HB_Arabic_Space = 1, /* This glyph represents a space inside arabic text */
189 HB_Character = 2, /* Inter-character justification point follows this glyph */
190 HB_Space = 4, /* This glyph represents a blank outside an Arabic run */
191 HB_Arabic_Normal = 7, /* Normal Middle-Of-Word glyph that connects to the right (begin) */
192 HB_Arabic_Waw = 8, /* Next character is final form of Waw/Ain/Qaf/Fa * /
193 HB_Arabic_BaRa = 9, /* Next two chars are Ba + Ra/Ya/AlefMaksura */
194 HB_Arabic_Alef = 10, /* Next character is final form of Alef/Tah/Lam/Kaf /Gaf */
195 HB_Arabic_HaaDal = 11, /* Next character is final form of Haa/Dal/Taa Marb utah */
196 HB_Arabic_Seen = 12, /* Initial or Medial form Of Seen/Sad */
197 HB_Arabic_Kashida = 13 /* Kashida(U+640) in middle of word */
198 } HB_JustificationClass;
199
200 /* This structure is binary compatible with Uniscribe's SCRIPT_VISATTR. Would be nice to keep
201 * it like that. If this is a problem please tell Trolltech :)
202 */
203 typedef struct {
204 hb_bitfield justification :4; /* Justification class */
205 hb_bitfield clusterStart :1; /* First glyph of representation of cluster */
206 hb_bitfield mark :1; /* needs to be positioned around base char */
207 hb_bitfield zeroWidth :1; /* ZWJ, ZWNJ etc, with no width */
208 hb_bitfield dontPrint :1;
209 hb_bitfield combiningClass :8;
210 } HB_GlyphAttributes;
211
212 typedef struct HB_FaceRec_ {
213 HB_Bool isSymbolFont;
214
215 HB_GDEF gdef;
216 HB_GSUB gsub;
217 HB_GPOS gpos;
218 HB_Bool supported_scripts[HB_ScriptCount];
219 HB_Buffer buffer;
220 HB_Script current_script;
221 int current_flags; /* HB_ShaperFlags */
222 HB_Bool has_opentype_kerning;
223 HB_Bool glyphs_substituted;
224 HB_GlyphAttributes *tmpAttributes;
225 unsigned int *tmpLogClusters;
226 int length;
227 int orig_nglyphs;
228 } HB_FaceRec;
229
230 typedef HB_Error (*HB_GetFontTableFunc)(void *font, HB_Tag tag, HB_Byte *buffer, HB_UInt *length);
231
232 HB_Face HB_NewFace(void *font, HB_GetFontTableFunc tableFunc);
233 void HB_FreeFace(HB_Face face);
234
235 typedef struct {
236 HB_Fixed x, y;
237 HB_Fixed width, height;
238 HB_Fixed xOffset, yOffset;
239 } HB_GlyphMetrics;
240
241 typedef enum {
242 HB_FontAscent
243 } HB_FontMetric;
244
245 typedef struct {
246 HB_Bool (*convertStringToGlyphIndices)(HB_Font font, const HB_UChar16 *stri ng, hb_uint32 length, HB_Glyph *glyphs, hb_uint32 *numGlyphs, HB_Bool rightToLef t);
247 void (*getGlyphAdvances)(HB_Font font, const HB_Glyph *glyphs, hb_uint32 numGlyphs, HB_Fixed *advances, int flags /*HB_ShaperFlag*/);
248 HB_Bool (*canRender)(HB_Font font, const HB_UChar16 *string, hb_uint32 leng th);
249 /* implementation needs to make sure to load a scaled glyph, so /no/ FT_LOAD _NO_SCALE */
250 HB_Error (*getPointInOutline)(HB_Font font, HB_Glyph glyph, int flags /*HB_S haperFlag*/, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints );
251 void (*getGlyphMetrics)(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *m etrics);
252 HB_Fixed (*getFontMetric)(HB_Font font, HB_FontMetric metric);
253 } HB_FontClass;
254
255 typedef struct HB_Font_ {
256 const HB_FontClass *klass;
257
258 /* Metrics */
259 HB_UShort x_ppem, y_ppem;
260 HB_16Dot16 x_scale, y_scale;
261
262 void *userData;
263 } HB_FontRec;
264
265 #ifdef HB_USE_PACKED_STRUCTS
266 #pragma pack(pop)
267 #endif
268
269 typedef struct HB_ShaperItem_ HB_ShaperItem;
270
271 struct HB_ShaperItem_ {
272 const HB_UChar16 *string; /* input: the Unicode UTF16 text to be shaped */
273 hb_uint32 stringLength; /* input: the length of the input in 16-bit words */
274 HB_ScriptItem item; /* input: the current run to be shap ed: a run of text all in the same script that is a substring of <string> */
275 HB_Font font; /* input: the font: scale, units and function pointers supplying glyph indices and metrics */
276 HB_Face face; /* input: the shaper state; current script, access to the OpenType tables , etc. */
277 int shaperFlags; /* input (unused) should be set to 0 ; intended to support flags defined in HB_ShaperFlag */
278 HB_Bool glyphIndicesPresent; /* input: true if the <glyphs> array contains glyph indices ready to be shaped */
279 hb_uint32 initialGlyphCount; /* input: if glyphIndicesPresent is true, the number of glyph indices in the <glyphs> array */
280
281 hb_uint32 num_glyphs; /* input: capacity of output arrays <glyphs>, <attributes>, <advances>, <offsets>, and <log_clusters>; */
282 /* output: required capacity (may be larger than actual capacity) */
283
284 HB_Glyph *glyphs; /* output: <num_glyphs> indices of s haped glyphs */
285 HB_GlyphAttributes *attributes; /* output: <num_glyphs> glyph attrib utes */
286 HB_Fixed *advances; /* output: <num_glyphs> advances */
287 HB_FixedPoint *offsets; /* output: <num_glyphs> offsets */
288 unsigned short *log_clusters; /* output: for each output glyph, th e index in the input of the start of its logical cluster */
289
290 /* internal */
291 HB_Bool kerning_applied; /* output: true if kerning was appli ed by the shaper */
292 };
293
294 HB_Bool HB_ShapeItem(HB_ShaperItem *item);
295
296 HB_END_HEADER
297
298 #endif
OLDNEW
« no previous file with comments | « third_party/harfbuzz/src/harfbuzz-shape.h ('k') | third_party/harfbuzz/src/harfbuzz-shaper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698