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

Side by Side Diff: third_party/harfbuzz/contrib/harfbuzz-unicode.c

Issue 164123: Linux: support mirrored charactors (Closed)
Patch Set: Created 11 years, 4 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
OLDNEW
1 #include <stdint.h> 1 #include <stdint.h>
2 #include <stdlib.h> 2 #include <stdlib.h>
3 3
4 #include <harfbuzz-external.h> 4 #include <harfbuzz-external.h>
5 #include <harfbuzz-impl.h> 5 #include <harfbuzz-impl.h>
6 #include <harfbuzz-shaper.h> 6 #include <harfbuzz-shaper.h>
7 #include "harfbuzz-unicode.h" 7 #include "harfbuzz-unicode.h"
8 8
9 #include "tables/script-properties.h" 9 #include "tables/script-properties.h"
10 #include "tables/grapheme-break-properties.h" 10 #include "tables/grapheme-break-properties.h"
11 #include "tables/mirroring-properties.h"
tony 2009/08/07 19:57:06 Nit: Should these headers be sorted or is this com
11 12
12 uint32_t 13 uint32_t
13 utf16_to_code_point(const uint16_t *chars, size_t len, ssize_t *iter) { 14 utf16_to_code_point(const uint16_t *chars, size_t len, ssize_t *iter) {
14 const uint16_t v = chars[(*iter)++]; 15 const uint16_t v = chars[(*iter)++];
15 if (HB_IsHighSurrogate(v)) { 16 if (HB_IsHighSurrogate(v)) {
16 // surrogate pair 17 // surrogate pair
17 if (*iter >= len) { 18 if (*iter >= len) {
18 // the surrogate is incomplete. 19 // the surrogate is incomplete.
19 return HB_InvalidCodePoint; 20 return HB_InvalidCodePoint;
20 } 21 }
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 abort(); 228 abort();
228 return 0; 229 return 0;
229 } 230 }
230 231
231 void 232 void
232 HB_GetGraphemeAndLineBreakClass(HB_UChar32 ch, HB_GraphemeClass *gclass, HB_Line BreakClass *breakclass) { 233 HB_GetGraphemeAndLineBreakClass(HB_UChar32 ch, HB_GraphemeClass *gclass, HB_Line BreakClass *breakclass) {
233 *gclass = HB_GetGraphemeClass(ch); 234 *gclass = HB_GetGraphemeClass(ch);
234 *breakclass = HB_GetLineBreakClass(ch); 235 *breakclass = HB_GetLineBreakClass(ch);
235 } 236 }
236 237
238 static int
239 mirroring_property_cmp(const void *vkey, const void *vcandidate) {
240 const uint32_t key = (uint32_t) (intptr_t) vkey;
241 const struct mirroring_property *candidate = vcandidate;
242
243 if (key < candidate->a) {
244 return -1;
245 } else if (key > candidate->a) {
246 return 1;
247 } else {
248 return 0;
249 }
250 }
251
237 HB_UChar16 252 HB_UChar16
238 HB_GetMirroredChar(HB_UChar16 ch) { 253 HB_GetMirroredChar(HB_UChar16 ch) {
239 abort(); 254 const void *mprop = bsearch((void *) (intptr_t) ch, mirroring_properties,
240 return 0; 255 mirroring_properties_count,
256 sizeof(struct mirroring_property),
257 mirroring_property_cmp);
258 if (!mprop)
259 return ch;
260
261 return ((const struct mirroring_property *) mprop)->b;
241 } 262 }
242 263
243 void * 264 void *
244 HB_Library_Resolve(const char *library, const char *symbol) { 265 HB_Library_Resolve(const char *library, const char *symbol) {
245 abort(); 266 abort();
246 return NULL; 267 return NULL;
247 } 268 }
248 269
249 void * 270 void *
250 HB_TextCodecForMib(int mib) { 271 HB_TextCodecForMib(int mib) {
251 abort(); 272 abort();
252 return NULL; 273 return NULL;
253 } 274 }
254 275
255 char * 276 char *
256 HB_TextCodec_ConvertFromUnicode(void *codec, const HB_UChar16 *unicode, hb_uint3 2 length, hb_uint32 *outputLength) { 277 HB_TextCodec_ConvertFromUnicode(void *codec, const HB_UChar16 *unicode, hb_uint3 2 length, hb_uint32 *outputLength) {
257 abort(); 278 abort();
258 return NULL; 279 return NULL;
259 } 280 }
260 281
261 void 282 void
262 HB_TextCodec_FreeResult(char *v) { 283 HB_TextCodec_FreeResult(char *v) {
263 abort(); 284 abort();
264 } 285 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698