Home | History | Annotate | Download | only in src
      1 /*
      2  * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
      3  * Copyright (C) 2007  Red Hat, Inc.
      4  *
      5  * This is part of HarfBuzz, an OpenType Layout engine library.
      6  *
      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.
     12  *
     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
     17  * DAMAGE.
     18  *
     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.
     24  *
     25  * Red Hat Author(s): Behdad Esfahbod
     26  */
     27 
     28 #ifndef HARFBUZZ_GLOBAL_H
     29 #define HARFBUZZ_GLOBAL_H
     30 
     31 #include <stdlib.h>
     32 #include <string.h>
     33 
     34 #ifdef __cplusplus
     35 #define HB_BEGIN_HEADER  extern "C" {
     36 #define HB_END_HEADER  }
     37 #else
     38 #define HB_BEGIN_HEADER  /* nothing */
     39 #define HB_END_HEADER  /* nothing */
     40 #endif
     41 
     42 #if defined(__GNUC__) || defined(_MSC_VER)
     43 #define HB_USE_PACKED_STRUCTS
     44 #endif
     45 
     46 HB_BEGIN_HEADER
     47 
     48 #ifndef FALSE
     49 #define FALSE 0
     50 #endif
     51 
     52 #ifndef TRUE
     53 #define TRUE (!FALSE)
     54 #endif
     55 
     56 #define HB_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
     57           ( ( (HB_UInt)_x1 << 24 ) |     \
     58             ( (HB_UInt)_x2 << 16 ) |     \
     59             ( (HB_UInt)_x3 <<  8 ) |     \
     60               (HB_UInt)_x4         )
     61 
     62 typedef char hb_int8;
     63 typedef unsigned char hb_uint8;
     64 typedef short hb_int16;
     65 typedef unsigned short hb_uint16;
     66 typedef int hb_int32;
     67 typedef unsigned int hb_uint32;
     68 
     69 typedef hb_uint8 HB_Bool;
     70 
     71 typedef hb_uint8 HB_Byte;
     72 typedef hb_uint16 HB_UShort;
     73 typedef hb_uint32 HB_UInt;
     74 typedef hb_int8 HB_Char;
     75 typedef hb_int16 HB_Short;
     76 typedef hb_int32 HB_Int;
     77 
     78 typedef hb_uint16 HB_UChar16;
     79 typedef hb_uint32 HB_UChar32;
     80 typedef hb_uint32 HB_Glyph;
     81 typedef hb_int32 HB_Fixed; /* 26.6 */
     82 
     83 #define HB_FIXED_CONSTANT(v) ((v) * 64)
     84 #define HB_FIXED_ROUND(v) (((v)+32) & -64)
     85 
     86 typedef hb_int32 HB_16Dot16; /* 16.16 */
     87 
     88 typedef void * HB_Pointer;
     89 typedef hb_uint32 HB_Tag;
     90 
     91 typedef enum {
     92   /* no error */
     93   HB_Err_Ok                           = 0x0000,
     94   HB_Err_Not_Covered                  = 0xFFFF,
     95 
     96   /* _hb_err() is called whenever returning the following errors,
     97    * and in a couple places for HB_Err_Not_Covered too. */
     98 
     99   /* programmer error */
    100   HB_Err_Invalid_Argument             = 0x1A66,
    101 
    102   /* font error */
    103   HB_Err_Invalid_SubTable_Format      = 0x157F,
    104   HB_Err_Invalid_SubTable             = 0x1570,
    105   HB_Err_Read_Error                   = 0x6EAD,
    106 
    107   /* system error */
    108   HB_Err_Out_Of_Memory                = 0xDEAD
    109 } HB_Error;
    110 
    111 typedef struct {
    112     HB_Fixed x;
    113     HB_Fixed y;
    114 } HB_FixedPoint;
    115 
    116 typedef struct HB_Font_ *HB_Font;
    117 typedef struct HB_StreamRec_ *HB_Stream;
    118 typedef struct HB_FaceRec_ *HB_Face;
    119 
    120 HB_END_HEADER
    121 
    122 #endif
    123