summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/graphics/text.cpp1
-rw-r--r--src/graphics/textureFont.cpp16
-rw-r--r--src/graphics/textureFont.h7
3 files changed, 22 insertions, 2 deletions
diff --git a/src/graphics/text.cpp b/src/graphics/text.cpp
index 43e8be1..7b135d6 100644
--- a/src/graphics/text.cpp
+++ b/src/graphics/text.cpp
@@ -5,6 +5,7 @@ using namespace Graphics;
template <>
void Text<TextureFont>::arrange(TextureFont &font){
// TODO: this is really awful rendering but works a little bit
+ // Add getLineSpacing + getKerning and so on
unsigned int filledX = 0;
unsigned int row = 0;
unsigned int col = 0;
diff --git a/src/graphics/textureFont.cpp b/src/graphics/textureFont.cpp
index 3be2444..d39677e 100644
--- a/src/graphics/textureFont.cpp
+++ b/src/graphics/textureFont.cpp
@@ -37,6 +37,20 @@ const sf::Glyph & TextureFont::getGlyph(char ch) const{
return pair->second;
}
-const sf::Texture * TextureFont::getTexture(unsigned int _){
+const sf::Texture * TextureFont::getTexture(...){
return &tex_;
}
+
+float TextureFont::getLineSpacing(...){
+ // TODO make sure this is the appropiate measurement, it might be
+ // smaller...
+ // SFML obtains that from freetype face->metrics.height which only includes
+ // the height from the baseline, then that's corrected in sf::Text with an
+ // spacing ratio -> just test with a font and see what's supposed to do
+ return glyphSize_.y;
+}
+
+float TextureFont::getKerning(...){
+ // Monospaced fonts have 0 kerning
+ return 0;
+}
diff --git a/src/graphics/textureFont.h b/src/graphics/textureFont.h
index f3f194a..224d300 100644
--- a/src/graphics/textureFont.h
+++ b/src/graphics/textureFont.h
@@ -22,7 +22,12 @@ namespace Graphics {
public:
TextureFont(const sf::Texture &texture, Descr desc);
const sf::Glyph &getGlyph(char ch) const;
- const sf::Texture *getTexture(unsigned int _);
+
+ // Doesn't control sizes or anything, they are like this to be
+ // compatible with sf::Font somehow.
+ const sf::Texture *getTexture(...);
+ float getLineSpacing(...);
+ float getKerning(...);
};
}