[API] unicode: rework virtual functions for subclassing
[profile/ivi/org.tizen.video-player.git] / src / hb-unicode.h
1 /*
2  * Copyright (C) 2009  Red Hat, Inc.
3  * Copyright © 2011 Codethink Limited
4  *
5  *  This is part of HarfBuzz, a text shaping library.
6  *
7  * Permission is hereby granted, without written agreement and without
8  * license or royalty fees, to use, copy, modify, and distribute this
9  * software and its documentation for any purpose, provided that the
10  * above copyright notice and the following two paragraphs appear in
11  * all copies of this software.
12  *
13  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
17  * DAMAGE.
18  *
19  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
22  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24  *
25  * Red Hat Author(s): Behdad Esfahbod
26  * Codethink Author(s): Ryan Lortie
27  */
28
29 #ifndef HB_UNICODE_H
30 #define HB_UNICODE_H
31
32 #include "hb-common.h"
33
34 HB_BEGIN_DECLS
35
36
37 /*
38  * hb_unicode_funcs_t
39  */
40
41 typedef struct _hb_unicode_funcs_t hb_unicode_funcs_t;
42
43 hb_unicode_funcs_t *
44 hb_unicode_funcs_create (hb_unicode_funcs_t *parent_funcs);
45
46 hb_unicode_funcs_t *
47 hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs);
48
49 unsigned int
50 hb_unicode_funcs_get_reference_count (hb_unicode_funcs_t *ufuncs);
51
52 void
53 hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs);
54
55 hb_unicode_funcs_t *
56 hb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs);
57
58 void
59 hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs);
60
61 hb_bool_t
62 hb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs);
63
64 /*
65  * funcs
66  */
67
68 /* typedefs */
69
70 typedef hb_codepoint_t                (*hb_unicode_get_mirroring_func_t)        (hb_unicode_funcs_t *ufuncs,
71                                                                                  hb_codepoint_t      unicode,
72                                                                                  void               *user_data);
73 typedef hb_unicode_general_category_t (*hb_unicode_get_general_category_func_t) (hb_unicode_funcs_t *ufuncs,
74                                                                                  hb_codepoint_t      unicode,
75                                                                                  void               *user_data);
76 typedef hb_script_t                   (*hb_unicode_get_script_func_t)           (hb_unicode_funcs_t *ufuncs,
77                                                                                  hb_codepoint_t      unicode,
78                                                                                  void               *user_data);
79 typedef unsigned int                  (*hb_unicode_get_combining_class_func_t)  (hb_unicode_funcs_t *ufuncs,
80                                                                                  hb_codepoint_t      unicode,
81                                                                                  void               *user_data);
82 typedef unsigned int                  (*hb_unicode_get_eastasian_width_func_t)  (hb_unicode_funcs_t *ufuncs,
83                                                                                  hb_codepoint_t      unicode,
84                                                                                  void               *user_data);
85
86 /* setters */
87
88 void
89 hb_unicode_funcs_set_mirroring_func (hb_unicode_funcs_t *ufuncs,
90                                      hb_unicode_get_mirroring_func_t mirroring_func,
91                                      void *user_data,
92                                      hb_destroy_func_t destroy);
93
94 void
95 hb_unicode_funcs_set_general_category_func (hb_unicode_funcs_t *ufuncs,
96                                             hb_unicode_get_general_category_func_t general_category_func,
97                                             void *user_data,
98                                             hb_destroy_func_t destroy);
99
100 void
101 hb_unicode_funcs_set_script_func (hb_unicode_funcs_t *ufuncs,
102                                   hb_unicode_get_script_func_t script_func,
103                                   void *user_data,
104                                   hb_destroy_func_t destroy);
105
106 void
107 hb_unicode_funcs_set_combining_class_func (hb_unicode_funcs_t *ufuncs,
108                                            hb_unicode_get_combining_class_func_t combining_class_func,
109                                            void *user_data,
110                                            hb_destroy_func_t destroy);
111
112 void
113 hb_unicode_funcs_set_eastasian_width_func (hb_unicode_funcs_t *ufuncs,
114                                            hb_unicode_get_eastasian_width_func_t eastasian_width_func,
115                                            void *user_data,
116                                            hb_destroy_func_t destroy);
117
118
119 /* accessors */
120
121 hb_codepoint_t
122 hb_unicode_get_mirroring (hb_unicode_funcs_t *ufuncs,
123                           hb_codepoint_t unicode);
124
125 hb_unicode_general_category_t
126 hb_unicode_get_general_category (hb_unicode_funcs_t *ufuncs,
127                                  hb_codepoint_t unicode);
128
129 hb_script_t
130 hb_unicode_get_script (hb_unicode_funcs_t *ufuncs,
131                        hb_codepoint_t unicode);
132
133 unsigned int
134 hb_unicode_get_combining_class (hb_unicode_funcs_t *ufuncs,
135                                 hb_codepoint_t unicode);
136
137 unsigned int
138 hb_unicode_get_eastasian_width (hb_unicode_funcs_t *ufuncs,
139                                 hb_codepoint_t unicode);
140
141
142 HB_END_DECLS
143
144 #endif /* HB_UNICODE_H */