summaryrefslogtreecommitdiff
path: root/src/mbgl/text/glyph_set.hpp
blob: 3037cefca01a77c795cb8e4dc58ec14cfe656e3f (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
36
37
38
39
40
41
42
43
#pragma once

#include <mbgl/text/bidi.hpp>
#include <mbgl/text/glyph.hpp>
#include <mbgl/util/geometry.hpp>

namespace mbgl {

class GlyphSet {
public:
    void insert(uint32_t id, SDFGlyph&&);
    const std::map<uint32_t, SDFGlyph>& getSDFs() const;
    const Shaping getShaping(const std::u16string& string,
                             float maxWidth,
                             float lineHeight,
                             float horizontalAlign,
                             float verticalAlign,
                             float justify,
                             float spacing,
                             const Point<float>& translate,
                             BiDi& bidi) const;

private:
    float determineAverageLineWidth(const std::u16string& logicalInput,
                                        const float spacing,
                                        float maxWidth) const;
    std::set<std::size_t> determineLineBreaks(const std::u16string& logicalInput,
                                          const float spacing,
                                          float maxWidth) const;

    void shapeLines(Shaping& shaping,
                    const std::vector<std::u16string>& lines,
                    const float spacing,
                    float lineHeight,
                    float horizontalAlign,
                    float verticalAlign,
                    float justify,
                    const Point<float>& translate) const;

    std::map<uint32_t, SDFGlyph> sdfs;
};

} // end namespace mbgl