summaryrefslogtreecommitdiff
path: root/src/mbgl/text/tagged_string.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/text/tagged_string.hpp')
-rw-r--r--src/mbgl/text/tagged_string.hpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/mbgl/text/tagged_string.hpp b/src/mbgl/text/tagged_string.hpp
index 476c2225f0..2607e10889 100644
--- a/src/mbgl/text/tagged_string.hpp
+++ b/src/mbgl/text/tagged_string.hpp
@@ -1,17 +1,23 @@
#pragma once
-#include <mbgl/text/glyph.hpp>
#include <mbgl/text/bidi.hpp>
+#include <mbgl/style/expression/formatted.hpp>
+#include <mbgl/util/font_stack.hpp>
namespace mbgl {
struct SectionOptions {
- SectionOptions(double scale_, FontStackHash fontStackHash_)
- : scale(scale_), fontStackHash(fontStackHash_)
+ SectionOptions(double scale_, FontStack fontStack_, optional<Color> textColor_ = nullopt)
+ : scale(scale_),
+ fontStackHash(FontStackHasher()(fontStack_)),
+ fontStack(std::move(fontStack_)),
+ textColor(std::move(textColor_))
{}
double scale;
FontStackHash fontStackHash;
+ FontStack fontStack;
+ optional<Color> textColor;
};
/**
@@ -71,7 +77,11 @@ struct TaggedString {
return styledText;
}
- void addSection(const std::u16string& text, double scale, FontStackHash fontStack);
+ void addSection(const std::u16string& text,
+ double scale,
+ FontStack fontStack,
+ optional<Color> textColor_ = nullopt);
+
const SectionOptions& sectionAt(std::size_t index) const {
return sections.at(index);
}
@@ -88,7 +98,7 @@ struct TaggedString {
void trim();
void verticalizePunctuation();
-
+
private:
StyledText styledText;
std::vector<SectionOptions> sections;