1 /************************************************************************/ 2 /* */ 3 /* The font list of a document. */ 4 /* */ 5 /************************************************************************/ 6 7 # ifndef DOC_FONT_H 8 # define DOC_FONT_H 9 10 # include <psFontInfo.h> 11 # include <utilIndexMapping.h> 12 # include <textOfficeCharset.h> 13 # include <utilIndexSet.h> 14 15 /************************************************************************/ 16 /* */ 17 /* Font Administration in terms of 'Document Fonts' */ 18 /* */ 19 /* 1) A document font is characterized by an item in the font list */ 20 /* in an office document. The main key is the name of the font. */ 21 /* It is possible that two fonts with the same name exist. In that */ 22 /* case, the character set helps to distinguish between them. */ 23 /* */ 24 /* 2) The administration distinguishes between fonts that are 'used' */ 25 /* and those that are not. For efficient PostScript production, */ 26 /* the distincion might be too coarse: Many fonts that have been */ 27 /* used count as used. The purpose of the administration is to */ 28 /* decide what fonts to save in a document. Typically the set of */ 29 /* fonts that count as used consistes of the fonts that were in */ 30 /* the font list of a document when it was opened plus the ones */ 31 /* that have been assigned to a stretch of text during editing. */ 32 /* */ 33 /* 3) fnil, fswiss .. */ 34 /* 4) Helvetica, Times.. */ 35 /* 5) \\falt in rtf */ 36 /* 6) f0, f1 ... */ 37 /* 7) fcharsetN */ 38 /* 8) cpgN */ 39 /* 9) fprqN */ 40 /* */ 41 /* 10) If the character set is given, (dfCharset) it is used to find */ 42 /* how the text is encoded. The actual index in the array of */ 43 /* office character sets is determined through a lookup. Otherwise */ 44 /* the index is derived from the code page (dfCodepage) or guessed */ 45 /* from the matching postscript font. */ 46 /* */ 47 /************************************************************************/ 48 49 /* fprqN */ 50 # define FONTpitchDEFAULT 0 51 # define FONTpitchFIXED 1 52 # define FONTpitchVARIABLE 2 53 54 # define FONTlenPANOSE 20 55 56 typedef enum FontFaceIndex 57 { 58 FONTfaceREGULAR= 0, 59 FONTfaceBOLD, 60 FONTfaceSLANTED, 61 FONTfaceBOLD_SLANTED, 62 63 FONTface_COUNT 64 } FontFaceIndex; 65 66 typedef struct DocumentFont 67 { 68 char * dfName; /* 4 */ 69 char * dfAltName; /* 5 */ 70 short int dfDocFontNumber;/* 6 */ 71 72 unsigned char dfStyleInt; /* 3 */ 73 unsigned char dfPitch; /* 9 */ 74 char dfPanose[FONTlenPANOSE+1]; 75 76 AfmFontInfo * dfPsFontInfo[FONTface_COUNT]; 77 78 /** 79 * Mostly used while reading/ 80 * opening/writing a document: 81 */ 82 IndexSet dfUnicodesUsed; 83 IndexMapping dfUnicodeToCharset; 84 85 int dfCharsetIdxUsed[CHARSETidx_COUNT]; 86 int dfCharsetIdxUsedCount; 87 } DocumentFont; 88 89 typedef enum DocumentFontProperty 90 { 91 DFpropFAMILY_STYLE= 0, 92 DFpropNAME, 93 DFpropALT_NAME, 94 DFpropCHARSET, 95 DFpropCODEPAGE, 96 DFpropPITCH, 97 DFpropPANOSE, 98 99 DFprop_COUNT 100 } DocumentFontProperty; 101 102 /************************************************************************/ 103 /* */ 104 /* Routine declarations. */ 105 /* */ 106 /************************************************************************/ 107 108 extern void docInitDocumentFont( DocumentFont * df ); 109 110 extern void docCleanDocumentFont( DocumentFont * df ); 111 112 extern int docCopyDocumentFont( DocumentFont * to, 113 const DocumentFont * from ); 114 115 extern int docFontSetFamilyStyle( DocumentFont * df, 116 int style ); 117 118 extern int docFontSetFamilyName( DocumentFont * df, 119 const char * name ); 120 121 extern int docFontSetAltName( DocumentFont * df, 122 const char * name ); 123 124 extern void utilCopyFontFaceMatches( DocumentFont * dfTo, 125 const DocumentFont * dfFrom ); 126 127 extern int docFontFindLegacyEncodings( DocumentFont * df ); 128 129 extern int utilRemoveCharsetFromFontName( DocumentFont * df, 130 int charset ); 131 132 extern int cssFontFamilyIndicator( char * target, 133 int maxSize, 134 int styleInt, 135 const char * familyName ); 136 137 # endif /* DOC_FONT_H */ 138