123a0898aSmrg/*
223a0898aSmrg
323a0898aSmrgCopyright 1991, 1998  The Open Group
423a0898aSmrg
523a0898aSmrgPermission to use, copy, modify, distribute, and sell this software and its
623a0898aSmrgdocumentation for any purpose is hereby granted without fee, provided that
723a0898aSmrgthe above copyright notice appear in all copies and that both that
823a0898aSmrgcopyright notice and this permission notice appear in supporting
923a0898aSmrgdocumentation.
1023a0898aSmrg
1123a0898aSmrgThe above copyright notice and this permission notice shall be included in
1223a0898aSmrgall copies or substantial portions of the Software.
1323a0898aSmrg
1423a0898aSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1523a0898aSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1623a0898aSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
1723a0898aSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
1823a0898aSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1923a0898aSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2023a0898aSmrg
2123a0898aSmrgExcept as contained in this notice, the name of The Open Group shall not be
2223a0898aSmrgused in advertising or otherwise to promote the sale, use or other dealings
2323a0898aSmrgin this Software without prior written authorization from The Open Group.
2423a0898aSmrg
2523a0898aSmrg*/
2623a0898aSmrg
2723a0898aSmrg/*
2823a0898aSmrg * Author:  Keith Packard, MIT X Consortium
2923a0898aSmrg */
3023a0898aSmrg
3123a0898aSmrg#ifndef _FONTFILEST_H_
3223a0898aSmrg#define _FONTFILEST_H_
3323a0898aSmrg
3423a0898aSmrg#include <X11/Xos.h>
3523a0898aSmrg#ifndef XP_PSTEXT
3623a0898aSmrg#include <X11/fonts/fontmisc.h>
3723a0898aSmrg#endif
3823a0898aSmrg#include <X11/fonts/fontstruct.h>
3923a0898aSmrg#include <X11/fonts/fontxlfd.h>
4023a0898aSmrg#include <X11/fonts/fntfil.h>
4123a0898aSmrg
4223a0898aSmrgtypedef struct _FontName {
4323a0898aSmrg    char	*name;
4423a0898aSmrg    short	length;
4523a0898aSmrg    short	ndashes;
4623a0898aSmrg} FontNameRec;
4723a0898aSmrg
4823a0898aSmrgtypedef struct _FontScaled {
4923a0898aSmrg    FontScalableRec	vals;
5023a0898aSmrg    FontEntryPtr	bitmap;
5123a0898aSmrg    FontPtr		pFont;
5223a0898aSmrg} FontScaledRec;
5323a0898aSmrg
5423a0898aSmrgtypedef struct _FontScalableExtra {
5523a0898aSmrg    FontScalableRec	defaults;
5623a0898aSmrg    int			numScaled;
5723a0898aSmrg    int			sizeScaled;
5823a0898aSmrg    FontScaledPtr	scaled;
5923a0898aSmrg    pointer		private;
6023a0898aSmrg} FontScalableExtraRec;
6123a0898aSmrg
6223a0898aSmrgtypedef struct _FontScalableEntry {
6323a0898aSmrg    FontRendererPtr	    renderer;
6423a0898aSmrg    char		    *fileName;
6523a0898aSmrg    FontScalableExtraPtr   extra;
6623a0898aSmrg} FontScalableEntryRec;
6723a0898aSmrg
6823a0898aSmrg/*
6923a0898aSmrg * This "can't" work yet - the returned alias string must be permanent,
7023a0898aSmrg * but this layer would need to generate the appropriate name from the
7123a0898aSmrg * resolved scalable + the XLFD values passed in.  XXX
7223a0898aSmrg */
7323a0898aSmrg
7423a0898aSmrgtypedef struct _FontScaleAliasEntry {
7523a0898aSmrg    char		*resolved;
7623a0898aSmrg} FontScaleAliasEntryRec;
7723a0898aSmrg
7823a0898aSmrgtypedef struct _FontBitmapEntry {
7923a0898aSmrg    FontRendererPtr	renderer;
8023a0898aSmrg    char		*fileName;
8123a0898aSmrg    FontPtr		pFont;
8223a0898aSmrg} FontBitmapEntryRec;
8323a0898aSmrg
8423a0898aSmrgtypedef struct _FontAliasEntry {
8523a0898aSmrg    char	*resolved;
8623a0898aSmrg} FontAliasEntryRec;
8723a0898aSmrg
8823a0898aSmrgtypedef struct _FontBCEntry {
8923a0898aSmrg    FontScalableRec	    vals;
9023a0898aSmrg    FontEntryPtr	    entry;
9123a0898aSmrg} FontBCEntryRec;
9223a0898aSmrg
9323a0898aSmrgtypedef struct _FontEntry {
9423a0898aSmrg    FontNameRec	name;
9523a0898aSmrg    int		type;
9623a0898aSmrg    union _FontEntryParts {
9723a0898aSmrg	FontScalableEntryRec	scalable;
9823a0898aSmrg	FontBitmapEntryRec	bitmap;
9923a0898aSmrg	FontAliasEntryRec	alias;
10023a0898aSmrg	FontBCEntryRec		bc;
10123a0898aSmrg    } u;
10223a0898aSmrg} FontEntryRec;
10323a0898aSmrg
10423a0898aSmrgtypedef struct _FontTable {
10523a0898aSmrg    int		    used;
10623a0898aSmrg    int		    size;
10723a0898aSmrg    FontEntryPtr    entries;
10823a0898aSmrg    Bool	    sorted;
10923a0898aSmrg} FontTableRec;
11023a0898aSmrg
11123a0898aSmrgtypedef struct _FontDirectory {
11223a0898aSmrg    char	    *directory;
11323a0898aSmrg    unsigned long   dir_mtime;
11423a0898aSmrg    unsigned long   alias_mtime;
11523a0898aSmrg    FontTableRec    scalable;
11623a0898aSmrg    FontTableRec    nonScalable;
11723a0898aSmrg    char	    *attributes;
11823a0898aSmrg} FontDirectoryRec;
11923a0898aSmrg
12023a0898aSmrg/* Capability bits: for definition of capabilities bitmap in the
12123a0898aSmrg   FontRendererRec to indicate support of XLFD enhancements */
12223a0898aSmrg
12323a0898aSmrg#define CAP_MATRIX		0x1
12423a0898aSmrg#define CAP_CHARSUBSETTING	0x2
12523a0898aSmrg
12623a0898aSmrgtypedef struct _FontRenderer {
12741c30155Smrg    const char    *fileSuffix;
12823a0898aSmrg    int	    fileSuffixLen;
12941c30155Smrg    int	    (*OpenBitmap)(FontPathElementPtr /* fpe */,
13023a0898aSmrg			  FontPtr * /* pFont */,
13141c30155Smrg			  int /* flags */,
13241c30155Smrg			  FontEntryPtr /* entry */,
13341c30155Smrg			  char * /* fileName */,
13441c30155Smrg			  fsBitmapFormat /* format */,
13523a0898aSmrg			  fsBitmapFormatMask /* mask */,
13623a0898aSmrg			  FontPtr /* non_cachable_font */);
13741c30155Smrg    int	    (*OpenScalable)(FontPathElementPtr /* fpe */,
13841c30155Smrg			    FontPtr * /* pFont */,
13941c30155Smrg			    int /* flags */,
14041c30155Smrg			    FontEntryPtr /* entry */,
14141c30155Smrg			    char * /* fileName */,
14241c30155Smrg			    FontScalablePtr /* vals */,
14341c30155Smrg			    fsBitmapFormat /* format */,
14423a0898aSmrg			    fsBitmapFormatMask /* fmask */,
14523a0898aSmrg			    FontPtr /* non_cachable_font */);
14641c30155Smrg    int	    (*GetInfoBitmap)(FontPathElementPtr /* fpe */,
14741c30155Smrg			     FontInfoPtr /* pFontInfo */,
14841c30155Smrg			     FontEntryPtr /* entry */,
14923a0898aSmrg			     char * /*fileName */);
15041c30155Smrg    int	    (*GetInfoScalable)(FontPathElementPtr /* fpe */,
15141c30155Smrg			       FontInfoPtr /* pFontInfo */,
15241c30155Smrg			       FontEntryPtr /* entry */,
15323a0898aSmrg			       FontNamePtr /* fontName */,
15441c30155Smrg			       char * /* fileName */,
15523a0898aSmrg			       FontScalablePtr /* vals */);
15623a0898aSmrg    int	    number;
15723a0898aSmrg    int     capabilities;	/* Bitmap components defined above */
15823a0898aSmrg} FontRendererRec;
15923a0898aSmrg
16023a0898aSmrgtypedef struct _FontRenders {
16123a0898aSmrg    int		    number;
16223a0898aSmrg    struct _FontRenderersElement {
16323a0898aSmrg        /* In order to preserve backward compatibility, the
16423a0898aSmrg           priority field is made invisible to renderers */
16523a0898aSmrg        FontRendererPtr renderer;
16623a0898aSmrg        int priority;
16723a0898aSmrg    } *renderers;
16823a0898aSmrg} FontRenderersRec, *FontRenderersPtr;
16923a0898aSmrg
17023a0898aSmrgtypedef struct _BitmapInstance {
17123a0898aSmrg    FontScalableRec	vals;
17223a0898aSmrg    FontBitmapEntryPtr	bitmap;
17323a0898aSmrg} BitmapInstanceRec, *BitmapInstancePtr;
17423a0898aSmrg
17523a0898aSmrgtypedef struct _BitmapScalablePrivate {
17623a0898aSmrg    int			numInstances;
17723a0898aSmrg    BitmapInstancePtr	instances;
17823a0898aSmrg} BitmapScalablePrivateRec, *BitmapScalablePrivatePtr;
17923a0898aSmrg
18023a0898aSmrgtypedef struct _BitmapSources {
18123a0898aSmrg    FontPathElementPtr	*fpe;
18223a0898aSmrg    int			size;
18323a0898aSmrg    int			count;
18423a0898aSmrg} BitmapSourcesRec, *BitmapSourcesPtr;
18523a0898aSmrg
18623a0898aSmrgextern BitmapSourcesRec	FontFileBitmapSources;
18723a0898aSmrg
18823a0898aSmrg/* Defines for FontFileFindNamesInScalableDir() behavior */
18923a0898aSmrg#define NORMAL_ALIAS_BEHAVIOR		0
19023a0898aSmrg#define LIST_ALIASES_AND_TARGET_NAMES   (1<<0)
19123a0898aSmrg#define IGNORE_SCALABLE_ALIASES		(1<<1)
19223a0898aSmrg
19323a0898aSmrg#endif /* _FONTFILEST_H_ */
194