Revert "dtudcfonted, dtudcexch: delete from repository"
[oweals/cde.git] / cde / programs / dtudcfonted / libfal / include / font.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: font.h /main/1 1995/09/14 20:54:34 cde-fuj2 $ */
24 /***********************************************************
25 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
26 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
27
28                         All Rights Reserved
29
30 Permission to use, copy, modify, and distribute this software and its
31 documentation for any purpose and without fee is hereby granted,
32 provided that the above copyright notice appear in all copies and that
33 both that copyright notice and this permission notice appear in
34 supporting documentation, and that the names of Digital or MIT not be
35 used in advertising or publicity pertaining to distribution of the
36 software without specific, written prior permission.
37
38 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44 SOFTWARE.
45
46 (c) Copyright 1995 FUJITSU LIMITED
47 This is source code modified by FUJITSU LIMITED under the Joint
48 Development Agreement for the CDEnext PST.
49 This is unpublished proprietary source code of FUJITSU LIMITED
50
51 ******************************************************************/
52 #ifndef FONT_H
53 #define FONT_H 1
54
55 #include "servermd.h"
56
57 #define NullCharInfo ((CharInfoPtr)0)
58 #define NullFontInfo ((FontInfoPtr)0)
59 #define LeftToRight 0
60 #define RightToLeft 1
61 /*
62  * for linear char sets
63  */
64 #define n1dChars(pfi) ((pfi)->lastCol - (pfi)->firstCol + 1)
65 #define chFirst firstCol        /* usage:  pfi->chFirst */
66 #define chLast lastCol          /* usage:  pfi->chLast */
67
68 /*
69  * for 2D char sets
70  */
71 #define n2dChars(pfi)   (((pfi)->lastCol - (pfi)->firstCol + 1) * \
72                          ((pfi)->lastRow - (pfi)->firstRow + 1))
73
74 #define ADDRXTHISCHARINFO( pf, ch ) \
75         ((CharInfoRec *) &((pf)->pCI[(ch) - (pf)->pFI->chFirst]))
76
77 #define GLWIDTHPIXELS(pci) \
78         ((pci)->metrics.rightSideBearing - (pci)->metrics.leftSideBearing)
79 #define GLHEIGHTPIXELS(pci) \
80         ((pci)->metrics.ascent + (pci)->metrics.descent)
81
82
83 #define GLYPHWIDTHBYTES(pci)    (((GLYPHWIDTHPIXELS(pci))+7) >> 3)
84 #define GLYPHHEIGHTPIXELS(pci)  (pci->metrics.ascent + pci->metrics.descent)
85 #define GLYPHWIDTHPIXELS(pci)   (pci->metrics.rightSideBearing \
86                                     - pci->metrics.leftSideBearing)
87 #define GLWIDTHPADDED( bc)      ((bc+7) & ~0x7)
88
89 #if GLYPHPADBYTES == 0 || GLYPHPADBYTES == 1
90 #define GLYPHWIDTHBYTESPADDED(pci)      (GLYPHWIDTHBYTES(pci))
91 #define PADGLYPHWIDTHBYTES(w)           (((w)+7)>>3)
92 #endif
93
94 #if GLYPHPADBYTES == 2
95 #define GLYPHWIDTHBYTESPADDED(pci)      ((GLYPHWIDTHBYTES(pci)+1) & ~0x1)
96 #define PADGLYPHWIDTHBYTES(w)           (((((w)+7)>>3)+1) & ~0x1)
97 #endif
98
99 #if GLYPHPADBYTES == 4
100 #define GLYPHWIDTHBYTESPADDED(pci)      ((GLYPHWIDTHBYTES(pci)+3) & ~0x3)
101 #define PADGLYPHWIDTHBYTES(w)           (((((w)+7)>>3)+3) & ~0x3)
102 #endif
103
104 #if GLYPHPADBYTES == 8 /* for a cray? */
105 #define GLYPHWIDTHBYTESPADDED(pci)      ((GLYPHWIDTHBYTES(pci)+7) & ~0x7)
106 #define PADGLYPHWIDTHBYTES(w)           (((((w)+7)>>3)+7) & ~0x7)
107 #endif
108
109 typedef struct _FontProp *FontPropPtr;
110 typedef struct _CharInfo *CharInfoPtr;
111 typedef struct _FontInfo *FontInfoPtr;
112 typedef unsigned int DrawDirection;
113 typedef struct _ExtentInfo *ExtentInfoPtr;
114
115
116 #endif /* FONT_H */