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 17 matching lines...) Expand all Loading... |
28 */ | 28 */ |
29 | 29 |
30 #ifndef HB_BUFFER_PRIVATE_HH | 30 #ifndef HB_BUFFER_PRIVATE_HH |
31 #define HB_BUFFER_PRIVATE_HH | 31 #define HB_BUFFER_PRIVATE_HH |
32 | 32 |
33 #include "hb-private.hh" | 33 #include "hb-private.hh" |
34 #include "hb-object-private.hh" | 34 #include "hb-object-private.hh" |
35 #include "hb-unicode-private.hh" | 35 #include "hb-unicode-private.hh" |
36 | 36 |
37 | 37 |
| 38 #ifndef HB_BUFFER_MAX_EXPANSION_FACTOR |
| 39 #define HB_BUFFER_MAX_EXPANSION_FACTOR 32 |
| 40 #endif |
| 41 #ifndef HB_BUFFER_MAX_LEN_MIN |
| 42 #define HB_BUFFER_MAX_LEN_MIN 8192 |
| 43 #endif |
| 44 #ifndef HB_BUFFER_MAX_LEN_DEFAULT |
| 45 #define HB_BUFFER_MAX_LEN_DEFAULT 0x3FFFFFFF /* Shaping more than a billion char
s? Let us know! */ |
| 46 #endif |
| 47 |
38 ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20); | 48 ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20); |
39 ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t)); | 49 ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t)); |
40 | 50 |
| 51 HB_MARK_AS_FLAG_T (hb_buffer_flags_t); |
| 52 HB_MARK_AS_FLAG_T (hb_buffer_serialize_flags_t); |
| 53 |
| 54 enum hb_buffer_scratch_flags_t { |
| 55 HB_BUFFER_SCRATCH_FLAG_DEFAULT = 0x00000000u, |
| 56 HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII = 0x00000001u, |
| 57 HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES = 0x00000002u, |
| 58 HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK = 0x00000004u, |
| 59 HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_CURSIVE = 0x00000008u, |
| 60 HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT = 0x00000010u, |
| 61 /* Reserved for complex shapers' internal use. */ |
| 62 HB_BUFFER_SCRATCH_FLAG_COMPLEX0 = 0x01000000u, |
| 63 HB_BUFFER_SCRATCH_FLAG_COMPLEX1 = 0x02000000u, |
| 64 HB_BUFFER_SCRATCH_FLAG_COMPLEX2 = 0x04000000u, |
| 65 HB_BUFFER_SCRATCH_FLAG_COMPLEX3 = 0x08000000u, |
| 66 }; |
| 67 HB_MARK_AS_FLAG_T (hb_buffer_scratch_flags_t); |
| 68 |
41 | 69 |
42 /* | 70 /* |
43 * hb_buffer_t | 71 * hb_buffer_t |
44 */ | 72 */ |
45 | 73 |
46 struct hb_buffer_t { | 74 struct hb_buffer_t { |
47 hb_object_header_t header; | 75 hb_object_header_t header; |
48 ASSERT_POD (); | 76 ASSERT_POD (); |
49 | 77 |
50 /* Information about how the text in the buffer should be treated */ | 78 /* Information about how the text in the buffer should be treated */ |
51 hb_unicode_funcs_t *unicode; /* Unicode functions */ | 79 hb_unicode_funcs_t *unicode; /* Unicode functions */ |
52 hb_buffer_flags_t flags; /* BOT / EOT / etc. */ | 80 hb_buffer_flags_t flags; /* BOT / EOT / etc. */ |
53 hb_buffer_cluster_level_t cluster_level; | 81 hb_buffer_cluster_level_t cluster_level; |
54 hb_codepoint_t replacement; /* U+FFFD or something else. */ | 82 hb_codepoint_t replacement; /* U+FFFD or something else. */ |
| 83 hb_buffer_scratch_flags_t scratch_flags; /* Have space-flallback, etc. */ |
| 84 unsigned int max_len; /* Maximum allowed len. */ |
55 | 85 |
56 /* Buffer contents */ | 86 /* Buffer contents */ |
57 hb_buffer_content_type_t content_type; | 87 hb_buffer_content_type_t content_type; |
58 hb_segment_properties_t props; /* Script, language, direction */ | 88 hb_segment_properties_t props; /* Script, language, direction */ |
59 | 89 |
60 bool in_error; /* Allocation failed */ | 90 bool in_error; /* Allocation failed */ |
61 bool have_output; /* Whether we have an output buffer going on */ | 91 bool have_output; /* Whether we have an output buffer going on */ |
62 bool have_positions; /* Whether we have positions */ | 92 bool have_positions; /* Whether we have positions */ |
63 | 93 |
64 unsigned int idx; /* Cursor into ->info and ->pos arrays */ | 94 unsigned int idx; /* Cursor into ->info and ->pos arrays */ |
65 unsigned int len; /* Length of ->info and ->pos arrays */ | 95 unsigned int len; /* Length of ->info and ->pos arrays */ |
66 unsigned int out_len; /* Length of ->out array if have_output */ | 96 unsigned int out_len; /* Length of ->out array if have_output */ |
67 | 97 |
68 unsigned int allocated; /* Length of allocated arrays */ | 98 unsigned int allocated; /* Length of allocated arrays */ |
69 hb_glyph_info_t *info; | 99 hb_glyph_info_t *info; |
70 hb_glyph_info_t *out_info; | 100 hb_glyph_info_t *out_info; |
71 hb_glyph_position_t *pos; | 101 hb_glyph_position_t *pos; |
72 | 102 |
73 inline hb_glyph_info_t &cur (unsigned int i = 0) { return info[idx + i]; } | 103 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];
} | 104 inline hb_glyph_info_t cur (unsigned int i = 0) const { return info[idx + i];
} |
75 | 105 |
76 inline hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]
; } | 106 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]; } | 107 inline hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx
+ i]; } |
78 | 108 |
79 inline hb_glyph_info_t &prev (void) { return out_info[out_len - 1]; } | 109 inline hb_glyph_info_t &prev (void) { return out_info[out_len ? out_len - 1 :
0]; } |
80 inline hb_glyph_info_t prev (void) const { return info[out_len - 1]; } | 110 inline hb_glyph_info_t prev (void) const { return out_info[out_len ? out_len -
1 : 0]; } |
81 | 111 |
82 inline bool has_separate_output (void) const { return info != out_info; } | 112 inline bool has_separate_output (void) const { return info != out_info; } |
83 | 113 |
84 unsigned int serial; | 114 unsigned int serial; |
85 | 115 |
86 /* These reflect current allocations of the bytes in glyph_info_t's var1 and v
ar2. */ | 116 /* These reflect current allocations of the bytes in glyph_info_t's var1 and v
ar2. */ |
87 uint8_t allocated_var_bytes[8]; | 117 uint8_t allocated_var_bytes[8]; |
88 const char *allocated_var_owner[8]; | 118 const char *allocated_var_owner[8]; |
89 | 119 |
90 /* Text before / after the main buffer contents. | 120 /* Text before / after the main buffer contents. |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 sizeof (b->info[0].var), owner) | 241 sizeof (b->info[0].var), owner) |
212 #define HB_BUFFER_ALLOCATE_VAR(b, var) \ | 242 #define HB_BUFFER_ALLOCATE_VAR(b, var) \ |
213 HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var) | 243 HB_BUFFER_XALLOCATE_VAR (b, allocate_var, var (), #var) |
214 #define HB_BUFFER_DEALLOCATE_VAR(b, var) \ | 244 #define HB_BUFFER_DEALLOCATE_VAR(b, var) \ |
215 HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var) | 245 HB_BUFFER_XALLOCATE_VAR (b, deallocate_var, var (), #var) |
216 #define HB_BUFFER_ASSERT_VAR(b, var) \ | 246 #define HB_BUFFER_ASSERT_VAR(b, var) \ |
217 HB_BUFFER_XALLOCATE_VAR (b, assert_var, var (), #var) | 247 HB_BUFFER_XALLOCATE_VAR (b, assert_var, var (), #var) |
218 | 248 |
219 | 249 |
220 #endif /* HB_BUFFER_PRIVATE_HH */ | 250 #endif /* HB_BUFFER_PRIVATE_HH */ |
OLD | NEW |