1 /************************************************************************/ 2 /* */ 3 /* Attributes of text. */ 4 /* */ 5 /************************************************************************/ 6 7 # ifndef UTIL_TEXT_ATTRIBUTE_H 8 # define UTIL_TEXT_ATTRIBUTE_H 9 10 # include <utilPropMask.h> 11 12 typedef struct TextAttribute 13 { 14 int taFontNumber; 15 int taFontSizeHalfPoints; 16 int taTextColorNumber; 17 int taTextStyleNumber; 18 19 int taBorderNumber; 20 int taShadingNumber; 21 int taBaselineShiftHalfPoints; 22 23 unsigned char taFontIsBold; 24 unsigned char taFontIsSlanted; 25 unsigned char taTextIsUnderlined; 26 # define DOCunderlineNONE 0 27 # define DOCunderlineSINGLE 1 28 # define DOCunderlineDOUBLE 2 29 30 unsigned char taSmallCaps; 31 unsigned char taHasStrikethrough; 32 unsigned char taCapitals; 33 34 unsigned char taSuperSub; 35 } TextAttribute; 36 37 typedef enum TextSuperSub 38 { 39 TEXTvaREGULAR= 0, 40 TEXTvaSUPERSCRIPT, 41 TEXTvaSUBSCRIPT, 42 43 TEXTva_COUNT 44 } TextSuperSub; 45 46 typedef enum TextProperty 47 { 48 TAprop_NONE= -1, 49 50 TApropFONT_NUMBER= 0, 51 TApropFONTSIZE, 52 TApropFONTBOLD, 53 TApropFONTSLANTED, 54 TApropTEXTUNDERLINED, 55 TApropSUPERSUB, 56 TApropSMALLCAPS, 57 TApropCAPITALS, 58 TApropSTRIKETHROUGH, 59 TApropTEXT_COLOR, 60 TApropTEXT_STYLE, 61 62 TApropBORDER, 63 TApropSHADING, 64 65 TApropBASELINE_SHIFT, 66 67 TAprop_BASELINE_SHIFT_DOWN, 68 # define TAprop_COUNT TAprop_BASELINE_SHIFT_DOWN 69 70 TAprop_FULL_COUNT 71 } TextProperty; 72 73 # define docEqualFontAttributes(ta1,ta2) ( \ 74 (ta1)->taFontIsBold == (ta2)->taFontIsBold && \ 75 (ta1)->taFontIsSlanted == (ta2)->taFontIsSlanted ) 76 77 # define docEqualFont(ta1,ta2) ( \ 78 (ta1)->taFontNumber == (ta2)->taFontNumber && \ 79 (ta1)->taFontSizeHalfPoints == (ta2)->taFontSizeHalfPoints && \ 80 (ta1)->taSuperSub == (ta2)->taSuperSub && \ 81 (ta1)->taSmallCaps == (ta2)->taSmallCaps && \ 82 docEqualFontAttributes( (ta1), (ta2) ) ) 83 84 # define docEqualTextAttributes(ta1,ta2) ( \ 85 docEqualFont((ta1),(ta2)) && \ 86 (ta1)->taTextIsUnderlined == (ta2)->taTextIsUnderlined && \ 87 (ta1)->taHasStrikethrough == (ta2)->taHasStrikethrough && \ 88 (ta1)->taCapitals == (ta2)->taCapitals && \ 89 (ta1)->taTextColorNumber == (ta2)->taTextColorNumber && \ 90 (ta1)->taBorderNumber == (ta2)->taBorderNumber && \ 91 (ta1)->taShadingNumber == (ta2)->taShadingNumber && \ 92 (ta1)->taBaselineShiftHalfPoints == (ta2)->taBaselineShiftHalfPoints ) 93 94 #define FACE_INDEX( isS, isB ) ( 2*( (isS) != 0 )+ ( (isB) != 0 ) ) 95 #define FACE_BOLD( idx ) ( (idx) % 2 != 0 ) 96 #define FACE_SLANTED( idx ) ( ((idx)/2) % 2 != 0 ) 97 98 /************************************************************************/ 99 /* */ 100 /* Default attributes. */ 101 /* */ 102 /************************************************************************/ 103 104 extern TextAttribute DocDefaultAttributes; 105 106 /************************************************************************/ 107 /* */ 108 /* Routine declarations. */ 109 /* */ 110 /************************************************************************/ 111 112 extern void utilInitTextAttribute( TextAttribute * ta ); 113 114 extern void utilUpdateTextAttribute( PropertyMask * pDoneMask, 115 TextAttribute * ta, 116 const PropertyMask * taSetMask, 117 const TextAttribute * taSet ); 118 119 extern void utilAttributeDifference( PropertyMask * pDifMask, 120 const TextAttribute * ta1, 121 const PropertyMask * cmpMask, 122 const TextAttribute * ta2 ); 123 124 extern int utilSetTextProperty( TextAttribute * ta, 125 int prop, 126 int arg ); 127 128 extern int utilGetTextProperty( const TextAttribute * ta, 129 int prop ); 130 131 # endif /* UTIL_TEXT_ATTRIBUTE_H */ 132