@@ -23,11 +23,15 @@ namespace yup
2323{
2424
2525// ==============================================================================
26+ /* * Font.
2627
28+ This class represents a font.
29+ */
2730class YUP_API Font
2831{
2932public:
3033 // ==============================================================================
34+ /* * Creates an empty font. */
3135 Font () = default ;
3236
3337 // ==============================================================================
@@ -38,18 +42,39 @@ class YUP_API Font
3842 Font& operator = (Font&& other) noexcept = default ;
3943
4044 // ==============================================================================
45+ /* * Loads a font from a memory block.
46+
47+ @param fontBytes The memory block containing the font data.
48+ @return The result of the operation.
49+ */
4150 Result loadFromData (const MemoryBlock& fontBytes);
4251
4352 // ==============================================================================
53+ /* * Loads a font from a file.
54+
55+ @param fontFile The file containing the font data.
56+ @return The result of the operation.
57+ */
4458 Result loadFromFile (const File& fontFile);
4559
4660 // ==============================================================================
61+ /* * Returns the ascent of the font. */
4762 float getAscent () const ;
63+
64+ /* * Returns the descent of the font. */
4865 float getDescent () const ;
66+
67+ /* * Returns the weight of the font. */
4968 int getWeight () const ;
69+
70+ /* * Returns true if the font is italic. */
5071 bool isItalic () const ;
5172
5273 // ==============================================================================
74+ /* * Axis.
75+
76+ This struct represents an axis of the font.
77+ */
5378 struct Axis
5479 {
5580 Axis () = default ;
@@ -60,19 +85,102 @@ class YUP_API Font
6085 float defaultValue = 0 .0f ;
6186 };
6287
88+ /* * Returns the number of axes in the font.
89+
90+ @return The number of axes in the font.
91+ */
6392 int getNumAxis () const ;
93+
94+ /* * Returns the description of the axis at the given index.
95+
96+ @param index The index of the axis.
97+
98+ @return The description of the axis.
99+ */
64100 std::optional<Font::Axis> getAxisDescription (int index) const ;
101+
102+ /* * Returns the description of the axis with the given tag name.
103+
104+ @param tagName The tag name of the axis.
105+
106+ @return The description of the axis.
107+ */
65108 std::optional<Font::Axis> getAxisDescription (StringRef tagName) const ;
66109
110+ // ==============================================================================
111+ /* * Returns the value of the axis at the given index.
112+
113+ @param index The index of the axis.
114+
115+ @return The value of the axis.
116+ */
67117 float getAxisValue (int index) const ;
68- float getAxisValue (StringRef tagName) const ;
69118
119+ /* * Sets the value of the axis at the given index.
120+
121+ @param index The index of the axis.
122+ @param value The value of the axis.
123+ */
70124 void setAxisValue (int index, float value);
71- void setAxisValue (StringRef tagName, float value);
72125
126+ /* * Returns a new font with the value of the axis at the given index.
127+
128+ @param index The index of the axis.
129+ @param value The value of the axis.
130+
131+ @return A new font with the value of the axis at the given index.
132+ */
73133 Font withAxisValue (int index, float value) const ;
134+
135+ /* * Resets the value of the axis at the given index.
136+
137+ @param index The index of the axis.
138+ */
139+ void resetAxisValue (int index);
140+
141+ // ==============================================================================
142+ /* * Returns the value of the axis with the given tag name.
143+
144+ @param tagName The tag name of the axis.
145+
146+ @return The value of the axis.
147+ */
148+ float getAxisValue (StringRef tagName) const ;
149+
150+ /* * Sets the value of the axis with the given tag name.
151+
152+ @param tagName The tag name of the axis.
153+ @param value The value of the axis.
154+ */
155+ void setAxisValue (StringRef tagName, float value);
156+
157+ /* * Returns a new font with the value of the axis with the given tag name.
158+
159+ @param tagName The tag name of the axis.
160+ @param value The value of the axis.
161+
162+ @return A new font with the value of the axis with the given tag name.
163+ */
74164 Font withAxisValue (StringRef tagName, float value) const ;
75165
166+ /* * Resets the value of the axis with the given tag name.
167+
168+ @param tagName The tag name of the axis.
169+ */
170+ void resetAxisValue (StringRef tagName);
171+
172+ // ==============================================================================
173+ /* * Resets the values of all axes.
174+
175+ @return A new font with the values of all axes reset.
176+ */
177+ void resetAllAxisValues ();
178+
179+ // ==============================================================================
180+ /* * Axis option.
181+
182+ This struct represents an option of the axis.
183+ */
76184 struct AxisOption
77185 {
78186 AxisOption (StringRef tagName, float value)
@@ -85,16 +193,25 @@ class YUP_API Font
85193 float value;
86194 };
87195
196+ /* * Sets the values of the axes.
197+
198+ @param axisOptions The options of the axes.
199+ */
88200 void setAxisValues (std::initializer_list<AxisOption> axisOptions);
89- Font withAxisValues (std::initializer_list<AxisOption> axisOptions) const ;
90201
91- void resetAxisValue (int index);
92- void resetAxisValue (StringRef tagName);
202+ /* * Returns a new font with the values of the axes.
93203
94- void resetAllAxisValues ();
204+ @param axisOptions The options of the axes.
205+
206+ @return A new font with the values of the axes.
207+ */
208+ Font withAxisValues (std::initializer_list<AxisOption> axisOptions) const ;
95209
96210 // ==============================================================================
211+ /* * Returns true if the fonts are equal. */
97212 bool operator == (const Font& other) const ;
213+
214+ /* * Returns true if the fonts are not equal. */
98215 bool operator != (const Font& other) const ;
99216
100217 // ==============================================================================
0 commit comments