font.hpp 921 B

123456789101112131415161718192021222324252627282930313233343536
  1. #if defined(Hiro_Font)
  2. struct Font {
  3. using type = Font;
  4. Font(const string& family = "", float size = 0.0);
  5. explicit operator bool() const;
  6. auto operator==(const Font& source) const -> bool;
  7. auto operator!=(const Font& source) const -> bool;
  8. auto bold() const -> bool;
  9. auto family() const -> string;
  10. auto italic() const -> bool;
  11. auto reset() -> type&;
  12. auto setBold(bool bold = true) -> type&;
  13. auto setFamily(const string& family = "") -> type&;
  14. auto setItalic(bool italic = true) -> type&;
  15. auto setSize(float size = 0.0) -> type&;
  16. auto size() const -> float;
  17. auto size(const string& text) const -> Size;
  18. static const string Sans;
  19. static const string Serif;
  20. static const string Mono;
  21. //private:
  22. //sizeof(Font) == 32
  23. struct State {
  24. string family; //24
  25. float size = 0.0; //4
  26. char bold = false; //1+
  27. char italic = false; //1=4
  28. } state;
  29. };
  30. #endif