FastUIDraw
glyph_source.hpp
Go to the documentation of this file.
1 /*!
2  * \file glyph_source.hpp
3  * \brief file glyph_source.hpp
4  *
5  * Copyright 2016 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_GLYPH_SOURCE_HPP
20 #define FASTUIDRAW_GLYPH_SOURCE_HPP
21 
22 #include <fastuidraw/text/font.hpp>
24 
25 namespace fastuidraw
26 {
27 /*!\addtogroup Glyph
28  * @{
29  */
30 
31  /*!
32  * Class to specify the source for a glyph.
33  */
35  {
36  public:
37  /*!
38  * Ctor. Initialize \ref m_glyph_code as 0 and \ref m_font
39  * as nullptr.
40  */
41  GlyphSource(void):
42  m_glyph_code(0)
43  {}
44 
45  /*!
46  * Ctor.
47  * \param f value to assign to \ref m_font
48  * \param g value to assign to \ref m_glyph_code
49  */
50  GlyphSource(const FontBase *f, uint32_t g):
51  m_glyph_code(g)
52  {
53  m_font = (f && g < f->number_glyphs()) ? f : nullptr;
54  }
55 
56  /*!
57  * Ctor.
58  * \param f value to assign to \ref m_font
59  * \param g value to assign to \ref m_glyph_code
60  */
61  GlyphSource(uint32_t g, const FontBase *f):
62  m_glyph_code(g)
63  {
64  m_font = (f && g < f->number_glyphs()) ? f : nullptr;
65  }
66 
67  /*!
68  * Comparison operator
69  * \param rhs value to compare against
70  */
71  bool
72  operator<(const GlyphSource &rhs) const
73  {
74  return (m_font < rhs.m_font)
75  || (m_font == rhs.m_font && m_glyph_code < rhs.m_glyph_code);
76  }
77 
78  /*!
79  * Glyph code of a \ref Glyph
80  */
81  uint32_t m_glyph_code;
82 
83  /*!
84  * Font of a \ref Glyph
85  */
86  const FontBase *m_font;
87  };
88 /*! @} */
89 }
90 
91 #endif
const FontBase * m_font
all classes and functions of FastUIDraw are in the namespace fastuidraw.
Definition: colorstop.hpp:28
virtual unsigned int number_glyphs(void) const =0
FontBase provides an interface for a font to generate glyph rendering data.
Definition: font.hpp:47
GlyphSource(uint32_t g, const FontBase *f)
bool operator<(const GlyphSource &rhs) const
GlyphSource(const FontBase *f, uint32_t g)
file glyph.hpp
file font.hpp