summaryrefslogtreecommitdiff
path: root/src/mbgl/text/font.hpp
blob: 65e471ed1816941bf0ffc3100bc65b8221085af6 (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
#ifndef MBGL_TEXT_FONT
#define MBGL_TEXT_FONT

#include <mbgl/text/glyph.hpp>
#include <mbgl/util/math.hpp>

#include <string>

#include <harfbuzz/hb.h>
#include <harfbuzz/hb-ft.h>

namespace mbgl {

class Font {
public:
    Font(const std::string &filename);
    ~Font();

    Shaping shape(const std::u32string &text, const float spacing, const vec2<float> &translate, const std::map<uint32_t, SDFGlyph> &sdfs);

private:
    void load();

    std::string filename_;
    std::vector<FT_Face> ft_faces;
    hb_font_t *font_;
    hb_buffer_t *buffer_;
    unsigned int upem_;
    double size = 0.0;
};

} // end namespace mbgl

#endif