hb-unicode-private.hh 3.4 KB
Newer Older
B
Behdad Esfahbod 已提交
1
/*
B
Behdad Esfahbod 已提交
2
 * Copyright © 2009  Red Hat, Inc.
3
 * Copyright © 2011  Codethink Limited
B
Behdad Esfahbod 已提交
4
 * Copyright © 2010,2011  Google, Inc.
B
Behdad Esfahbod 已提交
5
 *
B
Behdad Esfahbod 已提交
6
 *  This is part of HarfBuzz, a text shaping library.
B
Behdad Esfahbod 已提交
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
 *
 * Permission is hereby granted, without written agreement and without
 * license or royalty fees, to use, copy, modify, and distribute this
 * software and its documentation for any purpose, provided that the
 * above copyright notice and the following two paragraphs appear in
 * all copies of this software.
 *
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 *
 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 *
 * Red Hat Author(s): Behdad Esfahbod
27
 * Codethink Author(s): Ryan Lortie
28
 * Google Author(s): Behdad Esfahbod
B
Behdad Esfahbod 已提交
29 30
 */

31 32
#ifndef HB_UNICODE_PRIVATE_HH
#define HB_UNICODE_PRIVATE_HH
B
Behdad Esfahbod 已提交
33

34
#include "hb-private.hh"
B
Behdad Esfahbod 已提交
35 36

#include "hb-unicode.h"
37
#include "hb-object-private.hh"
B
Behdad Esfahbod 已提交
38 39 40

HB_BEGIN_DECLS

B
Behdad Esfahbod 已提交
41

B
Behdad Esfahbod 已提交
42 43 44 45
/*
 * hb_unicode_funcs_t
 */

B
Behdad Esfahbod 已提交
46
#define HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS \
B
Behdad Esfahbod 已提交
47 48 49 50 51
  HB_UNICODE_FUNC_IMPLEMENT (combining_class) \
  HB_UNICODE_FUNC_IMPLEMENT (eastasian_width) \
  HB_UNICODE_FUNC_IMPLEMENT (general_category) \
  HB_UNICODE_FUNC_IMPLEMENT (mirroring) \
  HB_UNICODE_FUNC_IMPLEMENT (script) \
52 53
  HB_UNICODE_FUNC_IMPLEMENT (compose) \
  HB_UNICODE_FUNC_IMPLEMENT (decompose) \
B
Behdad Esfahbod 已提交
54 55
  /* ^--- Add new callbacks here */

B
Behdad Esfahbod 已提交
56 57 58 59 60 61 62 63 64
/* Simple callbacks are those taking a hb_codepoint_t and returning a hb_codepoint_t */
#define HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE \
  HB_UNICODE_FUNC_IMPLEMENT (unsigned int, combining_class) \
  HB_UNICODE_FUNC_IMPLEMENT (unsigned int, eastasian_width) \
  HB_UNICODE_FUNC_IMPLEMENT (hb_unicode_general_category_t, general_category) \
  HB_UNICODE_FUNC_IMPLEMENT (hb_codepoint_t, mirroring) \
  HB_UNICODE_FUNC_IMPLEMENT (hb_script_t, script) \
  /* ^--- Add new simple callbacks here */

B
Behdad Esfahbod 已提交
65
struct _hb_unicode_funcs_t {
66 67
  hb_object_header_t header;

68
  hb_unicode_funcs_t *parent;
B
Behdad Esfahbod 已提交
69

70
  bool immutable;
71

72
  /* Don't access these directly.  Call hb_unicode_*() instead. */
73 74

  struct {
75
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_func_t name;
B
Behdad Esfahbod 已提交
76 77
    HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_UNICODE_FUNC_IMPLEMENT
78
  } func;
79 80

  struct {
B
Behdad Esfahbod 已提交
81
#define HB_UNICODE_FUNC_IMPLEMENT(name) void *name;
B
Behdad Esfahbod 已提交
82 83
    HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_UNICODE_FUNC_IMPLEMENT
84 85
  } user_data;

86
  struct {
B
Behdad Esfahbod 已提交
87
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_destroy_func_t name;
B
Behdad Esfahbod 已提交
88 89
    HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_UNICODE_FUNC_IMPLEMENT
90
  } destroy;
B
Behdad Esfahbod 已提交
91 92
};

93 94 95 96 97 98 99 100

#if HAVE_GLIB
extern HB_INTERNAL hb_unicode_funcs_t _hb_glib_unicode_funcs;
#define _hb_unicode_funcs_default _hb_glib_unicode_funcs
#elif HAVE_ICU
extern HB_INTERNAL hb_unicode_funcs_t _hb_icu_unicode_funcs;
#define _hb_unicode_funcs_default _hb_icu_unicode_funcs
#else
B
Behdad Esfahbod 已提交
101
extern HB_INTERNAL hb_unicode_funcs_t _hb_unicode_funcs_nil;
102 103 104
#define _hb_unicode_funcs_default _hb_unicode_funcs_nil
#endif

105

106

B
Behdad Esfahbod 已提交
107 108
HB_END_DECLS

109
#endif /* HB_UNICODE_PRIVATE_HH */