xoreos
0.0.5
src
graphics
aurora
ttffont.h
Go to the documentation of this file.
1
/* xoreos - A reimplementation of BioWare's Aurora engine
2
*
3
* xoreos is the legal property of its developers, whose names
4
* can be found in the AUTHORS file distributed with this source
5
* distribution.
6
*
7
* xoreos is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 3
10
* of the License, or (at your option) any later version.
11
*
12
* xoreos 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 General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19
*/
20
25
#ifndef GRAPHICS_AURORA_TTFFONT_H
26
#define GRAPHICS_AURORA_TTFFONT_H
27
28
#include <vector>
29
#include <map>
30
31
#include "
src/common/types.h
"
32
#include "
src/common/scopedptr.h
"
33
#include "
src/common/ptrvector.h
"
34
35
#include "
src/graphics/font.h
"
36
37
#include "
src/graphics/aurora/texturehandle.h
"
38
39
namespace
Common
{
40
class
UString;
41
}
42
43
namespace
Graphics
{
44
45
class
Surface;
46
class
TTFRenderer;
47
48
namespace
Aurora
{
49
50
class
TTFFont
:
public
Graphics::Font
{
51
public
:
52
TTFFont
(
Common::SeekableReadStream
*ttf,
int
height);
53
TTFFont
(
const
Common::UString
&name,
int
height);
54
~TTFFont
();
55
56
float
getWidth
(
uint32
c)
const
;
57
float
getHeight
()
const
;
58
59
void
draw
(
uint32
c)
const
;
60
61
void
buildChars
(
const
Common::UString
&str);
62
63
private
:
65
struct
Page
{
66
Surface
*
surface
;
67
TextureHandle
texture
;
68
69
bool
needRebuild
;
70
71
uint32
curX
;
72
uint32
curY
;
73
74
uint32
heightLeft
;
75
uint32
widthLeft
;
76
77
Page
();
78
79
void
rebuild
();
80
};
81
83
struct
Char
{
84
float
width
;
85
86
float
tX
[4],
tY
[4];
87
float
vX
[4],
vY
[4];
88
89
size_t
page
;
90
};
91
92
93
Common::ScopedPtr<TTFRenderer>
_ttf
;
94
95
Common::PtrVector<Page>
_pages
;
96
std::map<uint32, Char>
_chars
;
97
98
std::map<uint32, Char>::const_iterator
_missingChar
;
99
float
_missingWidth
;
100
101
uint32
_height
;
102
103
void
load
(
Common::SeekableReadStream
*ttf,
int
height);
104
105
void
rebuildPages
();
106
void
addChar
(
uint32
c);
107
void
drawMissing
()
const
;
108
};
109
110
}
// End of namespace Aurora
111
112
}
// End of namespace Graphics
113
114
#endif // GRAPHICS_AURORA_TTFFONT_H
Graphics::Aurora::TTFFont::Page::surface
Surface * surface
Definition:
ttffont.h:66
Graphics::Aurora::TTFFont::Page::curX
uint32 curX
Definition:
ttffont.h:71
Graphics::Aurora::TTFFont::Page::needRebuild
bool needRebuild
Definition:
ttffont.h:69
Graphics::Aurora::TTFFont::Page
A texture page filled with characters.
Definition:
ttffont.h:65
Common
Definition:
2dafile.h:39
Graphics::Aurora::TTFFont::_missingWidth
float _missingWidth
Definition:
ttffont.h:99
Common::UString
A class holding an UTF-8 string.
Definition:
ustring.h:48
Graphics::Aurora::TTFFont::Page::heightLeft
uint32 heightLeft
Definition:
ttffont.h:74
Graphics::Aurora::TTFFont::Page::rebuild
void rebuild()
Definition:
ttffont.cpp:58
Graphics::Aurora::TTFFont::_ttf
Common::ScopedPtr< TTFRenderer > _ttf
Definition:
ttffont.h:93
Graphics::Aurora::TTFFont::buildChars
void buildChars(const Common::UString &str)
Build all necessary characters to display this string.
Definition:
ttffont.cpp:169
Graphics::Aurora::TTFFont::rebuildPages
void rebuildPages()
Definition:
ttffont.cpp:176
Graphics::Aurora::TTFFont::Char::width
float width
Definition:
ttffont.h:84
texturehandle.h
A handle to an Aurora texture.
Graphics::Aurora::TTFFont::getHeight
float getHeight() const
Return the height of a character.
Definition:
ttffont.cpp:124
scopedptr.h
A simple scoped smart pointer template.
Common::PtrVector
A vector of pointer to objects, with automatic deletion.
Definition:
ptrvector.h:44
Graphics::Aurora::TTFFont::Page::curY
uint32 curY
Definition:
ttffont.h:72
Graphics::Aurora::TTFFont
Definition:
ttffont.h:50
Aurora
Definition:
2dafile.cpp:51
Graphics::Aurora::TTFFont::~TTFFont
~TTFFont()
Definition:
ttffont.cpp:79
Graphics::Aurora::TTFFont::Char::tX
float tX[4]
Definition:
ttffont.h:86
Graphics::Aurora::TTFFont::getWidth
float getWidth(uint32 c) const
Return the width of a character.
Definition:
ttffont.cpp:116
Graphics::Aurora::TTFFont::draw
void draw(uint32 c) const
Draw this character.
Definition:
ttffont.cpp:143
types.h
Low-level type definitions to handle fixed width types portably.
Graphics::Aurora::TTFFont::Char::vY
float vY[4]
Definition:
ttffont.h:87
Graphics::Font
An abstract font.
Definition:
font.h:39
Graphics::Aurora::TTFFont::Page::Page
Page()
Definition:
ttffont.cpp:49
ptrvector.h
A vector storing pointer to objects, with automatic deletion.
Graphics::Aurora::TTFFont::Page::widthLeft
uint32 widthLeft
Definition:
ttffont.h:75
Common::ScopedPtr
A scoped plain pointer, allowing pointer-y access and normal deletion.
Definition:
scopedptr.h:120
Graphics::Aurora::TTFFont::Char::page
size_t page
Definition:
ttffont.h:89
Graphics::Aurora::TTFFont::TTFFont
TTFFont(Common::SeekableReadStream *ttf, int height)
Definition:
ttffont.cpp:67
Graphics::Aurora::TTFFont::addChar
void addChar(uint32 c)
Definition:
ttffont.cpp:181
Graphics::Aurora::TTFFont::Char::tY
float tY[4]
Definition:
ttffont.h:86
Graphics::Aurora::TTFFont::_height
uint32 _height
Definition:
ttffont.h:101
Graphics::Aurora::TTFFont::Char::vX
float vX[4]
Definition:
ttffont.h:87
uint32
uint32_t uint32
Definition:
types.h:204
Graphics::Aurora::TTFFont::drawMissing
void drawMissing() const
Definition:
ttffont.cpp:128
Graphics::Aurora::TTFFont::_missingChar
std::map< uint32, Char >::const_iterator _missingChar
Definition:
ttffont.h:98
Graphics::Aurora::TTFFont::Char
A font character.
Definition:
ttffont.h:83
Graphics::Surface
Definition:
surface.h:32
Graphics
Definition:
loadprogress.h:33
Graphics::Aurora::TTFFont::_pages
Common::PtrVector< Page > _pages
Definition:
ttffont.h:95
Graphics::Aurora::TTFFont::load
void load(Common::SeekableReadStream *ttf, int height)
Definition:
ttffont.cpp:82
Graphics::Aurora::TTFFont::_chars
std::map< uint32, Char > _chars
Definition:
ttffont.h:96
Graphics::Aurora::TextureHandle
A handle to a texture.
Definition:
texturehandle.h:51
Graphics::Aurora::TTFFont::Page::texture
TextureHandle texture
Definition:
ttffont.h:67
Common::SeekableReadStream
Interface for a seekable & readable data stream.
Definition:
readstream.h:265
font.h
A font.
Generated on Sun Nov 18 2018 15:13:41 for xoreos by
1.8.14