FontEngine: remove hinting (exists in FontDescripion class) and let child classes handle it.
This commit is contained in:
parent
6e14209aae
commit
f72178ffd0
5 changed files with 8 additions and 31 deletions
2
bam.lua
2
bam.lua
|
|
@ -154,9 +154,9 @@ local graphics_module = Module("source/Graphics", {
|
|||
"Texture.cpp",
|
||||
|
||||
-- Text
|
||||
"Font/Engine/FontEngine.cpp",
|
||||
"Font/Engine/FreeTypeEngine.cpp",
|
||||
"Font/Engine/FreeTypeError.cpp",
|
||||
"Font/FontDescription.cpp",
|
||||
"Font.cpp",
|
||||
"Text.cpp",
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
|
||||
#include "FontEngine.h"
|
||||
|
||||
namespace sp {
|
||||
|
||||
FontEngine::FontEngine() :
|
||||
m_hinting (true)
|
||||
{
|
||||
}
|
||||
|
||||
void FontEngine::setHinting(bool value)
|
||||
{
|
||||
m_hinting = value;
|
||||
}
|
||||
|
||||
} // namespace sp
|
||||
|
|
@ -12,11 +12,6 @@ namespace sp {
|
|||
class FontEngine
|
||||
{
|
||||
public :
|
||||
|
||||
FontEngine();
|
||||
|
||||
void setHinting(bool value);
|
||||
|
||||
virtual bool setCharacterSize(unsigned int size) = 0;
|
||||
|
||||
virtual bool loadFromFile(const std::string& filename) = 0;
|
||||
|
|
@ -24,11 +19,6 @@ public :
|
|||
virtual Glyph loadGlyph(unsigned int codepoint, Image& img, unsigned int outlineSize = 0) = 0;
|
||||
|
||||
virtual std::string getName() = 0;
|
||||
|
||||
protected :
|
||||
|
||||
// True if hinting is enabled. false otherwise.
|
||||
bool m_hinting;
|
||||
};
|
||||
|
||||
} // namespace sp
|
||||
|
|
|
|||
|
|
@ -58,8 +58,9 @@ LibWrapper::~LibWrapper()
|
|||
}
|
||||
}
|
||||
|
||||
FreeTypeEngine::FreeTypeEngine() :
|
||||
m_face (NULL)
|
||||
FreeTypeEngine::FreeTypeEngine(FontDescription desc) :
|
||||
m_face (NULL),
|
||||
m_desc (desc)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -113,7 +114,7 @@ Glyph FreeTypeEngine::loadGlyph(unsigned int codepoint, Image& img, unsigned int
|
|||
flags |= FT_LOAD_NO_BITMAP;
|
||||
}
|
||||
|
||||
if (m_hinting) {
|
||||
if (m_desc.isHintingEnabled()) {
|
||||
flags |= FT_LOAD_FORCE_AUTOHINT;
|
||||
} else {
|
||||
flags |= FT_LOAD_NO_AUTOHINT;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include FT_FREETYPE_H
|
||||
|
||||
#include <string>
|
||||
#include <Spectre/Graphics/Font/FontDescription.h>
|
||||
#include "FontEngine.h"
|
||||
|
||||
namespace sp {
|
||||
|
|
@ -13,7 +14,7 @@ namespace sp {
|
|||
class FreeTypeEngine : public FontEngine
|
||||
{
|
||||
public:
|
||||
FreeTypeEngine();
|
||||
FreeTypeEngine(FontDescription desc = FontDescription());
|
||||
~FreeTypeEngine();
|
||||
|
||||
virtual bool setCharacterSize(unsigned int size);
|
||||
|
|
@ -27,6 +28,7 @@ public:
|
|||
private :
|
||||
|
||||
FT_Face m_face;
|
||||
FontDescription m_desc;
|
||||
};
|
||||
|
||||
} // namespace sp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue