2023-02-05 20:36:51 +00:00
|
|
|
#include "TextParser.h"
|
2023-07-30 13:01:56 +00:00
|
|
|
#include "../svg/SvgParser.h"
|
2023-02-05 20:36:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
TextParser::TextParser(juce::String text, juce::Font font) {
|
|
|
|
juce::Path textPath;
|
|
|
|
juce::GlyphArrangement glyphs;
|
|
|
|
glyphs.addFittedText(font, text, -2, -2, 4, 4, juce::Justification::centred, 2);
|
|
|
|
glyphs.createPath(textPath);
|
|
|
|
|
2023-07-30 13:01:56 +00:00
|
|
|
SvgParser::pathToShapes(textPath, shapes);
|
2023-02-05 20:36:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TextParser::~TextParser() {
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<std::unique_ptr<Shape>> TextParser::draw() {
|
|
|
|
// clone with deep copy
|
|
|
|
std::vector<std::unique_ptr<Shape>> tempShapes;
|
|
|
|
|
|
|
|
for (auto& shape : shapes) {
|
|
|
|
tempShapes.push_back(shape->clone());
|
|
|
|
}
|
|
|
|
return tempShapes;
|
|
|
|
}
|