Add initial font metrics and equation rendering.
This commit is contained in:
parent
c2027801be
commit
5ddd54dd6d
24 changed files with 868 additions and 63 deletions
|
@ -4,13 +4,16 @@
|
|||
#include "TestRenderUtils.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
#include "FontItem.h"
|
||||
#include "TextNode.h"
|
||||
#include "LatexSymbols.h"
|
||||
#include "EquationNode.h"
|
||||
#include "LatexMathExpression.h"
|
||||
|
||||
|
||||
TEST_CASE(TestLatexConverter, "publishing")
|
||||
{
|
||||
FontItem font("Cambria Math", 14);
|
||||
auto expression = std::make_unique<LatexMathExpression>("\\psi = \\frac{\\alpha + \\beta}{c}");
|
||||
|
||||
auto equation_node = std::make_unique<EquationNode>(Point(10, 10));
|
||||
equation_node->setContent(expression.get());
|
||||
|
||||
auto psi = LatexSymbolLookup::getSymbolUtf8("psi");
|
||||
auto alpha = LatexSymbolLookup::getSymbolUtf8("alpha");
|
||||
|
@ -20,10 +23,7 @@ TEST_CASE(TestLatexConverter, "publishing")
|
|||
|
||||
TestRenderer renderer(800, 800);
|
||||
|
||||
auto text = std::make_unique<TextNode>(content, Point(10, 10));
|
||||
text->setFont(font);
|
||||
|
||||
renderer.getScene()->addNode(text.get());
|
||||
|
||||
renderer.getScene()->addNode(equation_node.get());
|
||||
renderer.writeSvg(TestUtils::getTestOutputDir(__FILE__) / "out.svg");
|
||||
renderer.write(TestUtils::getTestOutputDir(__FILE__) / "out.png");
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue