2 * Copyright (C) 1998-2004 David Turner and Werner Lemberg
3 * Copyright (C) 2006 Behdad Esfahbod
5 * This is part of HarfBuzz, an OpenType Layout engine library.
7 * Permission is hereby granted, without written agreement and without
8 * license or royalty fees, to use, copy, modify, and distribute this
9 * software and its documentation for any purpose, provided that the
10 * above copyright notice and the following two paragraphs appear in
11 * all copies of this software.
13 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
19 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
22 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
26 #ifndef HARFBUZZ_IMPL_H
27 #define HARFBUZZ_IMPL_H
29 #include "harfbuzz-global.h"
40 # define NULL ((void *)0)
52 # define TTAG_GDEF HB_MAKE_TAG( 'G', 'D', 'E', 'F' )
55 # define TTAG_GPOS HB_MAKE_TAG( 'G', 'P', 'O', 'S' )
58 # define TTAG_GSUB HB_MAKE_TAG( 'G', 'S', 'U', 'B' )
62 # define HB_UNUSED(arg) ((arg) = (arg))
65 #define HB_LIKELY(cond) (cond)
66 #define HB_UNLIKELY(cond) (cond)
68 #define ARRAY_LEN(Array) ((int)(sizeof (Array) / sizeof (Array)[0]))
72 #define HB_IsHighSurrogate(ucs) \
73 (((ucs) & 0xfc00) == 0xd800)
75 #define HB_IsLowSurrogate(ucs) \
76 (((ucs) & 0xfc00) == 0xdc00)
78 #define HB_SurrogateToUcs4(high, low) \
79 (((HB_UChar32)(high))<<10) + (low) - 0x35fdc00;
85 #define ALLOC(_ptr,_size) \
86 ( (_ptr) = _hb_alloc( _size, &error ), error != 0 )
88 #define REALLOC(_ptr,_newsz) \
89 ( (_ptr) = _hb_realloc( (_ptr), (_newsz), &error ), error != 0 )
100 #define ALLOC_ARRAY(_ptr,_count,_type) \
101 ALLOC(_ptr,(_count)*sizeof(_type))
103 #define REALLOC_ARRAY(_ptr,_newcnt,_type) \
104 REALLOC(_ptr,(_newcnt)*sizeof(_type))
106 #define MEM_Copy(dest,source,count) memcpy( (char*)(dest), (const char*)(source), (size_t)(count) )
108 #define ERR(err) _hb_err (err)
111 HB_INTERNAL HB_Pointer
112 _hb_alloc( size_t size,
115 HB_INTERNAL HB_Pointer
116 _hb_realloc( HB_Pointer block,
121 _hb_free( HB_Pointer block );
124 /* helper func to set a breakpoint on */
126 _hb_err (HB_Error code);
131 #endif /* HARFBUZZ_IMPL_H */