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
13453543f8b3e19456279c86f711feba42ce976668cBehdad Esfahbod#if defined(HAVE_UCDN)
13553543f8b3e19456279c86f711feba42ce976668cBehdad Esfahbod  HB_UNICODE_FUNCS_IMPLEMENT(ucdn)
13653543f8b3e19456279c86f711feba42ce976668cBehdad Esfahbod#elif defined(HAVE_GLIB)
137d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod  HB_UNICODE_FUNCS_IMPLEMENT(glib)
138af1aa362cacc652ab8ffda05a5d98a3ff5430439Behdad Esfahbod#elif defined(HAVE_ICU) && defined(HAVE_ICU_BUILTIN)
139d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod  HB_UNICODE_FUNCS_IMPLEMENT(icu)
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)
149cdcdfe61b97a0a48ccf834b6d924d187da9609beBehdad Esfahbod#error "Could not find any Unicode functions implementation, you have to provide your own"
150cdcdfe61b97a0a48ccf834b6d924d187da9609beBehdad Esfahbod#error "Consider building hb-ucdn.c.  If you absolutely want to build without any, check the code."
15109732cc6695b8e41ba6cdcd4058a4f7cad90167aBehdad Esfahbod#endif
152d5045a5f4017631a4660f985fe451c5a64c42ca0Behdad Esfahbod
153288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
154085d4291a9f253a4b8e2eec8003ac11d02a9394fBehdad Esfahbod * hb_unicode_funcs_create: (Xconstructor)
155b91904a40da6287f84bc79de60674fa57232ec09Behdad Esfahbod * @parent: (nullable):
156288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
157288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
158288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
159288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: (transfer full):
160288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
161b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod * Since: 0.9.2
162288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
163d4bee9f813bb299b1c4aab7c33d588be2a7d354bBehdad Esfahbodhb_unicode_funcs_t *
1642fd0c577e322ccbf762927bc4600b3ea31db4c80Ryan Lortiehb_unicode_funcs_create (hb_unicode_funcs_t *parent)
1655c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod{
1665c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod  hb_unicode_funcs_t *ufuncs;
1675c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
16847e71d9661946a4ffb96026bf1d697d788414ab5Behdad Esfahbod  if (!(ufuncs = hb_object_create<hb_unicode_funcs_t> ()))
169f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod    return hb_unicode_funcs_get_empty ();
1705c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
171c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod  if (!parent)
172f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod    parent = hb_unicode_funcs_get_empty ();
173fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod
174c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod  hb_unicode_funcs_make_immutable (parent);
175c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod  ufuncs->parent = hb_unicode_funcs_reference (parent);
176fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod
177c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod  ufuncs->func = parent->func;
178c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod
179c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod  /* We can safely copy user_data from parent since we hold a reference
180c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod   * onto it and it's immutable.  We should not copy the destroy notifiers
181c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod   * though. */
182c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod  ufuncs->user_data = parent->user_data;
18348910f8f0034c54b4e11cef3d08aa40e52c06b28Behdad Esfahbod
1845c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod  return ufuncs;
1855c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod}
1865c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
187f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod
188be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbodconst hb_unicode_funcs_t _hb_unicode_funcs_nil = {
189be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod  HB_OBJECT_HEADER_STATIC,
190be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod
191dbdbfe3d7b36613d893832dcb1884c756c20bfdaBehdad Esfahbod  nullptr, /* parent */
1920594a2448440208efa0acac9a5d8d52d43108289Behdad Esfahbod  true, /* immutable */
193be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod  {
194f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_nil,
195be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod    HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
196f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod#undef HB_UNICODE_FUNC_IMPLEMENT
197be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod  }
198be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod};
199f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod
200288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
201288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_get_empty:
202288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
203288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
204288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
205288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: (transfer full):
206288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
207b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod * Since: 0.9.2
208288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
209be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbodhb_unicode_funcs_t *
210be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbodhb_unicode_funcs_get_empty (void)
211be4560a3b5e8599cbe2b29a01a60c21c9e2b194fBehdad Esfahbod{
212f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod  return const_cast<hb_unicode_funcs_t *> (&_hb_unicode_funcs_nil);
21380a6833b032bc63b4e8c3da6489d3767af1168f3Behdad Esfahbod}
21480a6833b032bc63b4e8c3da6489d3767af1168f3Behdad Esfahbod
215288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
216288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_reference: (skip)
217288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
218288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
219288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
220288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
221288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: (transfer full):
222288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
223b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod * Since: 0.9.2
224288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
22580a6833b032bc63b4e8c3da6489d3767af1168f3Behdad Esfahbodhb_unicode_funcs_t *
2265c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbodhb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs)
2275c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod{
22847e71d9661946a4ffb96026bf1d697d788414ab5Behdad Esfahbod  return hb_object_reference (ufuncs);
2295c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod}
2305c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
231288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
232288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_destroy: (skip)
233288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
234288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
235288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
236288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
237b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod * Since: 0.9.2
238288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
2395c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbodvoid
2405c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbodhb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs)
2415c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod{
24247e71d9661946a4ffb96026bf1d697d788414ab5Behdad Esfahbod  if (!hb_object_destroy (ufuncs)) return;
2435c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
244891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod#define HB_UNICODE_FUNC_IMPLEMENT(name) \
2454b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  if (ufuncs->destroy.name) ufuncs->destroy.name (ufuncs->user_data.name);
2464b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
2474b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod#undef HB_UNICODE_FUNC_IMPLEMENT
248fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod
249c784c67a28f5b92d396eaa9529d57ef91a5cb9acBehdad Esfahbod  hb_unicode_funcs_destroy (ufuncs->parent);
2502fd0c577e322ccbf762927bc4600b3ea31db4c80Ryan Lortie
2515c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod  free (ufuncs);
2525c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod}
2535c44188455ca1b696aa24b20c3a83877dfae2fb2Behdad Esfahbod
254288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
255288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_set_user_data: (skip)
256288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
257288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @key:
258288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @data:
259288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @destroy:
260288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @replace:
261288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
262288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
263288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
264288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value:
265288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
266b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod * Since: 0.9.2
267288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
2685fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbodhb_bool_t
2695fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbodhb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs,
2705fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod			        hb_user_data_key_t *key,
2715fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod			        void *              data,
27233ccc77902660ed4b49184e5ec99f4fd0ef63175Behdad Esfahbod			        hb_destroy_func_t   destroy,
27333ccc77902660ed4b49184e5ec99f4fd0ef63175Behdad Esfahbod				hb_bool_t           replace)
2745fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod{
27533ccc77902660ed4b49184e5ec99f4fd0ef63175Behdad Esfahbod  return hb_object_set_user_data (ufuncs, key, data, destroy, replace);
2765fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod}
2775fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod
278288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
279288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_get_user_data: (skip)
280288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
281288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @key:
282288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
283288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
284288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
285288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value: (transfer none):
286288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
287b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod * Since: 0.9.2
288288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
2895fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbodvoid *
2905fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbodhb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs,
2915fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod			        hb_user_data_key_t *key)
2925fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod{
2935fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod  return hb_object_get_user_data (ufuncs, key);
2945fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod}
2955fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod
2965fa849b77d49da2212825ebb1bea9145713b8449Behdad Esfahbod
297288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
298288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_make_immutable:
299288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
300288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
301288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
302288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
303b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod * Since: 0.9.2
304288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
305eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbodvoid
306eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbodhb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs)
307eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbod{
3083f310dc0cae9015c45ba642b9b83d5695c807aadBehdad Esfahbod  if (unlikely (hb_object_is_inert (ufuncs)))
309eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbod    return;
310eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbod
3110594a2448440208efa0acac9a5d8d52d43108289Behdad Esfahbod  ufuncs->immutable = true;
312eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbod}
313eb27ec0cef0d92740875ab5035b53acc639e5faeBehdad Esfahbod
314288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
315288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_is_immutable:
316288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
317288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
318288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
319288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
320288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value:
321288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
322b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod * Since: 0.9.2
323288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
324645f6f265b5f6fb85b3c0f59ea874d58c86e3917Behdad Esfahbodhb_bool_t
325645f6f265b5f6fb85b3c0f59ea874d58c86e3917Behdad Esfahbodhb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs)
326645f6f265b5f6fb85b3c0f59ea874d58c86e3917Behdad Esfahbod{
327645f6f265b5f6fb85b3c0f59ea874d58c86e3917Behdad Esfahbod  return ufuncs->immutable;
328645f6f265b5f6fb85b3c0f59ea874d58c86e3917Behdad Esfahbod}
329645f6f265b5f6fb85b3c0f59ea874d58c86e3917Behdad Esfahbod
330288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
331288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_funcs_get_parent:
332288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
333288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
334288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
335288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
336288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value:
337288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
338b8811429b6810c4f13be087b593a862c17d9d987Behdad Esfahbod * Since: 0.9.2
339288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
340fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbodhb_unicode_funcs_t *
341fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbodhb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs)
342fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod{
343f06ab8a4262c759b4723614fd28f55ee77aa8466Behdad Esfahbod  return ufuncs->parent ? ufuncs->parent : hb_unicode_funcs_get_empty ();
344fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod}
345fb194b8794898f51eb596fa4092c26606889d376Behdad Esfahbod
34604cc0a29ee1472c318c36efcd19b9c1a6657d9eaBehdad Esfahbod
347891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod#define HB_UNICODE_FUNC_IMPLEMENT(name)						\
3484b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod										\
3494b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbodvoid										\
3504b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbodhb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t		   *ufuncs,	\
351c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod				    hb_unicode_##name##_func_t	    func,	\
3524b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod				    void			   *user_data,	\
3534b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod				    hb_destroy_func_t		    destroy)	\
3544b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod{										\
3554b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  if (ufuncs->immutable)							\
3564b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    return;									\
3574b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod										\
3584b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  if (ufuncs->destroy.name)							\
3594b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    ufuncs->destroy.name (ufuncs->user_data.name);				\
3604b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod										\
3614b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  if (func) {									\
362c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod    ufuncs->func.name = func;							\
3634b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    ufuncs->user_data.name = user_data;						\
3644b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    ufuncs->destroy.name = destroy;						\
3654b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  } else {									\
366c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod    ufuncs->func.name = ufuncs->parent->func.name;				\
3674b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod    ufuncs->user_data.name = ufuncs->parent->user_data.name;			\
368dbdbfe3d7b36613d893832dcb1884c756c20bfdaBehdad Esfahbod    ufuncs->destroy.name = nullptr;						\
3694b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod  }										\
370891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod}
371891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod
3727470315a3e782aa6192bbe64f7a3944266fb1521Behdad EsfahbodHB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
373891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod#undef HB_UNICODE_FUNC_IMPLEMENT
374891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod
375891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod
376891c4755baae6cd59fad59d27fd8933e5f548a74Behdad Esfahbod#define HB_UNICODE_FUNC_IMPLEMENT(return_type, name)				\
3774b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod										\
3784b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbodreturn_type									\
379c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_unicode_##name (hb_unicode_funcs_t *ufuncs,					\
380c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		   hb_codepoint_t      unicode)					\
3814b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod{										\
3827470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  return ufuncs->name (unicode);						\
3834b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod}
3847470315a3e782aa6192bbe64f7a3944266fb1521Behdad EsfahbodHB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
3854b6317c4f426cfaf21e509dbf6ee6d4e0422cdacBehdad Esfahbod#undef HB_UNICODE_FUNC_IMPLEMENT
3865ceefa1d8dbd310570ea8d1c47107fe8d3dc96d9Behdad Esfahbod
387288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
388288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_compose:
389288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
390288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @a:
391288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @b:
392288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ab: (out):
393288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
394288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
395288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
396288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value:
397288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
39801c3a88543850c87483fd8671044df53b368c520Sascha Brawer * Since: 0.9.2
399288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
400c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_bool_t
401c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_unicode_compose (hb_unicode_funcs_t *ufuncs,
402c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		    hb_codepoint_t      a,
403c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		    hb_codepoint_t      b,
404c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		    hb_codepoint_t     *ab)
405c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod{
4067470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  return ufuncs->compose (a, b, ab);
407c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod}
408c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod
409288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
410288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_decompose:
411288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
412288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ab:
413288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @a: (out):
414288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @b: (out):
415288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
416288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
417288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
418288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value:
419288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
42001c3a88543850c87483fd8671044df53b368c520Sascha Brawer * Since: 0.9.2
421288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
422c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_bool_t
423c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbodhb_unicode_decompose (hb_unicode_funcs_t *ufuncs,
424c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		      hb_codepoint_t      ab,
425c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		      hb_codepoint_t     *a,
426c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod		      hb_codepoint_t     *b)
427c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod{
4287470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  return ufuncs->decompose (ab, a, b);
429c4641723fbf6532b2e80a662e15573b31276bc73Behdad Esfahbod}
4305ceefa1d8dbd310570ea8d1c47107fe8d3dc96d9Behdad Esfahbod
431288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod/**
432288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * hb_unicode_decompose_compatibility:
433288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @ufuncs: Unicode functions.
434288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @u:
435288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * @decomposed: (out):
436288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
437288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
438288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
439288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod * Return value:
440288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod *
44101c3a88543850c87483fd8671044df53b368c520Sascha Brawer * Since: 0.9.2
442288f2899979bcc9e68f8115cb76e3271ed0e17bcBehdad Esfahbod **/
443378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbodunsigned int
444378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbodhb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs,
445378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod				    hb_codepoint_t      u,
446378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod				    hb_codepoint_t     *decomposed)
447378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod{
4487470315a3e782aa6192bbe64f7a3944266fb1521Behdad Esfahbod  return ufuncs->decompose_compatibility (u, decomposed);
449378d279bbf692195c4654e312dae854ab3be04cfBehdad Esfahbod}
4502db2a566826ed4763ce69629194ec656bd48b0bdBehdad Esfahbod
4512db2a566826ed4763ce69629194ec656bd48b0bdBehdad Esfahbod
45221756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod/* See hb-unicode-private.hh for details. */
4536adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbodconst uint8_t
4546adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod_hb_modified_combining_class[256] =
4552db2a566826ed4763ce69629194ec656bd48b0bdBehdad Esfahbod{
4566adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  0, /* HB_UNICODE_COMBINING_CLASS_NOT_REORDERED */
4576adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  1, /* HB_UNICODE_COMBINING_CLASS_OVERLAY */
4586adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  2, 3, 4, 5, 6,
4596adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  7, /* HB_UNICODE_COMBINING_CLASS_NUKTA */
4606adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  8, /* HB_UNICODE_COMBINING_CLASS_KANA_VOICING */
4616adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  9, /* HB_UNICODE_COMBINING_CLASS_VIRAMA */
4626adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
4636adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  /* Hebrew */
46421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC10,
46521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC11,
46621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC12,
46721756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC13,
46821756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC14,
46921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC15,
47021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC16,
47121756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC17,
47221756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC18,
47321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC19,
47421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC20,
47521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC21,
47621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC22,
47721756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC23,
47821756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC24,
47921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC25,
48021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC26,
4816adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
4826adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  /* Arabic */
48321756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC27,
48421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC28,
48521756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC29,
48621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC30,
48721756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC31,
48821756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC32,
48921756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC33,
49021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC34,
49121756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC35,
4926adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
4936adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  /* Syriac */
49421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC36,
4956adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
4966adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  37, 38, 39,
4976adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
4986adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
4996adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  80, 81, 82, 83,
5006adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5016adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  /* Telugu */
50221756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC84,
5036adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  85, 86, 87, 88, 89, 90,
50421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC91,
5056adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
5066adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5076adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  /* Thai */
50821756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC103,
5096adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  104, 105, 106,
51021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC107,
5116adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
5126adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5136adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  /* Lao */
51421756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC118,
5156adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  119, 120, 121,
51621756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC122,
5176adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  123, 124, 125, 126, 127, 128,
5186adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5196adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  /* Tibetan */
52021756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC129,
52121756934a15e31dc243e2b6d80adec5752477652Behdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC130,
5226adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  131,
52356c9e7c004e802ddcb8c704346026f1d7a812f9fBehdad Esfahbod  HB_MODIFIED_COMBINING_CLASS_CCC132,
5246adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  133, 134, 135, 136, 137, 138, 139,
5256adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5266adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5276adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
5286adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
5296adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
5306adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
5316adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
5326adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
5336adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod
5346adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  200, /* HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT */
5356adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  201,
5366adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  202, /* HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW */
5376adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213,
5386adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  214, /* HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE */
5396adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  215,
5406adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  216, /* HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT */
5416adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  217,
5426adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  218, /* HB_UNICODE_COMBINING_CLASS_BELOW_LEFT */
5436adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  219,
5446adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  220, /* HB_UNICODE_COMBINING_CLASS_BELOW */
5456adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  221,
5466adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  222, /* HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT */
5476adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  223,
5486adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  224, /* HB_UNICODE_COMBINING_CLASS_LEFT */
5496adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  225,
5506adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  226, /* HB_UNICODE_COMBINING_CLASS_RIGHT */
5516adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  227,
5526adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  228, /* HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT */
5536adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  229,
5546adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  230, /* HB_UNICODE_COMBINING_CLASS_ABOVE */
5556adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  231,
5566adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  232, /* HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT */
5576adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  233, /* HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW */
5586adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  234, /* HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE */
5596adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  235, 236, 237, 238, 239,
5606adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  240, /* HB_UNICODE_COMBINING_CLASS_IOTA_SUBSCRIPT */
5616adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
5626adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod  255, /* HB_UNICODE_COMBINING_CLASS_INVALID */
5636adf417bc15d4524e280b284e3accd1ae647662eBehdad Esfahbod};
564