FastUIDraw
font_metrics.hpp
Go to the documentation of this file.
1 /*!
2  * \file font_metrics.hpp
3  * \brief file font_metrics.hpp
4  *
5  * Copyright 2019 by Intel.
6  *
7  * Contact: kevin.rogovin@gmail.com
8  *
9  * This Source Code Form is subject to the
10  * terms of the Mozilla Public License, v. 2.0.
11  * If a copy of the MPL was not distributed with
12  * this file, You can obtain one at
13  * http://mozilla.org/MPL/2.0/.
14  *
15  * \author Kevin Rogovin <kevin.rogovin@gmail.com>
16  *
17  */
18 
19 #ifndef FASTUIDRAW_FONT_METRICS_HPP
20 #define FASTUIDRAW_FONT_METRICS_HPP
21 
22 #include <fastuidraw/util/util.hpp>
23 
24 namespace fastuidraw
25 {
26 /*!\addtogroup Glyph
27  * @{
28  */
29 
30  /*!
31  * \brief
32  * Represents various metric values global to an entire font.
33  */
35  {
36  public:
37  /*!
38  * Ctor. Initializes all fields as zero.
39  */
40  FontMetrics(void);
41 
42  /*!
43  * Copy ctor.
44  * \param obj vaue from which to copy
45  */
46  FontMetrics(const FontMetrics &obj);
47 
48  ~FontMetrics();
49 
50  /*!
51  * assignment operator
52  * \param obj value from which to assign
53  */
55  operator=(const FontMetrics &obj);
56 
57  /*!
58  * Swap operation
59  * \param obj object with which to swap
60  */
61  void
62  swap(FontMetrics &obj);
63 
64  /*!
65  * The recommended distance, in font units, between lines of text.
66  * This is typically greater than the difference between \ref
67  * ascender() and \ref descender().
68  */
69  float
70  height(void) const;
71 
72  /*!
73  * Set the value returned by height(void) const
74  */
76  height(float);
77 
78  /*!
79  * The typographical ascender value for the font in
80  * font units; this is essentially the maximum across
81  * all glyphs of the distance from the baseline to top
82  * of the glyph.
83  */
84  float
85  ascender(void) const;
86 
87  /*!
88  * Set the value returned by ascender(void) const
89  */
91  ascender(float);
92 
93  /*!
94  * The typographical descender value for the font in
95  * font units; this is essentially the minumum across
96  * all glyphs of the signed distance from the baseline
97  * to bottom of the glyph. A negative value indicates
98  * below the baseline and a positive value above the
99  * baseline.
100  */
101  float
102  descender(void) const;
103 
104  /*!
105  * Set the value returned by descender(void) const
106  */
107  FontMetrics&
108  descender(float);
109 
110  /*!
111  * The number of font units per EM for the glyph.
112  * The conversion from font coordinates to pixel
113  * coordiantes is given by:
114  * \f$PixelCoordinates = FontCoordinates * PixelSize / units_per_EM\f$
115  */
116  float
117  units_per_EM(void) const;
118 
119  /*!
120  * Set the value returned by units_per_EM(void) const
121  */
122  FontMetrics&
123  units_per_EM(float);
124 
125  /*!
126  * Returns the strike-through position.
127  */
128  float
129  strikeout_position(void) const;
130 
131  /*!
132  * Set the value returned by strikeout_position(void) const
133  */
134  FontMetrics&
135  strikeout_position(float);
136 
137  /*!
138  * Returns the strike-through thickness.
139  */
140  float
141  strikeout_thickness(void) const;
142 
143  /*!
144  * Set the value returned by strikeout_thickness(void) const
145  */
146  FontMetrics&
147  strikeout_thickness(float);
148 
149  /*!
150  * Returns the underline position.
151  */
152  float
153  underline_position(void) const;
154 
155  /*!
156  * Set the value returned by underline_position(void) const
157  */
158  FontMetrics&
159  underline_position(float);
160 
161  /*!
162  * Returns the underline thickness.
163  */
164  float
165  underline_thickness(void) const;
166 
167  /*!
168  * Set the value returned by underline_thickness(void) const
169  */
170  FontMetrics&
171  underline_thickness(float);
172 
173  private:
174  void *m_d;
175  };
176 /*! @} */
177 }
178 
179 #endif
float strikeout_position(void) const
float descender(void) const
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
float height(void) const
void swap(FontMetrics &obj)
FontMetrics & operator=(const FontMetrics &obj)
float strikeout_thickness(void) const
float underline_thickness(void) const
file util.hpp
float units_per_EM(void) const
Represents various metric values global to an entire font.
float underline_position(void) const
float ascender(void) const