summaryrefslogtreecommitdiff
path: root/src/autohint/ahloader.h
blob: 78b1f16248a0e934cc0efde576eb40a310b343ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/***************************************************************************/
/*                                                                         */
/*  ahloader.h                                                             */
/*                                                                         */
/*    Glyph loader for the auto-hinting module (declaration only).         */
/*                                                                         */
/*  Copyright 2000 Catharon Productions Inc.                               */
/*  Author: David Turner                                                   */
/*                                                                         */
/*  This file is part of the Catharon Typography Project and shall only    */
/*  be used, modified, and distributed under the terms of the Catharon     */
/*  Open Source License that should come with this file under the name     */
/*  `CatharonLicense.txt'.  By continuing to use, modify, or distribute    */
/*  this file you indicate that you have read the license and              */
/*  understand and accept it fully.                                        */
/*                                                                         */
/*  Note that this license is compatible with the FreeType license.        */
/*                                                                         */
/***************************************************************************/


  /*************************************************************************/
  /*                                                                       */
  /* This defines the AH_GlyphLoader type in two different ways:           */
  /*                                                                       */
  /* - If the module is compiled within FreeType 2, the type is simply a   */
  /*   typedef to FT_GlyphLoader.                                          */
  /*                                                                       */
  /* - If the module is compiled as a standalone object, AH_GlyphLoader    */
  /*   has its own implementation.                                         */
  /*                                                                       */
  /*************************************************************************/


#ifndef AHLOADER_H
#define AHLOADER_H


#ifdef __cplusplus
  extern "C" {
#endif


#ifdef _STANDALONE_

  typedef struct  AH_GlyphLoad_
  {
    FT_Outline    outline;       /* outline             */
    FT_UInt       num_subglyphs; /* number of subglyphs */
    FT_SubGlyph*  subglyphs;     /* subglyphs           */
    FT_Vector*    extra_points;  /* extra points table  */

  } AH_GlyphLoad;


  struct  AH_GlyphLoader_
  {
    FT_Memory     memory;
    FT_UInt       max_points;
    FT_UInt       max_contours;
    FT_UInt       max_subglyphs;
    FT_Bool       use_extra;

    AH_GlyphLoad  base;
    AH_GlyphLoad  current;

    void*         other;        /* for possible future extensions */
  };


  FT_LOCAL
  FT_Error  AH_GlyphLoader_New( FT_Memory         memory,
                                AH_GlyphLoader**  aloader );

  FT_LOCAL
  FT_Error  AH_GlyphLoader_Create_Extra( AH_GlyphLoader*  loader );

  FT_LOCAL
  void  AH_GlyphLoader_Done( AH_GlyphLoader*  loader );

  FT_LOCAL
  void  AH_GlyphLoader_Reset( AH_GlyphLoader*  loader );

  FT_LOCAL
  void  AH_GlyphLoader_Rewind( AH_GlyphLoader*  loader );

  FT_LOCAL
  FT_Error  AH_GlyphLoader_Check_Points( AH_GlyphLoader*  loader,
                                         FT_UInt          n_points,
                                         FT_UInt          n_contours );

  FT_LOCAL
  FT_Error  AH_GlyphLoader_Check_Subglyphs( AH_GlyphLoader*  loader,
                                            FT_UInt          n_subs );

  FT_LOCAL
  void  AH_GlyphLoader_Prepare( AH_GlyphLoader*  loader );

  FT_LOCAL
  void  AH_GlyphLoader_Add( AH_GlyphLoader*  loader );

  FT_LOCAL
  FT_Error  AH_GlyphLoader_Copy_Points( AH_GlyphLoader*  target,
                                        FT_GlyphLoader*  source );

#else /* _STANDALONE */

#include <freetype/internal/ftobjs.h>

  #define AH_Load    FT_GlyphLoad
  #define AH_Loader  FT_GlyphLoader

  #define ah_loader_new              FT_GlyphLoader_New
  #define ah_loader_done             FT_GlyphLoader_Done
  #define ah_loader_reset            FT_GlyphLoader_Reset
  #define ah_loader_rewind           FT_GlyphLoader_Rewind
  #define ah_loader_create_extra     FT_GlyphLoader_Create_Extra
  #define ah_loader_check_points     FT_GlyphLoader_Check_Points
  #define ah_loader_check_subglyphs  FT_GlyphLoader_Check_Subglyphs
  #define ah_loader_prepare          FT_GlyphLoader_Prepare
  #define ah_loader_add              FT_GlyphLoader_Add
  #define ah_loader_copy_points      FT_GlyphLoader_Copy_Points

#endif /* _STANDALONE_ */


#ifdef __cplusplus
  }
#endif


#endif /* AHLOADER_H */


/* END */