summaryrefslogtreecommitdiff
path: root/src/mbgl/text/glyph_pbf.hpp
blob: 162aeed93a1587f69b6bc90c8ce1691d447a0e6d (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
#pragma once

#include <mbgl/text/glyph.hpp>
#include <mbgl/text/glyph_range.hpp>
#include <mbgl/util/image.hpp>

#include <string>
#include <vector>

namespace mbgl {

class SDFGlyph {
public:
    // We're using this value throughout the Mapbox GL ecosystem. If this is different, the glyphs
    // also need to be reencoded.
    static constexpr const uint8_t borderSize = 3;

    GlyphID id = 0;

    // A signed distance field of the glyph with a border (see above).
    AlphaImage bitmap;

    // Glyph metrics
    GlyphMetrics metrics;
};

std::vector<SDFGlyph> parseGlyphPBF(const GlyphRange&, const std::string& data);

} // namespace mbgl