1 /* 2 ****************************************************************************** 3 * Copyright (C) 1998-2003, International Business Machines Corporation and * 4 * others. All Rights Reserved. * 5 ****************************************************************************** 6 */ 7 8 #ifndef __FONTMAP_H 9 #define __FONTMAP_H 10 11 #include "layout/LETypes.h" 12 #include "layout/LEScripts.h" 13 #include "layout/LEFontInstance.h" 14 15 #include "GUISupport.h" 16 17 #define BUFFER_SIZE 128 18 19 class FontMap 20 { 21 public: 22 FontMap(const char *fileName, le_int16 pointSize, GUISupport *guiSupport, LEErrorCode &status); 23 24 virtual ~FontMap(); 25 26 virtual const LEFontInstance *getScriptFont(le_int32 scriptCode, LEErrorCode &status); 27 28 virtual le_int16 getPointSize() const; 29 30 virtual le_int32 getAscent() const; 31 32 virtual le_int32 getDescent() const; 33 34 virtual le_int32 getLeading() const; 35 36 protected: 37 virtual const LEFontInstance *openFont(const char *fontName, le_int16 pointSize, LEErrorCode &status) = 0; 38 39 char errorMessage[256]; 40 41 private: 42 static char *strip(char *s); 43 le_int32 getFontIndex(const char *fontName); 44 void getMaxMetrics(); 45 46 le_int16 fPointSize; 47 le_int32 fFontCount; 48 49 le_int32 fAscent; 50 le_int32 fDescent; 51 le_int32 fLeading; 52 53 GUISupport *fGUISupport; 54 55 const LEFontInstance *fFontInstances[scriptCodeCount]; 56 const char *fFontNames[scriptCodeCount]; 57 le_int32 fFontIndices[scriptCodeCount]; 58 }; 59 getPointSize()60inline le_int16 FontMap::getPointSize() const 61 { 62 return fPointSize; 63 } 64 65 #endif 66 67