-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathfont.cpp
More file actions
32 lines (27 loc) · 868 Bytes
/
font.cpp
File metadata and controls
32 lines (27 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <fea/rendering/font.hpp>
#include <fea/rendering/textsurface.hpp>
#include <fea/assert.hpp>
#include <sstream>
#include <sys/stat.h>
namespace fea
{
InvalidFontException::InvalidFontException(const std::string& message) : std::runtime_error(message)
{
}
Font::Font(const std::string& path, const float size) : mFontPath(path), mFontSize(size)
{
FEA_ASSERT(size > 0.0f, "Size of fonts must be a non-zero positive integer! " + std::to_string(size) + " provided.");
}
const std::string& Font::getPath() const
{
return mFontPath;
}
float Font::getSize() const
{
return mFontSize;
}
bool Font::operator==(const Font& other) const
{
return mFontPath == other.mFontPath && (uint32_t)(mFontSize * 100.0f) == (uint32_t)(other.mFontSize * 100.0f);
}
}