font.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef _font_h_
  2. #define _font_h_
  3. //////////////////////////////////////////////////////////////////////////////
  4. //
  5. // IEngineFont
  6. //
  7. //////////////////////////////////////////////////////////////////////////////
  8. class IEngineFont : public IObject {
  9. public:
  10. virtual int GetMaxTextLength(const ZString& str, int maxWidth, bool bLeft) = 0;
  11. virtual WinPoint GetTextExtent(const ZString& str) = 0;
  12. virtual WinPoint GetTextExtent(const char* sz) = 0;
  13. virtual int GetHeight() = 0;
  14. virtual void DrawString(
  15. Surface* psurface,
  16. const WinPoint& point,
  17. const WinRect& rectClip,
  18. const ZString& str,
  19. const Color& color
  20. ) = 0;
  21. };
  22. //////////////////////////////////////////////////////////////////////////////
  23. //
  24. // Color Codes
  25. //
  26. //////////////////////////////////////////////////////////////////////////////
  27. #define START_COLOR_CODE 0x81
  28. #define END_COLOR_CODE 0x82
  29. #define START_COLOR_STRING "\x81 %s"
  30. #define END_COLOR_STRING "\x82 "
  31. ZString ConvertColorToString (const Color& color);
  32. //////////////////////////////////////////////////////////////////////////////
  33. //
  34. // FontValue
  35. //
  36. //////////////////////////////////////////////////////////////////////////////
  37. ZString GetString(int indent, TRef<IEngineFont> pfont);
  38. void Write(IMDLBinaryFile* pmdlFile, TRef<IEngineFont> pfont);
  39. ZString GetFunctionName(const TRef<IEngineFont>& value);
  40. typedef TStaticValue<TRef<IEngineFont> > FontValue;
  41. #endif