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 HB_BEGIN_HEADER
     43 
     44 #ifndef FALSE
     45 #define FALSE 0
     46 #endif
     47 
     48 #ifndef TRUE
     49 #define TRUE (!FALSE)
     50 #endif
     51 
     52 #define HB_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
     53           ( ( (HB_UInt)_x1 << 24 ) |     \
     54             ( (HB_UInt)_x2 << 16 ) |     \
     55             ( (HB_UInt)_x3 <<  8 ) |     \
     56               (HB_UInt)_x4         )
     57 
     58 typedef char hb_int8;
     59 typedef unsigned char hb_uint8;
     60 typedef short hb_int16;
     61 typedef unsigned short hb_uint16;
     62 typedef int hb_int32;
     63 typedef unsigned int hb_uint32;
     64 
     65 typedef hb_uint8 HB_Bool;
     66 
     67 typedef hb_uint8 HB_Byte;
     68 typedef hb_uint16 HB_UShort;
     69 typedef hb_uint32 HB_UInt;
     70 typedef hb_int8 HB_Char;
     71 typedef hb_int16 HB_Short;
     72 typedef hb_int32 HB_Int;
     73 
     74 typedef hb_uint16 HB_UChar16;
     75 typedef hb_uint32 HB_UChar32;
     76 typedef hb_uint32 HB_Glyph;
     77 typedef hb_int32 HB_Fixed; /* 26.6 */
     78 
     79 #define HB_FIXED_CONSTANT(v) ((v) * 64)
     80 #define HB_FIXED_ROUND(v) (((v)+32) & -64)
     81 
     82 typedef hb_int32 HB_16Dot16; /* 16.16 */
     83 
     84 typedef void * HB_Pointer;
     85 typedef hb_uint32 HB_Tag;
     86 
     87 typedef enum {
     88   /* no error */
     89   HB_Err_Ok                           = 0x0000,
     90   HB_Err_Not_Covered                  = 0xFFFF,
     91 
     92   /* _hb_err() is called whenever returning the following errors,
     93    * and in a couple places for HB_Err_Not_Covered too. */
     94 
     95   /* programmer error */
     96   HB_Err_Invalid_Argument             = 0x1A66,
     97 
     98   /* font error */
     99   HB_Err_Invalid_SubTable_Format      = 0x157F,
    100   HB_Err_Invalid_SubTable             = 0x1570,
    101   HB_Err_Read_Error                   = 0x6EAD,
    102 
    103   /* system error */
    104   HB_Err_Out_Of_Memory                = 0xDEAD
    105 } HB_Error;
    106 
    107 typedef struct {
    108     HB_Fixed x;
    109     HB_Fixed y;
    110 } HB_FixedPoint;
    111 
    112 typedef struct HB_Font_ *HB_Font;
    113 typedef struct HB_StreamRec_ *HB_Stream;
    114 typedef struct HB_FaceRec_ *HB_Face;
    115 
    116 HB_END_HEADER
    117 
    118 #endif
    119