36 lines
906 B
C++
36 lines
906 B
C++
|
#include "TestFramework.h"
|
||
|
#include "TestUtils.h"
|
||
|
|
||
|
#include "DirectWriteHelpers.h"
|
||
|
#include "DirectWriteFontEngine.h"
|
||
|
#include "FileLogger.h"
|
||
|
|
||
|
#include "SvgDocument.h"
|
||
|
#include "SvgWriter.h"
|
||
|
#include "SvgShapeElements.h"
|
||
|
#include "File.h"
|
||
|
|
||
|
TEST_CASE(TestDirectWriteFontEngine, "fonts")
|
||
|
{
|
||
|
DirectWriteFontEngine font_engine;
|
||
|
font_engine.initialize();
|
||
|
|
||
|
auto glyph_run_outlines = font_engine.getGlyphRunOutlines({ 66 });
|
||
|
auto path = glyph_run_outlines->toPostScriptPath();
|
||
|
|
||
|
auto doc = std::make_unique<SvgDocument>();
|
||
|
|
||
|
auto element = std::make_unique<SvgPath>();
|
||
|
element->setPath(path);
|
||
|
element->setFillRule("evenodd");
|
||
|
|
||
|
doc->getRoot()->addChild(std::move(element));
|
||
|
doc->setViewBox(-20.0, -20.0, 40.0, 40.0);
|
||
|
|
||
|
auto writer = std::make_unique<SvgWriter>();
|
||
|
auto doc_string = writer->toString(doc.get());
|
||
|
|
||
|
File file(TestUtils::getTestOutputDir(__FILE__) / "out.svg");
|
||
|
file.writeText(doc_string);
|
||
|
|
||
|
}
|