#if !defined(_AR_TYPEDEF_)
#define _AR_TYPEDEF_

#include    "alldef.h"

#define codeMARK        0x80000000L
#define codeMARK1       0x80000001L
#define maxFONT         24
#define MAXINTERSECT    14

#ifdef  FREETYPE_GRAY
#define EGT_LOAD_NO_BITMAP 0x0001
#define EGT_BITMAP_GRAY    0x0002
#endif  /* FREETYPE_GRAY */

#define MAX_VCFT_FILE    6
#define MAX_BITMAP_FILE 12
#define MAX_SHARE_FILE  12

typedef char                    ar_CHAR;
typedef unsigned char           ar_BYTE;
typedef short int               ar_INT16;
typedef short int               ar_SHORT;
typedef short int               ar_WORD;
typedef short int               ar_F2Dot14;
typedef unsigned short int      ar_UINT16;
typedef long                    ar_INT32;
typedef long                    ar_DWORD;
typedef long                    ar_LONG;
typedef unsigned long           ar_UINT32;
typedef unsigned long           ar_UDWORD;
typedef double                  ar_INT64;
typedef double                  ar_DOUBLE;
typedef double long             ar_DDLONG;
typedef void                    ar_VOID;
typedef void *                  ar_LPVOID;
typedef void                    (* PROCPTR)();

typedef struct {
    ar_UINT16   MinHeight;
    ar_F2Dot14  HorizonStroke;
    ar_F2Dot14  VerticalStroke;
    ar_F2Dot14  SlopeStroke;
}   ADJENTRY;

typedef struct {
    ar_UINT16   EntryCount;
    ADJENTRY    Entrys[7];
}   ADJTABLE;

typedef struct {
    ar_INT16    MinX;
    ar_INT16    MinY;
    ar_INT16    MaxX;
    ar_INT16    MaxY;
    ar_INT16    EscX;
    ar_INT16    EscY;
}   BBOXMET;

typedef struct {
    ar_F2Dot14  M11;
    ar_F2Dot14  M12;
    ar_F2Dot14  M21;
    ar_F2Dot14  M22;
    ar_INT16    TX;
    ar_INT16    TY;
}   TRANSMAT;

#ifdef  SUPPORT_3D
typedef struct {
    ar_UINT16   LineMode;
    ar_INT16    y;
    ar_INT16    xl;
    ar_INT16    xr;
}   RASTERLINE;

#else
typedef struct {
    ar_INT16    y;
    ar_INT16    xl;
    ar_INT16    xr;
}   RASTERLINE;
#endif  /* SUPPORT_3D */

#ifdef  STROKE_BASE
#ifdef  SUPPORT_3D
typedef struct {
    ar_UINT16   LineMode;
    ar_INT16    x;
    ar_INT16    yt;
    ar_INT16    yd;
}   RASTERLINEY;
#else
typedef struct {
    ar_INT16    x;
    ar_INT16    yt;
    ar_INT16    yd;
}   RASTERLINEY;
#endif  /* SUPPORT_3D */
#endif  /* STOKE_BASE */

typedef struct {
    ar_INT16    x1;
    ar_INT16    y1;
    ar_INT16    x2;
    ar_INT16    y2;
}   BEZIERpoint;

typedef struct {
    ar_UINT32   ptr;
    union {
        ar_UINT32   IDset[2];
        struct {
            ar_INT16    ID;
            ar_UINT16   set;
            ar_UINT32   typeface;
        }   s;
    }   u;
#ifdef  HITACHI
    ar_LONG     off2ptr;
    ar_WORD     glyphid;
#endif  /* HITACHI */
}   FONT_ID;

#if defined(SUPPORT_PROPORTIONAL) || defined(FREETYPE_GRAY)
typedef struct  {
    ar_INT16    Height;
    ar_INT16    Ascent;
    ar_INT16    Descent;
    ar_INT16    InternalLeading;
    ar_INT16    ExternalLeading;
    ar_INT16    AveCharWidth;
    ar_INT16    MaxCharWidth;
    ar_INT16    Weight;
    ar_INT16    FirstChar;
    ar_INT16    LastChar;
    ar_INT16    DefaultChar;
    ar_INT16    BreakChar;
    ar_INT16    Italic;
    ar_INT16    Underlined;
    ar_INT16    StruckOut;
    ar_INT16    PitchAndFamily;
    ar_INT16    CharSet;
    ar_INT16    MaxBoundingBox[4];
}   FONTMET;

typedef struct {
    ar_INT16    GlyphOriginX;
    ar_INT16    GlyphOriginY;
    ar_INT16    BlackBoxX;
    ar_INT16    BlackBoxY;
    ar_INT16    ReferOriginX;
    ar_INT16    ReferOriginY;
    ar_INT16    CellIncX;
    ar_INT16    CellIncY;
}   CHARMET;
#endif  /* SUPPORT_PROPORTIONAL || FREETYPE_GRAY */

#ifdef  FREETYPE_GRAY
/*---For GetEgtFont()---*/
typedef struct  EGT_BITMAP_
{
    ar_INT16    Rows;
    ar_INT16    Width;
    ar_INT16    Pitch;
    ar_BYTE     *Buffer;
    ar_UINT32   BufferLength;
    ar_INT16    NumGrays;
}   EGT_BITMAP;

/*---For GetEgtFont()---*/
typedef struct  EGT_FONT_
{
    ar_INT16    Code;
    ar_INT16    Height;
    ar_INT16    Width;
    EGT_BITMAP  Bitmap;
    FONTMET     FontMetrics;
    CHARMET     CharMetrics;
    ar_INT32    Flag;
}   EGT_FONT;
#endif  /* FREETYPE_GRAY */

#ifdef  SUPPORT_3D
typedef struct  {
    ar_INT16    type;
    ar_INT16    dirc;
    ar_INT16    extX;
    ar_INT16    extY;
    ar_INT16    sltX;
    ar_INT16    sltY;
}   ATTR3D;
#endif  /* SUPPORT_3D */

struct  FILLF {
    ar_INT32    lastHIDX;
    ar_INT32    *orderPTR;
    ar_INT32    *topHidxPTR;
    ar_INT32    *topVPTR;
    ar_INT32    *H;
};

#ifdef  EMBED_BITMAP
typedef struct {
    ar_INT16    num_bitmap;
#ifdef  HITACHI
    ar_INT16    current_id;
#endif  /* HITACHI */
    ar_INT16    width;
    ar_INT16    height;
    ar_UINT16   start_code;
    ar_UINT16   final_code;
    ar_LONG     offset;
    ar_INT16    fixed;
    ar_INT16    one_two;
    ar_INT16    underline;
    ar_INT16    baseline;
    ar_INT16    bitmap_type;
}   b_type;

#ifdef  BMP_SHARE
typedef struct {
    ar_INT16    width;
    ar_INT16    height;
}   w_h;
typedef struct {
    ar_INT16    width;
    ar_INT16    height;
    ar_INT16    num_share;
    w_h     sharebmp[8];
}   bmpshare;
#endif
#endif /* EMBED_BITMAP */

#endif /* _AR_TYPEDEF_ */
