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

Side by Side Diff: third_party/harfbuzz/src/harfbuzz-shape.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
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2006 Red Hat, Inc.
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 * Red Hat Author(s): Owen Taylor
25 */
26
27 #include <stdint.h>
28
29 /* Base Types */
30
31 typedef hb_uint16 HB_CodePoint; /* UTF-16 codepoint (not character ) */
32 typedef char HB_Boolean;
33 typedef hb_uint32 HB_Fixed; /* 26.6 */
34 typedef hb_uint32 HB_Glyph;
35 typedef hb_uint32 HB_Unichar;
36
37 /* Metrics reported by the font backend for use of the shaper */
38 typedef struct _HB_GlyphMetrics HB_GlyphMetrics;
39 struct _HB_GlyphMetrics
40 {
41 HB_Fixed advance;
42
43 /* Do we need ink/logical extents for the glyph here? */
44 };
45
46 /*
47 * HB_Font: Abstract font interface.
48 * First pass of this might just have FT_Face *getFace();
49 */
50 typedef struct _HB_Font HB_Font;
51 typedef struct _HB_FontClass HB_FontClass;
52
53 struct HB_FontClass {
54 HB_Glyph (*charToGlyph)(HB_Font *font, HB_Unichar chr);
55 void (*getMetrics)(HB_Font *font, HB_Glyph glyph, HB_GlyphMetrics *met rics);
56 HB_Boolean (*getSFontTable)(HB_Font *font, void **cookie, char **start, int *len);
57 HB_Boolean (*freeSFontTable)(void **cookie);
58 };
59
60 struct _HB_Font {
61 HB_FontClass *clazz;
62 };
63
64 /*
65 * Language tags, of the form en-us; represented as interned, canonicalized
66 * strings. hb_language_from_string("en_US"), hb_language_from_string("en-us")
67 * both return the same (pointer-comparable) HB_Language).
68 */
69 typedef struct HB_Language_ *HB_Language;
70
71 HB_Language hb_language_from_string(const char *str);
72 const char *hb_language_to_string(HB_Language language);
73
74 /* Special treatment for the edges of runs.
75 */
76 typedef enum {
77 HB_RUN_EDGE_LINE_VISUAL_EDGE = 1 << 0,
78 HB_RUN_EDGE_LINE_LOGICAL_EDGE = 1 << 1,
79 HB_RUN_EDGE_LINE_ADD_HYPHEN = 1 << 2 /* ???? */
80 } HB_RunEdge;
81
82 /* Defines optional informaiton in HB_ShapeInput; this allows extension
83 * of HB_ShapeInput while keeping binary compatibility
84 */
85 typedef enum {
86 HB_SHAPE_START_TYPE = 1 << 0,
87 HB_SHAPE_END_TYPE = 1 << 1
88 } HB_ShapeFlags;
89
90 /* Attributes types are described by "interned strings"; this is a little
91 * annoying if you want to write a switch statement, but keeps things
92 * simple.
93 */
94 typedef struct _HB_AttributeType *HB_AttributeType;
95
96 HB_AttributeType hb_attribute_type_from_string(const char *str);
97 const char *hb_attribute_type_to_string(HB_AttributeType attribute_type);
98
99 struct HB_Attribute {
100 HB_AttributeType type;
101 int start;
102 int end;
103 };
104
105
106 /**
107 * You could handle this like HB_Language, but an enum seems a little nicer;
108 * another approach would be to use OpenType script tags.
109 */
110 typedef enum {
111 HB_SCRIPT_LATIN
112 /* ... */
113 } HB_ShapeScript;
114
115 /* This is just the subset of direction information needed by the shaper */
116 typedef enum {
117 HB_DIRECTION_LTR,
118 HB_DIRECTION_RTL,
119 HB_DIRECTION_TTB
120 } HB_Direction;
121
122 typedef struct _HB_ShapeInput HB_ShapeInput;
123 struct _HB_ShapeInput {
124 /* Defines what fields the caller has initialized - fields not in
125 * the enum are mandatory.
126 */
127 HB_ShapeFlags flags;
128
129 HB_CodePoint *text;
130 int length; /* total length of text to shape */
131 int shape_offset; /* start of section to shape */
132 int shape_length; /* number of code points to shape */
133
134 HB_Direction direction;
135 HB_ShapeScript script;
136 HB_Language language;
137
138 HB_AttributeType *attributes;
139 int n_attributes;
140
141 HB_RunEdge start_type;
142 HB_RunEdge end_type;
143 };
144
145 struct HB_GlyphItem {
146 HB_Glyph glyph;
147
148 HB_Fixed x_offset;
149 HB_Fixed y_offset;
150 HB_Fixed advance;
151
152 /* Add kashida information, etc, here */
153 };
154
155 typedef enum {
156 HB_RESULT_SUCCESS,
157 HB_RESULT_NO_MEMORY,
158 HB_SHAPE_RESULT_FAILED
159 } HB_Result;
160
161 /*
162 * Buffer for output
163 */
164 typedef struct _HB_GlyphBuffer HB_GlyphBuffer;
165 struct _HB_GlyphBuffer {
166 int glyph_item_size;
167 int total_glyphs;
168
169 int *log_clusters; /* Uniscribe style */
170 int cluster_space;
171
172 int glyph_space;
173 void *glyph_buffer;
174 };
175
176 /* Making this self-allocating simplifies writing shapers and
177 * also keeps things easier for caller. item_size passed in
178 * must be at least sizeof(HB_GlyphItem) but can be bigger,
179 * to accomodate application structures that extend HB_GlyphItem.
180 * The allocated items will be zero-initialized.
181 *
182 * (Hack: Harfbuzz could choose to use even a *bigger* item size
183 * and stick internal information before the public item structure.
184 * This hack could possibly be used to unify this with HB_Buffer)
185 */
186 HB_GlyphBuffer *hb_glyph_buffer_new (size_t item_size);
187 void hb_glyph_buffer_clear (HB_GlyphBuffer *buf);
188 HB_Result hb_glyph_buffer_extend_glyphs (HB_GlyphBuffer *buf, int n_item s);
189 HB_Result hb_glyph_buffer_extend_clusters (HB_GlyphBuffer *buf, int n_clus ters);
190 void hb_glyph_buffer_free (HB_GlyphBuffer *buf);
191
192
193 /* Accessor for a particular glyph */
194 #define HB_GLYPH_BUFFER_ITEM(buffer, index)
195
196 /*
197 * Main shaping function
198 */
199 HB_Result hb_shape(HB_ShapeInput *input, HB_GlyphBuffer *output);
OLDNEW
« no previous file with comments | « third_party/harfbuzz/src/harfbuzz-open-private.h ('k') | third_party/harfbuzz/src/harfbuzz-shaper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698