OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2010 Google, Inc. | 2 * Copyright © 2010 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 12 matching lines...) Expand all Loading... |
23 * | 23 * |
24 * Google Author(s): Behdad Esfahbod | 24 * Google Author(s): Behdad Esfahbod |
25 */ | 25 */ |
26 | 26 |
27 #ifndef HB_OT_SHAPE_PRIVATE_HH | 27 #ifndef HB_OT_SHAPE_PRIVATE_HH |
28 #define HB_OT_SHAPE_PRIVATE_HH | 28 #define HB_OT_SHAPE_PRIVATE_HH |
29 | 29 |
30 #include "hb-private.hh" | 30 #include "hb-private.hh" |
31 | 31 |
32 #include "hb-ot-map-private.hh" | 32 #include "hb-ot-map-private.hh" |
33 #include "hb-ot-shape-complex-private.hh" | 33 |
| 34 |
| 35 |
| 36 /* buffer var allocations, used during the entire shaping process */ |
| 37 #define unicode_props0()» var2.u8[0] |
| 38 #define unicode_props1()» var2.u8[1] |
| 39 |
34 | 40 |
35 | 41 |
36 struct hb_ot_shape_plan_t | 42 struct hb_ot_shape_plan_t |
37 { | 43 { |
| 44 hb_segment_properties_t props; |
| 45 const struct hb_ot_complex_shaper_t *shaper; |
38 hb_ot_map_t map; | 46 hb_ot_map_t map; |
39 hb_ot_complex_shaper_t shaper; | 47 const void *data; |
40 | 48 |
41 hb_ot_shape_plan_t (void) : map () {} | 49 inline void substitute_closure (hb_face_t *face, hb_set_t *glyphs) const { map
.substitute_closure (this, face, glyphs); } |
42 ~hb_ot_shape_plan_t (void) { map.finish (); } | 50 inline void substitute (hb_font_t *font, hb_buffer_t *buffer) const { map.subs
titute (this, font, buffer); } |
| 51 inline void position (hb_font_t *font, hb_buffer_t *buffer) const { map.positi
on (this, font, buffer); } |
| 52 |
| 53 void finish (void) { map.finish (); } |
| 54 }; |
| 55 |
| 56 struct hb_ot_shape_planner_t |
| 57 { |
| 58 /* In the order that they are filled in. */ |
| 59 hb_face_t *face; |
| 60 hb_segment_properties_t props; |
| 61 const struct hb_ot_complex_shaper_t *shaper; |
| 62 hb_ot_map_builder_t map; |
| 63 |
| 64 hb_ot_shape_planner_t (const hb_shape_plan_t *master_plan) : |
| 65 » » » face (master_plan->face), |
| 66 » » » props (master_plan->props), |
| 67 » » » shaper (NULL), |
| 68 » » » map () {} |
| 69 ~hb_ot_shape_planner_t (void) { map.finish (); } |
| 70 |
| 71 inline void compile (hb_ot_shape_plan_t &plan) |
| 72 { |
| 73 plan.props = props; |
| 74 plan.shaper = shaper; |
| 75 map.compile (face, &props, plan.map); |
| 76 } |
43 | 77 |
44 private: | 78 private: |
45 NO_COPY (hb_ot_shape_plan_t); | 79 NO_COPY (hb_ot_shape_planner_t); |
46 }; | 80 }; |
47 | 81 |
48 | 82 |
49 | 83 |
50 HB_INTERNAL hb_bool_t | |
51 _hb_ot_shape (hb_font_t *font, | |
52 hb_buffer_t *buffer, | |
53 const hb_feature_t *features, | |
54 unsigned int num_features); | |
55 | |
56 | |
57 inline void | 84 inline void |
58 _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *uni
code) | 85 _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *uni
code) |
59 { | 86 { |
60 info->unicode_props0() = ((unsigned int) hb_unicode_general_category (unicode,
info->codepoint)) | | 87 info->unicode_props0() = ((unsigned int) unicode->general_category (info->code
point)) | |
61 » » » (_hb_unicode_is_zero_width (info->codepoint) ? 0x80 :
0); | 88 » » » (unicode->is_zero_width (info->codepoint) ? 0x80 : 0)
; |
62 info->unicode_props1() = _hb_unicode_modified_combining_class (unicode, info->
codepoint); | 89 info->unicode_props1() = unicode->modified_combining_class (info->codepoint); |
63 } | 90 } |
64 | 91 |
65 inline hb_unicode_general_category_t | 92 inline hb_unicode_general_category_t |
66 _hb_glyph_info_get_general_category (const hb_glyph_info_t *info) | 93 _hb_glyph_info_get_general_category (const hb_glyph_info_t *info) |
67 { | 94 { |
68 return (hb_unicode_general_category_t) (info->unicode_props0() & 0x7F); | 95 return (hb_unicode_general_category_t) (info->unicode_props0() & 0x7F); |
69 } | 96 } |
70 | 97 |
| 98 inline void |
| 99 _hb_glyph_info_set_modified_combining_class (hb_glyph_info_t *info, unsigned int
modified_class) |
| 100 { |
| 101 info->unicode_props1() = modified_class; |
| 102 } |
| 103 |
71 inline unsigned int | 104 inline unsigned int |
72 _hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info) | 105 _hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info) |
73 { | 106 { |
74 return info->unicode_props1(); | 107 return info->unicode_props1(); |
75 } | 108 } |
76 | 109 |
77 inline hb_bool_t | 110 inline hb_bool_t |
78 _hb_glyph_info_is_zero_width (const hb_glyph_info_t *info) | 111 _hb_glyph_info_is_zero_width (const hb_glyph_info_t *info) |
79 { | 112 { |
80 return !!(info->unicode_props0() & 0x80); | 113 return !!(info->unicode_props0() & 0x80); |
81 } | 114 } |
82 | 115 |
83 #endif /* HB_OT_SHAPE_PRIVATE_HH */ | 116 #endif /* HB_OT_SHAPE_PRIVATE_HH */ |
OLD | NEW |