diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2022-12-13 19:58:50 +0100 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2022-12-14 15:57:07 +0100 |
commit | 02fe1199884d1056a3282268a8c75b3f086bfc9d (patch) | |
tree | dff312cbe6aa7131f3b442750f03e5ce4d7c416a /src/graphics/textureFont.cpp | |
parent | e45e92e0ff294e6a1899b01b8cfdd8ab25d8dcdc (diff) |
Sketch a proper font rendering infrastructure:
- Kerning
- LineSpacing
- ...
We should include that for a proper interaction with Graphics::Text
and to be able to render beautiful UIs.
Also, we need to discard spaces in newlines, break lines by word, and
that kind of things... We'll see.
Diffstat (limited to 'src/graphics/textureFont.cpp')
-rw-r--r-- | src/graphics/textureFont.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
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; +} |