SkFontParameters.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright 2018 Google Inc.
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #ifndef SkFontParameters_DEFINED
  8. #define SkFontParameters_DEFINED
  9. #include "include/core/SkScalar.h"
  10. #include "include/core/SkTypes.h"
  11. struct SkFontParameters {
  12. struct Variation {
  13. // Parameters in a variation font axis.
  14. struct Axis {
  15. // Four character identifier of the font axis (weight, width, slant, italic...).
  16. SkFourByteTag tag;
  17. // Minimum value supported by this axis.
  18. float min;
  19. // Default value set by this axis.
  20. float def;
  21. // Maximum value supported by this axis. The maximum can equal the minimum.
  22. float max;
  23. // Return whether this axis is recommended to be remain hidden in user interfaces.
  24. bool isHidden() const { return flags & HIDDEN; }
  25. // Set this axis to be remain hidden in user interfaces.
  26. void setHidden(bool hidden) { flags = hidden ? (flags | HIDDEN) : (flags & ~HIDDEN); }
  27. private:
  28. static constexpr uint16_t HIDDEN = 0x0001;
  29. // Attributes for a font axis.
  30. uint16_t flags;
  31. };
  32. };
  33. };
  34. #endif