15c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod/*
22409d5f8d7dd8b535ce5ea29e933f7db27d33793Behdad Esfahbod * Copyright © 2009  Red Hat, Inc.
36adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod * Copyright © 2011  Codethink Limited
46adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod * Copyright © 2010,2011,2012  Google, Inc.
55c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod *
6c755cb3e3ac55156d0d2ec05adea7a650b97cc41Behdad Esfahbod *  This is part of HarfBuzz, a text shaping library.
75c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod *
85c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * Permission is hereby granted, without written agreement and without
95c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this
105c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * software and its documentation for any purpose, provided that the
115c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * above copyright notice and the following two paragraphs appear in
125c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * all copies of this software.
135c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod *
145c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
155c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
165c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
175c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
185c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * DAMAGE.
195c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod *
205c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
215c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
225c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
235c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
245c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
255c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod *
265c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * Red Hat Author(s): Behdad Esfahbod
272fd0c577e322ccbf762927bc4600b3ea31db4c80Ryan Lortie * Codethink Author(s): Ryan Lortie
28fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod * Google Author(s): Behdad Esfahbod
295c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod */
305c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
31c57d454accff66e5f2c58006e8fb40bc020b6182Behdad Esfahbod#include "hb-private.hh"
325c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
33fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod#include "hb-unicode-private.hh"
345c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
35acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbod
36acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbod
375c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod/*
385c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod * hb_unicode_funcs_t
395c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod */
405c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
4121fdcee00125b6e1c09f0bed3064d16ccd3a7a5dBehdad Esfahbodstatic hb_unicode_combining_class_t
42c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_unicode_combining_class_nil (hb_unicode_funcs_t *ufuncs    HB_UNUSED,
43c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod				hb_codepoint_t      unicode   HB_UNUSED,
44c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod				void               *user_data HB_UNUSED)
45891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod{
4621fdcee00125b6e1c09f0bed3064d16ccd3a7a5dBehdad Esfahbod  return HB_UNICODE_COMBINING_CLASS_NOT_REORDERED;
472fd0c577e322ccbf762927bc4600b3ea31db4c80Ryan Lortie}
482fd0c577e322ccbf762927bc4600b3ea31db4c80Ryan Lortie
49891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbodstatic unsigned int
50c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_unicode_eastasian_width_nil (hb_unicode_funcs_t *ufuncs    HB_UNUSED,
51c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod				hb_codepoint_t      unicode   HB_UNUSED,
52c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod				void               *user_data HB_UNUSED)
53891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod{
54891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod  return 1;
55891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod}
56891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod
57891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbodstatic hb_unicode_general_category_t
58c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_unicode_general_category_nil (hb_unicode_funcs_t *ufuncs    HB_UNUSED,
59c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod				 hb_codepoint_t      unicode   HB_UNUSED,
60c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod				 void               *user_data HB_UNUSED)
61891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod{
62891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod  return HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER;
63891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod}
64891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod
65891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbodstatic hb_codepoint_t
66c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_unicode_mirroring_nil (hb_unicode_funcs_t *ufuncs    HB_UNUSED,
67c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod			  hb_codepoint_t      unicode   HB_UNUSED,
68c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod			  void               *user_data HB_UNUSED)
69891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod{
70891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod  return unicode;
71891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod}
72891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod
73891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbodstatic hb_script_t
74c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_unicode_script_nil (hb_unicode_funcs_t *ufuncs    HB_UNUSED,
75c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		       hb_codepoint_t      unicode   HB_UNUSED,
76c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		       void               *user_data HB_UNUSED)
77891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod{
78891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod  return HB_SCRIPT_UNKNOWN;
79891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod}
802fd0c577e322ccbf762927bc4600b3ea31db4c80Ryan Lortie
81c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodstatic hb_bool_t
8222fdc66712464bdb02e45eed49e4be57e79b442fBehdad Esfahbodhb_unicode_compose_nil (hb_unicode_funcs_t *ufuncs    HB_UNUSED,
83c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod			hb_codepoint_t      a         HB_UNUSED,
84c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod			hb_codepoint_t      b         HB_UNUSED,
85c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod			hb_codepoint_t     *ab        HB_UNUSED,
86c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod			void               *user_data HB_UNUSED)
87c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod{
880594a2448440208efa0acac9a5d8d52d43108289Behdad Esfahbod  return false;
89c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod}
90c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod
91c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodstatic hb_bool_t
9222fdc66712464bdb02e45eed49e4be57e79b442fBehdad Esfahbodhb_unicode_decompose_nil (hb_unicode_funcs_t *ufuncs    HB_UNUSED,
93c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod			  hb_codepoint_t      ab        HB_UNUSED,
94c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod			  hb_codepoint_t     *a         HB_UNUSED,
95c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod			  hb_codepoint_t     *b         HB_UNUSED,
96c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod			  void               *user_data HB_UNUSED)
97c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod{
980594a2448440208efa0acac9a5d8d52d43108289Behdad Esfahbod  return false;
99c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod}
100c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod
10148910f8f0034c54b4e11cef3d08aa40e52c06b28Behdad Esfahbod
102378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbodstatic unsigned int
103378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbodhb_unicode_decompose_compatibility_nil (hb_unicode_funcs_t *ufuncs     HB_UNUSED,
104378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod					hb_codepoint_t      u          HB_UNUSED,
105378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod					hb_codepoint_t     *decomposed HB_UNUSED,
106378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod					void               *user_data  HB_UNUSED)
107378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod{
108378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod  return 0;
109378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod}
110378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod
111fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod
112d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod#define HB_UNICODE_FUNCS_IMPLEMENT_SET \
113d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod  HB_UNICODE_FUNCS_IMPLEMENT (glib) \
114d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod  HB_UNICODE_FUNCS_IMPLEMENT (icu) \
1153f33f0d1f2603f22e86adffe3c3836136ba5e5fdBehdad Esfahbod  HB_UNICODE_FUNCS_IMPLEMENT (ucdn) \
116d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod  HB_UNICODE_FUNCS_IMPLEMENT (nil) \
117d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod  /* ^--- Add new callbacks before nil */
118d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod
119d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod#define hb_nil_get_unicode_funcs hb_unicode_funcs_get_empty
120d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod
121d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod/* Prototype them all */
122d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod#define HB_UNICODE_FUNCS_IMPLEMENT(set) \
123d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbodextern "C" hb_unicode_funcs_t *hb_##set##_get_unicode_funcs (void);
124d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad EsfahbodHB_UNICODE_FUNCS_IMPLEMENT_SET
125d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod#undef HB_UNICODE_FUNCS_IMPLEMENT
126d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod
127d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod
1285c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbodhb_unicode_funcs_t *
129d4bee9f813bb299b1c4aab7c33d588be2a7d354bBehdad Esfahbodhb_unicode_funcs_get_default (void)
130d4bee9f813bb299b1c4aab7c33d588be2a7d354bBehdad Esfahbod{
131d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod#define HB_UNICODE_FUNCS_IMPLEMENT(set) \
132d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod  return hb_##set##_get_unicode_funcs ();
133d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod
134d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod#ifdef HAVE_GLIB
135d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod  HB_UNICODE_FUNCS_IMPLEMENT(glib)
136af1aa362cacc652ab8ffda05a5d98a3ff5430439Behdad Esfahbod#elif defined(HAVE_ICU) && defined(HAVE_ICU_BUILTIN)
137d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod  HB_UNICODE_FUNCS_IMPLEMENT(icu)
1383f33f0d1f2603f22e86adffe3c3836136ba5e5fdBehdad Esfahbod#elif defined(HAVE_UCDN)
1393f33f0d1f2603f22e86adffe3c3836136ba5e5fdBehdad Esfahbod  HB_UNICODE_FUNCS_IMPLEMENT(ucdn)
140d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod#else
141d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod#define HB_UNICODE_FUNCS_NIL 1
142d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod  HB_UNICODE_FUNCS_IMPLEMENT(nil)
143d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod#endif
144d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod
145d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod#undef HB_UNICODE_FUNCS_IMPLEMENT
146d4bee9f813bb299b1c4aab7c33d588be2a7d354bBehdad Esfahbod}
147d4bee9f813bb299b1c4aab7c33d588be2a7d354bBehdad Esfahbod
148d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod#if !defined(HB_NO_UNICODE_FUNCS) && defined(HB_UNICODE_FUNCS_NIL)
14909732cc6695b8e41ba6cdcd4058a4f7cad90167aBehdad Esfahbod#ifdef _MSC_VER
15009732cc6695b8e41ba6cdcd4058a4f7cad90167aBehdad Esfahbod#pragma message("Could not find any Unicode functions implementation, you have to provide your own")
15109732cc6695b8e41ba6cdcd4058a4f7cad90167aBehdad Esfahbod#pragma message("To suppress this warnings, define HB_NO_UNICODE_FUNCS")
15209732cc6695b8e41ba6cdcd4058a4f7cad90167aBehdad Esfahbod#else
15309732cc6695b8e41ba6cdcd4058a4f7cad90167aBehdad Esfahbod#warning "Could not find any Unicode functions implementation, you have to provide your own"
15409732cc6695b8e41ba6cdcd4058a4f7cad90167aBehdad Esfahbod#warning "To suppress this warning, define HB_NO_UNICODE_FUNCS"
15509732cc6695b8e41ba6cdcd4058a4f7cad90167aBehdad Esfahbod#endif
156d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod#endif
157d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod
158288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
159085d4291a9f253a4b8e2eec8003ac11d02a9394fBehdad Esfahbod * hb_unicode_funcs_create: (Xconstructor)
160288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @parent: (allow-none):
161288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
162288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
163288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
164288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: (transfer full):
165288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
166288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Since: 1.0
167288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
168d4bee9f813bb299b1c4aab7c33d588be2a7d354bBehdad Esfahbodhb_unicode_funcs_t *
1692fd0c577e322ccbf762927bc4600b3ea31db4c80Ryan Lortiehb_unicode_funcs_create (hb_unicode_funcs_t *parent)
1705c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod{
1715c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod  hb_unicode_funcs_t *ufuncs;
1725c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
17347e71d9661946a4ffb96026bf1d697d788414ab5Behdad Esfahbod  if (!(ufuncs = hb_object_create<hb_unicode_funcs_t> ()))
174f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod    return hb_unicode_funcs_get_empty ();
1755c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
176c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod  if (!parent)
177f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod    parent = hb_unicode_funcs_get_empty ();
178fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod
179c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod  hb_unicode_funcs_make_immutable (parent);
180c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod  ufuncs->parent = hb_unicode_funcs_reference (parent);
181fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod
182c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod  ufuncs->func = parent->func;
183c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod
184c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod  /* We can safely copy user_data from parent since we hold a reference
185c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod   * onto it and it's immutable.  We should not copy the destroy notifiers
186c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod   * though. */
187c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod  ufuncs->user_data = parent->user_data;
18848910f8f0034c54b4e11cef3d08aa40e52c06b28Behdad Esfahbod
1895c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod  return ufuncs;
1905c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod}
1915c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
192f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod
193be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbodconst hb_unicode_funcs_t _hb_unicode_funcs_nil = {
194be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod  HB_OBJECT_HEADER_STATIC,
195be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod
196be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod  NULL, /* parent */
1970594a2448440208efa0acac9a5d8d52d43108289Behdad Esfahbod  true, /* immutable */
198be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod  {
199f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_nil,
200be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod    HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
201f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod#undef HB_UNICODE_FUNC_IMPLEMENT
202be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod  }
203be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod};
204f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod
205288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
206288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_get_empty:
207288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
208288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
209288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
210288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: (transfer full):
211288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
212288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Since: 1.0
213288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
214be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbodhb_unicode_funcs_t *
215be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbodhb_unicode_funcs_get_empty (void)
216be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod{
217f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod  return const_cast<hb_unicode_funcs_t *> (&_hb_unicode_funcs_nil);
21880a6833b032bc63b4e8c3da6489d3767af1168f3Behdad Esfahbod}
21980a6833b032bc63b4e8c3da6489d3767af1168f3Behdad Esfahbod
220288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
221288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_reference: (skip)
222288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
223288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
224288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
225288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
226288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: (transfer full):
227288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
228288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Since: 1.0
229288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
23080a6833b032bc63b4e8c3da6489d3767af1168f3Behdad Esfahbodhb_unicode_funcs_t *
2315c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbodhb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs)
2325c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod{
23347e71d9661946a4ffb96026bf1d697d788414ab5Behdad Esfahbod  return hb_object_reference (ufuncs);
2345c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod}
2355c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
236288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
237288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_destroy: (skip)
238288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
239288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
240288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
241288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
242288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Since: 1.0
243288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
2445c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbodvoid
2455c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbodhb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs)
2465c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod{
24747e71d9661946a4ffb96026bf1d697d788414ab5Behdad Esfahbod  if (!hb_object_destroy (ufuncs)) return;
2485c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
249891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod#define HB_UNICODE_FUNC_IMPLEMENT(name) \
2504b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  if (ufuncs->destroy.name) ufuncs->destroy.name (ufuncs->user_data.name);
2514b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
2524b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod#undef HB_UNICODE_FUNC_IMPLEMENT
253fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod
254c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod  hb_unicode_funcs_destroy (ufuncs->parent);
2552fd0c577e322ccbf762927bc4600b3ea31db4c80Ryan Lortie
2565c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod  free (ufuncs);
2575c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod}
2585c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
259288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
260288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_set_user_data: (skip)
261288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
262288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @key:
263288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @data:
264288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @destroy:
265288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @replace:
266288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
267288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
268288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
269288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value:
270288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
271288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Since: 1.0
272288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
2735fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbodhb_bool_t
2745fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbodhb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs,
2755fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod			        hb_user_data_key_t *key,
2765fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod			        void *              data,
27733ccc77902660ed4b49184e5ec99f4fd0ef63175Behdad Esfahbod			        hb_destroy_func_t   destroy,
27833ccc77902660ed4b49184e5ec99f4fd0ef63175Behdad Esfahbod				hb_bool_t           replace)
2795fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod{
28033ccc77902660ed4b49184e5ec99f4fd0ef63175Behdad Esfahbod  return hb_object_set_user_data (ufuncs, key, data, destroy, replace);
2815fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod}
2825fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod
283288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
284288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_get_user_data: (skip)
285288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
286288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @key:
287288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
288288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
289288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
290288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: (transfer none):
291288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
292288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Since: 1.0
293288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
2945fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbodvoid *
2955fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbodhb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs,
2965fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod			        hb_user_data_key_t *key)
2975fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod{
2985fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod  return hb_object_get_user_data (ufuncs, key);
2995fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod}
3005fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod
3015fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod
302288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
303288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_make_immutable:
304288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
305288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
306288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
307288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
308288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Since: 1.0
309288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
310eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbodvoid
311eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbodhb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs)
312eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbod{
3133f310dc0cae9015c45ba642b9b83d5695c807aadBehdad Esfahbod  if (unlikely (hb_object_is_inert (ufuncs)))
314eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbod    return;
315eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbod
3160594a2448440208efa0acac9a5d8d52d43108289Behdad Esfahbod  ufuncs->immutable = true;
317eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbod}
318eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbod
319288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
320288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_is_immutable:
321288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
322288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
323288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
324288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
325288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value:
326288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
327288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Since: 1.0
328288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
329645f6f265b5f6fb85b3c0f59ea874d58c86e3917Behdad Esfahbodhb_bool_t
330645f6f265b5f6fb85b3c0f59ea874d58c86e3917Behdad Esfahbodhb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs)
331645f6f265b5f6fb85b3c0f59ea874d58c86e3917Behdad Esfahbod{
332645f6f265b5f6fb85b3c0f59ea874d58c86e3917Behdad Esfahbod  return ufuncs->immutable;
333645f6f265b5f6fb85b3c0f59ea874d58c86e3917Behdad Esfahbod}
334645f6f265b5f6fb85b3c0f59ea874d58c86e3917Behdad Esfahbod
335288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
336288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_get_parent:
337288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
338288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
339288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
340288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
341288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value:
342288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
343288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Since: 1.0
344288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
345fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbodhb_unicode_funcs_t *
346fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbodhb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs)
347fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod{
348f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod  return ufuncs->parent ? ufuncs->parent : hb_unicode_funcs_get_empty ();
349fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod}
350fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod
35104cc0a29ee1472c318c36efcd19b9c1a6657d9eaBehdad Esfahbod
352891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod#define HB_UNICODE_FUNC_IMPLEMENT(name)						\
3534b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod										\
3544b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbodvoid										\
3554b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbodhb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t		   *ufuncs,	\
356c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod				    hb_unicode_##name##_func_t	    func,	\
3574b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod				    void			   *user_data,	\
3584b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod				    hb_destroy_func_t		    destroy)	\
3594b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod{										\
3604b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  if (ufuncs->immutable)							\
3614b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    return;									\
3624b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod										\
3634b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  if (ufuncs->destroy.name)							\
3644b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    ufuncs->destroy.name (ufuncs->user_data.name);				\
3654b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod										\
3664b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  if (func) {									\
367c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod    ufuncs->func.name = func;							\
3684b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    ufuncs->user_data.name = user_data;						\
3694b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    ufuncs->destroy.name = destroy;						\
3704b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  } else {									\
371c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod    ufuncs->func.name = ufuncs->parent->func.name;				\
3724b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    ufuncs->user_data.name = ufuncs->parent->user_data.name;			\
3734b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    ufuncs->destroy.name = NULL;						\
3744b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  }										\
375891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod}
376891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod
3777470315a3e782aa6192bbe64f7a3944266fb1521Behdad EsfahbodHB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
378891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod#undef HB_UNICODE_FUNC_IMPLEMENT
379891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod
380891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod
381891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name)				\
3824b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod										\
3834b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbodreturn_type									\
384c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_unicode_##name (hb_unicode_funcs_t *ufuncs,					\
385c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		   hb_codepoint_t      unicode)					\
3864b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod{										\
3877470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  return ufuncs->name (unicode);						\
3884b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod}
3897470315a3e782aa6192bbe64f7a3944266fb1521Behdad EsfahbodHB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
3904b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod#undef HB_UNICODE_FUNC_IMPLEMENT
3915ceefa1d8dbd310570ea8d1c47107fe8d3dc96d9Behdad Esfahbod
392288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
393288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_compose:
394288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
395288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @a:
396288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @b:
397288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ab: (out):
398288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
399288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
400288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
401288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value:
402288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
403288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Since: 1.0
404288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
405c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_bool_t
406c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_unicode_compose (hb_unicode_funcs_t *ufuncs,
407c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		    hb_codepoint_t      a,
408c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		    hb_codepoint_t      b,
409c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		    hb_codepoint_t     *ab)
410c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod{
4117470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  return ufuncs->compose (a, b, ab);
412c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod}
413c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod
414288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
415288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_decompose:
416288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
417288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ab:
418288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @a: (out):
419288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @b: (out):
420288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
421288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
422288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
423288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value:
424288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
425288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Since: 1.0
426288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
427c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_bool_t
428c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_unicode_decompose (hb_unicode_funcs_t *ufuncs,
429c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		      hb_codepoint_t      ab,
430c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		      hb_codepoint_t     *a,
431c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		      hb_codepoint_t     *b)
432c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod{
4337470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  return ufuncs->decompose (ab, a, b);
434c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod}
4355ceefa1d8dbd310570ea8d1c47107fe8d3dc96d9Behdad Esfahbod
436288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
437288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_decompose_compatibility:
438288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
439288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @u:
440288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @decomposed: (out):
441288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
442288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
443288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
444288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value:
445288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
446288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Since: 1.0
447288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
448378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbodunsigned int
449378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbodhb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs,
450378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod				    hb_codepoint_t      u,
451378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod				    hb_codepoint_t     *decomposed)
452378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod{
4537470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  return ufuncs->decompose_compatibility (u, decomposed);
454378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod}
4552db2a566826ed4763ce69629194ec656bd48b0bdBehdad Esfahbod
4562db2a566826ed4763ce69629194ec656bd48b0bdBehdad Esfahbod
45721756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod/* See hb-unicode-private.hh for details. */
4586adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbodconst uint8_t
4596adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod_hb_modified_combining_class[256] =
4602db2a566826ed4763ce69629194ec656bd48b0bdBehdad Esfahbod{
4616adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  0, /* HB_UNICODE_COMBINING_CLASS_NOT_REORDERED */
4626adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  1, /* HB_UNICODE_COMBINING_CLASS_OVERLAY */
4636adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  2, 3, 4, 5, 6,
4646adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  7, /* HB_UNICODE_COMBINING_CLASS_NUKTA */
4656adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  8, /* HB_UNICODE_COMBINING_CLASS_KANA_VOICING */
4666adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  9, /* HB_UNICODE_COMBINING_CLASS_VIRAMA */
4676adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
4686adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  /* Hebrew */
46921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC10,
47021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC11,
47121756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC12,
47221756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC13,
47321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC14,
47421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC15,
47521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC16,
47621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC17,
47721756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC18,
47821756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC19,
47921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC20,
48021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC21,
48121756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC22,
48221756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC23,
48321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC24,
48421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC25,
48521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC26,
4866adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
4876adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  /* Arabic */
48821756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC27,
48921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC28,
49021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC29,
49121756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC30,
49221756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC31,
49321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC32,
49421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC33,
49521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC34,
49621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC35,
4976adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
4986adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  /* Syriac */
49921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC36,
5006adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5016adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  37, 38, 39,
5026adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
5036adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
5046adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  80, 81, 82, 83,
5056adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5066adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  /* Telugu */
50721756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC84,
5086adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  85, 86, 87, 88, 89, 90,
50921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC91,
5106adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
5116adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5126adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  /* Thai */
51321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC103,
5146adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  104, 105, 106,
51521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC107,
5166adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
5176adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5186adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  /* Lao */
51921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC118,
5206adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  119, 120, 121,
52121756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC122,
5226adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  123, 124, 125, 126, 127, 128,
5236adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5246adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  /* Tibetan */
52521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC129,
52621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC130,
5276adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  131,
52856c9e7c004e802ddcb8c704346026f1d7a812f9fBehdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC132,
5296adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  133, 134, 135, 136, 137, 138, 139,
5306adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5316adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5326adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
5336adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
5346adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
5356adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
5366adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
5376adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
5386adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5396adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  200, /* HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT */
5406adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  201,
5416adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  202, /* HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW */
5426adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
5436adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  214, /* HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE */
5446adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  215,
5456adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  216, /* HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT */
5466adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  217,
5476adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  218, /* HB_UNICODE_COMBINING_CLASS_BELOW_LEFT */
5486adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  219,
5496adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  220, /* HB_UNICODE_COMBINING_CLASS_BELOW */
5506adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  221,
5516adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  222, /* HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT */
5526adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  223,
5536adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  224, /* HB_UNICODE_COMBINING_CLASS_LEFT */
5546adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  225,
5556adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  226, /* HB_UNICODE_COMBINING_CLASS_RIGHT */
5566adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  227,
5576adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  228, /* HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT */
5586adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  229,
5596adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  230, /* HB_UNICODE_COMBINING_CLASS_ABOVE */
5606adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  231,
5616adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  232, /* HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT */
5626adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  233, /* HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW */
5636adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  234, /* HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE */
5646adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  235, 236, 237, 238, 239,
5656adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  240, /* HB_UNICODE_COMBINING_CLASS_IOTA_SUBSCRIPT */
5666adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
5676adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  255, /* HB_UNICODE_COMBINING_CLASS_INVALID */
5686adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod};
569