Update copyright headers
[apps/home/video-player.git] / src / hb-ot-shape-complex-private.hh
1 /*
2  * Copyright © 2010,2011  Google, Inc.
3  *
4  *  This is part of HarfBuzz, a text shaping library.
5  *
6  * Permission is hereby granted, without written agreement and without
7  * license or royalty fees, to use, copy, modify, and distribute this
8  * software and its documentation for any purpose, provided that the
9  * above copyright notice and the following two paragraphs appear in
10  * all copies of this software.
11  *
12  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16  * DAMAGE.
17  *
18  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
21  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23  *
24  * Google Author(s): Behdad Esfahbod
25  */
26
27 #ifndef HB_OT_SHAPE_COMPLEX_PRIVATE_HH
28 #define HB_OT_SHAPE_COMPLEX_PRIVATE_HH
29
30 #include "hb-private.hh"
31
32 #include "hb-ot-shape-private.hh"
33
34 HB_BEGIN_DECLS
35
36
37 static inline hb_ot_complex_shaper_t
38 hb_ot_shape_complex_categorize (const hb_segment_properties_t *props)
39 {
40   switch ((int) props->script)
41   {
42     case HB_SCRIPT_ARABIC:
43     case HB_SCRIPT_MANDAIC:
44     case HB_SCRIPT_MONGOLIAN:
45     case HB_SCRIPT_NKO:
46     case HB_SCRIPT_SYRIAC:
47       return hb_ot_complex_shaper_arabic;
48
49     /* TODO: These are all the scripts that the ucd/IndicSyllabicCategory.txt covers.
50      * Quite possibly many of these need no shaping, and some other are encoded visually.
51      * Needs to be refined.
52      */
53     case HB_SCRIPT_BALINESE:
54     case HB_SCRIPT_BATAK:
55     case HB_SCRIPT_BENGALI:
56     case HB_SCRIPT_BRAHMI:
57     case HB_SCRIPT_BUGINESE:
58     case HB_SCRIPT_BUHID:
59     case HB_SCRIPT_CHAM:
60     case HB_SCRIPT_DEVANAGARI:
61     case HB_SCRIPT_GUJARATI:
62     case HB_SCRIPT_GURMUKHI:
63     case HB_SCRIPT_HANUNOO:
64     case HB_SCRIPT_JAVANESE:
65     case HB_SCRIPT_KAITHI:
66     case HB_SCRIPT_KANNADA:
67     case HB_SCRIPT_KAYAH_LI:
68     case HB_SCRIPT_KHAROSHTHI:
69     case HB_SCRIPT_KHMER:
70     case HB_SCRIPT_LAO:
71     case HB_SCRIPT_LEPCHA:
72     case HB_SCRIPT_LIMBU:
73     case HB_SCRIPT_MALAYALAM:
74     case HB_SCRIPT_MEETEI_MAYEK:
75     case HB_SCRIPT_MYANMAR:
76     case HB_SCRIPT_NEW_TAI_LUE:
77     case HB_SCRIPT_ORIYA:
78     case HB_SCRIPT_PHAGS_PA:
79     case HB_SCRIPT_REJANG:
80     case HB_SCRIPT_SAURASHTRA:
81     case HB_SCRIPT_SINHALA:
82     case HB_SCRIPT_SUNDANESE:
83     case HB_SCRIPT_SYLOTI_NAGRI:
84     case HB_SCRIPT_TAGALOG:
85     case HB_SCRIPT_TAGBANWA:
86     case HB_SCRIPT_TAI_LE:
87     case HB_SCRIPT_TAI_THAM:
88     case HB_SCRIPT_TAI_VIET:
89     case HB_SCRIPT_TAMIL:
90     case HB_SCRIPT_TELUGU:
91     case HB_SCRIPT_THAI:
92     case HB_SCRIPT_TIBETAN:
93       return hb_ot_complex_shaper_indic;
94
95     default:
96       return hb_ot_complex_shaper_none;
97   }
98 }
99
100
101
102 /*
103  * collect_features()
104  *
105  * Called during shape_plan().
106  *
107  * Shapers should use plan->map to add their features.
108  */
109
110 HB_INTERNAL void _hb_ot_shape_complex_collect_features_arabic   (hb_ot_shape_planner_t *plan, const hb_segment_properties_t  *props);
111 HB_INTERNAL void _hb_ot_shape_complex_collect_features_indic    (hb_ot_shape_planner_t *plan, const hb_segment_properties_t  *props);
112
113 static inline void
114 hb_ot_shape_complex_collect_features (hb_ot_shape_planner_t *planner,
115                                       const hb_segment_properties_t  *props)
116 {
117   switch (planner->shaper) {
118     case hb_ot_complex_shaper_arabic:   _hb_ot_shape_complex_collect_features_arabic    (planner, props);       return;
119     case hb_ot_complex_shaper_indic:    _hb_ot_shape_complex_collect_features_indic     (planner, props);       return;
120     case hb_ot_complex_shaper_none:     default:                                                                return;
121   }
122 }
123
124
125 /* setup_masks()
126  *
127  * Called during shape_execute().
128  *
129  * Shapers should use c->plan.map to get feature masks and set on buffer.
130  */
131
132 HB_INTERNAL void _hb_ot_shape_complex_setup_masks_arabic        (hb_ot_shape_context_t *c);
133 HB_INTERNAL void _hb_ot_shape_complex_setup_masks_indic         (hb_ot_shape_context_t *c);
134
135 static inline void
136 hb_ot_shape_complex_setup_masks (hb_ot_shape_context_t *c)
137 {
138   switch (c->plan->shaper) {
139     case hb_ot_complex_shaper_arabic:   _hb_ot_shape_complex_setup_masks_arabic (c);    return;
140     case hb_ot_complex_shaper_indic:    _hb_ot_shape_complex_setup_masks_indic (c);     return;
141     case hb_ot_complex_shaper_none:     default:                                        return;
142   }
143 }
144
145
146 HB_END_DECLS
147
148 #endif /* HB_OT_SHAPE_COMPLEX_PRIVATE_HH */