Rpi-hw  0.7.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
base.hpp
1 /*
2  Title --- font/base.hpp
3 
4  Copyright (C) 2013 Giacomo Trudu - wicker25[at]gmail[dot]com
5 
6  This file is part of Rpi-hw.
7 
8  Rpi-hw is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation version 3 of the License.
11 
12  Rpi-hw is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with Rpi-hw. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 
22 #ifndef _RPI_HW_FONT_BASE_HPP_
23 #define _RPI_HW_FONT_BASE_HPP_
24 
25 #include <iostream>
26 
27 #include <rpi-hw/types.hpp>
28 #include <rpi-hw/font/glyph.hpp>
29 
30 namespace rpihw { // Begin main namespace
31 
32 /*!
33  @namespace rpihw::font
34  @brief Namespace of the fonts.
35 */
36 
37 namespace font { // Begin fonts namespace
38 
39 //! The font rendering mode.
40 enum RenderMode {
41 
42  RENDER_DEFAULT = 0,
43  RENDER_MONOCHROME = 1
44 };
45 
46 /*!
47  @class base
48  @brief Generic font.
49 */
50 class base {
51 
52 public:
53 
54  /*!
55  @brief Sets the font size.
56  @param[in] height The height of the font.
57  */
58  virtual void setSize( uint8_t height ) = 0;
59 
60  /*!
61  @brief Returns the width of a character.
62  @param[in] charcode The character code.
63  @return The width of the font.
64  */
65  virtual uint8_t getWidth( uint32_t charcode ) const = 0;
66 
67  //! Returns the height of the font.
68  virtual uint8_t getHeight() const = 0;
69 
70  /*!
71  @brief Returns the data of the character font.
72  @param[in] charcode The character code.
73  @param[in] glyph The glyph of the character.
74  */
75  virtual void data( uint32_t charcode, glyph &glyph ) const = 0;
76 };
77 
78 } // End of fonts namespace
79 
80 } // End of main namespace
81 
82 #endif /* _RPI_HW_FONT_BASE_HPP_ */
virtual uint8_t getHeight() const =0
Returns the height of the font.
virtual void data(uint32_t charcode, glyph &glyph) const =0
Returns the data of the character font.
RenderMode
The font rendering mode.
Definition: base.hpp:40
Generic font.
Definition: base.hpp:50
Simple glyph structure.
Definition: glyph.hpp:48
virtual uint8_t getWidth(uint32_t charcode) const =0
Returns the width of a character.
virtual void setSize(uint8_t height)=0
Sets the font size.