1a96d7823Smrg/* 2a96d7823Smrg 3a96d7823SmrgCopyright 1991, 1998 The Open Group 4a96d7823Smrg 5a96d7823SmrgPermission to use, copy, modify, distribute, and sell this software and its 6a96d7823Smrgdocumentation for any purpose is hereby granted without fee, provided that 7a96d7823Smrgthe above copyright notice appear in all copies and that both that 8a96d7823Smrgcopyright notice and this permission notice appear in supporting 9a96d7823Smrgdocumentation. 10a96d7823Smrg 11a96d7823SmrgThe above copyright notice and this permission notice shall be included in 12a96d7823Smrgall copies or substantial portions of the Software. 13a96d7823Smrg 14a96d7823SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15a96d7823SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16a96d7823SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17a96d7823SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18a96d7823SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19a96d7823SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20a96d7823Smrg 21a96d7823SmrgExcept as contained in this notice, the name of The Open Group shall not be 22a96d7823Smrgused in advertising or otherwise to promote the sale, use or other dealings 23a96d7823Smrgin this Software without prior written authorization from The Open Group. 24a96d7823Smrg 25a96d7823Smrg*/ 26a96d7823Smrg 27a96d7823Smrg/* 28a96d7823Smrg * Author: Keith Packard, MIT X Consortium 29a96d7823Smrg */ 30a96d7823Smrg 31a96d7823Smrg#ifndef _FONTFILEST_H_ 32a96d7823Smrg#define _FONTFILEST_H_ 33a96d7823Smrg 34a96d7823Smrg#include <X11/Xos.h> 35a96d7823Smrg#ifndef XP_PSTEXT 36a96d7823Smrg#include <X11/fonts/fontmisc.h> 37a96d7823Smrg#endif 38a96d7823Smrg#include <X11/fonts/fontstruct.h> 39a96d7823Smrg#include <X11/fonts/fontxlfd.h> 40a96d7823Smrg#include <X11/fonts/fntfil.h> 41a96d7823Smrg 42a96d7823Smrgtypedef struct _FontName { 43a96d7823Smrg char *name; 44a96d7823Smrg short length; 45a96d7823Smrg short ndashes; 46a96d7823Smrg} FontNameRec; 47a96d7823Smrg 48a96d7823Smrgtypedef struct _FontScaled { 49a96d7823Smrg FontScalableRec vals; 50a96d7823Smrg FontEntryPtr bitmap; 51a96d7823Smrg FontPtr pFont; 52a96d7823Smrg} FontScaledRec; 53a96d7823Smrg 54a96d7823Smrgtypedef struct _FontScalableExtra { 55a96d7823Smrg FontScalableRec defaults; 56a96d7823Smrg int numScaled; 57a96d7823Smrg int sizeScaled; 58a96d7823Smrg FontScaledPtr scaled; 59a96d7823Smrg pointer private; 60a96d7823Smrg} FontScalableExtraRec; 61a96d7823Smrg 62a96d7823Smrgtypedef struct _FontScalableEntry { 63a96d7823Smrg FontRendererPtr renderer; 64a96d7823Smrg char *fileName; 65a96d7823Smrg FontScalableExtraPtr extra; 66a96d7823Smrg} FontScalableEntryRec; 67a96d7823Smrg 68a96d7823Smrg/* 69a96d7823Smrg * This "can't" work yet - the returned alias string must be permanent, 70a96d7823Smrg * but this layer would need to generate the appropriate name from the 71a96d7823Smrg * resolved scalable + the XLFD values passed in. XXX 72a96d7823Smrg */ 73a96d7823Smrg 74a96d7823Smrgtypedef struct _FontScaleAliasEntry { 75a96d7823Smrg char *resolved; 76a96d7823Smrg} FontScaleAliasEntryRec; 77a96d7823Smrg 78a96d7823Smrgtypedef struct _FontBitmapEntry { 79a96d7823Smrg FontRendererPtr renderer; 80a96d7823Smrg char *fileName; 81a96d7823Smrg FontPtr pFont; 82a96d7823Smrg} FontBitmapEntryRec; 83a96d7823Smrg 84a96d7823Smrgtypedef struct _FontAliasEntry { 85a96d7823Smrg char *resolved; 86a96d7823Smrg} FontAliasEntryRec; 87a96d7823Smrg 88a96d7823Smrgtypedef struct _FontEntry { 89a96d7823Smrg FontNameRec name; 90a96d7823Smrg int type; 91a96d7823Smrg union _FontEntryParts { 92a96d7823Smrg FontScalableEntryRec scalable; 93a96d7823Smrg FontBitmapEntryRec bitmap; 94a96d7823Smrg FontAliasEntryRec alias; 95a96d7823Smrg } u; 96a96d7823Smrg} FontEntryRec; 97a96d7823Smrg 98a96d7823Smrgtypedef struct _FontTable { 99a96d7823Smrg int used; 100a96d7823Smrg int size; 101a96d7823Smrg FontEntryPtr entries; 102a96d7823Smrg Bool sorted; 103a96d7823Smrg} FontTableRec; 104a96d7823Smrg 105a96d7823Smrgtypedef struct _FontDirectory { 106a96d7823Smrg char *directory; 107a96d7823Smrg unsigned long dir_mtime; 108a96d7823Smrg unsigned long alias_mtime; 109a96d7823Smrg FontTableRec scalable; 110a96d7823Smrg FontTableRec nonScalable; 111a96d7823Smrg char *attributes; 112a96d7823Smrg} FontDirectoryRec; 113a96d7823Smrg 114a96d7823Smrg/* Capability bits: for definition of capabilities bitmap in the 115a96d7823Smrg FontRendererRec to indicate support of XLFD enhancements */ 116a96d7823Smrg 117a96d7823Smrg#define CAP_MATRIX 0x1 118a96d7823Smrg#define CAP_CHARSUBSETTING 0x2 119a96d7823Smrg 120a96d7823Smrgtypedef struct _FontRenderer { 121a96d7823Smrg const char *fileSuffix; 122a96d7823Smrg int fileSuffixLen; 123a96d7823Smrg int (*OpenBitmap)(FontPathElementPtr /* fpe */, 124a96d7823Smrg FontPtr * /* pFont */, 125a96d7823Smrg int /* flags */, 126a96d7823Smrg FontEntryPtr /* entry */, 127a96d7823Smrg char * /* fileName */, 128a96d7823Smrg fsBitmapFormat /* format */, 129a96d7823Smrg fsBitmapFormatMask /* mask */, 130a96d7823Smrg FontPtr /* non_cachable_font */); 131a96d7823Smrg int (*OpenScalable)(FontPathElementPtr /* fpe */, 132a96d7823Smrg FontPtr * /* pFont */, 133a96d7823Smrg int /* flags */, 134a96d7823Smrg FontEntryPtr /* entry */, 135a96d7823Smrg char * /* fileName */, 136a96d7823Smrg FontScalablePtr /* vals */, 137a96d7823Smrg fsBitmapFormat /* format */, 138a96d7823Smrg fsBitmapFormatMask /* fmask */, 139a96d7823Smrg FontPtr /* non_cachable_font */); 140a96d7823Smrg int (*GetInfoBitmap)(FontPathElementPtr /* fpe */, 141a96d7823Smrg FontInfoPtr /* pFontInfo */, 142a96d7823Smrg FontEntryPtr /* entry */, 143a96d7823Smrg char * /*fileName */); 144a96d7823Smrg int (*GetInfoScalable)(FontPathElementPtr /* fpe */, 145a96d7823Smrg FontInfoPtr /* pFontInfo */, 146a96d7823Smrg FontEntryPtr /* entry */, 147a96d7823Smrg FontNamePtr /* fontName */, 148a96d7823Smrg char * /* fileName */, 149a96d7823Smrg FontScalablePtr /* vals */); 150a96d7823Smrg int number; 151a96d7823Smrg int capabilities; /* Bitmap components defined above */ 152a96d7823Smrg} FontRendererRec; 153a96d7823Smrg 154a96d7823Smrgtypedef struct _FontRenders { 155a96d7823Smrg int number; 156a96d7823Smrg struct _FontRenderersElement { 157a96d7823Smrg /* In order to preserve backward compatibility, the 158a96d7823Smrg priority field is made invisible to renderers */ 159a96d7823Smrg FontRendererPtr renderer; 160a96d7823Smrg int priority; 161a96d7823Smrg } *renderers; 162a96d7823Smrg} FontRenderersRec, *FontRenderersPtr; 163a96d7823Smrg 164a96d7823Smrgtypedef struct _BitmapInstance { 165a96d7823Smrg FontScalableRec vals; 166a96d7823Smrg FontBitmapEntryPtr bitmap; 167a96d7823Smrg} BitmapInstanceRec, *BitmapInstancePtr; 168a96d7823Smrg 169a96d7823Smrgtypedef struct _BitmapScalablePrivate { 170a96d7823Smrg int numInstances; 171a96d7823Smrg BitmapInstancePtr instances; 172a96d7823Smrg} BitmapScalablePrivateRec, *BitmapScalablePrivatePtr; 173a96d7823Smrg 174a96d7823Smrgtypedef struct _BitmapSources { 175a96d7823Smrg FontPathElementPtr *fpe; 176a96d7823Smrg int size; 177a96d7823Smrg int count; 178a96d7823Smrg} BitmapSourcesRec, *BitmapSourcesPtr; 179a96d7823Smrg 180a96d7823Smrgextern BitmapSourcesRec FontFileBitmapSources; 181a96d7823Smrg 182a96d7823Smrg/* Defines for FontFileFindNamesInScalableDir() behavior */ 183a96d7823Smrg#define NORMAL_ALIAS_BEHAVIOR 0 184a96d7823Smrg#define LIST_ALIASES_AND_TARGET_NAMES (1<<0) 185a96d7823Smrg#define IGNORE_SCALABLE_ALIASES (1<<1) 186a96d7823Smrg 187a96d7823Smrg#endif /* _FONTFILEST_H_ */ 188