summaryrefslogtreecommitdiff
path: root/src/graphics/textureFont.h
blob: 224d300a8eef3d1df1ca0c9c8de4a0bf24dde76a (plain)
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
33
34
35
#ifndef GRAPHICS_FONT_H
#define GRAPHICS_FONT_H

#include<string>
#include<array>
#include<SFML/Graphics.hpp>

namespace Graphics {
    class TextureFont {
        public:
        struct Descr {
            std::string mapping;
            unsigned int numrows, numcols;
        };
        private:
            using GlyphTable = std::map<char, sf::Glyph>;
            GlyphTable glyphTable_;

            const sf::Texture &tex_;
            const Descr description_;
            sf::Vector2i glyphSize_;
        public:
            TextureFont(const sf::Texture &texture, Descr desc);
            const sf::Glyph &getGlyph(char ch) const;

            // 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(...);
    };

}

#endif // GRAPHICS_FONT_H