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 "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 _FontBCEntry *FontBCEntryPtr; 46typedef struct _FontDirectory *FontDirectoryPtr; 47typedef struct _FontRenderer *FontRendererPtr; 48 49#define NullFontEntry ((FontEntryPtr) 0) 50#define NullFontTable ((FontTablePtr) 0) 51#define NullFontName ((FontNamePtr) 0) 52#define NullFontScaled ((FontScaled) 0) 53#define NullFontScalableExtra ((FontScalableExtra) 0) 54#define NullFontscalableEntry ((FontScalableEntry) 0) 55#define NullFontScaleAliasEntry ((FontScaleAliasEntry) 0) 56#define NullFontBitmapEntry ((FontBitmapEntry) 0) 57#define NullFontAliasEntry ((FontAliasEntry) 0) 58#define NullFontBCEntry ((FontBCEntry) 0) 59#define NullFontDirectory ((FontDirectoryPtr) 0) 60#define NullFontRenderer ((FontRendererPtr) 0) 61 62#define FONT_ENTRY_SCALABLE 0 63#define FONT_ENTRY_SCALE_ALIAS 1 64#define FONT_ENTRY_BITMAP 2 65#define FONT_ENTRY_ALIAS 3 66#define FONT_ENTRY_BC 4 67 68#define MAXFONTNAMELEN 1024 69#define MAXFONTFILENAMELEN 1024 70 71#define FontDirFile "fonts.dir" 72#define FontAliasFile "fonts.alias" 73#define FontScalableFile "fonts.scale" 74 75extern int FontFileNameCheck(const char *name); 76extern int FontFileInitFPE(FontPathElementPtr fpe); 77extern int FontFileResetFPE(FontPathElementPtr fpe); 78extern int FontFileFreeFPE(FontPathElementPtr fpe); 79extern int FontFileOpenFont(pointer client, FontPathElementPtr fpe, 80 Mask flags, const char *name, int namelen, 81 fsBitmapFormat format, fsBitmapFormatMask fmask, 82 XID id, FontPtr *pFont, char **aliasName, 83 FontPtr non_cachable_font); 84extern void FontFileCloseFont(FontPathElementPtr fpe, FontPtr pFont); 85extern int FontFileOpenBitmap(FontPathElementPtr fpe, FontPtr *pFont, 86 int flags, FontEntryPtr entry, 87 fsBitmapFormat format, fsBitmapFormatMask fmask); 88extern int FontFileListFonts(pointer client, FontPathElementPtr fpe, 89 const char *pat, int len, int max, 90 FontNamesPtr names); 91extern int FontFileStartListFonts(pointer client, FontPathElementPtr fpe, 92 const char *pat, int len, int max, 93 pointer *privatep, int mark_aliases); 94extern int FontFileStartListFontsWithInfo(pointer client, 95 FontPathElementPtr fpe, 96 const char *pat, int len, int max, 97 pointer *privatep); 98extern int FontFileListNextFontWithInfo(pointer client, 99 FontPathElementPtr fpe, 100 char **namep, int *namelenp, 101 FontInfoPtr * pFontInfo, 102 int *numFonts, pointer private); 103extern int FontFileStartListFontsAndAliases(pointer client, 104 FontPathElementPtr fpe, 105 const char *pat, int len, int max, 106 pointer *privatep); 107extern int FontFileListNextFontOrAlias(pointer client, 108 FontPathElementPtr fpe, 109 char **namep, int *namelenp, 110 char **resolvedp, int *resolvedlenp, 111 pointer private); 112extern void FontFileRegisterLocalFpeFunctions(void); 113extern void CatalogueRegisterLocalFpeFunctions(void); 114 115 116extern FontEntryPtr FontFileAddEntry(FontTablePtr table, 117 FontEntryPtr prototype); 118extern Bool FontFileAddFontAlias(FontDirectoryPtr dir, char *aliasName, 119 char *fontName); 120extern Bool FontFileAddFontFile(FontDirectoryPtr dir, char *fontName, 121 char *fileName); 122extern int FontFileCountDashes(char *name, int namelen); 123extern FontEntryPtr FontFileFindNameInDir(FontTablePtr table, FontNamePtr pat); 124extern FontEntryPtr FontFileFindNameInScalableDir(FontTablePtr table, 125 FontNamePtr pat, 126 FontScalablePtr vals); 127extern int FontFileFindNamesInDir(FontTablePtr table, FontNamePtr pat, 128 int max, FontNamesPtr names); 129extern int FontFileFindNamesInScalableDir(FontTablePtr table, 130 FontNamePtr pat, int max, 131 FontNamesPtr names, 132 FontScalablePtr vals, 133 int alias_behavior, int *newmax); 134 135extern void FontFileFreeDir(FontDirectoryPtr dir); 136extern void FontFileFreeEntry(FontEntryPtr entry); 137extern void FontFileFreeTable(FontTablePtr table); 138extern Bool FontFileInitTable(FontTablePtr table, int size); 139extern FontDirectoryPtr FontFileMakeDir(const char *dirName, int size); 140extern Bool FontFileMatchName(char *name, int length, FontNamePtr pat); 141extern char *FontFileSaveString(char *s); 142extern void FontFileSortDir(FontDirectoryPtr dir); 143extern void FontFileSortTable(FontTablePtr table); 144 145extern void FontDefaultFormat(int *bit, int *byte, int *glyph, int *scan); 146 147extern Bool FontFileRegisterRenderer(FontRendererPtr renderer); 148extern Bool FontFilePriorityRegisterRenderer(FontRendererPtr renderer, 149 int priority); 150extern FontRendererPtr FontFileMatchRenderer(char *fileName); 151 152extern Bool FontFileAddScaledInstance(FontEntryPtr entry, 153 FontScalablePtr vals, FontPtr pFont, 154 char *bitmapName); 155extern void FontFileSwitchStringsToBitmapPointers(FontDirectoryPtr dir); 156extern void FontFileRemoveScaledInstance(FontEntryPtr entry, FontPtr pFont); 157extern Bool FontFileCompleteXLFD(FontScalablePtr vals, FontScalablePtr def); 158extern FontScaledPtr FontFileFindScaledInstance(FontEntryPtr entry, 159 FontScalablePtr vals, 160 int noSpecificSize); 161 162extern Bool FontFileRegisterBitmapSource(FontPathElementPtr fpe); 163extern void FontFileUnregisterBitmapSource(FontPathElementPtr fpe); 164extern void FontFileEmptyBitmapSource(void); 165extern int FontFileMatchBitmapSource(FontPathElementPtr fpe, 166 FontPtr *pFont, int flags, 167 FontEntryPtr entry, 168 FontNamePtr zeroPat, 169 FontScalablePtr vals, 170 fsBitmapFormat format, 171 fsBitmapFormatMask fmask, 172 Bool noSpecificSize); 173 174extern int FontFileReadDirectory(const char *directory, 175 FontDirectoryPtr * pdir); 176extern Bool FontFileDirectoryChanged(FontDirectoryPtr dir); 177 178#endif /* _FONTFILE_H_ */ 179