summaryrefslogtreecommitdiff
path: root/src/mbgl/text/shaping.hpp
blob: b7eee5a5dbe8ff5ec609a77681305ddf9087cca4 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once

#include <mbgl/text/glyph.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/style/image.hpp>
#include <mbgl/util/optional.hpp>

namespace mbgl {

class SpriteAtlasElement;
class SymbolFeature;
class BiDi;

class PositionedIcon {
private:
    PositionedIcon(const SpriteAtlasElement& image_,
                   float top_,
                   float bottom_,
                   float left_,
                   float right_,
                   float angle_)
        : _image(image_),
          _top(top_),
          _bottom(bottom_),
          _left(left_),
          _right(right_),
          _angle(angle_) {}

    optional<SpriteAtlasElement> _image;
    float _top;
    float _bottom;
    float _left;
    float _right;
    float _angle;

public:
    static optional<PositionedIcon> shapeIcon(const class SpriteAtlasElement&, const std::array<float, 2>& iconOffset, const float iconRotation);

    optional<class SpriteAtlasElement> image() const { return _image; }
    float top() const { return _top; }
    float bottom() const { return _bottom; }
    float left() const { return _left; }
    float right() const { return _right; }
    float angle() const { return _angle; }
};

const Shaping getShaping(const std::u16string& string,
                         float maxWidth,
                         float lineHeight,
                         float horizontalAlign,
                         float verticalAlign,
                         float justify,
                         float spacing,
                         const Point<float>& translate,
                         float verticalHeight,
                         const WritingModeType,
                         BiDi& bidi,
                         const GlyphPositions& glyphs);

} // namespace mbgl