• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  *
3  * psstack.h
4  *
5  *   Adobe's code for emulating a CFF stack (specification).
6  *
7  * Copyright 2007-2013 Adobe Systems Incorporated.
8  *
9  * This software, and all works of authorship, whether in source or
10  * object code form as indicated by the copyright notice(s) included
11  * herein (collectively, the "Work") is made available, and may only be
12  * used, modified, and distributed under the FreeType Project License,
13  * LICENSE.TXT.  Additionally, subject to the terms and conditions of the
14  * FreeType Project License, each contributor to the Work hereby grants
15  * to any individual or legal entity exercising permissions granted by
16  * the FreeType Project License and this section (hereafter, "You" or
17  * "Your") a perpetual, worldwide, non-exclusive, no-charge,
18  * royalty-free, irrevocable (except as stated in this section) patent
19  * license to make, have made, use, offer to sell, sell, import, and
20  * otherwise transfer the Work, where such license applies only to those
21  * patent claims licensable by such contributor that are necessarily
22  * infringed by their contribution(s) alone or by combination of their
23  * contribution(s) with the Work to which such contribution(s) was
24  * submitted.  If You institute patent litigation against any entity
25  * (including a cross-claim or counterclaim in a lawsuit) alleging that
26  * the Work or a contribution incorporated within the Work constitutes
27  * direct or contributory patent infringement, then any patent licenses
28  * granted to You under this License for that Work shall terminate as of
29  * the date such litigation is filed.
30  *
31  * By using, modifying, or distributing the Work you indicate that you
32  * have read and understood the terms and conditions of the
33  * FreeType Project License as well as those provided in this section,
34  * and you accept them fully.
35  *
36  */
37 
38 
39 #ifndef PSSTACK_H_
40 #define PSSTACK_H_
41 
42 #include <freetype/internal/compiler-macros.h>
43 
44 FT_BEGIN_HEADER
45 
46 
47   /* CFF operand stack; specified maximum of 48 or 192 values */
48   typedef struct  CF2_StackNumber_
49   {
50     union
51     {
52       CF2_Fixed  r;      /* 16.16 fixed point */
53       CF2_Frac   f;      /* 2.30 fixed point (for font matrix) */
54       CF2_Int    i;
55     } u;
56 
57     CF2_NumberType  type;
58 
59   } CF2_StackNumber;
60 
61 
62   typedef struct  CF2_StackRec_
63   {
64     FT_Memory         memory;
65     FT_Error*         error;
66     CF2_StackNumber*  buffer;
67     CF2_StackNumber*  top;
68     FT_UInt           stackSize;
69 
70   } CF2_StackRec, *CF2_Stack;
71 
72 
73   FT_LOCAL( CF2_Stack )
74   cf2_stack_init( FT_Memory  memory,
75                   FT_Error*  error,
76                   FT_UInt    stackSize );
77   FT_LOCAL( void )
78   cf2_stack_free( CF2_Stack  stack );
79 
80   FT_LOCAL( CF2_UInt )
81   cf2_stack_count( CF2_Stack  stack );
82 
83   FT_LOCAL( void )
84   cf2_stack_pushInt( CF2_Stack  stack,
85                      CF2_Int    val );
86   FT_LOCAL( void )
87   cf2_stack_pushFixed( CF2_Stack  stack,
88                        CF2_Fixed  val );
89 
90   FT_LOCAL( CF2_Int )
91   cf2_stack_popInt( CF2_Stack  stack );
92   FT_LOCAL( CF2_Fixed )
93   cf2_stack_popFixed( CF2_Stack  stack );
94 
95   FT_LOCAL( CF2_Fixed )
96   cf2_stack_getReal( CF2_Stack  stack,
97                      CF2_UInt   idx );
98   FT_LOCAL( void )
99   cf2_stack_setReal( CF2_Stack  stack,
100                      CF2_UInt   idx,
101                      CF2_Fixed  val );
102 
103   FT_LOCAL( void )
104   cf2_stack_pop( CF2_Stack  stack,
105                  CF2_UInt   num );
106 
107   FT_LOCAL( void )
108   cf2_stack_roll( CF2_Stack  stack,
109                   CF2_Int    count,
110                   CF2_Int    idx );
111 
112   FT_LOCAL( void )
113   cf2_stack_clear( CF2_Stack  stack );
114 
115 
116 FT_END_HEADER
117 
118 
119 #endif /* PSSTACK_H_ */
120 
121 
122 /* END */
123