pm_font.h 955 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * File : pm_font.h
  3. * COPYRIGHT (C) 2012-2017, Shanghai Real-Thread Technology Co., Ltd
  4. *
  5. * Change Logs:
  6. * Date Author Notes
  7. * 2017-11-05 realthread the first version
  8. */
  9. #pragma once
  10. #include <rtgui/rtgui.h>
  11. #include <rtgui/font.h>
  12. namespace Persimmon
  13. {
  14. /**
  15. * Font class
  16. */
  17. class Font
  18. {
  19. public:
  20. enum Weight
  21. {
  22. Light = 25,
  23. Normal = 50,
  24. DemiBold = 63,
  25. Bold = 75,
  26. Black = 87
  27. };
  28. enum Style
  29. {
  30. StyleNormal,
  31. StyleItalic,
  32. StyleOblique
  33. };
  34. Font(struct rtgui_font* font);
  35. ~Font();
  36. Rect getMetrics(const char* text);
  37. struct rtgui_font* getFont()
  38. {
  39. return font;
  40. }
  41. private:
  42. struct rtgui_font* font;
  43. };
  44. /*
  45. * FreeType Font
  46. */
  47. class FTFont : public Font
  48. {
  49. public:
  50. FTFont(const char* fontname, int size, int weight = Font::Normal, bool italic = false);
  51. ~FTFont();
  52. private:
  53. };
  54. }