|
Packit |
874993 |
/*
|
|
Packit |
874993 |
* Copyright © 2011 Google, Inc.
|
|
Packit |
874993 |
*
|
|
Packit |
874993 |
* This is part of HarfBuzz, a text shaping library.
|
|
Packit |
874993 |
*
|
|
Packit |
874993 |
* Permission is hereby granted, without written agreement and without
|
|
Packit |
874993 |
* license or royalty fees, to use, copy, modify, and distribute this
|
|
Packit |
874993 |
* software and its documentation for any purpose, provided that the
|
|
Packit |
874993 |
* above copyright notice and the following two paragraphs appear in
|
|
Packit |
874993 |
* all copies of this software.
|
|
Packit |
874993 |
*
|
|
Packit |
874993 |
* IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
|
Packit |
874993 |
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
|
Packit |
874993 |
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
|
Packit |
874993 |
* IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
Packit |
874993 |
* DAMAGE.
|
|
Packit |
874993 |
*
|
|
Packit |
874993 |
* THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
|
Packit |
874993 |
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
Packit |
874993 |
* FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
|
Packit |
874993 |
* ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
|
Packit |
874993 |
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
|
Packit |
874993 |
*
|
|
Packit |
874993 |
* Google Author(s): Behdad Esfahbod
|
|
Packit |
874993 |
*/
|
|
Packit |
874993 |
|
|
Packit |
874993 |
#include "hb-private.hh"
|
|
Packit |
874993 |
|
|
Packit |
874993 |
/* g++ didn't like older gtype.h gcc-only code path. */
|
|
Packit |
874993 |
#include <glib.h>
|
|
Packit |
874993 |
#if !GLIB_CHECK_VERSION(2,29,16)
|
|
Packit |
874993 |
#undef __GNUC__
|
|
Packit |
874993 |
#undef __GNUC_MINOR__
|
|
Packit |
874993 |
#define __GNUC__ 2
|
|
Packit |
874993 |
#define __GNUC_MINOR__ 6
|
|
Packit |
874993 |
#endif
|
|
Packit |
874993 |
|
|
Packit |
874993 |
#include "hb-gobject.h"
|
|
Packit |
874993 |
|
|
Packit |
874993 |
#define HB_DEFINE_BOXED_TYPE(name,copy_func,free_func) \
|
|
Packit |
874993 |
GType \
|
|
Packit |
874993 |
hb_gobject_##name##_get_type (void) \
|
|
Packit |
874993 |
{ \
|
|
Packit |
874993 |
static gsize type_id = 0; \
|
|
Packit |
874993 |
if (g_once_init_enter (&type_id)) { \
|
|
Packit |
874993 |
GType id = g_boxed_type_register_static (g_intern_static_string ("hb_" #name "_t"), \
|
|
Packit |
874993 |
(GBoxedCopyFunc) copy_func, \
|
|
Packit |
874993 |
(GBoxedFreeFunc) free_func); \
|
|
Packit |
874993 |
g_once_init_leave (&type_id, id); \
|
|
Packit |
874993 |
} \
|
|
Packit |
874993 |
return type_id; \
|
|
Packit |
874993 |
}
|
|
Packit |
874993 |
|
|
Packit |
874993 |
#define HB_DEFINE_OBJECT_TYPE(name) \
|
|
Packit |
874993 |
HB_DEFINE_BOXED_TYPE (name, hb_##name##_reference, hb_##name##_destroy);
|
|
Packit |
874993 |
|
|
Packit |
874993 |
#define HB_DEFINE_VALUE_TYPE(name) \
|
|
Packit |
874993 |
static hb_##name##_t *_hb_##name##_reference (const hb_##name##_t *l) \
|
|
Packit |
874993 |
{ \
|
|
Packit |
874993 |
hb_##name##_t *c = (hb_##name##_t *) calloc (1, sizeof (hb_##name##_t)); \
|
|
Packit |
874993 |
if (unlikely (!c)) return NULL; \
|
|
Packit |
874993 |
*c = *l; \
|
|
Packit |
874993 |
return c; \
|
|
Packit |
874993 |
} \
|
|
Packit |
874993 |
static void _hb_##name##_destroy (hb_##name##_t *l) { free (l); } \
|
|
Packit |
874993 |
HB_DEFINE_BOXED_TYPE (name, _hb_##name##_reference, _hb_##name##_destroy);
|
|
Packit |
874993 |
|
|
Packit |
874993 |
HB_DEFINE_OBJECT_TYPE (buffer)
|
|
Packit |
874993 |
HB_DEFINE_OBJECT_TYPE (blob)
|
|
Packit |
874993 |
HB_DEFINE_OBJECT_TYPE (face)
|
|
Packit |
874993 |
HB_DEFINE_OBJECT_TYPE (font)
|
|
Packit |
874993 |
HB_DEFINE_OBJECT_TYPE (font_funcs)
|
|
Packit |
874993 |
HB_DEFINE_OBJECT_TYPE (set)
|
|
Packit |
874993 |
HB_DEFINE_OBJECT_TYPE (shape_plan)
|
|
Packit |
874993 |
HB_DEFINE_OBJECT_TYPE (unicode_funcs)
|
|
Packit |
874993 |
HB_DEFINE_VALUE_TYPE (feature)
|
|
Packit |
874993 |
HB_DEFINE_VALUE_TYPE (glyph_info)
|
|
Packit |
874993 |
HB_DEFINE_VALUE_TYPE (glyph_position)
|
|
Packit |
874993 |
HB_DEFINE_VALUE_TYPE (segment_properties)
|
|
Packit |
874993 |
HB_DEFINE_VALUE_TYPE (user_data_key)
|
|
Packit |
874993 |
|
|
Packit |
874993 |
HB_DEFINE_VALUE_TYPE (ot_math_glyph_variant)
|
|
Packit |
874993 |
HB_DEFINE_VALUE_TYPE (ot_math_glyph_part)
|