diff --git a/bam.lua b/bam.lua index 8379d00..3fd8c7f 100644 --- a/bam.lua +++ b/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", diff --git a/source/Graphics/Font/Engine/FontEngine.cpp b/source/Graphics/Font/Engine/FontEngine.cpp deleted file mode 100644 index f672f7e..0000000 --- a/source/Graphics/Font/Engine/FontEngine.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -#include "FontEngine.h" - -namespace sp { - -FontEngine::FontEngine() : -m_hinting (true) -{ -} - -void FontEngine::setHinting(bool value) -{ - m_hinting = value; -} - -} // namespace sp diff --git a/source/Graphics/Font/Engine/FontEngine.h b/source/Graphics/Font/Engine/FontEngine.h index 8c03b12..4d400a7 100644 --- a/source/Graphics/Font/Engine/FontEngine.h +++ b/source/Graphics/Font/Engine/FontEngine.h @@ -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 diff --git a/source/Graphics/Font/Engine/FreeTypeEngine.cpp b/source/Graphics/Font/Engine/FreeTypeEngine.cpp index 1ed4e34..83f66af 100644 --- a/source/Graphics/Font/Engine/FreeTypeEngine.cpp +++ b/source/Graphics/Font/Engine/FreeTypeEngine.cpp @@ -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; diff --git a/source/Graphics/Font/Engine/FreeTypeEngine.h b/source/Graphics/Font/Engine/FreeTypeEngine.h index 6a8403e..98b19ae 100644 --- a/source/Graphics/Font/Engine/FreeTypeEngine.h +++ b/source/Graphics/Font/Engine/FreeTypeEngine.h @@ -6,6 +6,7 @@ #include FT_FREETYPE_H #include +#include #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