Add initial directwrite to svg conversion.
This commit is contained in:
parent
2c825adc1d
commit
b7f75f903e
15 changed files with 571 additions and 7 deletions
|
@ -1,5 +1,43 @@
|
|||
#include "FontGlyph.h"
|
||||
|
||||
void GlyphRunOutlines::addToFeature(const Point& point)
|
||||
{
|
||||
mFeatures[mFeatures.size() - 1].mPoints.push_back(point);
|
||||
}
|
||||
|
||||
void GlyphRunOutlines::startFeature(const Point& point, bool isFilled)
|
||||
{
|
||||
GlyphRunOutline feature;
|
||||
feature.mFilled = isFilled;
|
||||
feature.mPoints.push_back(point);
|
||||
mFeatures.push_back(feature);
|
||||
}
|
||||
|
||||
const std::vector<GlyphRunOutline> GlyphRunOutlines::getFeatures() const
|
||||
{
|
||||
return mFeatures;
|
||||
}
|
||||
|
||||
std::string GlyphRunOutlines::toPostScriptPath()
|
||||
{
|
||||
std::string path;
|
||||
for (const auto& feature : mFeatures)
|
||||
{
|
||||
if (feature.mPoints.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
auto last_point = feature.mPoints[0];
|
||||
path += "M" + std::to_string(last_point.getX()) + " " + std::to_string(last_point.getY()) + " ";
|
||||
for (std::size_t idx = 1; idx < feature.mPoints.size(); idx++)
|
||||
{
|
||||
path += "L" + std::to_string(feature.mPoints[idx].getX()) + " " + std::to_string(feature.mPoints[idx].getY()) + " ";
|
||||
}
|
||||
path += "z ";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
FontGlyph::FontGlyph(unsigned width, unsigned height, int bearingX, int bearingY,
|
||||
int advanceX, std::unique_ptr<Image<unsigned char> > image)
|
||||
: mImage(std::move(image)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue