]> git.sesse.net Git - rdpsrv/blob - Xserver/lib/font/Type1/t1snap.c
Support RDP5 logon packets.
[rdpsrv] / Xserver / lib / font / Type1 / t1snap.c
1 /* $XConsortium: t1snap.c,v 1.3 91/10/10 11:19:47 rws Exp $ */
2 /* Copyright International Business Machines,Corp. 1991
3  * All Rights Reserved
4  *
5  * License to use, copy, modify, and distribute this software
6  * and its documentation for any purpose and without fee is
7  * hereby granted, provided that the above copyright notice
8  * appear in all copies and that both that copyright notice and
9  * this permission notice appear in supporting documentation,
10  * and that the name of IBM not be used in advertising or
11  * publicity pertaining to distribution of the software without
12  * specific, written prior permission.
13  *
14  * IBM PROVIDES THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES
15  * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
16  * LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF
18  * THIRD PARTY RIGHTS.  THE ENTIRE RISK AS TO THE QUALITY AND
19  * PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
20  * OR MAINTAIN, BELONGS TO THE LICENSEE.  SHOULD ANY PORTION OF
21  * THE SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM) ASSUMES
22  * THE ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION.  IN
23  * NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
24  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
25  * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
26  * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
27  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
28  * SOFTWARE.
29  */
30  
31 #include "objects.h"
32 #include "spaces.h"
33 #include "paths.h"
34  
35 /*
36 :h2.Handle Functions
37  
38 :h3.Phantom() - Returns a Move Segment Equivalent to Handles
39  
40 This is a user operator.  Its new name is QueryHandle.
41 */
42  
43 struct segment *t1_Phantom(obj)
44        register struct xobject *obj;  /* object to take the Phantom of       */
45 {
46        struct fractpoint pt; /* handle size will built here                  */
47  
48        if (obj == NULL)
49                pt.x = pt.y = 0;
50        else
51                PathDelta(obj, &pt);
52  
53        return(PathSegment(MOVETYPE, pt.x, pt.y));
54 }
55  
56 /*
57 :h3.Snap() - Force Ending Handle of Object to Origin
58  
59 This is a user operator.
60 */
61  
62 struct xobject *t1_Snap(p)
63        register struct segment *p;  /* path to snap                          */
64 {
65        struct fractpoint pt; /* for finding length of path                   */
66  
67        if (p == NULL)
68                return(NULL);
69        p = UniquePath(p);
70  
71        PathDelta(p, &pt);
72        if (p->last->type == MOVETYPE) {
73                p->last->dest.x -= pt.x;
74                p->last->dest.y -= pt.y;
75        }
76        else
77                p = JoinSegment(p, MOVETYPE, -pt.x, -pt.y, NULL);
78        return((struct xobject *)p);
79 }