Mailbox support for texture layers.
[chromium-blink-merge.git] / third_party / harfbuzz / contrib / harfbuzz-unicode-tables.c
blob7cf6056d3503c6e22c1e98e5a2802926f922cf3a
1 #include <stdlib.h>
2 #include <stdint.h>
4 #include <harfbuzz-external.h>
6 #include "tables/category-properties.h"
7 #include "tables/combining-properties.h"
9 HB_LineBreakClass
10 HB_GetLineBreakClass(HB_UChar32 ch) {
11 abort();
12 return 0;
15 static int
16 combining_property_cmp(const void *vkey, const void *vcandidate) {
17 const uint32_t key = (uint32_t) (intptr_t) vkey;
18 const struct combining_property *candidate = vcandidate;
20 if (key < candidate->range_start) {
21 return -1;
22 } else if (key > candidate->range_end) {
23 return 1;
24 } else {
25 return 0;
29 static int
30 code_point_to_combining_class(HB_UChar32 cp) {
31 const void *vprop = bsearch((void *) (intptr_t) cp, combining_properties,
32 combining_properties_count,
33 sizeof(struct combining_property),
34 combining_property_cmp);
35 if (!vprop)
36 return 0;
38 return ((const struct combining_property *) vprop)->klass;
41 int
42 HB_GetUnicodeCharCombiningClass(HB_UChar32 ch) {
43 return code_point_to_combining_class(ch);
44 return 0;
47 static int
48 category_property_cmp(const void *vkey, const void *vcandidate) {
49 const uint32_t key = (uint32_t) (intptr_t) vkey;
50 const struct category_property *candidate = vcandidate;
52 if (key < candidate->range_start) {
53 return -1;
54 } else if (key > candidate->range_end) {
55 return 1;
56 } else {
57 return 0;
61 static HB_CharCategory
62 code_point_to_category(HB_UChar32 cp) {
63 const void *vprop = bsearch((void *) (intptr_t) cp, category_properties,
64 category_properties_count,
65 sizeof(struct category_property),
66 category_property_cmp);
67 if (!vprop)
68 return HB_Other_NotAssigned;
70 return ((const struct category_property *) vprop)->category;
73 void
74 HB_GetUnicodeCharProperties(HB_UChar32 ch,
75 HB_CharCategory *category,
76 int *combiningClass) {
77 *category = code_point_to_category(ch);
78 *combiningClass = code_point_to_combining_class(ch);
81 HB_CharCategory
82 HB_GetUnicodeCharCategory(HB_UChar32 ch) {
83 return code_point_to_category(ch);