Line data Source code
1 : // Copyright (c) 2021 Made to Order Software Corp. All Rights Reserved
2 : //
3 : // https://snapwebsites.org/project/ftmesh
4 : // contact@m2osw.com
5 : //
6 : // This program is free software; you can redistribute it and/or modify
7 : // it under the terms of the GNU General Public License as published by
8 : // the Free Software Foundation; either version 2 of the License, or
9 : // (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License along
17 : // with this program; if not, write to the Free Software Foundation, Inc.,
18 : // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 :
20 : /** \file
21 : * \brief Implementation of the mesh_char class.
22 : *
23 : * When creating a string, you need to handle the advancement between
24 : * characters which varies depending on the current and next characters
25 : * (when the font has kerning data). Also, various characters have various
26 : * width in a fully dynamic font (i.e. variable size).
27 : *
28 : * Therefore, just an array of meshes would not be enough. The mesh_string
29 : * is a queue which adds the advance amount between each character to the
30 : * meshes of each character.
31 : */
32 :
33 : // self
34 : //
35 : #include <ftmesh/mesh_char.h>
36 :
37 :
38 : // last include
39 : //
40 : #include <snapdev/poison.h>
41 :
42 :
43 :
44 :
45 : namespace ftmesh
46 : {
47 :
48 :
49 9 : mesh_char::mesh_char(mesh::pointer_t mesh, float advance)
50 : : f_mesh(mesh)
51 9 : , f_advance(advance)
52 : {
53 9 : }
54 :
55 :
56 9 : mesh::pointer_t mesh_char::get_mesh() const
57 : {
58 9 : return f_mesh;
59 : }
60 :
61 :
62 9 : float mesh_char::get_advance() const
63 : {
64 9 : return f_advance;
65 : }
66 :
67 :
68 : } // namespace ftmesh
69 : // vim: ts=4 sw=4 et
|