1/* 2 3Copyright 1991, 1998 The Open Group 4 5Permission to use, copy, modify, distribute, and sell this software and its 6documentation for any purpose is hereby granted without fee, provided that 7the above copyright notice appear in all copies and that both that 8copyright notice and this permission notice appear in supporting 9documentation. 10 11The above copyright notice and this permission notice shall be included in 12all copies or substantial portions of the Software. 13 14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 21Except as contained in this notice, the name of The Open Group shall not be 22used in advertising or otherwise to promote the sale, use or other dealings 23in this Software without prior written authorization from The Open Group. 24 25*/ 26 27/* 28 * Author: Keith Packard, MIT X Consortium 29 */ 30 31#ifndef _FONTFILE_H_ 32#define _FONTFILE_H_ 33 34#include <X11/fonts/fontxlfd.h> 35 36typedef struct _FontEntry *FontEntryPtr; 37typedef struct _FontTable *FontTablePtr; 38typedef struct _FontName *FontNamePtr; 39typedef struct _FontScaled *FontScaledPtr; 40typedef struct _FontScalableExtra *FontScalableExtraPtr; 41typedef struct _FontScalableEntry *FontScalableEntryPtr; 42typedef struct _FontScaleAliasEntry *FontScaleAliasEntryPtr; 43typedef struct _FontBitmapEntry *FontBitmapEntryPtr; 44typedef struct _FontAliasEntry *FontAliasEntryPtr; 45typedef struct _FontDirectory *FontDirectoryPtr; 46typedef struct _FontRenderer *FontRendererPtr; 47 48#define NullFontEntry ((FontEntryPtr) 0) 49#define NullFontTable ((FontTablePtr) 0) 50#define NullFontName ((FontNamePtr) 0) 51#define NullFontScaled ((FontScaled) 0) 52#define NullFontScalableExtra ((FontScalableExtra) 0) 53#define NullFontscalableEntry ((FontScalableEntry) 0) 54#define NullFontScaleAliasEntry ((FontScaleAliasEntry) 0) 55#define NullFontBitmapEntry ((FontBitmapEntry) 0) 56#define NullFontAliasEntry ((FontAliasEntry) 0) 57#define NullFontDirectory ((FontDirectoryPtr) 0) 58#define NullFontRenderer ((FontRendererPtr) 0) 59 60#define FONT_ENTRY_SCALABLE 0 61#define FONT_ENTRY_SCALE_ALIAS 1 62#define FONT_ENTRY_BITMAP 2 63#define FONT_ENTRY_ALIAS 3 64 65#define MAXFONTNAMELEN 1024 66#define MAXFONTFILENAMELEN 1024 67 68#define FontDirFile "fonts.dir" 69#define FontAliasFile "fonts.alias" 70#define FontScalableFile "fonts.scale" 71 72extern int FontFileNameCheck ( const char *name ); 73extern int FontFileInitFPE ( FontPathElementPtr fpe ); 74extern int FontFileResetFPE ( FontPathElementPtr fpe ); 75extern int FontFileFreeFPE ( FontPathElementPtr fpe ); 76extern int FontFileOpenFont ( pointer client, FontPathElementPtr fpe, 77 Mask flags, const char *name, int namelen, 78 fsBitmapFormat format, fsBitmapFormatMask fmask, 79 XID id, FontPtr *pFont, char **aliasName, 80 FontPtr non_cachable_font ); 81extern void FontFileCloseFont ( FontPathElementPtr fpe, FontPtr pFont ); 82extern int FontFileOpenBitmap ( FontPathElementPtr fpe, FontPtr *pFont, 83 int flags, FontEntryPtr entry, 84 fsBitmapFormat format, 85 fsBitmapFormatMask fmask ); 86extern int FontFileListFonts ( pointer client, FontPathElementPtr fpe, 87 const char *pat, int len, int max, 88 FontNamesPtr names ); 89extern int FontFileStartListFonts ( pointer client, FontPathElementPtr fpe, 90 const char *pat, int len, int max, 91 pointer *privatep, int mark_aliases ); 92extern int FontFileStartListFontsWithInfo ( pointer client, 93 FontPathElementPtr fpe, 94 const char *pat, int len, int max, 95 pointer *privatep ); 96extern int FontFileListNextFontWithInfo ( pointer client, 97 FontPathElementPtr fpe, 98 char **namep, int *namelenp, 99 FontInfoPtr *pFontInfo, 100 int *numFonts, pointer private ); 101extern int FontFileStartListFontsAndAliases ( pointer client, 102 FontPathElementPtr fpe, 103 const char *pat, int len, int max, 104 pointer *privatep ); 105extern int FontFileListNextFontOrAlias ( pointer client, 106 FontPathElementPtr fpe, 107 char **namep, int *namelenp, 108 char **resolvedp, int *resolvedlenp, 109 pointer private ); 110extern void FontFileRegisterLocalFpeFunctions ( void ); 111extern void CatalogueRegisterLocalFpeFunctions ( void ); 112 113 114extern FontEntryPtr FontFileAddEntry ( FontTablePtr table, 115 FontEntryPtr prototype ); 116extern Bool FontFileAddFontAlias ( FontDirectoryPtr dir, char *aliasName, 117 char *fontName ); 118extern Bool FontFileAddFontFile ( FontDirectoryPtr dir, char *fontName, 119 char *fileName ); 120extern int FontFileCountDashes ( char *name, int namelen ); 121extern FontEntryPtr FontFileFindNameInDir ( FontTablePtr table, 122 FontNamePtr pat ); 123extern FontEntryPtr FontFileFindNameInScalableDir ( FontTablePtr table, 124 FontNamePtr pat, 125 FontScalablePtr vals ); 126extern int FontFileFindNamesInDir ( FontTablePtr table, FontNamePtr pat, 127 int max, FontNamesPtr names ); 128extern int FontFileFindNamesInScalableDir ( FontTablePtr table, 129 FontNamePtr pat, int max, 130 FontNamesPtr names, 131 FontScalablePtr vals, 132 int alias_behavior, int *newmax ); 133 134extern void FontFileFreeDir ( FontDirectoryPtr dir ); 135extern void FontFileFreeEntry ( FontEntryPtr entry ); 136extern void FontFileFreeTable ( FontTablePtr table ); 137extern Bool FontFileInitTable ( FontTablePtr table, int size ); 138extern FontDirectoryPtr FontFileMakeDir ( const char *dirName, int size ); 139extern Bool FontFileMatchName ( char *name, int length, FontNamePtr pat ); 140extern char * FontFileSaveString ( char *s ); 141extern void FontFileSortDir ( FontDirectoryPtr dir ); 142extern void FontFileSortTable ( FontTablePtr table ); 143 144extern void FontDefaultFormat ( int *bit, int *byte, int *glyph, int *scan ); 145 146extern Bool FontFileRegisterRenderer ( FontRendererPtr renderer ); 147extern Bool FontFilePriorityRegisterRenderer ( FontRendererPtr renderer, 148 int priority ); 149extern FontRendererPtr FontFileMatchRenderer ( char *fileName ); 150 151extern Bool FontFileAddScaledInstance ( FontEntryPtr entry, 152 FontScalablePtr vals, FontPtr pFont, 153 char *bitmapName ); 154extern void FontFileSwitchStringsToBitmapPointers ( FontDirectoryPtr dir ); 155extern void FontFileRemoveScaledInstance ( FontEntryPtr entry, FontPtr pFont ); 156extern Bool FontFileCompleteXLFD ( FontScalablePtr vals, FontScalablePtr def ); 157extern FontScaledPtr FontFileFindScaledInstance ( FontEntryPtr entry, 158 FontScalablePtr vals, 159 int noSpecificSize ); 160 161extern Bool FontFileRegisterBitmapSource ( FontPathElementPtr fpe ); 162extern void FontFileUnregisterBitmapSource ( FontPathElementPtr fpe ); 163extern void FontFileEmptyBitmapSource ( void ); 164extern int FontFileMatchBitmapSource ( FontPathElementPtr fpe, 165 FontPtr *pFont, int flags, 166 FontEntryPtr entry, 167 FontNamePtr zeroPat, 168 FontScalablePtr vals, 169 fsBitmapFormat format, 170 fsBitmapFormatMask fmask, 171 Bool noSpecificSize ); 172 173extern int FontFileReadDirectory ( const char *directory, FontDirectoryPtr *pdir ); 174extern Bool FontFileDirectoryChanged ( FontDirectoryPtr dir ); 175 176#endif /* _FONTFILE_H_ */ 177