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 Google, Inc. | 4 * Copyright © 2011 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 unsigned int idx; /* Cursor into ->info and ->pos arrays */ | 64 unsigned int idx; /* Cursor into ->info and ->pos arrays */ |
65 unsigned int len; /* Length of ->info and ->pos arrays */ | 65 unsigned int len; /* Length of ->info and ->pos arrays */ |
66 unsigned int out_len; /* Length of ->out array if have_output */ | 66 unsigned int out_len; /* Length of ->out array if have_output */ |
67 | 67 |
68 unsigned int allocated; /* Length of allocated arrays */ | 68 unsigned int allocated; /* Length of allocated arrays */ |
69 hb_glyph_info_t *info; | 69 hb_glyph_info_t *info; |
70 hb_glyph_info_t *out_info; | 70 hb_glyph_info_t *out_info; |
71 hb_glyph_position_t *pos; | 71 hb_glyph_position_t *pos; |
72 | 72 |
| 73 inline hb_glyph_info_t &cur (unsigned int i = 0) { return info[idx + i]; } |
| 74 inline hb_glyph_info_t cur (unsigned int i = 0) const { return info[idx + i];
} |
| 75 |
| 76 inline hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]
; } |
| 77 inline hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx
+ i]; } |
| 78 |
| 79 inline hb_glyph_info_t &prev (void) { return out_info[out_len - 1]; } |
| 80 inline hb_glyph_info_t prev (void) const { return info[out_len - 1]; } |
| 81 |
73 unsigned int serial; | 82 unsigned int serial; |
74 uint8_t allocated_var_bytes[8]; | 83 uint8_t allocated_var_bytes[8]; |
75 const char *allocated_var_owner[8]; | 84 const char *allocated_var_owner[8]; |
76 | 85 |
77 | 86 |
78 /* Methods */ | 87 /* Methods */ |
79 | 88 |
80 HB_INTERNAL void reset (void); | 89 HB_INTERNAL void reset (void); |
81 | 90 |
82 inline unsigned int backtrack_len (void) const | 91 inline unsigned int backtrack_len (void) const |
(...skipping 14 matching lines...) Expand all Loading... |
97 HB_INTERNAL void guess_properties (void); | 106 HB_INTERNAL void guess_properties (void); |
98 | 107 |
99 HB_INTERNAL void swap_buffers (void); | 108 HB_INTERNAL void swap_buffers (void); |
100 HB_INTERNAL void clear_output (void); | 109 HB_INTERNAL void clear_output (void); |
101 HB_INTERNAL void clear_positions (void); | 110 HB_INTERNAL void clear_positions (void); |
102 HB_INTERNAL void replace_glyphs_be16 (unsigned int num_in, | 111 HB_INTERNAL void replace_glyphs_be16 (unsigned int num_in, |
103 unsigned int num_out, | 112 unsigned int num_out, |
104 const uint16_t *glyph_data_be); | 113 const uint16_t *glyph_data_be); |
105 HB_INTERNAL void replace_glyphs (unsigned int num_in, | 114 HB_INTERNAL void replace_glyphs (unsigned int num_in, |
106 unsigned int num_out, | 115 unsigned int num_out, |
107 » » » » const uint16_t *glyph_data); | 116 » » » » const hb_codepoint_t *glyph_data); |
108 HB_INTERNAL void replace_glyph (hb_codepoint_t glyph_index); | 117 HB_INTERNAL void replace_glyph (hb_codepoint_t glyph_index); |
109 /* Makes a copy of the glyph at idx to output and replace glyph_index */ | 118 /* Makes a copy of the glyph at idx to output and replace glyph_index */ |
110 HB_INTERNAL void output_glyph (hb_codepoint_t glyph_index); | 119 HB_INTERNAL void output_glyph (hb_codepoint_t glyph_index); |
111 /* Copies glyph at idx to output but doesn't advance idx */ | 120 /* Copies glyph at idx to output but doesn't advance idx */ |
112 HB_INTERNAL void copy_glyph (void); | 121 HB_INTERNAL void copy_glyph (void); |
113 /* Copies glyph at idx to output and advance idx. | 122 /* Copies glyph at idx to output and advance idx. |
114 * If there's no output, just advance idx. */ | 123 * If there's no output, just advance idx. */ |
115 HB_INTERNAL void next_glyph (void); | 124 HB_INTERNAL void next_glyph (void); |
116 /* Advance idx without copying to output. */ | 125 /* Advance idx without copying to output. */ |
117 inline void skip_glyph (void) { idx++; } | 126 inline void skip_glyph (void) { idx++; } |
118 | 127 |
119 inline void reset_masks (hb_mask_t mask) | 128 inline void reset_masks (hb_mask_t mask) |
120 { | 129 { |
121 for (unsigned int j = 0; j < len; j++) | 130 for (unsigned int j = 0; j < len; j++) |
122 info[j].mask = mask; | 131 info[j].mask = mask; |
123 } | 132 } |
124 inline void add_masks (hb_mask_t mask) | 133 inline void add_masks (hb_mask_t mask) |
125 { | 134 { |
126 for (unsigned int j = 0; j < len; j++) | 135 for (unsigned int j = 0; j < len; j++) |
127 info[j].mask |= mask; | 136 info[j].mask |= mask; |
128 } | 137 } |
129 HB_INTERNAL void set_masks (hb_mask_t value, | 138 HB_INTERNAL void set_masks (hb_mask_t value, |
130 hb_mask_t mask, | 139 hb_mask_t mask, |
131 unsigned int cluster_start, | 140 unsigned int cluster_start, |
132 unsigned int cluster_end); | 141 unsigned int cluster_end); |
133 | 142 |
| 143 HB_INTERNAL void merge_clusters (unsigned int start, |
| 144 unsigned int end); |
| 145 HB_INTERNAL void merge_out_clusters (unsigned int start, |
| 146 unsigned int end); |
| 147 |
134 /* Internal methods */ | 148 /* Internal methods */ |
135 HB_INTERNAL bool enlarge (unsigned int size); | 149 HB_INTERNAL bool enlarge (unsigned int size); |
136 | 150 |
137 inline bool ensure (unsigned int size) | 151 inline bool ensure (unsigned int size) |
138 { return likely (size <= allocated) ? TRUE : enlarge (size); } | 152 { return likely (size <= allocated) ? TRUE : enlarge (size); } |
139 | 153 |
140 HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out); | 154 HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out); |
141 | 155 |
142 HB_INTERNAL void *get_scratch_buffer (unsigned int *size); | 156 HB_INTERNAL void *get_scratch_buffer (unsigned int *size); |
143 }; | 157 }; |
144 | 158 |
145 | 159 |
146 #define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \ | 160 #define HB_BUFFER_XALLOCATE_VAR(b, func, var, owner) \ |
147 b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \ | 161 b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \ |
148 sizeof (b->info[0].var), owner) | 162 sizeof (b->info[0].var), owner) |
149 #define HB_BUFFER_ALLOCATE_VAR(b, var) \ | 163 #define HB_BUFFER_ALLOCATE_VAR(b, var) \ |
150 HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var) | 164 HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var) |
151 #define HB_BUFFER_DEALLOCATE_VAR(b, var) \ | 165 #define HB_BUFFER_DEALLOCATE_VAR(b, var) \ |
152 HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var) | 166 HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var) |
153 | 167 |
154 | 168 |
155 | 169 |
156 #endif /* HB_BUFFER_PRIVATE_HH */ | 170 #endif /* HB_BUFFER_PRIVATE_HH */ |
OLD | NEW |