parse maxWidth, lineHeight and alignment, pass to FontStack::getShaping
This commit is contained in:
@@ -68,6 +68,12 @@ inline TextPathType textPathType(const std::string& path) {
|
||||
else return TextPathType::Horizontal;
|
||||
};
|
||||
|
||||
inline float alignmentType(const std::string& alignment) {
|
||||
if (alignment == "right") return 1.0f;
|
||||
else if (alignment == "left") return 0.0f;
|
||||
else return 0.5;
|
||||
};
|
||||
|
||||
class BucketGeometryDescription {
|
||||
public:
|
||||
CapType cap = CapType::None;
|
||||
@@ -79,6 +85,9 @@ public:
|
||||
float miter_limit = 2.0f;
|
||||
float round_limit = 1.0f;
|
||||
TextPathType path = TextPathType::Horizontal;
|
||||
float alignment = 0.5;
|
||||
float line_height = 1.2 * 24;
|
||||
float max_width = 15.0f * 24;
|
||||
float padding = 2.0f;
|
||||
float textMinDistance = 250.0f;
|
||||
float rotate = 0.0f; // what is this?
|
||||
|
||||
@@ -30,7 +30,14 @@ public:
|
||||
void insert(uint32_t id, const SDFGlyph &glyph);
|
||||
const std::map<uint32_t, GlyphMetrics> &getMetrics() const;
|
||||
const std::map<uint32_t, SDFGlyph> &getSDFs() const;
|
||||
const Shaping getShaping(const std::u32string &string) const;
|
||||
const Shaping getShaping(const std::u32string &string,
|
||||
const float &maxWidth,
|
||||
const float &lineHeight,
|
||||
const float &alignment) const;
|
||||
Shaping lineWrap(Shaping shaped,
|
||||
const float &lineHeight,
|
||||
const float &maxWidth,
|
||||
const float &alignment) const;
|
||||
|
||||
private:
|
||||
std::map<uint32_t, std::string> bitmaps;
|
||||
|
||||
@@ -20,8 +20,6 @@ public:
|
||||
const BucketGeometryDescription &info,
|
||||
const GlyphPositions &face,
|
||||
const Shaping &shaping);
|
||||
float measureText(const GlyphPositions &face,
|
||||
const Shaping &shaping);
|
||||
|
||||
private:
|
||||
const int8_t zoom;
|
||||
|
||||
Reference in New Issue
Block a user