1 /* 2 3 Copyright 1991, 1998 The Open Group 4 5 Permission to use, copy, modify, distribute, and sell this software and its 6 documentation for any purpose is hereby granted without fee, provided that 7 the above copyright notice appear in all copies and that both that 8 copyright notice and this permission notice appear in supporting 9 documentation. 10 11 The above copyright notice and this permission notice shall be included in 12 all copies or substantial portions of the Software. 13 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 21 Except as contained in this notice, the name of The Open Group shall not be 22 used in advertising or otherwise to promote the sale, use or other dealings 23 in 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 36 typedef struct _FontEntry *FontEntryPtr; 37 typedef struct _FontTable *FontTablePtr; 38 typedef struct _FontName *FontNamePtr; 39 typedef struct _FontScaled *FontScaledPtr; 40 typedef struct _FontScalableExtra *FontScalableExtraPtr; 41 typedef struct _FontScalableEntry *FontScalableEntryPtr; 42 typedef struct _FontScaleAliasEntry *FontScaleAliasEntryPtr; 43 typedef struct _FontBitmapEntry *FontBitmapEntryPtr; 44 typedef struct _FontAliasEntry *FontAliasEntryPtr; 45 typedef struct _FontBCEntry *FontBCEntryPtr; 46 typedef struct _FontDirectory *FontDirectoryPtr; 47 typedef 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 75 extern int FontFileNameCheck ( const char *name ); 76 extern int FontFileInitFPE ( FontPathElementPtr fpe ); 77 extern int FontFileResetFPE ( FontPathElementPtr fpe ); 78 extern int FontFileFreeFPE ( FontPathElementPtr fpe ); 79 extern 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 ); 84 extern void FontFileCloseFont ( FontPathElementPtr fpe, FontPtr pFont ); 85 extern int FontFileOpenBitmap ( FontPathElementPtr fpe, FontPtr *pFont, 86 int flags, FontEntryPtr entry, 87 fsBitmapFormat format, 88 fsBitmapFormatMask fmask ); 89 extern int FontFileListFonts ( pointer client, FontPathElementPtr fpe, 90 const char *pat, int len, int max, 91 FontNamesPtr names ); 92 extern int FontFileStartListFonts ( pointer client, FontPathElementPtr fpe, 93 const char *pat, int len, int max, 94 pointer *privatep, int mark_aliases ); 95 extern int FontFileStartListFontsWithInfo ( pointer client, 96 FontPathElementPtr fpe, 97 const char *pat, int len, int max, 98 pointer *privatep ); 99 extern int FontFileListNextFontWithInfo ( pointer client, 100 FontPathElementPtr fpe, 101 char **namep, int *namelenp, 102 FontInfoPtr *pFontInfo, 103 int *numFonts, pointer private ); 104 extern int FontFileStartListFontsAndAliases ( pointer client, 105 FontPathElementPtr fpe, 106 const char *pat, int len, int max, 107 pointer *privatep ); 108 extern int FontFileListNextFontOrAlias ( pointer client, 109 FontPathElementPtr fpe, 110 char **namep, int *namelenp, 111 char **resolvedp, int *resolvedlenp, 112 pointer private ); 113 extern void FontFileRegisterLocalFpeFunctions ( void ); 114 extern void CatalogueRegisterLocalFpeFunctions ( void ); 115 116 117 extern FontEntryPtr FontFileAddEntry ( FontTablePtr table, 118 FontEntryPtr prototype ); 119 extern Bool FontFileAddFontAlias ( FontDirectoryPtr dir, char *aliasName, 120 char *fontName ); 121 extern Bool FontFileAddFontFile ( FontDirectoryPtr dir, char *fontName, 122 char *fileName ); 123 extern int FontFileCountDashes ( char *name, int namelen ); 124 extern FontEntryPtr FontFileFindNameInDir ( FontTablePtr table, 125 FontNamePtr pat ); 126 extern FontEntryPtr FontFileFindNameInScalableDir ( FontTablePtr table, 127 FontNamePtr pat, 128 FontScalablePtr vals ); 129 extern int FontFileFindNamesInDir ( FontTablePtr table, FontNamePtr pat, 130 int max, FontNamesPtr names ); 131 extern int FontFileFindNamesInScalableDir ( FontTablePtr table, 132 FontNamePtr pat, int max, 133 FontNamesPtr names, 134 FontScalablePtr vals, 135 int alias_behavior, int *newmax ); 136 137 extern void FontFileFreeDir ( FontDirectoryPtr dir ); 138 extern void FontFileFreeEntry ( FontEntryPtr entry ); 139 extern void FontFileFreeTable ( FontTablePtr table ); 140 extern Bool FontFileInitTable ( FontTablePtr table, int size ); 141 extern FontDirectoryPtr FontFileMakeDir ( const char *dirName, int size ); 142 extern Bool FontFileMatchName ( char *name, int length, FontNamePtr pat ); 143 extern char * FontFileSaveString ( char *s ); 144 extern void FontFileSortDir ( FontDirectoryPtr dir ); 145 extern void FontFileSortTable ( FontTablePtr table ); 146 147 extern void FontDefaultFormat ( int *bit, int *byte, int *glyph, int *scan ); 148 149 extern Bool FontFileRegisterRenderer ( FontRendererPtr renderer ); 150 extern Bool FontFilePriorityRegisterRenderer ( FontRendererPtr renderer, 151 int priority ); 152 extern FontRendererPtr FontFileMatchRenderer ( char *fileName ); 153 154 extern Bool FontFileAddScaledInstance ( FontEntryPtr entry, 155 FontScalablePtr vals, FontPtr pFont, 156 char *bitmapName ); 157 extern void FontFileSwitchStringsToBitmapPointers ( FontDirectoryPtr dir ); 158 extern void FontFileRemoveScaledInstance ( FontEntryPtr entry, FontPtr pFont ); 159 extern Bool FontFileCompleteXLFD ( FontScalablePtr vals, FontScalablePtr def ); 160 extern FontScaledPtr FontFileFindScaledInstance ( FontEntryPtr entry, 161 FontScalablePtr vals, 162 int noSpecificSize ); 163 164 extern Bool FontFileRegisterBitmapSource ( FontPathElementPtr fpe ); 165 extern void FontFileUnregisterBitmapSource ( FontPathElementPtr fpe ); 166 extern void FontFileEmptyBitmapSource ( void ); 167 extern int FontFileMatchBitmapSource ( FontPathElementPtr fpe, 168 FontPtr *pFont, int flags, 169 FontEntryPtr entry, 170 FontNamePtr zeroPat, 171 FontScalablePtr vals, 172 fsBitmapFormat format, 173 fsBitmapFormatMask fmask, 174 Bool noSpecificSize ); 175 176 extern int FontFileReadDirectory ( const char *directory, FontDirectoryPtr *pdir ); 177 extern Bool FontFileDirectoryChanged ( FontDirectoryPtr dir ); 178 179 #endif /* _FONTFILE_H_ */ 180