Add initial font metrics and equation rendering.

This commit is contained in:
jmsgrogan 2023-01-25 16:51:36 +00:00
parent c2027801be
commit 5ddd54dd6d
24 changed files with 868 additions and 63 deletions

View file

@ -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");
};