OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2011 Google, Inc. | 2 * Copyright © 2011 Google, Inc. |
3 * | 3 * |
4 * This is part of HarfBuzz, a text shaping library. | 4 * This is part of HarfBuzz, a text shaping library. |
5 * | 5 * |
6 * Permission is hereby granted, without written agreement and without | 6 * Permission is hereby granted, without written agreement and without |
7 * license or royalty fees, to use, copy, modify, and distribute this | 7 * license or royalty fees, to use, copy, modify, and distribute this |
8 * software and its documentation for any purpose, provided that the | 8 * software and its documentation for any purpose, provided that the |
9 * above copyright notice and the following two paragraphs appear in | 9 * above copyright notice and the following two paragraphs appear in |
10 * all copies of this software. | 10 * all copies of this software. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 /* TODO | 98 /* TODO |
99 * | 99 * |
100 * - Apply fallback kern. | 100 * - Apply fallback kern. |
101 * - Handle Variation Selectors? | 101 * - Handle Variation Selectors? |
102 * - Apply normalization? | 102 * - Apply normalization? |
103 * | 103 * |
104 * This will make the fallback shaper into a dumb "TrueType" | 104 * This will make the fallback shaper into a dumb "TrueType" |
105 * shaper which many people unfortunately still request. | 105 * shaper which many people unfortunately still request. |
106 */ | 106 */ |
107 | 107 |
108 bool has_space; | |
109 hb_codepoint_t space; | 108 hb_codepoint_t space; |
110 has_space = font->get_glyph (' ', 0, &space); | 109 bool has_space = font->get_glyph (' ', 0, &space); |
111 | 110 |
112 buffer->clear_positions (); | 111 buffer->clear_positions (); |
113 | 112 |
| 113 hb_direction_t direction = buffer->props.direction; |
| 114 hb_unicode_funcs_t *unicode = buffer->unicode; |
114 unsigned int count = buffer->len; | 115 unsigned int count = buffer->len; |
115 | 116 hb_glyph_info_t *info = buffer->info; |
| 117 hb_glyph_position_t *pos = buffer->pos; |
116 for (unsigned int i = 0; i < count; i++) | 118 for (unsigned int i = 0; i < count; i++) |
117 { | 119 { |
118 if (has_space && buffer->unicode->is_default_ignorable (buffer->info[i].code
point)) { | 120 if (has_space && unicode->is_default_ignorable (info[i].codepoint)) { |
119 buffer->info[i].codepoint = space; | 121 info[i].codepoint = space; |
120 buffer->pos[i].x_advance = 0; | 122 pos[i].x_advance = 0; |
121 buffer->pos[i].y_advance = 0; | 123 pos[i].y_advance = 0; |
122 continue; | 124 continue; |
123 } | 125 } |
124 font->get_glyph (buffer->info[i].codepoint, 0, &buffer->info[i].codepoint); | 126 font->get_glyph (info[i].codepoint, 0, &info[i].codepoint); |
125 font->get_glyph_advance_for_direction (buffer->info[i].codepoint, | 127 font->get_glyph_advance_for_direction (info[i].codepoint, |
126 » » » » » buffer->props.direction, | 128 » » » » » direction, |
127 » » » » » &buffer->pos[i].x_advance, | 129 » » » » » &pos[i].x_advance, |
128 » » » » » &buffer->pos[i].y_advance); | 130 » » » » » &pos[i].y_advance); |
129 font->subtract_glyph_origin_for_direction (buffer->info[i].codepoint, | 131 font->subtract_glyph_origin_for_direction (info[i].codepoint, |
130 » » » » » buffer->props.direction, | 132 » » » » » direction, |
131 » » » » » &buffer->pos[i].x_offset, | 133 » » » » » &pos[i].x_offset, |
132 » » » » » &buffer->pos[i].y_offset); | 134 » » » » » &pos[i].y_offset); |
133 } | 135 } |
134 | 136 |
135 if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction)) | 137 if (HB_DIRECTION_IS_BACKWARD (direction)) |
136 hb_buffer_reverse (buffer); | 138 hb_buffer_reverse (buffer); |
137 | 139 |
138 return true; | 140 return true; |
139 } | 141 } |
OLD | NEW |