OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 1998-2004 David Turner and Werner Lemberg | 2 * Copyright © 1998-2004 David Turner and Werner Lemberg |
3 * Copyright © 2004,2007,2009,2010 Red Hat, Inc. | 3 * Copyright © 2004,2007,2009,2010 Red Hat, Inc. |
4 * Copyright © 2011,2012 Google, Inc. | 4 * Copyright © 2011,2012 Google, Inc. |
5 * | 5 * |
6 * This is part of HarfBuzz, a text shaping library. | 6 * This is part of HarfBuzz, a text shaping library. |
7 * | 7 * |
8 * Permission is hereby granted, without written agreement and without | 8 * Permission is hereby granted, without written agreement and without |
9 * license or royalty fees, to use, copy, modify, and distribute this | 9 * license or royalty fees, to use, copy, modify, and distribute this |
10 * software and its documentation for any purpose, provided that the | 10 * software and its documentation for any purpose, provided that the |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 unsigned int context_len[2]; | 96 unsigned int context_len[2]; |
97 | 97 |
98 | 98 |
99 /* Methods */ | 99 /* Methods */ |
100 | 100 |
101 HB_INTERNAL void reset (void); | 101 HB_INTERNAL void reset (void); |
102 HB_INTERNAL void clear (void); | 102 HB_INTERNAL void clear (void); |
103 | 103 |
104 inline unsigned int backtrack_len (void) const | 104 inline unsigned int backtrack_len (void) const |
105 { return have_output? out_len : idx; } | 105 { return have_output? out_len : idx; } |
| 106 inline unsigned int lookahead_len (void) const |
| 107 { return len - idx; } |
106 inline unsigned int next_serial (void) { return serial++; } | 108 inline unsigned int next_serial (void) { return serial++; } |
107 | 109 |
108 HB_INTERNAL void allocate_var (unsigned int byte_i, unsigned int count, const
char *owner); | 110 HB_INTERNAL void allocate_var (unsigned int byte_i, unsigned int count, const
char *owner); |
109 HB_INTERNAL void deallocate_var (unsigned int byte_i, unsigned int count, cons
t char *owner); | 111 HB_INTERNAL void deallocate_var (unsigned int byte_i, unsigned int count, cons
t char *owner); |
110 HB_INTERNAL void assert_var (unsigned int byte_i, unsigned int count, const ch
ar *owner); | 112 HB_INTERNAL void assert_var (unsigned int byte_i, unsigned int count, const ch
ar *owner); |
111 HB_INTERNAL void deallocate_var_all (void); | 113 HB_INTERNAL void deallocate_var_all (void); |
112 | 114 |
113 HB_INTERNAL void add (hb_codepoint_t codepoint, | 115 HB_INTERNAL void add (hb_codepoint_t codepoint, |
114 unsigned int cluster); | 116 unsigned int cluster); |
115 HB_INTERNAL void add_info (const hb_glyph_info_t &glyph_info); | 117 HB_INTERNAL void add_info (const hb_glyph_info_t &glyph_info); |
(...skipping 11 matching lines...) Expand all Loading... |
127 HB_INTERNAL void replace_glyphs (unsigned int num_in, | 129 HB_INTERNAL void replace_glyphs (unsigned int num_in, |
128 unsigned int num_out, | 130 unsigned int num_out, |
129 const hb_codepoint_t *glyph_data); | 131 const hb_codepoint_t *glyph_data); |
130 | 132 |
131 HB_INTERNAL void replace_glyph (hb_codepoint_t glyph_index); | 133 HB_INTERNAL void replace_glyph (hb_codepoint_t glyph_index); |
132 /* Makes a copy of the glyph at idx to output and replace glyph_index */ | 134 /* Makes a copy of the glyph at idx to output and replace glyph_index */ |
133 HB_INTERNAL void output_glyph (hb_codepoint_t glyph_index); | 135 HB_INTERNAL void output_glyph (hb_codepoint_t glyph_index); |
134 HB_INTERNAL void output_info (const hb_glyph_info_t &glyph_info); | 136 HB_INTERNAL void output_info (const hb_glyph_info_t &glyph_info); |
135 /* Copies glyph at idx to output but doesn't advance idx */ | 137 /* Copies glyph at idx to output but doesn't advance idx */ |
136 HB_INTERNAL void copy_glyph (void); | 138 HB_INTERNAL void copy_glyph (void); |
| 139 HB_INTERNAL bool move_to (unsigned int i); /* i is output-buffer index. */ |
137 /* Copies glyph at idx to output and advance idx. | 140 /* Copies glyph at idx to output and advance idx. |
138 * If there's no output, just advance idx. */ | 141 * If there's no output, just advance idx. */ |
139 inline void | 142 inline void |
140 next_glyph (void) | 143 next_glyph (void) |
141 { | 144 { |
142 if (have_output) | 145 if (have_output) |
143 { | 146 { |
144 if (unlikely (out_info != info || out_len != idx)) { | 147 if (unlikely (out_info != info || out_len != idx)) { |
145 if (unlikely (!make_room_for (1, 1))) return; | 148 if (unlikely (!make_room_for (1, 1))) return; |
146 out_info[out_len] = info[idx]; | 149 out_info[out_len] = info[idx]; |
(...skipping 27 matching lines...) Expand all Loading... |
174 HB_INTERNAL void merge_out_clusters (unsigned int start, | 177 HB_INTERNAL void merge_out_clusters (unsigned int start, |
175 unsigned int end); | 178 unsigned int end); |
176 | 179 |
177 /* Internal methods */ | 180 /* Internal methods */ |
178 HB_INTERNAL bool enlarge (unsigned int size); | 181 HB_INTERNAL bool enlarge (unsigned int size); |
179 | 182 |
180 inline bool ensure (unsigned int size) | 183 inline bool ensure (unsigned int size) |
181 { return likely (size < allocated) ? true : enlarge (size); } | 184 { return likely (size < allocated) ? true : enlarge (size); } |
182 | 185 |
183 HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out); | 186 HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out); |
| 187 HB_INTERNAL bool shift_forward (unsigned int count); |
184 | 188 |
185 HB_INTERNAL void *get_scratch_buffer (unsigned int *size); | 189 typedef long scratch_buffer_t; |
| 190 HB_INTERNAL scratch_buffer_t *get_scratch_buffer (unsigned int *size); |
186 | 191 |
187 inline void clear_context (unsigned int side) { context_len[side] = 0; } | 192 inline void clear_context (unsigned int side) { context_len[side] = 0; } |
188 }; | 193 }; |
189 | 194 |
190 | 195 |
191 #define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \ | 196 #define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \ |
192 b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \ | 197 b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \ |
193 sizeof (b->info[0].var), owner) | 198 sizeof (b->info[0].var), owner) |
194 #define HB_BUFFER_ALLOCATE_VAR(b, var) \ | 199 #define HB_BUFFER_ALLOCATE_VAR(b, var) \ |
195 HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var) | 200 HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var) |
196 #define HB_BUFFER_DEALLOCATE_VAR(b, var) \ | 201 #define HB_BUFFER_DEALLOCATE_VAR(b, var) \ |
197 HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var) | 202 HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var) |
198 #define HB_BUFFER_ASSERT_VAR(b, var) \ | 203 #define HB_BUFFER_ASSERT_VAR(b, var) \ |
199 HB_BUFFER_XALLOCATE_VAR (b, assert_var, var (), #var) | 204 HB_BUFFER_XALLOCATE_VAR (b, assert_var, var (), #var) |
200 | 205 |
201 | 206 |
202 #endif /* HB_BUFFER_PRIVATE_HH */ | 207 #endif /* HB_BUFFER_PRIVATE_HH */ |
OLD | NEW |