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 
8 #ifndef SkFontParameters_DEFINED
9 #define SkFontParameters_DEFINED
10 
11 #include "SkScalar.h"
12 #include "SkTypes.h"
13 
14 struct SkFontParameters {
15     struct Variation {
16         // Parameters in a variation font axis.
17         struct Axis {
18             // Four character identifier of the font axis (weight, width, slant, italic...).
19             SkFourByteTag tag;
20             // Minimum value supported by this axis.
21             float min;
22             // Default value set by this axis.
23             float def;
24             // Maximum value supported by this axis. The maximum can equal the minimum.
25             float max;
26             // Return whether this axis is recommended to be remain hidden in user interfaces.
isHiddenSkFontParameters::Variation::Axis27             bool isHidden() const { return flags & HIDDEN; }
28             // Set this axis to be remain hidden in user interfaces.
setHiddenSkFontParameters::Variation::Axis29             void setHidden(bool hidden) { flags = hidden ? (flags | HIDDEN) : (flags & ~HIDDEN); }
30         private:
31             static constexpr uint16_t HIDDEN = 0x0001;
32             // Attributes for a font axis.
33             uint16_t flags;
34         };
35     };
36 };
37 
38 #endif
39