Add offscreen text rendering.
This commit is contained in:
parent
c63138c455
commit
076e32b1d6
17 changed files with 156 additions and 101 deletions
|
@ -1,22 +1,29 @@
|
|||
#include "TestFramework.h"
|
||||
#include "TestUtils.h"
|
||||
|
||||
#include "TestRenderUtils.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
#include "File.h"
|
||||
|
||||
#include <iostream>
|
||||
#include "FontItem.h"
|
||||
#include "TextNode.h"
|
||||
#include "LatexSymbols.h"
|
||||
|
||||
TEST_CASE(TestLatexConverter, "publishing")
|
||||
{
|
||||
std::wstring out = L"\u03A8";
|
||||
std::wcout << out << std::endl;
|
||||
FontItem font("Cambria Math", 14);
|
||||
|
||||
auto psi = LatexSymbolLookup::getSymbolUtf8("psi");
|
||||
auto alpha = LatexSymbolLookup::getSymbolUtf8("alpha");
|
||||
auto beta = LatexSymbolLookup::getSymbolUtf8("beta");
|
||||
|
||||
std::string out_c = StringUtils::convert(out);
|
||||
auto content = *psi + " " + *alpha + " " + *beta + " ";
|
||||
|
||||
File file(TestUtils::getTestOutputDir(__FILE__) / "utf8_render.dat");
|
||||
file.writeText(out_c);
|
||||
TestRenderer renderer(800, 800);
|
||||
|
||||
//std::cout << out_c << std::endl;
|
||||
auto text = std::make_unique<TextNode>(content, Point(10, 10));
|
||||
text->setFont(font);
|
||||
|
||||
renderer.getScene()->addNode(text.get());
|
||||
|
||||
renderer.write(TestUtils::getTestOutputDir(__FILE__) / "out.png");
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue