FontMap.h 1.8 KB

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