1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
/************************************************************************/
/* */
/* The font list of a document. */
/* */
/************************************************************************/
# ifndef DOC_FONT_H
# define DOC_FONT_H
# include <utilPropMask.h>
# include <utilTextAttribute.h>
# include <utilFontEncoding.h>
/************************************************************************/
/* */
/* Font Administration in terms of 'Document Fonts' */
/* */
/* 1) A document font is characterized by an item in the font list */
/* in an offce document. The main key is the name of the font. */
/* It is possible that two fonts with the same name exist. In that */
/* case, the character set helps to distinguish between them. */
/* */
/* 2) The administration distinguishes between fonts that are 'used' */
/* and those that are not. For efficient PostScript production, */
/* the distincion might be too coarse: Many fonts that have been */
/* used count as used. The purpose of the administration is to */
/* decide what fonts to save in a document. Typically the set of */
/* fonts that count as used consistes of the fonts that were in */
/* the font list of a document when it was opened plus the ones */
/* that have been assigned to a stretch of text during editing. */
/* */
/************************************************************************/
/* fprqN */
# define FONTpitchDEFAULT 0
# define FONTpitchFIXED 1
# define FONTpitchVARIABLE 2
# define FONTlenPANOSE 20
typedef enum FontFaceIndex
{
FONTfaceREGULAR= 0,
FONTfaceBOLD,
FONTfaceSLANTED,
FONTfaceBOLD_SLANTED,
FONTface_COUNT
} FontFaceIndex;
typedef struct DocumentFont
{
char * dfFamilyStyle; /* fnil, fswiss .. */
char * dfName; /* Helvetica, */
char * dfAltName; /* \\falt in rtf */
short int dfDocFontNumber;/* f0, f1 ... */
short int dfDocFamilyIndex;
short int dfEncodingSet;
short int dfCharset; /* fcharsetN */
short int dfCodepage; /* cpgN */
short int dfPsFamilyNumber;
short int dfPsFaceNumber[FONTface_COUNT];
unsigned char dfPitch; /* fprqN */
unsigned char dfUsed; /* 2 */
char dfPanose[FONTlenPANOSE+1];
} DocumentFont;
typedef enum DocumentFontProperty
{
DFpropFAMILY_STYLE= 0,
DFpropNAME,
DFpropALT_NAME,
DFpropCHARSET,
DFpropCODEPAGE,
DFpropPITCH,
DFpropPANOSE,
DFprop_COUNT
} DocumentFontProperty;
typedef struct DocumentFontFamily
{
char * dffFamilyName;
int dffFontForEncoding[ENCODINGps_COUNT];
} DocumentFontFamily;
typedef struct DocumentFontList
{
int dflFontCount;
DocumentFont * dflFonts;
int dflFamilyCount;
DocumentFontFamily * dflFamilies;
} DocumentFontList;
typedef enum DocumentFontStyle
{
DFstyleFNIL= 0,
DFstyleFROMAN,
DFstyleFSWISS,
DFstyleFMODERN,
DFstyleFSCRIPT,
DFstyleFDECOR,
DFstyleFTECH,
DFstyle_COUNT
} DocumentFontStyle;
#define FACE_INDEX( isS, isB ) ( 2*( (isS) != 0 )+ ( (isB) != 0 ) )
#define FACE_BOLD( idx ) ( (idx) % 2 != 0 )
#define FACE_SLANTED( idx ) ( ((idx)/2) % 2 != 0 )
/************************************************************************/
/* */
/* Routine declarations. */
/* */
/************************************************************************/
extern void docInitDocumentFont( DocumentFont * df );
extern void docCleanDocumentFont( DocumentFont * df );
extern int docCopyDocumentFont( DocumentFont * to,
const DocumentFont * from );
extern void docInitFontList( DocumentFontList * dfl );
extern void docCleanFontList( DocumentFontList * dfl );
extern int docCopyFontList( DocumentFontList * to,
const DocumentFontList * from );
extern int utilFontFamilyStyle( const char * fontFamilyName );
extern DocumentFont * docInsertFont( DocumentFontList * dfl,
int n,
const DocumentFont * df );
extern int utilFontCompareFaces( const void * veft1,
const void * veft2 );
extern int docGetFontByName( DocumentFontList * dfl,
const char * fontFamilyName,
int encoding );
extern int docMergeFontIntoFontlist(
DocumentFontList * dflTo,
const DocumentFont * dfFrom );
extern int docFontSetFamilyStyle( DocumentFont * df,
int style );
extern int docFontSetFamilyName( DocumentFont * df,
const char * name );
extern int docFontSetAltName( DocumentFont * df,
const char * name );
# endif /* DOC_FONT_H */
|