~ubuntu-branches/ubuntu/trusty/libxfont/trusty-proposed

« back to all changes in this revision

Viewing changes to src/Type1/paths.h

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Potyra
  • Date: 2009-05-09 12:11:53 UTC
  • mfrom: (1.1.10 upstream) (10.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090509121153-nwte290k1e9gew62
Tags: 1:1.4.0-1ubuntu1
* Rebase to unstable, remaining change:
  + debian/rules: unset LDFLAGS to not be hit by -Bsymbolic-functions,
    as libxfont contains weak symbols which are meant to be overriden
    (cf. LP #226156).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Xorg: paths.h,v 1.3 2000/08/17 19:46:31 cpqbld Exp $ */
2
 
/* Copyright International Business Machines, Corp. 1991
3
 
 * All Rights Reserved
4
 
 * Copyright Lexmark International, Inc. 1991
5
 
 * All Rights Reserved
6
 
 *
7
 
 * License to use, copy, modify, and distribute this software and its
8
 
 * documentation for any purpose and without fee is hereby granted,
9
 
 * provided that the above copyright notice appear in all copies and that
10
 
 * both that copyright notice and this permission notice appear in
11
 
 * supporting documentation, and that the name of IBM or Lexmark not be
12
 
 * used in advertising or publicity pertaining to distribution of the
13
 
 * software without specific, written prior permission.
14
 
 *
15
 
 * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
16
 
 * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
17
 
 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
18
 
 * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.  THE ENTIRE RISK AS TO THE
19
 
 * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
20
 
 * OR MAINTAIN, BELONGS TO THE LICENSEE.  SHOULD ANY PORTION OF THE
21
 
 * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
22
 
 * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION.  IN NO EVENT SHALL
23
 
 * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
24
 
 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
25
 
 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
26
 
 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
27
 
 * THIS SOFTWARE.
28
 
 */
29
 
/* $XFree86: xc/lib/font/Type1/paths.h,v 1.3 1999/08/22 08:58:53 dawes Exp $ */
30
 
 
31
 
/*SHARED*/
32
 
 
33
 
#define   Loc(S,x,y)                   t1_Loc(S,(double)x,(double)y)
34
 
#define   ILoc(S,x,y)                  t1_ILoc(S,x,y)
35
 
#define   Line(P)                      t1_Line(P)
36
 
#define   Join(p1,p2)                  t1_Join(p1,p2)
37
 
#define   ClosePath(p)                 t1_ClosePath(p,0)
38
 
#define   CloseLastSubPath(p)          t1_ClosePath(p,1)
39
 
#define   Conic(B,C,s)                 t1_Conic(B,C,(double)s)
40
 
#define   RoundConic(M,C,r)            t1_RoundConic(M,C,(double)r)
41
 
#define   ArcP3(S,P2,P3)               t1_ArcP3(S,P2,P3)
42
 
#define   ArcCA(S,C,d)                 t1_ArcCA(S,C,(double)d)
43
 
#define   Bezier(B,C,D)                t1_Bezier(B,C,D)
44
 
#define   Hint(S,r,w,o,h,a,d,l)        t1_Hint(S,r,w,o,h,a,d,l)
45
 
#define   Reverse(p)                   t1_Reverse(p)
46
 
#define   ReverseSubPaths(p)           t1_ReverseSubPaths(p)
47
 
#define   AddLoc(p1,p2)                t1_Join(p1,p2)
48
 
#define   SubLoc(p1,p2)                t1_SubLoc(p1,p2)
49
 
#define   DropSegment(p)               t1_DropSegment(p)
50
 
#define   HeadSegment(p)               t1_HeadSegment(p)
51
 
#define   QueryLoc(P,S,x,y)            t1_QueryLoc(P,S,x,y)
52
 
#define   QueryPath(p,t,B,C,D,r)       t1_QueryPath(p,t,B,C,D,r)
53
 
#define   QueryBounds(p,S,x1,y1,x2,y2)  t1_QueryBounds(p,S,x1,y1,x2,y2)
54
 
 
55
 
 
56
 
/* create a location object (or "move" segment) */
57
 
extern struct segment *t1_Loc ( struct XYspace *S, double x, double y );
58
 
/* integer argument version of same             */
59
 
extern struct segment *t1_ILoc ( struct XYspace *S, int x, int y );
60
 
/* straight line path segment                   */
61
 
extern struct segment *t1_Line ( struct segment *P );
62
 
/* join two paths or regions together           */
63
 
extern struct segment *t1_Join ( struct segment *p1, struct segment *p2 );
64
 
/* close a path or path set                  */
65
 
extern struct segment *t1_ClosePath ( struct segment *p0, int lastonly );
66
 
#if 0
67
 
struct conicsegment *t1_Conic();  /* conic curve path segment                 */
68
 
 
69
 
struct conicsegment *t1_RoundConic();  /* ditto, specified another way        */
70
 
struct conicsegment *t1_ArcP3(); /* circular path segment with three points   */
71
 
struct conicsegment *t1_ArcCA(); /* ditto, with center point and angle        */
72
 
#endif
73
 
/* Bezier third order curve path segment  */
74
 
extern struct beziersegment *t1_Bezier ( struct segment *B, struct segment *C, 
75
 
                                         struct segment *D );
76
 
/* Query location; return its (x,y)             */
77
 
extern void t1_QueryLoc ( struct segment *P, struct XYspace *S, double *xP, 
78
 
                          double *yP );
79
 
/*END SHARED*/
80
 
/*SHARED*/
81
 
 
82
 
#define   CopyPath(p)             t1_CopyPath(p)
83
 
#define   KillPath(p)             t1_KillPath(p)
84
 
#define   PathTransform(p,m)      t1_PathXform(p,m)
85
 
#define   PathDelta(p,pt)         t1_PathDelta(p,pt)
86
 
#define   BoundingBox(h,w)        t1_BoundingBox(h,w)
87
 
#define   PathSegment(t,x,y)      t1_PathSegment(t,(fractpel)x,(fractpel)y)
88
 
#define   JoinSegment(b,t,x,y,a)  t1_JoinSegment(b,t,(fractpel)x,(fractpel)y,a)
89
 
#define   Hypoteneuse(dx,dy)      t1_Hypoteneuse(dx,dy)
90
 
  
91
 
/* duplicate a path                            */
92
 
extern struct segment *t1_CopyPath ( struct segment *p0 );
93
 
/* destroy a path                               */
94
 
extern void t1_KillPath ( struct segment *p );
95
 
/* transform a path arbitrarily              */
96
 
extern struct segment *t1_PathXform ( struct segment *p0, struct XYspace *S );
97
 
/* calculate the ending point of a path         */
98
 
extern void t1_PathDelta ( struct segment *p, struct fractpoint *pt );
99
 
/* produce a MOVE or LINE segment           */
100
 
extern struct segment *t1_PathSegment ( int type, fractpel x, fractpel y );
101
 
/* join a MOVE or LINE segment to a path    */
102
 
extern struct segment *t1_JoinSegment ( struct segment *before, int type, fractpel x, fractpel y, struct segment *after );
103
 
 
104
 
/*END SHARED*/
105
 
/*SHARED*/
106
 
 
107
 
#define    ConsumePath(p)    MAKECONSUME(p,KillPath(p))
108
 
#define    UniquePath(p)     MAKEUNIQUE(p,CopyPath(p))
109
 
 
110
 
/*END SHARED*/
111
 
/*SHARED*/
112
 
 
113
 
struct segment {
114
 
       XOBJ_COMMON     /* xobject common data define 3-26-91 PNM             */
115
 
       unsigned char size;   /* size of the structure                        */
116
 
       unsigned char context;  /* index to device context                    */
117
 
       struct segment *link; /* pointer to next structure in linked list     */
118
 
       struct segment *last; /* pointer to last structure in list            */
119
 
       struct fractpoint dest; /* relative ending location of path segment   */
120
 
} ;
121
 
 
122
 
#define   ISCLOSED(flag)   ((flag)&0x80)  /* subpath is closed               */
123
 
#define   LASTCLOSED(flag) ((flag)&0x40)  /* last segment in closed subpath  */
124
 
 
125
 
/*
126
 
NOTE: The ISCLOSED flag is set on the MOVETYPE segment before the
127
 
subpath proper; the LASTCLOSED flag is set on the last segment (LINETYPE)
128
 
in the subpath
129
 
 
130
 
We define the ISPATHANCHOR predicate to test that a path handle
131
 
passed by the user is valid:
132
 
*/
133
 
 
134
 
#define   ISPATHANCHOR(p)  (ISPATHTYPE(p->type)&&p->last!=NULL)
135
 
 
136
 
/*
137
 
For performance reasons, a user's "location" object is identical to
138
 
a path whose only segment is a move segment.  We define a predicate
139
 
to test for this case.  See also :hdref refid=location..
140
 
*/
141
 
 
142
 
#define   ISLOCATION(p)    ((p)->type == MOVETYPE && (p)->link == NULL)
143
 
 
144
 
/*END SHARED*/
145
 
/*SHARED*/
146
 
 
147
 
struct conicsegment {
148
 
       XOBJ_COMMON          /* xobject common data define 3-26-91 PNM        */
149
 
                            /* type = CONICTYPE                              */
150
 
       unsigned char size;   /* as with any 'segment' type                   */
151
 
       unsigned char context;  /* as with any 'segment' type                 */
152
 
       struct segment *link; /* as with any 'segment' type                   */
153
 
       struct segment *last; /* as with any 'segment' type                   */
154
 
       struct fractpoint dest;  /* Ending point (C point)                    */
155
 
       struct fractpoint M;  /* "midpoint" of conic explained above          */
156
 
       float roundness;      /* explained above                              */
157
 
} ;
158
 
/*END SHARED*/
159
 
/*SHARED*/
160
 
 
161
 
struct beziersegment {
162
 
       XOBJ_COMMON           /* xobject common data define 3-26-91 PNM       */
163
 
                             /* type = BEZIERTYPE                            */
164
 
       unsigned char size;   /* as with any 'segment' type                   */
165
 
       unsigned char context;  /* as with any 'segment' type                 */
166
 
       struct segment *link; /* as with any 'segment' type                   */
167
 
       struct segment *last; /* as with any 'segment' type                   */
168
 
       struct fractpoint dest;  /* ending point (D)                          */
169
 
       struct fractpoint B;  /* control point B                              */
170
 
       struct fractpoint C;  /* control point C                              */
171
 
} ;
172
 
 
173
 
/*END SHARED*/
174
 
/*SHARED*/
175
 
 
176
 
struct hintsegment {
177
 
       XOBJ_COMMON            /* xobject common data define 3-26-91 PNM      */
178
 
                              /* type = HINTTYPE                             */
179
 
       unsigned char size;   /* size of the structure                        */
180
 
       unsigned char context;  /* device context                             */
181
 
       struct segment *link; /* pointer to next structure in linked list     */
182
 
       struct segment *last; /* pointer to last structure in list            */
183
 
       struct fractpoint dest; /* ALWAYS 0,0                                 */
184
 
       struct fractpoint ref;
185
 
       struct fractpoint width;
186
 
       char orientation;
187
 
       char hinttype;
188
 
       char adjusttype;
189
 
       char direction;
190
 
       int label;
191
 
} ;
192
 
 
193
 
/*END SHARED*/
194
 
/*SHARED*/
195
 
 
196
 
/*
197
 
CONCAT links the 'p2' path chain on the end of the 'p1' chain.  (This macro
198
 
is also used by the STROKES module.)
199
 
*/
200
 
#define  CONCAT(p1, p2)  { \
201
 
       p1->last->link = p2;     /* link p2 on end of p1                      */ \
202
 
       p1->last = p2->last;    /* last of new is last of p2                  */ \
203
 
       p2->last = NULL; }    /* only first segment has non-NULL "last"       */
204
 
 
205
 
/*END SHARED*/