Add offscreen text rendering.
This commit is contained in:
parent
c63138c455
commit
076e32b1d6
17 changed files with 156 additions and 101 deletions
|
@ -0,0 +1,35 @@
|
|||
#include "LatexSymbols.h"
|
||||
|
||||
#include "StringUtils.h"
|
||||
|
||||
std::unordered_map<std::string, std::wstring> LatexSymbolLookup::mSymbols = {
|
||||
{"Psi", L"\u03A8"},
|
||||
{"alpha", L"\u03B1"},
|
||||
{"beta", L"\u03B2"},
|
||||
{"gamma", L"\u03B3"},
|
||||
{"psi", L"\u03C8"}
|
||||
};
|
||||
|
||||
std::optional<std::string> LatexSymbolLookup::getSymbolUtf8(const std::string& tag)
|
||||
{
|
||||
if (auto entry = getSymbolUtf16(tag); entry)
|
||||
{
|
||||
return StringUtils::convert(*entry);
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<std::wstring> LatexSymbolLookup::getSymbolUtf16(const std::string& tag)
|
||||
{
|
||||
if (auto iter = mSymbols.find(tag); iter != mSymbols.end())
|
||||
{
|
||||
return iter->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
|
@ -22,5 +22,10 @@ struct LatexMathSymbol
|
|||
class LatexSymbolLookup
|
||||
{
|
||||
public:
|
||||
std::unordered_map<std::string, LatexMathSymbol> mTags;
|
||||
static std::optional<std::string> getSymbolUtf8(const std::string& tag);
|
||||
|
||||
static std::optional<std::wstring> getSymbolUtf16(const std::string& tag);
|
||||
|
||||
private:
|
||||
static std::unordered_map<std::string, std::wstring> mSymbols;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue