Add initial directwrite to svg conversion.
This commit is contained in:
parent
2c825adc1d
commit
b7f75f903e
15 changed files with 571 additions and 7 deletions
|
@ -7,6 +7,10 @@ if(UNIX)
|
|||
fonts/TestFreeTypeFontEngine.cpp
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
set(PLATFORM_UNIT_TEST_FILES
|
||||
fonts/TestDirectWriteFontEngine.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
|
|
36
test/fonts/TestDirectWriteFontEngine.cpp
Normal file
36
test/fonts/TestDirectWriteFontEngine.cpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
#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);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue