Rpi-hw  0.7.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
glyph.hpp
1 /*
2  Title --- font/glyph.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_GLYPH_HPP_
23 #define _RPI_HW_FONT_GLYPH_HPP_
24 
25 #include <rpi-hw/types.hpp>
26 #include <rpi-hw/exception.hpp>
27 
28 namespace rpihw { // Begin main namespace
29 
30 namespace font { // Begin fonts namespace
31 
32 //! The format of pixels in the bitmap buffer.
33 enum PixelMode {
34 
35  PIXEL_MODE_NONE = 0,
36  PIXEL_MODE_MONO = 1,
37  PIXEL_MODE_GRAY = 2,
38  PIXEL_MODE_GRAY2 = 3,
39  PIXEL_MODE_GRAY4 = 4,
40  PIXEL_MODE_LCD = 5,
41  PIXEL_MODE_LCD_V = 6
42 };
43 
44 /*!
45  @class glyph
46  @brief Simple glyph structure.
47 */
48 struct glyph {
49 
50  //! The width of the glyph.
51  uint8_t width;
52  //! The height of the glyph.
53  uint8_t height;
54 
55  //! The left side bearing.
56  int8_t left;
57  //! The top side bearing.
58  int8_t top;
59 
60  //! The format of the glyph bitmap (monochrome or gray).
62  //! Maximum gray level value (in the range 1 to 255).
63  uint8_t grays;
64  //! The number of bytes per bitmap line. May be positive or negative.
65  int16_t pitch;
66 
67  //! The horizontal advance width in pixels.
68  int8_t xadvance;
69  //! The vertical advance height in pixels.
70  int8_t yadvance;
71 
72  //! A pointer to the bitmap pixels.
73  const uint8_t *buffer;
74 };
75 
76 } // End of fonts namespace
77 
78 } // End of main namespace
79 
80 #endif /* _RPI_HW_GLYPH_HPP_ */
int8_t yadvance
The vertical advance height in pixels.
Definition: glyph.hpp:70
int8_t top
The top side bearing.
Definition: glyph.hpp:58
PixelMode
The format of pixels in the bitmap buffer.
Definition: glyph.hpp:33
uint8_t grays
Maximum gray level value (in the range 1 to 255).
Definition: glyph.hpp:63
int16_t pitch
The number of bytes per bitmap line. May be positive or negative.
Definition: glyph.hpp:65
PixelMode format
The format of the glyph bitmap (monochrome or gray).
Definition: glyph.hpp:61
int8_t xadvance
The horizontal advance width in pixels.
Definition: glyph.hpp:68
const uint8_t * buffer
A pointer to the bitmap pixels.
Definition: glyph.hpp:73
uint8_t width
The width of the glyph.
Definition: glyph.hpp:51
Simple glyph structure.
Definition: glyph.hpp:48
uint8_t height
The height of the glyph.
Definition: glyph.hpp:53
int8_t left
The left side bearing.
Definition: glyph.hpp:56