MODIFIED: Synchronization of JKQTMathText and JKQTBasePlotter over threads: using read/write lockers now and removed some unnecessary mutexes by using a kind of singleton pattern

This commit is contained in:
jkriege2 2024-01-05 23:26:47 +01:00
parent 11b9ac6c8b
commit 9662ed2d69
29 changed files with 1636 additions and 1638 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

View File

@ -94,10 +94,13 @@ This test results in the following numbers (on my AMD Ryzen5 8/16-core laptop):
[comment]:RESULTS
<u><b>SERIAL RESULTS:</b></u><br/>runtime, overall = 1822.3ms<br/>single runtimes = (227.7 +/- 306.8) ms<br/>speedup = 1.00x<br/>threads / available = 1 / 16<br/><br/>
<b>VERSION:</b> 5.0.0
<b>BUILD MODE:</b> Release
<u><b>SERIAL RESULTS:</b></u><br/>runtime, overall = 1896.0ms<br/>single runtimes = (236.9 +/- 379.1) ms<br/>speedup = 1.00x<br/>threads / available = 1 / 16<br/><br/>
<u><b>PARALLEL RESULTS:</b></u><br/>
runtime, overall = 811.1ms<br/>single runtimes = (760.8 +/- 63.8) ms<br/>speedup = 7.50x<br/>threads / available = 8 / 16<br/><br/><b>speedup vs. serial = 2.2x</b>
runtime, overall = 624.7ms<br/>single runtimes = (564.3 +/- 107.7) ms<br/>speedup = 7.23x<br/>threads / available = 8 / 16<br/><br/><b>speedup vs. serial = 3.0x</b>
[comment]:RESULTS_END

View File

@ -15,6 +15,7 @@
#include "multithreaded_thread.h"
#include "jkqtmath/jkqtpstatbasics.h"
#include "jkqtpexampleapplication.h"
#include "jkqtplotter_version.h"
#define NUM_SHOWN_PLOTS 3
#define NUM_PLOTS 8
@ -129,7 +130,9 @@ int main(int argc, char* argv[])
const auto iend=md.indexOf("[comment]:RESULTS_END");
qDebug()<<" istart="<<istart<<", iend="<<iend;
if (istart>=0 && iend>istart) {
const QByteArray newResults="[comment]:RESULTS\n\n<u><b>SERIAL RESULTS:</b></u><br/>"+ser_result.toUtf8()
const QByteArray newResults="[comment]:RESULTS\n\n<b>VERSION:</b> "+QByteArray(JKQTPLOTTER_VERSION::PROJECT_VERSION)
+"\n<b>BUILD MODE:</b> "+QByteArray(JKQTPLOTTER_VERSION::PROJECT_BUILDTYPE)
+"\n\n<u><b>SERIAL RESULTS:</b></u><br/>"+ser_result.toUtf8()
+"\n\n<u><b>PARALLEL RESULTS:</b></u><br/>\n"+par_result.toUtf8()+"\n\n";
md.replace(istart,iend-istart,newResults);
if (f.open(QFile::WriteOnly)) {

View File

@ -40,7 +40,9 @@ const int JKQTPImageTools::NDEFAULTSTEPS = 5;
QMap<int, JKQTPImageTools::LUTData > JKQTPImageTools::global_jkqtpimagetools_lutstore = JKQTPImageTools::getDefaultLUTs();
int JKQTPImageTools::global_next_userpalette = JKQTPMathImageFIRST_REGISTERED_USER_PALETTE;
std::mutex JKQTPImageTools::lutMutex;
QReadWriteLock JKQTPImageTools::lutMutex;
QStringList JKQTPImageTools::getPredefinedPalettesGlobalList = QStringList();
QStringList JKQTPImageTools::getPredefinedPalettesMachineReadableGlobalList = QStringList();
@ -2040,38 +2042,44 @@ bool JKQTPImagePlot_QPairCompareFirst(const QPair<T1, T2> &s1, const QPair<T1, T
}
QStringList JKQTPImageTools::getPredefinedPalettes() {
std::lock_guard<std::mutex> lock(JKQTPImageTools::lutMutex);
static QStringList sl;
QReadLocker lock(&JKQTPImageTools::lutMutex);
if (sl.size()!=JKQTPImageTools::global_jkqtpimagetools_lutstore.size()) {
sl.clear();
for (auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.begin(); it!=JKQTPImageTools::global_jkqtpimagetools_lutstore.end(); ++it) {
if (it.key()>=0 && it.key()<=JKQTPMathImageLAST_POSSIBLE_REGISTERED_USER_PALETTE) {
if (it.value().nameT.size()!=0) sl<<it.value().nameT;
else if (it.value().name.size()!=0) sl<<it.value().name;
else sl<<QString(QObject::tr("Palette")+" #"+QString::number(it.key()));
if (getPredefinedPalettesGlobalList.size()!=JKQTPImageTools::global_jkqtpimagetools_lutstore.size()) {
lock.unlock();
QWriteLocker lock(&JKQTPImageTools::lutMutex);
if (getPredefinedPalettesGlobalList.size()!=JKQTPImageTools::global_jkqtpimagetools_lutstore.size()) {
getPredefinedPalettesGlobalList.clear();
for (auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.begin(); it!=JKQTPImageTools::global_jkqtpimagetools_lutstore.end(); ++it) {
if (it.key()>=0 && it.key()<=JKQTPMathImageLAST_POSSIBLE_REGISTERED_USER_PALETTE) {
if (it.value().nameT.size()!=0) getPredefinedPalettesGlobalList<<it.value().nameT;
else if (it.value().name.size()!=0) getPredefinedPalettesGlobalList<<it.value().name;
else getPredefinedPalettesGlobalList<<QString(QObject::tr("Palette")+" #"+QString::number(it.key()));
}
}
}
}
return sl;
return getPredefinedPalettesGlobalList;
}
QStringList JKQTPImageTools::getPredefinedPalettesMachineReadable() {
std::lock_guard<std::mutex> lock(JKQTPImageTools::lutMutex);
static QStringList sl;
QReadLocker lock(&JKQTPImageTools::lutMutex);
if (sl.size()!=JKQTPImageTools::global_jkqtpimagetools_lutstore.size()) {
sl.clear();
for (auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.begin(); it!=JKQTPImageTools::global_jkqtpimagetools_lutstore.end(); ++it) {
if (it.key()>=0) {
if (it.value().name.size()!=0) sl<<it.value().name;
else if (it.value().nameT.size()!=0) sl<<it.value().nameT;
else sl<<QString("palette #"+QString::number(it.key()));
if (getPredefinedPalettesMachineReadableGlobalList.size()!=JKQTPImageTools::global_jkqtpimagetools_lutstore.size()) {
lock.unlock();
QWriteLocker lock(&JKQTPImageTools::lutMutex);
if (getPredefinedPalettesMachineReadableGlobalList.size()!=JKQTPImageTools::global_jkqtpimagetools_lutstore.size()) {
getPredefinedPalettesMachineReadableGlobalList.clear();
for (auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.begin(); it!=JKQTPImageTools::global_jkqtpimagetools_lutstore.end(); ++it) {
if (it.key()>=0) {
if (it.value().name.size()!=0) getPredefinedPalettesMachineReadableGlobalList<<it.value().name;
else if (it.value().nameT.size()!=0) getPredefinedPalettesMachineReadableGlobalList<<it.value().nameT;
else getPredefinedPalettesMachineReadableGlobalList<<QString("palette #"+QString::number(it.key()));
}
}
}
}
return sl;
return getPredefinedPalettesMachineReadableGlobalList;
}
@ -2080,7 +2088,7 @@ QStringList JKQTPImageTools::getPredefinedPalettesMachineReadable() {
QString JKQTPImageTools::JKQTPMathImageColorPalette2String(JKQTPMathImageColorPalette p)
{
std::lock_guard<std::mutex> lock(JKQTPImageTools::lutMutex);
QReadLocker lock(&JKQTPImageTools::lutMutex);
auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.find(p);
if (it==JKQTPImageTools::global_jkqtpimagetools_lutstore.end()) return QString::number(static_cast<int>(p));
else {
@ -2091,7 +2099,7 @@ QString JKQTPImageTools::JKQTPMathImageColorPalette2String(JKQTPMathImageColorPa
QString JKQTPImageTools::JKQTPMathImageColorPalette2StringHumanReadable(JKQTPMathImageColorPalette p)
{
std::lock_guard<std::mutex> lock(JKQTPImageTools::lutMutex);
QReadLocker lock(&JKQTPImageTools::lutMutex);
auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.find(p);
if (it==JKQTPImageTools::global_jkqtpimagetools_lutstore.end()) return QString::number(static_cast<int>(p));
else {
@ -2103,7 +2111,7 @@ QString JKQTPImageTools::JKQTPMathImageColorPalette2StringHumanReadable(JKQTPMat
JKQTPMathImageColorPalette JKQTPImageTools::String2JKQTPMathImageColorPalette(const QString &p)
{
std::lock_guard<std::mutex> lock(JKQTPImageTools::lutMutex);
QReadLocker lock(&JKQTPImageTools::lutMutex);
for (auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.begin(); it!=JKQTPImageTools::global_jkqtpimagetools_lutstore.end(); ++it) {
if (QString::compare(p, it.value().name, Qt::CaseInsensitive)==0) {
return static_cast<JKQTPMathImageColorPalette>(it.key());
@ -2234,7 +2242,7 @@ QVector<QColor> JKQTPImageTools::getColorsforPalette(JKQTPMathImageColorPalette
int JKQTPImageTools::registerPalette(const QString &name, const JKQTPImageTools::LUTType &paletteLut, const QString &nameT)
{
std::lock_guard<std::mutex> lock(JKQTPImageTools::lutMutex);
QWriteLocker lock(&JKQTPImageTools::lutMutex);
int id=JKQTPImageTools::global_next_userpalette++;
JKQTPImageTools::global_jkqtpimagetools_lutstore[id].name=name;
JKQTPImageTools::global_jkqtpimagetools_lutstore[id].nameT=((nameT.size()>0)?nameT:name);

View File

@ -28,7 +28,7 @@
#include <cfloat>
#include <stdint.h>
#include <QColor>
#include <mutex>
#include <QReadWriteLock>
#include <vector>
#include "jkqtcommon/jkqtcommon_imexport.h"
#include "jkqtcommon/jkqtpmathtools.h"
@ -341,16 +341,16 @@ enum JKQTPMathImageColorPalette {
JKQTPMathImagePastel2_STEP, /*!< \image{inline} html palettes/palette_pastel2_step.png */
JKQTPMathImageSet1_STEP, /*!< \image{inline} html palettes/palette_set1_step.png */
JKQTPMathImageSet2_STEP, /*!< \image{inline} html palettes/palette_set2_step.png */
JKQTPMathImageALPHA, /*!< \brief special palette with increasing alpha values */
JKQTPMathImageINVERTED_ALPHA, /*!< \brief special palette with decreasing alpha values */
JKQTPMathImagePREDEFINED_PALETTES_COUNT, /*!< \brief the number of predefined palettes */
JKQTPMathImageUSER_PALETTE=65000, /*!< \brief special value for JKQTPImageTools::array2image(), which signals the usage of a provided user-defined palette */
JKQTPMathImageALPHA=JKQTPMathImageUSER_PALETTE-2, /*!< \brief special palette with increasing alpha values */
JKQTPMathImageINVERTED_ALPHA=JKQTPMathImageUSER_PALETTE-1, /*!< \brief special palette with decreasing alpha values */
JKQTPMathImageFIRST_REGISTERED_USER_PALETTE=JKQTPMathImagePREDEFINED_PALETTES_COUNT, /*!< \brief the ID of the first user-defined paletted, registered with JKQTPImageTools::registerPalette() or JKQTPImageTools::registerPalettesFromFile() */
JKQTPMathImageLAST_POSSIBLE_REGISTERED_USER_PALETTE=JKQTPMathImageUSER_PALETTE-10, /*!< \brief the ID of the first user-defined paletted, registered with JKQTPImageTools::registerPalette() or JKQTPImageTools::registerPalettesFromFile() */
JKQTPMathImageLAST_POSSIBLE_REGISTERED_USER_PALETTE=JKQTPMathImageUSER_PALETTE-10, /*!< \brief the ID of the last user-defined paletted, registered with JKQTPImageTools::registerPalette() or JKQTPImageTools::registerPalettesFromFile() */
};
@ -664,8 +664,12 @@ struct JKQTPImageTools {
\see registerPalette() registerPalettesFromFile()
*/
static JKQTCOMMON_LIB_EXPORT int global_next_userpalette;
/** \brief Mutex to protect global_jkqtpimagetools_lutstore and global_next_userpalette */
static JKQTCOMMON_LIB_EXPORT std::mutex lutMutex;
/** \brief storage for the palette names in getPredefinedPalettes() \internal */
static JKQTCOMMON_LIB_EXPORT QStringList getPredefinedPalettesGlobalList;
/** \brief storage for the palette names in etPredefinedPalettesMachineReadable() \internal */
static JKQTCOMMON_LIB_EXPORT QStringList getPredefinedPalettesMachineReadableGlobalList;
/** \brief Mutex to protect global_jkqtpimagetools_lutstore, getPredefinedPalettesGlobalList, getPredefinedPalettesMachineReadableGlobalList and global_next_userpalette */
static JKQTCOMMON_LIB_EXPORT QReadWriteLock lutMutex;
/*! \brief returns data of the default LUTs, used to initialize global_jkqtpimagetools_lutstore

View File

@ -25,6 +25,9 @@
#define JKQTPCONCURRENCYTOOLS_H
#include "jkqtcommon/jkqtcommon_imexport.h"
#include <QReadWriteLock>
#include <QReadLocker>
#include <QWriteLocker>
#include <mutex>
/** \brief template class that wraps any datatype and combines it with a mutex, exposes the lock()/unlock()
@ -37,9 +40,39 @@ template <class T>
class JKQTPSynchronized {
public:
/** \brief Mutex used by this temmplate */
typedef std::mutex MutexType;
/** \brief type of a lock_guard for a JKQTPSynchronized<T> */
typedef std::lock_guard<JKQTPSynchronized<T> > Locker;
typedef QReadWriteLock MutexType;
/** \brief type of AdoptLock tag, which is used in ReadLocker and WriteLocker to adopt a pre-locked JKQTPSynchronized<T> */
struct AdoptLockType { explicit AdoptLockType() = default; };
/** \brief tag, which is used in ReadLocker and WriteLocker to adopt a pre-locked JKQTPSynchronized<T> */
static constexpr AdoptLockType AdoptLock { };
/** \brief type of a lock_guard for a JKQTPSynchronized<T> for reading */
class ReadLocker
{
public:
inline ReadLocker(const JKQTPSynchronized<T> &sync) noexcept: m_sync(sync) { m_sync.lockForRead(); };
inline ReadLocker(const JKQTPSynchronized<T> &sync, AdoptLockType) noexcept : m_sync(sync) { };
inline ~ReadLocker() { m_sync.unlock(); }
private:
Q_DISABLE_COPY(ReadLocker)
const JKQTPSynchronized<T> &m_sync;
};
/** \brief type of a lock_guard for a JKQTPSynchronized<T> for writing */
class WriteLocker
{
public:
inline WriteLocker(JKQTPSynchronized<T> &sync) noexcept: m_sync(sync) { m_sync.lockForWrite(); };
inline WriteLocker(JKQTPSynchronized<T> &sync, AdoptLockType) noexcept : m_sync(sync) { };
inline ~WriteLocker() { m_sync.unlock(); }
private:
Q_DISABLE_COPY(WriteLocker)
JKQTPSynchronized<T> &m_sync;
};
/** \brief type of a lock_guard for a JKQTPSynchronized<T> for writing */
typedef JKQTPSynchronized<T>::WriteLocker Locker;
/** \brief contained data type T */
typedef T data_type;
/** \brief default constructor, the internal data is default-initialized */
@ -59,18 +92,32 @@ public:
m_data=std::move(other.m_data);
}
/** \brief locks the internal mutex until unlock() is called,
/** \brief locks the internal mutex for writing, until unlock() is called
*
* \note Use Locker instances to actually lock, using a RAII-idiom, as this is safer than doing this by hand!
* \note Use WriteLocker or Locker instances to actually lock, using a RAII-idiom, as this is safer than doing this by hand!
*/
inline void lock() {
m_mutex.lock();
inline void lock() const {
lockForWrite();
}
/** \brief unlocks the internal mutex from a previous lock() call
/** \brief locks the internal mutex for writing, until unlock() is called
*
* \note Use WriteLocker or Locker instances to actually lock, using a RAII-idiom, as this is safer than doing this by hand!
*/
inline void lockForWrite() const {
m_mutex.lockForWrite();
}
/** \brief locks the internal mutex for writing, until unlock() is called
*
* \note Use WriteLocker or Locker instances to actually lock, using a RAII-idiom, as this is safer than doing this by hand!
*/
inline void lockForRead() const {
m_mutex.lockForRead();
}
/** \brief unlocks the internal mutex from a previous lock(), lockForWrite() or lockForRead() call
*
* \note Use Locker instances to actually lock, using a RAII-idiom, as this is safer than doing this by hand!
*/
inline void unlock() {
inline void unlock() const {
m_mutex.unlock();
}
/** \brief assign a value to the internal data storage, <b>not thread-safe.</b>
@ -130,7 +177,7 @@ public:
/** \brief returns the value in the internal data storage, <b>thread-safe</b>.
*/
inline T get_safe() const {
Locker lck(m_mutex);
ReadLocker lck(this);
return m_data;
}

View File

@ -556,14 +556,14 @@ JKQTPSynchronized<QVector<JKQTPCustomGraphSymbolFunctor> > JKQTPlotterDrawingToo
JKQTPGraphSymbols JKQTPRegisterCustomGraphSymbol(JKQTPCustomGraphSymbolFunctor&& f)
{
JKQTPlotterDrawingTools::SymbolsLocker lock(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore);
JKQTPlotterDrawingTools::SymbolsWriteLocker lock(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore);
JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->push_back(std::move(f));
return static_cast<JKQTPGraphSymbols>(static_cast<uint64_t>(JKQTPFirstCustomSymbol)+static_cast<uint64_t>(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->size()-1));
}
JKQTPGraphSymbols JKQTPRegisterCustomGraphSymbol(const JKQTPCustomGraphSymbolFunctor& f)
{
JKQTPlotterDrawingTools::SymbolsLocker lock(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore);
JKQTPlotterDrawingTools::SymbolsWriteLocker lock(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore);
JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->push_back(f);
return static_cast<JKQTPGraphSymbols>(static_cast<uint64_t>(JKQTPFirstCustomSymbol)+static_cast<uint64_t>(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->size()-1));
}

View File

@ -87,7 +87,8 @@ struct JKQTPlotterDrawingTools {
* \internal
*/
static JKQTCOMMON_LIB_EXPORT JKQTPSynchronized<QVector<JKQTPCustomGraphSymbolFunctor> > JKQTPCustomGraphSymbolStore;
typedef JKQTPSynchronized<QVector<JKQTPCustomGraphSymbolFunctor> >::Locker SymbolsLocker;
typedef JKQTPSynchronized<QVector<JKQTPCustomGraphSymbolFunctor> >::ReadLocker SymbolsReadLocker;
typedef JKQTPSynchronized<QVector<JKQTPCustomGraphSymbolFunctor> >::WriteLocker SymbolsWriteLocker;
};
@ -982,7 +983,7 @@ inline void JKQTPPlotSymbol(TPainter& painter, double x, double y, JKQTPGraphSym
painter.drawPath(path);
}
if (symbol>=JKQTPFirstCustomSymbol) {
JKQTPlotterDrawingTools::SymbolsLocker lock(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore);
JKQTPlotterDrawingTools::SymbolsReadLocker lock(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore);
const int idx(static_cast<int>(symbol-JKQTPFirstCustomSymbol));
if (idx>=0 && idx<JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->size()) {
painter.setPen(p);

View File

@ -29,22 +29,21 @@
#include <QFontInfo>
#include <QApplication>
#include <QFont>
#include <mutex>
void initJKQTMathTextResources()
{
static bool initialized=false;
static std::mutex mutex_initialized;
std::lock_guard<std::mutex> lock(mutex_initialized);
if (!initialized) {
#ifdef JKQTMATHTEXT_COMPILED_WITH_XITS
Q_INIT_RESOURCE(xits);
#endif
#ifdef JKQTMATHTEXT_COMPILED_WITH_FIRAMATH
Q_INIT_RESOURCE(firamath);
#endif
initialized=true;
}
static std::once_flag flag;
std::call_once(flag, []() {
#ifdef JKQTMATHTEXT_COMPILED_WITH_XITS
Q_INIT_RESOURCE(xits);
#endif
#ifdef JKQTMATHTEXT_COMPILED_WITH_FIRAMATH
Q_INIT_RESOURCE(firamath);
#endif
}
);
}
JKQTMathTextFontSpecifier::JKQTMathTextFontSpecifier():
@ -234,6 +233,8 @@ bool JKQTMathTextFontSpecifier::hasFallbackSymbolFontName() const
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getXITSFamilies()
{
initJKQTMathTextResources();
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
QFontDatabase fdb;
const auto fontFamilies=fdb.families();
@ -249,9 +250,7 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getXITSFamilies()
if (QFile::exists(":/JKQTMathText/fonts/xits-regular.otf")) { QFontDatabase::addApplicationFont(":/JKQTMathText/fonts/xits-regular.otf"); }
}
static JKQTMathTextFontSpecifier fontSpec;
static std::mutex fontSpecMutex;
std::lock_guard<std::mutex> lock(fontSpecMutex);
static JKQTMathTextFontSpecifier fontSpec;
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
fontSpec.m_transformOnOutput=false;
for (int i=0; i<fontFamilies.size(); i++) {
@ -277,22 +276,20 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getXITSFamilies()
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getASANAFamilies()
{
initJKQTMathTextResources();
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
QFontDatabase fdb;
const auto fontFamilies=fdb.families();
#else
const auto fontFamilies=QFontDatabase::families();
#endif
if (!fontFamilies.contains("Asana") && !fontFamilies.contains("Asana Math")) {
if (QFile::exists(":/JKQTMathText/fonts/asana-math.otf")) { /*i=*/QFontDatabase::addApplicationFont(":/JKQTMathText/fonts/asana-math.otf"); }
}
static JKQTMathTextFontSpecifier fontSpec=[]() -> JKQTMathTextFontSpecifier {
initJKQTMathTextResources();
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
QFontDatabase fdb;
const auto fontFamilies=fdb.families();
#else
const auto fontFamilies=QFontDatabase::families();
#endif
if (!fontFamilies.contains("Asana") && !fontFamilies.contains("Asana Math")) {
if (QFile::exists(":/JKQTMathText/fonts/asana-math.otf")) { /*i=*/QFontDatabase::addApplicationFont(":/JKQTMathText/fonts/asana-math.otf"); }
}
static JKQTMathTextFontSpecifier fontSpec;
static std::mutex fontSpecMutex;
std::lock_guard<std::mutex> lock(fontSpecMutex);
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
JKQTMathTextFontSpecifier fontSpec;
fontSpec.m_transformOnOutput=false;
for (int i=0; i<fontFamilies.size(); i++) {
if (fontFamilies.at(i).contains("Asana Math")) {
@ -310,22 +307,19 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getASANAFamilies()
fontSpec.m_fontName=fontSpec.m_mathFontName;
}
fontSpec.m_fallbackSymbolFont=fontSpec.m_mathFontName;
}
return fontSpec;
}();
return fontSpec;
}
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getSTIXFamilies()
{
initJKQTMathTextResources();
static QStringList mathNames{"STIX Two Math", "STIX Math", "STIX Two Math Standard", "STIX Math Standard"};
static QStringList textNames{"STIX", "STIXGeneral", "STIX General"};
static JKQTMathTextFontSpecifier fontSpec=[]() -> JKQTMathTextFontSpecifier {
initJKQTMathTextResources();
static QStringList mathNames{"STIX Two Math", "STIX Math", "STIX Two Math Standard", "STIX Math Standard"};
static QStringList textNames{"STIX", "STIXGeneral", "STIX General"};
static JKQTMathTextFontSpecifier fontSpec;
static std::mutex fontSpecMutex;
std::lock_guard<std::mutex> lock(fontSpecMutex);
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
JKQTMathTextFontSpecifier fontSpec;
fontSpec.m_transformOnOutput=false;
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
QFontDatabase fdb;
@ -365,27 +359,26 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getSTIXFamilies()
fontSpec.m_fontName=fontSpec.m_mathFontName;
}
fontSpec.m_fallbackSymbolFont=fontSpec.m_mathFontName;
}
return fontSpec;
}();
return fontSpec;
}
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getFIRAFamilies()
{
initJKQTMathTextResources();
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
QFontDatabase fdb;
const auto fontFamilies=fdb.families();
#else
const auto fontFamilies=QFontDatabase::families();
#endif
if (!fontFamilies.contains("Fira Math")) {
if (QFile::exists(":/JKQTMathText/fonts/FiraMath-Regular.otf")) { QFontDatabase::addApplicationFont(":/JKQTMathText/fonts/FiraMath-Regular.otf"); }
}
static JKQTMathTextFontSpecifier fontSpec=[]() -> JKQTMathTextFontSpecifier {
initJKQTMathTextResources();
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
QFontDatabase fdb;
const auto fontFamilies=fdb.families();
#else
const auto fontFamilies=QFontDatabase::families();
#endif
if (!fontFamilies.contains("Fira Math")) {
if (QFile::exists(":/JKQTMathText/fonts/FiraMath-Regular.otf")) { QFontDatabase::addApplicationFont(":/JKQTMathText/fonts/FiraMath-Regular.otf"); }
}
static JKQTMathTextFontSpecifier fontSpec;
static std::mutex fontSpecMutex;
std::lock_guard<std::mutex> lock(fontSpecMutex);
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
JKQTMathTextFontSpecifier fontSpec;
fontSpec.m_transformOnOutput=false;
for (int i=0; i<fontFamilies.size(); i++) {
if (fontFamilies.at(i).contains("Fira Math")) {
@ -405,17 +398,16 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getFIRAFamilies()
fontSpec.m_fontName=fontSpec.m_mathFontName;
}
fontSpec.m_fallbackSymbolFont=fontSpec.m_mathFontName;
}
return fontSpec;
}();
return fontSpec;
}
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getAppFontFamilies()
{
static JKQTMathTextFontSpecifier fontSpec;
static std::mutex fontSpecMutex;
std::lock_guard<std::mutex> lock(fontSpecMutex);
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
static JKQTMathTextFontSpecifier fontSpec=[]() -> JKQTMathTextFontSpecifier {
JKQTMathTextFontSpecifier fontSpec;
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
QFontDatabase fdb;
const auto fontFamilies=fdb.families();
@ -448,16 +440,14 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getAppFontFamilies()
if (xits.hasMathFontName()) fontSpec.m_mathFontName=xits.mathFontName();
}
}
}
return fontSpec;
}();
return fontSpec;
}
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getAppFontSFFamilies()
{
static JKQTMathTextFontSpecifier fontSpec;
static std::mutex fontSpecMutex;
std::lock_guard<std::mutex> lock(fontSpecMutex);
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
static JKQTMathTextFontSpecifier fontSpec=[]() -> JKQTMathTextFontSpecifier {
const QFont f=QGuiApplication::font().family();
QFont testFnt;
if (f.styleHint()==QFont::SansSerif) {
@ -467,7 +457,8 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getAppFontSFFamilies()
testFnt.setStyleHint(QFont::StyleHint::SansSerif);
fontSpec.m_fontName=fontSpec.m_mathFontName=testFnt.defaultFamily();
}
}
return fontSpec;
}();
return fontSpec;
}

View File

@ -41,7 +41,7 @@
JKQTMathTextBoxInstructionNode::JKQTMathTextBoxInstructionNode(JKQTMathText* _parent, const QString& name, JKQTMathTextNode* child, const QStringList& parameters):
JKQTMathTextInstruction1Node(_parent, name, child, parameters)
{
fillInstructions();
}
JKQTMathTextBoxInstructionNode::~JKQTMathTextBoxInstructionNode() {
@ -56,7 +56,7 @@ QString JKQTMathTextBoxInstructionNode::getTypeName() const
JKQTMathTextNodeSize JKQTMathTextBoxInstructionNode::getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const {
JKQTMathTextEnvironment ev=currentEv;
const auto& inst=instructions.value(getInstructionName());
const auto& inst=instructions().value(getInstructionName());
inst.modifier(ev, getParameters());
const QPen p=inst.pen(ev, getParameters(), parentMathText);
const QBrush b=inst.brush(ev, getParameters(), parentMathText);
@ -77,7 +77,7 @@ double JKQTMathTextBoxInstructionNode::draw(QPainter& painter, double x, double
doDrawBoxes(painter, x, y, currentEv);
JKQTMathTextEnvironment ev=currentEv;
const auto& inst=instructions.value(getInstructionName());
const auto& inst=instructions().value(getInstructionName());
inst.modifier(ev, getParameters());
const QPen p=inst.pen(ev, getParameters(), parentMathText);
const QBrush b=inst.brush(ev, getParameters(), parentMathText);
@ -111,8 +111,8 @@ double JKQTMathTextBoxInstructionNode::draw(QPainter& painter, double x, double
bool JKQTMathTextBoxInstructionNode::toHtml(QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const {
JKQTMathTextEnvironment ev=currentEv;
fillInstructions();
const auto& inst=instructions.value(getInstructionName());
const auto& inst=instructions().value(getInstructionName());
inst.modifier(ev, getParameters());
const QPen p=inst.pen(ev, getParameters(), parentMathText);
const QBrush b=inst.brush(ev, getParameters(), parentMathText);
@ -140,174 +140,172 @@ bool JKQTMathTextBoxInstructionNode::toHtml(QString &html, JKQTMathTextEnvironme
bool JKQTMathTextBoxInstructionNode::supportsInstructionName(const QString &instructionName)
{
fillInstructions();
return instructions.contains(instructionName);
return instructions().contains(instructionName);
}
size_t JKQTMathTextBoxInstructionNode::countParametersOfInstruction(const QString &instructionName)
{
fillInstructions();
if (instructions.contains(instructionName)) return instructions[instructionName].NParams;
if (instructions().contains(instructionName)) return instructions()[instructionName].NParams;
return 0;
}
void JKQTMathTextBoxInstructionNode::modifyInMathEnvironment(const QString &instructionName, bool &insideMath, bool& insideMathTextStyle, const QStringList& params)
{
fillInstructions();
if (instructions.contains(instructionName)) {
if (instructions().contains(instructionName)) {
JKQTMathTextEnvironment ev;
ev.insideMath=insideMath;
ev.insideMathUseTextStyle=insideMathTextStyle;
instructions[instructionName].modifier(ev, params);
instructions()[instructionName].modifier(ev, params);
insideMath=ev.insideMath;
insideMathTextStyle=ev.insideMathUseTextStyle;
}
}
QHash<QString, JKQTMathTextBoxInstructionNode::InstructionProperties> JKQTMathTextBoxInstructionNode::instructions;
const QHash<QString, JKQTMathTextBoxInstructionNode::InstructionProperties>& JKQTMathTextBoxInstructionNode::instructions() {
static QHash<QString, JKQTMathTextBoxInstructionNode::InstructionProperties> table=[](){
QHash<QString, JKQTMathTextBoxInstructionNode::InstructionProperties> instructions;
void JKQTMathTextBoxInstructionNode::fillInstructions()
{
static std::mutex sMutex;
std::lock_guard<std::mutex> lock(sMutex);
if (instructions.size()>0) return;
{
InstructionProperties i(InstructionProperties::NoModification,
InstructionProperties::DefaultPen,
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/0);
instructions["fbox"] = i;
instructions["framebox"] = i;
instructions["boxed"] = i;
instructions["framed"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
InstructionProperties::DefaultPen,
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/0);
i.doubleLine=true;
instructions["doublebox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
InstructionProperties::DefaultPen,
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/0);
i.roundingFactor=0.7;
instructions["ovalbox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
p.setWidthF(p.widthF()*1.5);
return p;
},
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/0);
i.roundingFactor=0.8;
instructions["Ovalbox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
InstructionProperties::DefaultPen,
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/0);
i.roundingFactor=0.7;
i.doubleLine=true;
instructions["ovaldoublebox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
p.setColor(jkqtp_String2QColor(parameters.value(0, p.color().name())));
return p;
},
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/1);
instructions["colorbox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
p.setStyle(Qt::DashLine);
return p;
},
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/0);
instructions["dashbox"] = i;
instructions["dashedbox"] = i;
instructions["dbox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
p.setStyle(Qt::DotLine);
return p;
},
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/0);
instructions["dottedbox"] = i;
instructions["dotbox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
InstructionProperties::NoPen,
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& parameters, JKQTMathText* /*parent*/){
return QBrush(jkqtp_String2QColor(parameters.value(0, QColor(Qt::transparent).name())), Qt::SolidPattern);
},
InstructionProperties::DefaultPadding,
/*Nparams=*/1);
instructions["shaded"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
InstructionProperties::NoPen,
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& parameters, JKQTMathText* /*parent*/){
return QBrush(jkqtp_String2QColor(parameters.value(0, QColor(Qt::transparent).name())), Qt::SolidPattern);
},
0,
/*Nparams=*/1);
instructions["snugshade"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
InstructionProperties::DefaultPen,
InstructionProperties::NoBrush,
0,
/*Nparams=*/0);
instructions["snugbox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
p.setColor(jkqtp_String2QColor(parameters.value(0, p.color().name())));
return p;
},
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& parameters, JKQTMathText* /*parent*/){
return QBrush(jkqtp_String2QColor(parameters.value(1, QColor(Qt::transparent).name())), Qt::SolidPattern);
},
InstructionProperties::DefaultPadding,
/*Nparams=*/2);
instructions["fcolorbox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
InstructionProperties::DefaultPen,
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/0);
instructions["fbox"] = i;
instructions["framebox"] = i;
instructions["boxed"] = i;
instructions["framed"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
InstructionProperties::DefaultPen,
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/0);
i.doubleLine=true;
instructions["doublebox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
InstructionProperties::DefaultPen,
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/0);
i.roundingFactor=0.7;
instructions["ovalbox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
p.setWidthF(p.widthF()*1.5);
return p;
},
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/0);
i.roundingFactor=0.8;
instructions["Ovalbox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
InstructionProperties::DefaultPen,
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/0);
i.roundingFactor=0.7;
i.doubleLine=true;
instructions["ovaldoublebox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
p.setColor(jkqtp_String2QColor(parameters.value(0, p.color().name())));
return p;
},
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/1);
instructions["colorbox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
p.setStyle(Qt::DashLine);
return p;
},
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/0);
instructions["dashbox"] = i;
instructions["dashedbox"] = i;
instructions["dbox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
p.setStyle(Qt::DotLine);
return p;
},
InstructionProperties::NoBrush,
InstructionProperties::DefaultPadding,
/*Nparams=*/0);
instructions["dottedbox"] = i;
instructions["dotbox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
InstructionProperties::NoPen,
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& parameters, JKQTMathText* /*parent*/){
return QBrush(jkqtp_String2QColor(parameters.value(0, QColor(Qt::transparent).name())), Qt::SolidPattern);
},
InstructionProperties::DefaultPadding,
/*Nparams=*/1);
instructions["shaded"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
InstructionProperties::NoPen,
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& parameters, JKQTMathText* /*parent*/){
return QBrush(jkqtp_String2QColor(parameters.value(0, QColor(Qt::transparent).name())), Qt::SolidPattern);
},
0,
/*Nparams=*/1);
instructions["snugshade"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
InstructionProperties::DefaultPen,
InstructionProperties::NoBrush,
0,
/*Nparams=*/0);
instructions["snugbox"] = i;
}
{
InstructionProperties i(InstructionProperties::NoModification,
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
p.setColor(jkqtp_String2QColor(parameters.value(0, p.color().name())));
return p;
},
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& parameters, JKQTMathText* /*parent*/){
return QBrush(jkqtp_String2QColor(parameters.value(1, QColor(Qt::transparent).name())), Qt::SolidPattern);
},
InstructionProperties::DefaultPadding,
/*Nparams=*/2);
instructions["fcolorbox"] = i;
}
return instructions;
}();
return table;
}
JKQTMathTextBoxInstructionNode::InstructionProperties::ModifyEnvironmentFunctor JKQTMathTextBoxInstructionNode::InstructionProperties::NoModification=
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& /*parameters*/){};

View File

@ -106,13 +106,11 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextBoxInstructionNode: public JKQTMathTex
double roundingFactor;
};
/** \brief fills instructions
/** \brief defines all implemented instructions in this node
*
* \note this is the customization point for new instructions!
*/
static void fillInstructions();
/** \brief defines all implemented instructions in this node */
static QHash<QString, InstructionProperties> instructions;
static const QHash<QString, InstructionProperties>& instructions();
};

View File

@ -108,14 +108,12 @@ QString JKQTMathTextDecoratedNode::DecorationType2String(JKQTMathTextDecoratedNo
JKQTMathTextDecoratedNode::DecorationType JKQTMathTextDecoratedNode::InstructionName2DecorationType(const QString &mode)
{
fillInstructions();
return instructions[mode];
return instructions()[mode];
}
bool JKQTMathTextDecoratedNode::supportsInstructionName(const QString &instructionName)
{
fillInstructions();
return instructions.contains(instructionName);
return instructions().contains(instructionName);
}
@ -168,64 +166,64 @@ JKQTMathTextNodeSize JKQTMathTextDecoratedNode::getSizeInternal(QPainter& painte
return s;
}
QHash<QString, JKQTMathTextDecoratedNode::DecorationType> JKQTMathTextDecoratedNode::instructions;
const QHash<QString, JKQTMathTextDecoratedNode::DecorationType>& JKQTMathTextDecoratedNode::instructions() {
static QHash<QString, JKQTMathTextDecoratedNode::DecorationType> table =[](){
QHash<QString, JKQTMathTextDecoratedNode::DecorationType> instructions;
void JKQTMathTextDecoratedNode::fillInstructions()
{
static std::mutex sMutex;
std::lock_guard<std::mutex> lock(sMutex);
if (instructions.size()>0) return;
instructions["vec"]=MTDvec;
instructions["overline"]=MTDoverline;
instructions["oline"]=MTDoverline;
instructions["ol"]=MTDoverline;
instructions["underline"]=MTDunderline;
instructions["uline"]=MTDunderline;
instructions["ul"]=MTDunderline;
instructions["dashuline"]=MTDunderlineDashed;
instructions["dotuline"]=MTDunderlineDotted;
instructions["uuline"]=MTDdoubleunderline;
instructions["uul"]=MTDdoubleunderline;
instructions["ooline"]=MTDdoubleoverline;
instructions["ool"]=MTDdoubleoverline;
instructions["arrow"]=MTDarrow;
instructions["overrightarrow"]=MTDarrow;
instructions["overarrow"]=MTDarrow;
instructions["hat"]=MTDhat;
instructions["^"]=MTDhat;
instructions["widehat"]=MTDwidehat;
instructions["check"]=MTDcheck;
instructions["v"]=MTDcheck;
instructions["widecheck"]=MTDwidecheck;
instructions["bar"]=MTDbar;
instructions["="]=MTDbar;
instructions["dot"]=MTDdot;
instructions["."]=MTDdot;
instructions["ocirc"]=MTDocirc;
instructions["tilde"]=MTDtilde;
instructions["~"]=MTDtilde;
instructions["acute"]=MTDacute;
instructions["'"]=MTDacute;
instructions["grave"]=MTDgrave;
instructions["`"]=MTDgrave;
instructions["breve"]=MTDbreve;
instructions["u"]=MTDbreve;
instructions["widetilde"]=MTDwidetilde;
instructions["ddot"]=MTDddot;
instructions["cancel"]=MTDcancel;
instructions["xcancel"]=MTDxcancel;
instructions["bcancel"]=MTDbcancel;
instructions["strike"]=MTDstrike;
instructions["st"]=MTDstrike;
instructions["sout"]=MTDstrike;
instructions["overleftarrow"]=MTDoverleftarrow;
instructions["overrightarrow"]=MTDoverrightarrow;
instructions["overleftrightarrow"]=MTDoverleftrightarrow;
instructions["underleftarrow"]=MTDunderleftarrow;
instructions["underrightarrow"]=MTDunderrightarrow;
instructions["underleftrightarrow"]=MTDunderleftrightarrow;
instructions["vec"]=MTDvec;
instructions["overline"]=MTDoverline;
instructions["oline"]=MTDoverline;
instructions["ol"]=MTDoverline;
instructions["underline"]=MTDunderline;
instructions["uline"]=MTDunderline;
instructions["ul"]=MTDunderline;
instructions["dashuline"]=MTDunderlineDashed;
instructions["dotuline"]=MTDunderlineDotted;
instructions["uuline"]=MTDdoubleunderline;
instructions["uul"]=MTDdoubleunderline;
instructions["ooline"]=MTDdoubleoverline;
instructions["ool"]=MTDdoubleoverline;
instructions["arrow"]=MTDarrow;
instructions["overrightarrow"]=MTDarrow;
instructions["overarrow"]=MTDarrow;
instructions["hat"]=MTDhat;
instructions["^"]=MTDhat;
instructions["widehat"]=MTDwidehat;
instructions["check"]=MTDcheck;
instructions["v"]=MTDcheck;
instructions["widecheck"]=MTDwidecheck;
instructions["bar"]=MTDbar;
instructions["="]=MTDbar;
instructions["dot"]=MTDdot;
instructions["."]=MTDdot;
instructions["ocirc"]=MTDocirc;
instructions["tilde"]=MTDtilde;
instructions["~"]=MTDtilde;
instructions["acute"]=MTDacute;
instructions["'"]=MTDacute;
instructions["grave"]=MTDgrave;
instructions["`"]=MTDgrave;
instructions["breve"]=MTDbreve;
instructions["u"]=MTDbreve;
instructions["widetilde"]=MTDwidetilde;
instructions["ddot"]=MTDddot;
instructions["cancel"]=MTDcancel;
instructions["xcancel"]=MTDxcancel;
instructions["bcancel"]=MTDbcancel;
instructions["strike"]=MTDstrike;
instructions["st"]=MTDstrike;
instructions["sout"]=MTDstrike;
instructions["overleftarrow"]=MTDoverleftarrow;
instructions["overrightarrow"]=MTDoverrightarrow;
instructions["overleftrightarrow"]=MTDoverleftrightarrow;
instructions["underleftarrow"]=MTDunderleftarrow;
instructions["underrightarrow"]=MTDunderrightarrow;
instructions["underleftrightarrow"]=MTDunderleftrightarrow;
return instructions;
}();
return table;
}
double JKQTMathTextDecoratedNode::draw(QPainter& painter, double x, double y, JKQTMathTextEnvironment currentEv) const {

View File

@ -104,9 +104,7 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextDecoratedNode: public JKQTMathTextSing
/** \brief type of decoration that is added to the child node */
DecorationType decoration;
/** \brief lists all supported instructions */
static QHash<QString, DecorationType> instructions;
/** \brief fills instructions */
static void fillInstructions();
static const QHash<QString, DecorationType>& instructions();
};
#endif // JKQTMATHTEXTDECORATEDNODE_H

View File

@ -34,38 +34,36 @@
#include <QFont>
QHash<QString, JKQTMathTextFracNode::FracType> JKQTMathTextFracNode::instructions;
void JKQTMathTextFracNode::fillInstructions()
{
static std::mutex sMutex;
std::lock_guard<std::mutex> lock(sMutex);
if (instructions.size()>0) return;
instructions["frac"]=MTFMfrac;
instructions["dfrac"] = MTFMdfrac;
instructions["cfrac"]=MTFMdfrac;
instructions["sfrac"] = MTFMsfrac;
instructions["slantfrac"] = MTFMsfrac;
instructions["xfrac"]=MTFMsfrac;
instructions["stfrac"] = MTFMstfrac;
instructions["nicefrac"] = MTFMstfrac;
instructions["slanttextfrac"] = MTFMstfrac;
instructions["xtfrac"]=MTFMstfrac;
instructions["tfrac"]=MTFMtfrac;
instructions["stackrel"]=MTFMstackrel;
instructions["underbrace"]=MTFMunderbrace;
instructions["underbracket"]=MTFMunderbracket;
instructions["underset"]=MTFMunderset;
instructions["overbrace"]=MTFMoverbrace;
instructions["overbracket"]=MTFMoverbracket;
instructions["overset"]=MTFMoverset;
const QHash<QString, JKQTMathTextFracNode::FracType>& JKQTMathTextFracNode::instructions() {
static QHash<QString, JKQTMathTextFracNode::FracType> table=[]()
{
QHash<QString, JKQTMathTextFracNode::FracType> instructions;
instructions["frac"]=MTFMfrac;
instructions["dfrac"] = MTFMdfrac;
instructions["cfrac"]=MTFMdfrac;
instructions["sfrac"] = MTFMsfrac;
instructions["slantfrac"] = MTFMsfrac;
instructions["xfrac"]=MTFMsfrac;
instructions["stfrac"] = MTFMstfrac;
instructions["nicefrac"] = MTFMstfrac;
instructions["slanttextfrac"] = MTFMstfrac;
instructions["xtfrac"]=MTFMstfrac;
instructions["tfrac"]=MTFMtfrac;
instructions["stackrel"]=MTFMstackrel;
instructions["underbrace"]=MTFMunderbrace;
instructions["underbracket"]=MTFMunderbracket;
instructions["underset"]=MTFMunderset;
instructions["overbrace"]=MTFMoverbrace;
instructions["overbracket"]=MTFMoverbracket;
instructions["overset"]=MTFMoverset;
return instructions;
}();
return table;
}
QString JKQTMathTextFracNode::FracType2String(JKQTMathTextFracNode::FracType mode)
{
switch(mode) {
@ -99,14 +97,12 @@ QString JKQTMathTextFracNode::FracType2String(JKQTMathTextFracNode::FracType mod
JKQTMathTextFracNode::FracType JKQTMathTextFracNode::InstructionName2FracType(const QString &mode)
{
fillInstructions();
return instructions.value(mode, MTFMfrac);
return instructions().value(mode, MTFMfrac);
}
bool JKQTMathTextFracNode::supportsInstructionName(const QString &instructionName)
{
fillInstructions();
return instructions.contains(instructionName);
return instructions().contains(instructionName);
}

View File

@ -90,9 +90,7 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextFracNode: public JKQTMathTextDualChild
JKQTMathTextFracNode::FracType getMode() const;
protected:
/** \brief lists all supported instructions */
static QHash<QString, FracType> instructions;
/** \brief fills instructions */
static void fillInstructions();
static const QHash<QString, FracType>& instructions();
/** \copydoc JKQTMathTextNode::getSizeInternal() */
virtual JKQTMathTextNodeSize getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const override;
/** \brief actual display type of fraction object */

View File

@ -64,7 +64,6 @@ JKQTMathTextSimpleInstructionNode::JKQTMathTextSimpleInstructionNode(JKQTMathTex
instructionName(_name),
parameters(_parameters)
{
fillInstructions();
}
@ -81,7 +80,6 @@ QString JKQTMathTextSimpleInstructionNode::getTypeName() const
double JKQTMathTextSimpleInstructionNode::draw(QPainter &painter, double x, double y, JKQTMathTextEnvironment currentEv) const
{
doDrawBoxes(painter, x, y, currentEv);
fillInstructions();
QFont f=currentEv.getFont(parentMathText);
f.setStyleStrategy(QFont::PreferDefault);
const QFontMetricsF fm(f, painter.device());
@ -95,7 +93,6 @@ double JKQTMathTextSimpleInstructionNode::draw(QPainter &painter, double x, doub
bool JKQTMathTextSimpleInstructionNode::toHtml(QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const
{
fillInstructions();
const QString txt=executeInstruction();
html+=txt;
return true;
@ -113,20 +110,17 @@ const QStringList &JKQTMathTextSimpleInstructionNode::getParameters() const
bool JKQTMathTextSimpleInstructionNode::supportsInstructionName(const QString &instructionName)
{
fillInstructions();
return instructions.contains(instructionName);
return instructions().contains(instructionName);
}
size_t JKQTMathTextSimpleInstructionNode::countParametersOfInstruction(const QString &instructionName)
{
fillInstructions();
if (instructions.contains(instructionName)) return instructions[instructionName].NParams;
if (instructions().contains(instructionName)) return instructions()[instructionName].NParams;
return 0;
}
JKQTMathTextNodeSize JKQTMathTextSimpleInstructionNode::getSizeInternal(QPainter &painter, JKQTMathTextEnvironment currentEv) const
{
fillInstructions();
QFont f=currentEv.getFont(parentMathText);
f.setStyleStrategy(QFont::PreferDefault);
const QFontMetricsF fm(f, painter.device());
@ -140,47 +134,46 @@ JKQTMathTextNodeSize JKQTMathTextSimpleInstructionNode::getSizeInternal(QPainter
return s;
}
QHash<QString, JKQTMathTextSimpleInstructionNode::InstructionProperties> JKQTMathTextSimpleInstructionNode::instructions;
void JKQTMathTextSimpleInstructionNode::fillInstructions()
{
static std::mutex sMutex;
std::lock_guard<std::mutex> lock(sMutex);
if (instructions.size()>0) return;
{
InstructionProperties i([](const QStringList& parameters) -> QString {
bool ok=false;
qlonglong code=parameters.value(0, "0").toLongLong(&ok, 16);
ok=ok&&(code>=0);
if (ok&&(code>=0)&&(code<=0xFFFFFFFF)) return QString::fromStdString(jkqtp_UnicodeToUTF8(static_cast<uint32_t>(code)));
else return QString();
}, 1);
instructions["unicode"]= i;
instructions["usym"]= i;
}
{
InstructionProperties i([](const QStringList& parameters) -> QString {
bool ok=false;
qlonglong code=parameters.value(0, "0").toLongLong(&ok, 16);
ok=ok&&(code>=0);
if (ok) {
QByteArray bytes;
while (code!=0) {
bytes.prepend(static_cast<char>(code&0xFF));
code=code>>8;
}
return QString::fromUtf8(bytes);
const QHash<QString, JKQTMathTextSimpleInstructionNode::InstructionProperties>& JKQTMathTextSimpleInstructionNode::instructions() {
static QHash<QString, JKQTMathTextSimpleInstructionNode::InstructionProperties> table=[]()
{
QHash<QString, JKQTMathTextSimpleInstructionNode::InstructionProperties> instructions;
{
InstructionProperties i([](const QStringList& parameters) -> QString {
bool ok=false;
qlonglong code=parameters.value(0, "0").toLongLong(&ok, 16);
ok=ok&&(code>=0);
if (ok&&(code>=0)&&(code<=0xFFFFFFFF)) return QString::fromStdString(jkqtp_UnicodeToUTF8(static_cast<uint32_t>(code)));
else return QString();
}, 1);
instructions["unicode"]= i;
instructions["usym"]= i;
}
return QChar(0);
}, 1);
instructions["utfeight"]= i;
}
{
InstructionProperties i([](const QStringList& parameters) -> QString {
bool ok=false;
qlonglong code=parameters.value(0, "0").toLongLong(&ok, 16);
ok=ok&&(code>=0);
if (ok) {
QByteArray bytes;
while (code!=0) {
bytes.prepend(static_cast<char>(code&0xFF));
code=code>>8;
}
return QString::fromUtf8(bytes);
}
return QChar(0);
}, 1);
instructions["utfeight"]= i;
}
return instructions;
}();
return table;
}
QString JKQTMathTextSimpleInstructionNode::executeInstruction() const
{
fillInstructions();
return instructions.value(getInstructionName(), InstructionProperties()).evaluator(getParameters());
return instructions().value(getInstructionName(), InstructionProperties()).evaluator(getParameters());
}
JKQTMathTextSimpleInstructionNode::InstructionProperties::InstructionProperties():

View File

@ -103,14 +103,11 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextSimpleInstructionNode: public JKQTMath
/** \brief output of the instruction */
EvaluateInstructionFunctor evaluator;
};
/** \brief fills instructions
/** \brief defines all implemented instructions in this node
*
* \note this is the customization point for new instructions!
*/
static void fillInstructions();
/** \brief defines all implemented instructions in this node */
static QHash<QString, InstructionProperties> instructions;
static const QHash<QString, InstructionProperties>& instructions();
/** \brief executes the instruction on \a ev */
QString executeInstruction() const;
/** \brief instruction name */

File diff suppressed because it is too large Load Diff

View File

@ -53,15 +53,15 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextModifiedTextPropsInstructionNode: publ
virtual bool toHtml(QString& html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const override;
/** \brief returns true, if the given \a instructionName can be represented by this node
* \see instructions
* \see instructions()
*/
static bool supportsInstructionName(const QString& instructionName);
/** \brief returns the number of additional string parameters, required for the given \a instructionName
* \see instructions
* \see instructions()
*/
static size_t countParametersOfInstruction(const QString& instructionName);
/** \brief sets \a insideMath to \c true if inside the node is to be parsed in math mode and \c false else
* \see instructions
* \see instructions()
*/
static void modifyInMathEnvironment(const QString& instructionName, bool& insideMath, bool &insideMathTextStyle, const QStringList &params=QStringList());
@ -82,13 +82,11 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextModifiedTextPropsInstructionNode: publ
ModifyEnvironmentFunctor modifier;
};
/** \brief fills instructions
/** \brief defines all implemented instructions in this node
*
* \note this is the customization point for new instructions!
*/
static void fillInstructions();
/** \brief defines all implemented instructions in this node */
static QHash<QString, InstructionProperties> instructions;
static const QHash<QString, InstructionProperties>& instructions();
/** \brief executes the instruction on \a ev */
void executeInstruction(JKQTMathTextEnvironment& ev) const;
};
@ -116,15 +114,15 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextModifiedEnvironmentInstructionNode: pu
virtual void modifyEnvironment(JKQTMathTextEnvironment& currentEv) const override;
/** \brief returns true, if the given \a instructionName can be represented by this node
* \see instructions
* \see instructions()
*/
static bool supportsInstructionName(const QString& instructionName);
/** \brief returns the number of additional string parameters, required for the given \a instructionName
* \see instructions
* \see instructions()
*/
static size_t countParametersOfInstruction(const QString& instructionName);
/** \brief sets \a insideMathTextStyle to \c true if textstyle is set inside math
* \see instructions
* \see instructions()
*/
static void modifyInMathTextStyleEnvironment(const QString& instructionName, bool &insideMathTextStyle, JKQTMathText *parentMathText, const QStringList &params=QStringList());
protected:
@ -146,13 +144,11 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextModifiedEnvironmentInstructionNode: pu
ModifyEnvironmentFunctor modifier;
};
/** \brief fills instructions
/** \brief defines all implemented instructions in this node
*
* \note this is the customization point for new instructions!
*/
static void fillInstructions();
/** \brief defines all implemented instructions in this node */
static QHash<QString, InstructionProperties> instructions;
static const QHash<QString, InstructionProperties>& instructions();
};

View File

@ -38,7 +38,6 @@
JKQTMathTextSymbolNode::JKQTMathTextSymbolNode(JKQTMathText* _parent, const QString& name):
JKQTMathTextNode(_parent), symbolName(name)
{
fillSymbolTables();
}
JKQTMathTextSymbolNode::~JKQTMathTextSymbolNode() {
@ -142,7 +141,7 @@ double JKQTMathTextSymbolNode::draw(QPainter& painter, double x, double y, JKQTM
const NodeSize s=getSymbolSize(painter, currentEv);
doDrawBoxes(painter, x, y, s);
const auto fullProps=symbols.value(symbolName, SymbolFullProps());
const auto fullProps=symbols().value(symbolName, SymbolFullProps());
const GlobalSymbolFlags globalFlags=fullProps.globalFlags;
const auto drawProps=fullProps.getDrawingData(currentEv, parentMathText, painter);
const QFont f=drawProps.first;
@ -217,7 +216,7 @@ double JKQTMathTextSymbolNode::draw(QPainter& painter, double x, double y, JKQTM
bool JKQTMathTextSymbolNode::toHtml(QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const {
bool ok=true;
const auto props=symbols.value(symbolName, SymbolFullProps());
const auto props=symbols().value(symbolName, SymbolFullProps());
QString s=props.html.symbol;
JKQTMathTextEnvironment ev=currentEv;
ev.fontSize=ev.fontSize*props.html.fontScalingFactor;
@ -235,7 +234,7 @@ JKQTMathTextSymbolNode::NodeSize JKQTMathTextSymbolNode::getSymbolSize(QPainter
{
NodeSize s;
const auto fullProps=symbols.value(symbolName, SymbolFullProps());
const auto fullProps=symbols().value(symbolName, SymbolFullProps());
const GlobalSymbolFlags globalFlags=fullProps.globalFlags;
const auto drawProps=fullProps.getDrawingData(currentEv, parentMathText, painter);
const QFont f=drawProps.first;
@ -297,39 +296,34 @@ JKQTMathTextSymbolNode::NodeSize JKQTMathTextSymbolNode::getSymbolSize(QPainter
bool JKQTMathTextSymbolNode::hasSymbol(const QString &symbolName)
{
fillSymbolTables();
return symbols.contains(symbolName);
return symbols().contains(symbolName);
}
QStringList JKQTMathTextSymbolNode::getSymbols()
{
fillSymbolTables();
return symbols.keys();
return symbols().keys();
}
bool JKQTMathTextSymbolNode::isSubSuperscriptBelowAboveSymbol(const QString &symbolName)
{
fillSymbolTables();
if (symbols.contains(symbolName)) {
return has(symbols[symbolName].globalFlags, SubSuperscriptBelowAboveSymbol);
if (symbols().contains(symbolName)) {
return has(symbols()[symbolName].globalFlags, SubSuperscriptBelowAboveSymbol);
}
return false;
}
bool JKQTMathTextSymbolNode::isExtendedWidthSymbol(const QString &symbolName)
{
fillSymbolTables();
if (symbols.contains(symbolName)) {
return has(symbols[symbolName].globalFlags, ExtendWidthInMathmode) || has(symbols[symbolName].globalFlags, SmallExtendWidthInMathmode);
if (symbols().contains(symbolName)) {
return has(symbols()[symbolName].globalFlags, ExtendWidthInMathmode) || has(symbols()[symbolName].globalFlags, SmallExtendWidthInMathmode);
}
return false;
}
int JKQTMathTextSymbolNode::getSymbolLength(const QString &symbolName)
{
fillSymbolTables();
if (symbols.contains(symbolName)) {
return symbols[symbolName].props.value(MTFEUnicode, symbols[symbolName].props.value(MTFEStandard, SymbolProps())).symbol.size();
if (symbols().contains(symbolName)) {
return symbols()[symbolName].props.value(MTFEUnicode, symbols()[symbolName].props.value(MTFEStandard, SymbolProps())).symbol.size();
}
return 0;
}
@ -381,6 +375,439 @@ JKQTMathTextSymbolNode::SymbolFullProps JKQTMathTextSymbolNode::NarrowMathOperat
return SymbolFullProps(SymbolProps(op, ItalicOff|BoldOff|HeightIsAscent, 1.0, 0.0)).addGlobalFlags(SmallExtendWidthInMathmode|MakeWhitespaceHalf).addHtml(ophtml, ItalicOff|BoldOff|HeightIsAscent, 1.0, 0.0);
}
const QHash<QString, JKQTMathTextSymbolNode::SymbolFullProps> &JKQTMathTextSymbolNode::symbols()
{
static QHash<QString, JKQTMathTextSymbolNode::SymbolFullProps> s_symbols=[](){
QHash<QString, JKQTMathTextSymbolNode::SymbolFullProps> symbols;
/**************************************************************************************
* STANDARD Symbols available in all standard fonts
**************************************************************************************/
symbols["#"]=SimpleTextSymbol("#", "&num;");
symbols["%"]=SimpleTextSymbol("%", "&NestedGreaterGreater;");
symbols["&"]=SimpleTextSymbol("&", "&amp;");
symbols["("]=SimpleUprightTextSymbol("(");
symbols[")"]=SimpleUprightTextSymbol(")");
symbols["["]=SimpleUprightTextSymbol("[");
symbols["]"]=SimpleUprightTextSymbol("]");
symbols["_"]=SimpleTextSymbol("_");
symbols["{"]=SimpleUprightTextSymbol("{");
symbols["|"]=SimpleUprightTextSymbol("||", "&Vert;").addUprightUnicode(QChar(0x2016));
symbols["}"]=SimpleUprightTextSymbol("}");
symbols["AC"]=UprightSymbolUnicode(QChar(0x223F)).addUprightHtml("&acd;").addUprightStd("~");
symbols["circonflex"]=SimpleTextSymbol("^");
symbols["aa"]=SimpleTextSymbol(QChar(0xE5));
symbols["ae"]=SimpleTextSymbol(QChar(0xE6));
symbols["AE"]=SimpleTextSymbol(QChar(0xC6));
symbols["AA"]=SimpleTextSymbol(QChar(0xC5));
symbols["oe"]=UnicodeSymbol(QChar(0x153)).addStd("oe").addHtml("&oelig;");
symbols["OE"]=UnicodeSymbol(QChar(0x152)).addStd("OE").addHtml("&OElig;");
symbols["ss"]=SimpleTextSymbol(QChar(0xDF)).addHtml("&szlig;");
symbols["l"]=UnicodeSymbol(QChar(0x141)).addHtml("&lstrok;");
symbols["L"]=UnicodeSymbol(QChar(0x142)).addHtml("&Lstrok;");
symbols["o"]=SimpleTextSymbol(QChar(0xF8)).addHtml("&oslash;");
symbols["O"]=SimpleTextSymbol(QChar(0xD8)).addHtml("&Oslash;");
{ auto s=UprightSymbolUnicode(QChar(0x212B)).addUprightStd(QChar(0xC5));
symbols["Angstrom"]=s; symbols["angstrom"]=s; }
{ auto s=UnicodeSymbol(QChar(0x2136)).addHtml("&beth;");
symbols["Beth"]=s; symbols["Bet"]=s; symbols["beth"]=s; symbols["bet"]=s; }
symbols["Box"]=UprightSymbolUnicode(QChar(0x25A1));
symbols["DC"]=UnicodeSymbol(QChar(0x2393)).addWinSymbol(QChar(0xBB)).addStd("=");
symbols["EUR"]=UnicodeSymbol(QChar(0x20AC));
symbols["Im"]=UprightSymbolUnicode(QChar(0x2111)).addHtml("&image;").addWinSymbol(QChar(0xC1));
symbols["No"]=UnicodeSymbol(QChar(0x2116));
{ auto s=UprightSymbolUnicode(QChar(0x2126)).addUprightWinSymbol("W").addUprightHtml("&Omega;");
symbols["Ohm"]=s; symbols["ohm"]=s; }
symbols["P"]=SimpleTextSymbol(QChar(0xB6)).addHtml("&para;");
symbols["Re"]=UnicodeSymbol(QChar(0x211C)).addHtml("&Rfr;").addWinSymbol(QChar(0xC2));
{ auto s=SimpleTextSymbol(QChar(0xA7)).addHtml("&sect;");
symbols["S"]=s; symbols["§"]=s;}
symbols["accurrent"]=UnicodeSymbol(QChar(0x23E6));
{ auto s=UnicodeSymbol(QChar(0x2135)).addHtml("&aleph;").addWinSymbol(QChar(0xC0));
symbols["alef"]=s; symbols["aleph"]=s; symbols["Aleph"]=s; symbols["Alef"]=s; }
symbols["angle"]=UprightSymbolUnicode(QChar(0x2220)).addHtml("&angle;").addWinSymbol(QChar(0xD0));
symbols["backslash"]=SimpleTextSymbol("\\");
symbols["benzene"]=UprightSymbolUnicode(QChar(0x232C));
symbols["benzenr"]=UprightSymbolUnicode(QChar(0x23E3));
symbols["blacksquare"]=UprightSymbolUnicode(QChar(0x220E)).addUprightHtml("&squ;");
{ auto s=UprightSymbolUnicode(QChar(0x231E));
symbols["blcorner"]=s; symbols["llcorner"]=s; }
{ auto s=UprightSymbolUnicode(QChar(0x231F));
symbols["brcorner"]=s; symbols["lrcorner"]=s; }
{ auto s=UprightSymbolUnicode(QChar(0x2022)).addUprightHtml("&bull;").addUprightWinSymbol(QChar(0xB7));
symbols["bullet"]=s; symbols["textbullet"]=s; }
symbols["cdots"]=UprightSymbolUnicode(QChar(0x22EF)).addUprightHtml("&middot;&middot;&middot;").addUprightStd(QString(3, QChar(0xB7)));
{ auto s=UnicodeSymbol(QChar(0x2103)).addUprightStd("°C").addUprightHtml("&deg;C");
symbols["celsius"]=s; symbols["degC"]=s; symbols["degreeCelsius"]=s; }
symbols["ell"]=UprightSymbolUnicode(QChar(0x2113), "&ell;");
symbols["wp"]=UprightSymbolUnicode(QChar(0x2118), "&wp;").addGlobalFlags(SubscriptCorrection);
symbols["mho"]=UprightSymbolUnicode(QChar(0x2127), "&mho;");
symbols["lozenge"]=UprightSymbolUnicode(QChar(0x25CA), "&loz;");
symbols["cent"]=SimpleTextSymbol(QChar(0xA2), "&cent;");
symbols["checkmark"]=UprightSymbolStd(QChar(0x2713)).addUprightHtml("&check;");
symbols["circ"]=UprightSymbolStd(QChar(0x2218)).addUprightHtml("&SmallCircle;").addStd("o", ItalicOff,0.7, -0.25);
symbols["co"]=UprightSymbolUnicode(QChar(0x2105));
{ auto s=SimpleTextSymbol(QChar(0xA9), "&copy;");
symbols["copyright"]=s; symbols["textcopyright"]=s; symbols["circledC"]=s; }
{ auto s=UprightSymbolUnicode(QChar(0x2020)).addUprightHtml("&dagger;");
symbols["dagger"]=s; symbols["dag"]=s; symbols["textdagger"]=s; }
{ auto s=UprightSymbolUnicode(QChar(0x2021)).addUprightHtml("&ddagger;");
symbols["ddagger"]=s; symbols["ddag"]=s; symbols["textdaggerdbl"]=s; }
{ auto s=UnicodeSymbol(QChar(0x2138)).addHtml("&daleth;");
symbols["dalet"]=s; symbols["Dalet"]=s; symbols["daleth"]=s; symbols["Daleth"]=s; }
symbols["dd"] = SymbolFullProps(SymbolProps("d", Upright|BoldOff), "d", Upright|BoldOff);
symbols["diamond"]=UprightSymbolUnicode(QChar(0x22C4)).addHtml("&diam;").addWinSymbol(QChar(0xE0));
symbols["dollar"]=UnicodeSymbol(QChar(0x0024));
{ auto s=SimpleTextSymbol(QChar(0x24), "&dollar;");
symbols["dollar"]=s; symbols["$"]=s; }
symbols["dprime"]=UnicodeSymbol(QChar(0x2033)).addHtml("&Prime;").addStd("''");
symbols["complement"] = SymbolFullProps(SymbolProps("C", Upright|BoldOff), "C", Upright|BoldOff).addUnicode(QChar(0x2201), Upright|BoldOff);
symbols["ee"] = SymbolFullProps(SymbolProps("e", Upright|BoldOff), "e", Upright|BoldOff);
{ auto s=UnicodeSymbol(QChar(0x2026)).addHtml("&mldr;").addWinSymbol(QChar(0xBC)).addStd("...");
symbols["ellipsis"]=s; symbols["dots"]=s; symbols["ldots"]=s; }
{ auto s=SimpleTextSymbol(QChar(0x20AC), "&euro;");
symbols["euro"]=s; symbols["EUR"]=s; }
{ auto s=UnicodeSymbol(QChar(0x2109));
symbols["fahrenheit"]=s; symbols["degF"]=s; }
symbols["female"]=UnicodeSymbol(QChar(0x2640)).addHtml("&female;");
symbols["flq"]=UnicodeSymbol(QChar(0x2039)).addHtml("&lsaquo;").addStd("<");
symbols["flqq"]=UnicodeSymbol(QChar(0x00AB)).addHtml("&laquo;").addStd(QChar(0xAB));
//symbols["frown"]=UnicodeSymbol(QChar(0x2322)).addHtml("&frown;");
symbols["frq"]=UnicodeSymbol(QChar(0x203A)).addHtml("&rsaquo;").addStd(">");
symbols["frqq"]=UnicodeSymbol(QChar(0x00BB)).addHtml("&raquo;").addStd(QChar(0xBB));
{ auto s=UnicodeSymbol(QChar(0x2137)).addHtml("&gimel;");
symbols["gimel"]=s; symbols["Gimel"]=s; }
symbols["glq"]=UnicodeSymbol(QChar(0x2018)).addHtml("&OpenCurlyQuote;").addStd("'");
symbols["glqq"]=UnicodeSymbol(QChar(0x201C)).addHtml("&OpenCurlyDoubleQuote;").addStd("\"");
symbols["grq"]=UnicodeSymbol(QChar(0x2019)).addHtml("&CloseCurlyQuote;").addStd("'");
symbols["grqq"]=UnicodeSymbol(QChar(0x201D)).addHtml("&CloseCurlyDoubleQuote;").addStd("\"");
symbols["hbar"]=UprightSymbolUnicode(QChar(0x210F)).addUprightHtml("&hbar;").addStd("h", ItalicOn|DrawLeftHBar).addGlobalFlags(SubscriptCorrection);
symbols["hexagon"]=UprightSymbolUnicode(QChar(0x2394));
symbols["ii"] = SymbolFullProps(SymbolProps("i", Upright|BoldOff), "i", Upright|BoldOff);
symbols["infty"]=UprightSymbolUnicode(QChar(0x221E)).addUprightHtml("&infin;").addUprightWinSymbol(QChar(0xA5)).addUprightStd("8", RotateSymbol90);
symbols["langle"]=UprightSymbolUnicode(QChar(0x2329)).addWinSymbol(QChar(0xE1));
symbols["lceil"]=UprightSymbolUnicode(QChar(0x2308)).addUprightHtml("&LeftCeiling;").addUprightWinSymbol(QChar(0xE9));
symbols["lfloor"]=UprightSymbolUnicode(QChar(0x230A)).addUprightHtml("&LeftFloor;").addUprightWinSymbol(QChar(0xEB));
symbols["lightning"]=UnicodeSymbol(QChar(0x21AF));
symbols["male"]=UnicodeSymbol(QChar(0x2642)).addHtml("&male;");
symbols["measuredangle"]=UprightSymbolUnicode(QChar(0x2221)).addUprightHtml("&measuredangle;");
symbols["micro"] = SimpleTextSymbol(QChar(0xB5), "&micro;");
symbols["ohm"]=UprightSymbolUnicode(QChar(0x2126)).addUprightHtml("&Omega;").addUprightWinSymbol(QChar(0x57));
symbols["partial"]=UprightSymbolUnicode(QChar(0x2202)).addUprightHtml("&part;").addUprightWinSymbol(QChar(0xB6));
{ auto s=UnicodeSymbol(QChar(0x2030)).addHtml("&permil;");
symbols["perthousand"]=s; symbols["permil"]=s; }
symbols["pound"]=SimpleTextSymbol(QChar(0xA3), "&pound;");
symbols["pound"]=UnicodeSymbol(QChar(0x00A3));
symbols["prime"]=UnicodeSymbol(QChar(0x2032)).addHtml("&prime;").addStd("'");
symbols["arcminute"]=UnicodeSymbol(QChar(0x2032)).addHtml("&prime;").addStd("'");
symbols["arcsecond"]=UnicodeSymbol(QChar(0x2033)).addHtml("&dprime;").addStd("'");
symbols["rangle"]=UprightSymbolUnicode(QChar(0x232A)).addUprightWinSymbol(QChar(0xF1));
symbols["rceil"]=UprightSymbolUnicode(QChar(0x2309)).addUprightHtml("&RightCeiling;").addUprightWinSymbol(QChar(0xF9));
{ auto s=SimpleTextSymbol(QChar(0xAE), "&reg;");
symbols["registered"]=s; symbols["textregistered"]=s; symbols["circledR"]=s; }
symbols["rfloor"]=UprightSymbolUnicode(QChar(0x230B)).addUprightHtml("&RightFloor;").addUprightWinSymbol(QChar(0xFB));
symbols["rightangle"]=UprightSymbolUnicode(QChar(0x221F)).addUprightHtml("&angrt;");
//symbols["smile"]=UprightSymbolUnicode(QChar(0x2323)).addUprightHtml("&smile;");
symbols["sphericalangle"]=UprightSymbolUnicode(QChar(0x2222)).addUprightHtml("&angsph;");
symbols["star"]=UprightSymbolUnicode(QChar(0x22C6));
symbols["tcohm"]=UnicodeSymbol(QChar(0x2126));
{ auto s=UnicodeSymbol(QChar(0x2014), "&#11840;");
symbols["dblhyphen"]=s; symbols["textdblhyphen"]=s; symbols["textdblhyphenchar"]=s; }
{ auto s=UnicodeSymbol(QChar(0x2014), "&mdash;");
symbols["---"]=s; symbols["textemdash"]=s; symbols["emdash"]=s; }
{ auto s=UnicodeSymbol(QChar(0x2013), "&ndash;");
symbols["--"]=s; symbols["textendash"]=s; symbols["endash"]=s; }
{ auto s=SimpleTextSymbol("-");
symbols["texthyphen"]=s; symbols["hyphen"]=s; }
symbols["textbar"]=SimpleTextSymbol("|", "&VerticalLine;");
{ auto s=SimpleTextSymbol(QChar(0xB0), "&deg;");
symbols["textdegree"]=s; symbols["degree"] = s; }
symbols["textgreater"]=SimpleTextSymbol(">", "&gt;");
symbols["textless"]=SimpleTextSymbol("<", "&lt;");
symbols["textquestiondown"]=SimpleTextSymbol(QChar(0xBF), "&iquest;");
symbols["textexclamdown"]=SimpleTextSymbol(QChar(0xA1), "&iexcl;");
{ auto s=UnicodeSymbol(QChar(0x231C));
symbols["tlcorner"]=s; symbols["ulcorner"]=s; }
symbols["trademark"]=UnicodeSymbol(QChar(0x2122)).addHtml("&trade;").addWinSymbol(QChar(0xD4)).addStd("(TM)");
symbols["trapezium"]=UnicodeSymbol(QChar(0x23E2)).addHtml("&trpezium;");
{ auto s=UprightSymbolUnicode(QChar(0x231D));
symbols["trcorner"]=s; symbols["urcorner"]=s; }
symbols["trprime"]=UnicodeSymbol(QChar(0x2034)).addHtml("&tprime;").addStd("'''");
symbols["varcarriagereturn"]=UnicodeSymbol(QChar(0x23CE)).addWinSymbol(QChar(0xBF));
symbols["varhexagonlrbonds"]=UnicodeSymbol(QChar(0x232C));
symbols["yen"]=SimpleTextSymbol(QChar(0xA5), "&yen;");
/**************************************************************************************
* STANDARD MathOperator Strings
**************************************************************************************/
symbols["Pr"] = NarrowMathOperatorText("Pr");
symbols["acos"] = NarrowMathOperatorText("acos");
symbols["arccos"] = NarrowMathOperatorText("arccos");
symbols["arcsin"] = NarrowMathOperatorText("arcsin");
symbols["arctan"] = NarrowMathOperatorText("arctan");
symbols["arg"] = NarrowMathOperatorText("arg").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["argmax"] = NarrowMathOperatorText("arg max", "arg&thinsp;max").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["argmin"] = NarrowMathOperatorText("arg min", "arg&thinsp;min").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["asin"] = NarrowMathOperatorText("asin");
symbols["atan"] = NarrowMathOperatorText("atan");
symbols["cos"] = NarrowMathOperatorText("cos");
symbols["cosh"] = NarrowMathOperatorText("cosh");
symbols["cot"] = NarrowMathOperatorText("cot");
symbols["coth"] = NarrowMathOperatorText("coth");
symbols["coth"] = NarrowMathOperatorText("coth");
symbols["deg"] = NarrowMathOperatorText("deg");
symbols["det"] = NarrowMathOperatorText("det");
symbols["dim"] = NarrowMathOperatorText("dim");
symbols["exp"] = NarrowMathOperatorText("exp");
symbols["gcd"] = NarrowMathOperatorText("gcd");
symbols["hom"] = NarrowMathOperatorText("hom");
symbols["ker"] = NarrowMathOperatorText("ker");
symbols["lb"] = NarrowMathOperatorText("lb");
symbols["ld"] = NarrowMathOperatorText("ld");
symbols["lim"] = NarrowMathOperatorText("lim").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["liminf"] = NarrowMathOperatorText("lim inf", "lim&thinsp;inf").addGlobalFlags(SubSuperscriptBelowAboveSymbol).addGlobalFlags(SubscriptCorrection);
symbols["limsup"] = NarrowMathOperatorText("lim sup", "lim&thinsp;sup").addGlobalFlags(SubSuperscriptBelowAboveSymbol).addGlobalFlags(SubscriptCorrection);
symbols["ln"] = NarrowMathOperatorText("ln");
symbols["log"] = NarrowMathOperatorText("log");
symbols["max"] = NarrowMathOperatorText("max");
symbols["median"] = NarrowMathOperatorText("median");
symbols["min"] = NarrowMathOperatorText("min");
symbols["mod"] = NarrowMathOperatorText("mod");
symbols["sec"] = NarrowMathOperatorText("sec");
symbols["sgn"] = NarrowMathOperatorText("sgn");
symbols["sign"] = NarrowMathOperatorText("sign");
symbols["sin"] = NarrowMathOperatorText("sin");
symbols["sinh"] = NarrowMathOperatorText("sinh");
symbols["tan"] = NarrowMathOperatorText("tan");
symbols["tanh"] = NarrowMathOperatorText("tanh");
/**************************************************************************************
* STANDARD MathOperator Symbols
**************************************************************************************/
{ auto s=MathOperatorSymbolUnicode(QChar(0x2217)).addMathOperatorStd("*").addMathOperatorHtml("*");
symbols["*"]=s; symbols["ast"]=s; symbols["asterisk"]=s; }
symbols["/"]=NarrowMathOperatorSymbolStd("/");
symbols["+"]=MathOperatorSymbolUnicode(QChar(0x2B)).addMathOperatorHtml("+").addMathOperatorStd("+");
symbols["-"]=MathOperatorSymbolUnicode(QChar(0x2212)).addMathOperatorHtml("-").addMathOperatorStd("-");
symbols["<"]=MathOperatorSymbol("<", "&lt;");
symbols["="]=MathOperatorSymbol("=");
symbols[">"]=MathOperatorSymbol(">", "&gt;");
symbols["Downarrow"]=UprightSymbolUnicode(QChar(0x21D3)).addUprightHtml("&DoubleDownArrow;").addUprightWinSymbol(QChar(0xDF));
symbols["Leftarrow"]=UprightSymbolUnicode(QChar(0x21D0)).addUprightHtml("&DoubleLeftArrow;").addUprightWinSymbol(QChar(0xDC));
symbols["Rightarrow"]=UprightSymbolUnicode(QChar(0x21D2)).addUprightHtml("&Rightarrow;").addUprightWinSymbol(QChar(0xDE));
symbols["Uparrow"]=UprightSymbolUnicode(QChar(0x21D1)).addUprightHtml("&DoubleUpArrow;").addUprightWinSymbol(QChar(0xDD));
symbols["Updownarrow"]=UprightSymbolUnicode(QChar(0x21D5)).addUprightHtml("&Updownarrow;");
symbols["approx"]=MathOperatorSymbolUnicode(QChar(0x2248)).addMathOperatorHtml("&asymp;").addMathOperatorWinSymbol(QChar(0xBB));
symbols["bbC"]=UnicodeSymbol(QChar(0x2102));
symbols["bbH"]=UnicodeSymbol(QChar(0x210D));
symbols["bbN"]=UnicodeSymbol(QChar(0x2115));
symbols["bbP"]=UnicodeSymbol(QChar(0x2119));
symbols["bbQ"]=UnicodeSymbol(QChar(0x211A));
symbols["bbR"]=UnicodeSymbol(QChar(0x211D));
symbols["bbZ"]=UnicodeSymbol(QChar(0x2124));
symbols["because"]=MathOperatorSymbolUnicode(QChar(0x2235)).addMathOperatorHtml("&because;");
symbols["bigcap"]=NarrowMathOperatorSymbolUnicode(QChar(0x22C2)).addMathOperatorHtml("&Intersection;").addMathOperatorWinSymbol(QChar(0xC7), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["bigcup"]=NarrowMathOperatorSymbolUnicode(QChar(0x22C3)).addMathOperatorHtml("&xcup;").addMathOperatorWinSymbol(QChar(0xC8), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
{ auto s=NarrowMathOperatorSymbolUnicode(QChar(0x22C0)).addMathOperatorHtml("&Wedge;").addMathOperatorWinSymbol(QChar(0xD9), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["bigwedge"]=s; symbols["bighat"]=s; }
symbols["bigvee"]=NarrowMathOperatorSymbolUnicode(QChar(0x22C1)).addMathOperatorHtml("&xvee;").addMathOperatorWinSymbol(QChar(0xDA), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["bigotimes"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A02)).addMathOperatorHtml("&bigotimes;").addMathOperatorWinSymbol(QChar(0xC4), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["bigoplus"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A01)).addMathOperatorHtml("&bigoplus;").addMathOperatorWinSymbol(QChar(0xC5), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["bigodot"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A00)).addMathOperatorHtml("&bigodot;").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["biguplus"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A04)).addMathOperatorHtml("&biguplus;").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["bigsqcup"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A06)).addMathOperatorHtml("&bigsqcup;").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
{ auto s=MathOperatorSymbolUnicode(QChar(0x22A5)).addMathOperatorHtml("&UpTee;");
symbols["bot"]=s; symbols["perp"]=s; }
{ auto s=MathOperatorSymbolUnicode(QChar(0x2229)).addMathOperatorHtml("&cap;").addMathOperatorWinSymbol(QChar(0xC7));
symbols["cap"]=s; symbols["land"]=s; }
symbols["cdot"]=MathOperatorSymbol(QChar(0xB7)).addMathOperatorHtml("&middot;").addMathOperatorWinSymbol(QChar(0xD7));
symbols["cong"]=MathOperatorSymbolUnicode(QChar(0x2245)).addMathOperatorHtml("&TildeFullEqual;");
symbols["coprod"]=NarrowMathOperatorSymbolUnicode(QChar(0x2210)).addMathOperatorHtml("&Coproduct;").addWinSymbol(QChar(0xD5), ItalicOff|BoldOff|FlipSymbolUpDown, 1.8, 0.1).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
{ auto s=MathOperatorSymbolUnicode(QChar(0x222A)).addMathOperatorHtml("&cup;").addMathOperatorWinSymbol(QChar(0xC8));
symbols["cup"]=s; symbols["lor"]=s; }
symbols["ddots"]=UprightSymbolUnicode(QChar(0x22F1)).addMathOperatorHtml("&dtdot;");
symbols["div"]=MathOperatorSymbolUnicode(QChar(0x00F7)).addMathOperatorHtml("&div;").addMathOperatorWinSymbol(QChar(0xB8));
symbols["downarrow"]=UprightSymbolUnicode(QChar(0x2193)).addUprightHtml("&ShortDownArrow;").addUprightWinSymbol(QChar(0xAF));
symbols["downharpoonleft"]=UprightSymbolUnicode(QChar(0x21C3)).addUprightHtml("&LeftDownVector;");
symbols["downharpoonright"]=UprightSymbolUnicode(QChar(0x21C2)).addUprightHtml("&RightDownVector;");
{ auto s=MathOperatorSymbolUnicode(QChar(0x2205)).addMathOperatorHtml("&varnothing;").addMathOperatorWinSymbol(QChar(0xC6)).addStd("0", BoldOff|ItalicOff|DrawSlash);
symbols["emptyset"]=s; symbols["varnothing"]=s; }
symbols["equiv"]=MathOperatorSymbolUnicode(QChar(0x2261)).addMathOperatorHtml("&equiv;").addMathOperatorWinSymbol(QChar(0xBA));
symbols["exists"]=NarrowMathOperatorSymbolUnicode(QChar(0x2203)).addMathOperatorHtml("&exist;").addMathOperatorWinSymbol(QChar(0x24)).addStd("E", ItalicOff|BoldOff|FlipSymbolLeftRight);
symbols["forall"]=NarrowMathOperatorSymbolUnicode(QChar(0x2200)).addMathOperatorHtml("&forall;").addMathOperatorWinSymbol(QChar(0x22)).addStd("A", ItalicOff|BoldOff|FlipSymbolUpDown).addGlobalFlags(SubscriptCorrection);
{ auto s=MathOperatorSymbolUnicode(QChar(0x2265)).addMathOperatorHtml("&GreaterEqual;").addMathOperatorWinSymbol(QChar(0xB3));
symbols["geq"]=s; symbols["ge"]=s; }
symbols["geqq"]=MathOperatorSymbolUnicode(QChar(0x2267)).addMathOperatorHtml("&GreaterFullEqual;");
symbols["gg"]=MathOperatorSymbolUnicode(QChar(0x226B)).addMathOperatorHtml("&NestedGreaterGreater;").addMathOperatorStd(">>");
symbols["iddots"]=UprightSymbolUnicode(QChar(0x22F0)).addMathOperatorHtml("&utdot;");
{ auto s=UprightSymbolUnicode(QChar(0x21D4)).addUprightHtml("&DoubleLeftRightArrow;").addUprightWinSymbol(QChar(0xDB));
symbols["iff"]=s; symbols["Leftrightarrow"]=s; }
symbols["iiint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222D)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("&tint;").addMathOperatorWinSymbol(QString(3, QChar(0xF2)), 1.8, 0.1);
symbols["iint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222C)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("&Int;").addMathOperatorWinSymbol(QString(2, QChar(0xF2)), 1.8, 0.1);
symbols["in"]=MathOperatorSymbolUnicode(QChar(0x2208)).addMathOperatorHtml("&isin;").addMathOperatorWinSymbol(QChar(0xCE));
symbols["int"]=NarrowMathOperatorSymbolUnicode(QChar(0x222B)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("&int;").addMathOperatorWinSymbol(QChar(0xF2), 1.8, 0.1);
symbols["leftarrow"]=UprightSymbolUnicode(QChar(0x2190)).addUprightHtml("&larr;").addUprightWinSymbol(QChar(0xAC));
symbols["longleftarrow"]=UprightSymbolUnicode(QChar(0x27F5)).addUprightHtml("&longleftarrow;");
symbols["longrightarrow"]=UprightSymbolUnicode(QChar(0x27F6)).addUprightHtml("&longrightarrow;");
symbols["longleftrightarrow"]=UprightSymbolUnicode(QChar(0x27F7)).addUprightHtml("&longleftrightarrow;");
symbols["Longleftarrow"]=UprightSymbolUnicode(QChar(0x27F8)).addUprightHtml("&DoubleLongLeftArrow;");
symbols["Longrightarrow"]=UprightSymbolUnicode(QChar(0x27F9)).addUprightHtml("&DoubleLongRightArrow;");
symbols["Longleftrightarrow"]=UprightSymbolUnicode(QChar(0x27FA)).addUprightHtml("&Longleftrightarrow;");
symbols["leftharpoondown"]=UprightSymbolUnicode(QChar(0x21BD)).addUprightHtml("&leftharpoondown;");
symbols["leftharpoonup"]=UprightSymbolUnicode(QChar(0x21BC)).addUprightHtml("&LeftVector;");
symbols["leftrightarrow"]=UprightSymbolUnicode(QChar(0x2194)).addUprightHtml("&harr;").addUprightWinSymbol(QChar(0xAB));
symbols["leftrightharpoon"]=UprightSymbolUnicode(QChar(0x21CB)).addUprightHtml("&ReverseEquilibrium;");
{ auto s=MathOperatorSymbolUnicode(QChar(0x2264)).addMathOperatorHtml("&leq;").addMathOperatorWinSymbol(QChar(0xA3));
symbols["leq"]=s; symbols["le"]=s; }
symbols["leqq"]=MathOperatorSymbolUnicode(QChar(0x2266)).addMathOperatorHtml("&LessFullEqual;");
symbols["ll"]=MathOperatorSymbolUnicode(QChar(0x226A)).addMathOperatorHtml("&NestedLessLess;").addMathOperatorStd("<<");
symbols["lnot"]=MathOperatorSymbolUnicode(QChar(0xAC)).addMathOperatorWinSymbol(QChar(0xD8)).addMathOperatorHtml("&not;");
symbols["mapimage"]=MathOperatorSymbolUnicode(QChar(0x22B7)).addMathOperatorHtml("&imof;");
symbols["maporiginal"]=MathOperatorSymbolUnicode(QChar(0x22B6)).addMathOperatorHtml("&origof;");
symbols["mapsto"]=MathOperatorSymbolUnicode(QChar(0x21A6)).addMathOperatorHtml("&RightTeeArrow;");
symbols["mid"]=MathOperatorSymbolUnicode(QChar(0x2223)).addMathOperatorHtml("&VerticalBar;").addMathOperatorWinSymbol(QChar(0xBD)).addMathOperatorStd("|");
symbols["mp"]=MathOperatorSymbolUnicode(QChar(0x2213)).addMathOperatorHtml("&mp;").addWinSymbol(QChar(0xB1),ItalicOff|BoldOff|FlipSymbolUpDown).addStd(QChar(0xB1),ItalicOff|BoldOff|FlipSymbolUpDown);
symbols["multimap"]=MathOperatorSymbolUnicode(QChar(0x22B8)).addMathOperatorHtml("&mumap;");
symbols["nabla"]=NarrowMathOperatorSymbolUnicode(QChar(0x2207)).addMathOperatorHtml("&nabla;").addMathOperatorWinSymbol(QChar(0xD1)).addGlobalFlags(IntLikeSymbolCorrection);
symbols["ne"]=NarrowMathOperatorSymbolUnicode(QChar(0x2260)).addMathOperatorHtml("&ne;").addMathOperatorWinSymbol(QChar(0xB9));
symbols["nearrow"]=UprightSymbolUnicode(QChar(0x2197)).addUprightHtml("&UpperRightArrow;");
{ auto s=MathOperatorSymbolUnicode(QChar(0x00AC)).addMathOperatorHtml("&not;").addMathOperatorWinSymbol(QChar(0xD8));
symbols["neg"]=s; symbols["lnot"]=s; }
symbols["neq"]=MathOperatorSymbolUnicode(QChar(0x2260)).addMathOperatorHtml("&ne;").addMathOperatorWinSymbol(QChar(0xB9)).addStd("=", ItalicOff|BoldOff|DrawSlash);
symbols["nexists"]=NarrowMathOperatorSymbolUnicode(QChar(0x2204)).addMathOperatorHtml("&NotExists;").addStd("E", ItalicOff|BoldOff|FlipSymbolLeftRight|DrawSlash).addMathOperatorWinSymbol(QChar(0x24), ItalicOff|BoldOff|DrawSlash);
symbols["ni"]=NarrowMathOperatorSymbolUnicode(QChar(0x220B)).addMathOperatorHtml("&ReverseElement;").addMathOperatorWinSymbol(QChar(0xCE), ItalicOff|BoldOff|FlipSymbolLeftRight);
symbols["nmid"]=NarrowMathOperatorSymbolUnicode(QChar(0x2224)).addMathOperatorHtml("&NotVerticalBar;");
symbols["notin"]=NarrowMathOperatorSymbolUnicode(QChar(0x2209)).addMathOperatorHtml("&notin;").addMathOperatorWinSymbol(QChar(0xCF));
symbols["notni"]=NarrowMathOperatorSymbolUnicode(QChar(0x220C)).addMathOperatorHtml("&NotReverseElement;");
symbols["nparallel"]=MathOperatorSymbolUnicode(QChar(0x2226)).addMathOperatorHtml("&NotDoubleVerticalBar;");
symbols["nwarrow"]=UprightSymbolUnicode(QChar(0x2196)).addUprightHtml("&UpperLeftArrow;");
symbols["odot"]=MathOperatorSymbolUnicode(QChar(0x2299)).addMathOperatorHtml("&odot;");
symbols["oiiint"]=NarrowMathOperatorSymbolUnicode(QChar(0x2230)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("&Cconint;");
symbols["oiint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222F)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("&DoubleContourIntegral;");
symbols["oint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222E)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("&ContourIntegral;");
symbols["ominus"]=MathOperatorSymbolUnicode(QChar(0x2296)).addMathOperatorHtml("&ominus;");
symbols["oplus"]=MathOperatorSymbolUnicode(QChar(0x2295)).addMathOperatorHtml("&CirclePlus;").addMathOperatorWinSymbol(QChar(0xC5));
symbols["oslash"]=MathOperatorSymbolUnicode(QChar(0x2298)).addMathOperatorHtml("&osol;");
symbols["otimes"]=MathOperatorSymbolUnicode(QChar(0x2297)).addMathOperatorHtml("&CircleTimes;").addMathOperatorWinSymbol(QChar(0xC4));
symbols["parallel"]=NarrowMathOperatorSymbolUnicode(QChar(0x2225)).addMathOperatorHtml("&shortparallel;").addMathOperatorStd("||");
symbols["pm"] = MathOperatorSymbol(QChar(0xB1), "&plusmn;").addMathOperatorWinSymbol(QChar(0xB1));
symbols["prec"]=MathOperatorSymbolUnicode(QChar(0x227A)).addMathOperatorHtml("&prec;");
symbols["prod"]=NarrowMathOperatorSymbolUnicode(QChar(0x220F)).addMathOperatorWinSymbol(QChar(0xD5), 1.8, 0.1).addMathOperatorHtml("&prod;").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["propto"]=MathOperatorSymbolUnicode(QChar(0x221D)).addMathOperatorWinSymbol(QChar(0xB5)).addMathOperatorHtml("&Proportional;");
symbols["rightharpoondown"]=UprightSymbolUnicode(QChar(0x21C1)).addUprightHtml("&rightharpoondown;");
symbols["rightharpoonup"]=UprightSymbolUnicode(QChar(0x21C0)).addUprightHtml("&RightVector;");
symbols["rightleftharpoon"]=UprightSymbolUnicode(QChar(0x21CC)).addUprightHtml("&Equilibrium;");
symbols["searrow"]=UprightSymbolUnicode(QChar(0x2198)).addUprightHtml("&LowerRightArrow;");
symbols["setminus"]=MathOperatorSymbolUnicode(QChar(0x2216)).addMathOperatorHtml("&smallsetminus;");
{ auto s=MathOperatorSymbolUnicode(QChar(0x223C)).addMathOperatorHtml("&tilde;").addMathOperatorStd("~");
symbols["~"]=s; symbols["sim"]=s; }
symbols["simeq"]=MathOperatorSymbolUnicode(QChar(0x2243)).addMathOperatorHtml("&TildeEqual;");
symbols["sqcap"]=MathOperatorSymbolUnicode(QChar(0x2293)).addMathOperatorHtml("&SquareIntersection;");
symbols["sqcup"]=MathOperatorSymbolUnicode(QChar(0x2294)).addMathOperatorHtml("&SquareUnion;");
symbols["square"]=MathOperatorSymbolUnicode(QChar(0x25A1));
symbols["subset"]=MathOperatorSymbolUnicode(QChar(0x2282)).addMathOperatorHtml("&sub;").addMathOperatorWinSymbol(QChar(0xCC));
symbols["subseteq"]=MathOperatorSymbolUnicode(QChar(0x2286)).addMathOperatorHtml("&SubsetEqual;").addMathOperatorWinSymbol(QChar(0xCD));
symbols["subsetnot"]=MathOperatorSymbolUnicode(QChar(0x2284)).addMathOperatorHtml("&nsub;").addMathOperatorWinSymbol(QChar(0xCB));
symbols["succ"]=MathOperatorSymbolUnicode(QChar(0x227B)).addMathOperatorHtml("&succ;");
symbols["sum"]=NarrowMathOperatorSymbolUnicode(QChar(0x2211)).addMathOperatorWinSymbol(QChar(0xE5), 1.8, 0.1).addMathOperatorHtml("&sum;").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["supset"]=MathOperatorSymbolUnicode(QChar(0x2283)).addMathOperatorHtml("&sup;").addMathOperatorWinSymbol(QChar(0xC9));
symbols["supseteq"]=MathOperatorSymbolUnicode(QChar(0x2287)).addMathOperatorHtml("&SupersetEqual;").addMathOperatorWinSymbol(QChar(0xCA));
symbols["supsetnot"]=MathOperatorSymbolUnicode(QChar(0x2285)).addMathOperatorHtml("&nsup;");
symbols["swarrow"]=UprightSymbolUnicode(QChar(0x2199)).addUprightHtml("&LowerLeftArrow;");
symbols["therefore"]=MathOperatorSymbolUnicode(QChar(0x2234)).addMathOperatorHtml("&therefore;").addMathOperatorWinSymbol(QChar(0x5C));
symbols["times"] = MathOperatorSymbol(QChar(0xD7), "&times;").addMathOperatorWinSymbol(QChar(0xB4));
{ auto s=UprightSymbolUnicode(QChar(0x2192)).addUprightHtml("&rarr;").addUprightWinSymbol(QChar(0xAE));
symbols["to"]=s; symbols["rightarrow"]=s; }
symbols["top"]=MathOperatorSymbolUnicode(QChar(0x22A4)).addMathOperatorHtml("&top;").addMathOperatorWinSymbol(QChar(0x5E)).addUprightStd("T");
symbols["triangle"]=NarrowMathOperatorSymbolUnicode(QChar(0x2206));
symbols["uparrow"]=UprightSymbolUnicode(QChar(0x2191)).addUprightHtml("&ShortUpArrow;").addUprightWinSymbol(QChar(0xAD));
symbols["updownarrow"]=UprightSymbolUnicode(QChar(0x2195)).addUprightHtml("&updownarrow;");
symbols["upharpoonleft"]=UprightSymbolUnicode(QChar(0x21BF)).addUprightHtml("&LeftUpVector;");
symbols["upharpoonright"]=UprightSymbolUnicode(QChar(0x21BE)).addUprightHtml("&RightUpVector;");
symbols["vartriangleleft"]=NarrowMathOperatorSymbolUnicode(QChar(0x22B2)).addMathOperatorHtml("&LeftTriangle;");
symbols["vdots"]=UprightSymbolUnicode(QChar(0x22EE)).addMathOperatorHtml("&vellip;");
symbols["vee"]=MathOperatorSymbolUnicode(QChar(0x2228)).addMathOperatorHtml("&vee;").addMathOperatorWinSymbol(QChar(0xDA));
symbols["vdash"]=MathOperatorSymbolUnicode(QChar(0x22A2)).addMathOperatorHtml("&vdash;");
symbols["dashv"]=MathOperatorSymbolUnicode(QChar(0x22A3)).addMathOperatorHtml("&dashv;");
symbols["vDash"]=MathOperatorSymbolUnicode(QChar(0x22A8)).addMathOperatorHtml("&DoubleRightTee;");
symbols["nvdash"]=MathOperatorSymbolUnicode(QChar(0x22AC)).addMathOperatorHtml("&nvdash;");
symbols["Vdash"]=MathOperatorSymbolUnicode(QChar(0x22A9)).addMathOperatorHtml("&Vdash;");
symbols["models"]=MathOperatorSymbolUnicode(QChar(0x22A7)).addMathOperatorHtml("&models;");
symbols["wedge"]=MathOperatorSymbolUnicode(QChar(0x2227)).addMathOperatorHtml("&wedge;").addMathOperatorWinSymbol(QChar(0xD9));
/**************************************************************************************
* GREEK letters
**************************************************************************************/
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "alpha", "a", QChar(0x3B1), "&alpha;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "beta", "b", QChar(0x3B2), "&beta;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "gamma", "g", QChar(0x3B3), "&gamma;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "delta", "d", QChar(0x3B4), "&delta;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "epsilon", "e", QChar(0x3F5), "&varepsilon;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "varepsilon", "e", QChar(0x3B5), "&epsi;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "zeta", "z", QChar(0x3B6),"&zeta;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "eta", "h", QChar(0x3B7),"&eta;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "theta", "q", QChar(0x3B8),"&theta;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "vartheta", "J", QChar(0x3D1),"&thetasym;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "iota", "i", QChar(0x3B9),"&iota;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "kappa", "k", QChar(0x3BA),"&kappa;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "lambda", "l", QChar(0x3BB),"&lambda;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "mu", "m", QChar(0x3BC),"&mu;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "nu", "n", QChar(0x3BD),"&nu;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "xi", "x", QChar(0x3BE),"&xi;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "pi", "p", QChar(0x3C0),"&pi;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "varpi", "v", QChar(0x3D6),"&piv;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "rho", "r", QChar(0x3C1),"&rho;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "varrho", "r", QChar(0x3F1),"&varrho;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "sigma", "s", QChar(0x3C3),"&sigma;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "varsigma", "V", QChar(0x3C2),"&varsigma;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "tau", "t", QChar(0x3C4),"&tau;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "upsilon", "u", QChar(0x3C5),"&upsilon;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "phi", "f", QChar(0x3C5),"&straightphi;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "varphi", "j", QChar(0x3D6),"&phi;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "chi", "c", QChar(0x3C7),"&chi;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "psi", "y", QChar(0x3C8),"&psi;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "omega", "w", QChar(0x3C9),"&omega;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Gamma", "G", QChar(0x3A3),"&Gamma;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Delta", "D", QChar(0x394),"&Delta;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Theta", "Q", QChar(0x398),"&Theta;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Lambda", "L", QChar(0x39B),"&Lambda;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Omega", "W", QChar(0x3A9),"&Omega;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Xi", "X", QChar(0x39E),"&Xi;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Pi", "P", QChar(0x3A0),"&Pi;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Sigma", "S", QChar(0x3A3),"&Sigma;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Upsilon", "U", QChar(0x3C6),"&Upsilon;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Phi", "F", QChar(0x3A6),"&Phi;");
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Psi", "Y", QChar(0x3A8),"&Psi;");
/**************************************************************************************
* SYMBOLS from special fonts
**************************************************************************************/
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
QFontDatabase fdb;
const auto fonts=fdb.families();
#else
const auto fonts=QFontDatabase::families();
#endif
if (fonts.contains("Wingdings")) {
{ auto s=SymbolFullProps("Wingdings", QChar(0x46));
symbols["lefthand"]=s; symbols["HandRight"]=s;}
{ auto s=SymbolFullProps("Wingdings", QChar(0x45));
symbols["righthand"]=s; symbols["HandLeft"]=s;}
}
return symbols;
}();
return s_symbols;
}
JKQTMathTextSymbolNode::SymbolFullProps JKQTMathTextSymbolNode::MathOperatorSymbolUnicode(const QString &unicode)
{
return SymbolFullProps(MTFEUnicode, SymbolProps(unicode, ItalicOff|BoldOff, 1.0, 0.0)).addGlobalFlags(ExtendWidthInMathmode|MakeWhitespaceHalf);
@ -416,7 +843,7 @@ JKQTMathTextSymbolNode::SymbolFullProps JKQTMathTextSymbolNode::UprightGreekLett
return SymbolFullProps(MTFEUnicode, SymbolProps(letterUnicode, ItalicOff), MTFEWinSymbol, SymbolProps(letterWinSymbol, ItalicOff), html, ItalicOff);
}
void JKQTMathTextSymbolNode::addGreekLetterVariants_WinSymbol_Unicode_Html(const QString &baseInstructionName, const QString &letterWinSymbol, const QString &letterUnicode, const QString &html)
void JKQTMathTextSymbolNode::addGreekLetterVariants_WinSymbol_Unicode_Html(QHash<QString, JKQTMathTextSymbolNode::SymbolFullProps>& symbols, const QString &baseInstructionName, const QString &letterWinSymbol, const QString &letterUnicode, const QString &html)
{
symbols[baseInstructionName]=MathGreekLetter_WinSymbol_Unicode_Html(letterWinSymbol, letterUnicode, html).addGlobalFlags(SubscriptCorrection);
symbols["text"+baseInstructionName]=AsOutsiudeGreekLetter_WinSymbol_Unicode_Html(letterWinSymbol, letterUnicode, html);
@ -488,437 +915,7 @@ JKQTMathTextSymbolNode::SymbolFullProps JKQTMathTextSymbolNode::SimpleUprightTex
QHash<QString, JKQTMathTextSymbolNode::SymbolFullProps> JKQTMathTextSymbolNode::symbols=QHash<QString, JKQTMathTextSymbolNode::SymbolFullProps>();
void JKQTMathTextSymbolNode::fillSymbolTables()
{
static std::mutex sMutex;
std::lock_guard<std::mutex> lock(sMutex);
if (symbols.size()>0) return; // tables have already been filled! So nothing to do here
/**************************************************************************************
* STANDARD Symbols available in all standard fonts
**************************************************************************************/
symbols["#"]=SimpleTextSymbol("#", "&num;");
symbols["%"]=SimpleTextSymbol("%", "&NestedGreaterGreater;");
symbols["&"]=SimpleTextSymbol("&", "&amp;");
symbols["("]=SimpleUprightTextSymbol("(");
symbols[")"]=SimpleUprightTextSymbol(")");
symbols["["]=SimpleUprightTextSymbol("[");
symbols["]"]=SimpleUprightTextSymbol("]");
symbols["_"]=SimpleTextSymbol("_");
symbols["{"]=SimpleUprightTextSymbol("{");
symbols["|"]=SimpleUprightTextSymbol("||", "&Vert;").addUprightUnicode(QChar(0x2016));
symbols["}"]=SimpleUprightTextSymbol("}");
symbols["AC"]=UprightSymbolUnicode(QChar(0x223F)).addUprightHtml("&acd;").addUprightStd("~");
symbols["circonflex"]=SimpleTextSymbol("^");
symbols["aa"]=SimpleTextSymbol(QChar(0xE5));
symbols["ae"]=SimpleTextSymbol(QChar(0xE6));
symbols["AE"]=SimpleTextSymbol(QChar(0xC6));
symbols["AA"]=SimpleTextSymbol(QChar(0xC5));
symbols["oe"]=UnicodeSymbol(QChar(0x153)).addStd("oe").addHtml("&oelig;");
symbols["OE"]=UnicodeSymbol(QChar(0x152)).addStd("OE").addHtml("&OElig;");
symbols["ss"]=SimpleTextSymbol(QChar(0xDF)).addHtml("&szlig;");
symbols["l"]=UnicodeSymbol(QChar(0x141)).addHtml("&lstrok;");
symbols["L"]=UnicodeSymbol(QChar(0x142)).addHtml("&Lstrok;");
symbols["o"]=SimpleTextSymbol(QChar(0xF8)).addHtml("&oslash;");
symbols["O"]=SimpleTextSymbol(QChar(0xD8)).addHtml("&Oslash;");
{ auto s=UprightSymbolUnicode(QChar(0x212B)).addUprightStd(QChar(0xC5));
symbols["Angstrom"]=s; symbols["angstrom"]=s; }
{ auto s=UnicodeSymbol(QChar(0x2136)).addHtml("&beth;");
symbols["Beth"]=s; symbols["Bet"]=s; symbols["beth"]=s; symbols["bet"]=s; }
symbols["Box"]=UprightSymbolUnicode(QChar(0x25A1));
symbols["DC"]=UnicodeSymbol(QChar(0x2393)).addWinSymbol(QChar(0xBB)).addStd("=");
symbols["EUR"]=UnicodeSymbol(QChar(0x20AC));
symbols["Im"]=UprightSymbolUnicode(QChar(0x2111)).addHtml("&image;").addWinSymbol(QChar(0xC1));
symbols["No"]=UnicodeSymbol(QChar(0x2116));
{ auto s=UprightSymbolUnicode(QChar(0x2126)).addUprightWinSymbol("W").addUprightHtml("&Omega;");
symbols["Ohm"]=s; symbols["ohm"]=s; }
symbols["P"]=SimpleTextSymbol(QChar(0xB6)).addHtml("&para;");
symbols["Re"]=UnicodeSymbol(QChar(0x211C)).addHtml("&Rfr;").addWinSymbol(QChar(0xC2));
{ auto s=SimpleTextSymbol(QChar(0xA7)).addHtml("&sect;");
symbols["S"]=s; symbols["§"]=s;}
symbols["accurrent"]=UnicodeSymbol(QChar(0x23E6));
{ auto s=UnicodeSymbol(QChar(0x2135)).addHtml("&aleph;").addWinSymbol(QChar(0xC0));
symbols["alef"]=s; symbols["aleph"]=s; symbols["Aleph"]=s; symbols["Alef"]=s; }
symbols["angle"]=UprightSymbolUnicode(QChar(0x2220)).addHtml("&angle;").addWinSymbol(QChar(0xD0));
symbols["backslash"]=SimpleTextSymbol("\\");
symbols["benzene"]=UprightSymbolUnicode(QChar(0x232C));
symbols["benzenr"]=UprightSymbolUnicode(QChar(0x23E3));
symbols["blacksquare"]=UprightSymbolUnicode(QChar(0x220E)).addUprightHtml("&squ;");
{ auto s=UprightSymbolUnicode(QChar(0x231E));
symbols["blcorner"]=s; symbols["llcorner"]=s; }
{ auto s=UprightSymbolUnicode(QChar(0x231F));
symbols["brcorner"]=s; symbols["lrcorner"]=s; }
{ auto s=UprightSymbolUnicode(QChar(0x2022)).addUprightHtml("&bull;").addUprightWinSymbol(QChar(0xB7));
symbols["bullet"]=s; symbols["textbullet"]=s; }
symbols["cdots"]=UprightSymbolUnicode(QChar(0x22EF)).addUprightHtml("&middot;&middot;&middot;").addUprightStd(QString(3, QChar(0xB7)));
{ auto s=UnicodeSymbol(QChar(0x2103)).addUprightStd("°C").addUprightHtml("&deg;C");
symbols["celsius"]=s; symbols["degC"]=s; symbols["degreeCelsius"]=s; }
symbols["ell"]=UprightSymbolUnicode(QChar(0x2113), "&ell;");
symbols["wp"]=UprightSymbolUnicode(QChar(0x2118), "&wp;").addGlobalFlags(SubscriptCorrection);
symbols["mho"]=UprightSymbolUnicode(QChar(0x2127), "&mho;");
symbols["lozenge"]=UprightSymbolUnicode(QChar(0x25CA), "&loz;");
symbols["cent"]=SimpleTextSymbol(QChar(0xA2), "&cent;");
symbols["checkmark"]=UprightSymbolStd(QChar(0x2713)).addUprightHtml("&check;");
symbols["circ"]=UprightSymbolStd(QChar(0x2218)).addUprightHtml("&SmallCircle;").addStd("o", ItalicOff,0.7, -0.25);
symbols["co"]=UprightSymbolUnicode(QChar(0x2105));
{ auto s=SimpleTextSymbol(QChar(0xA9), "&copy;");
symbols["copyright"]=s; symbols["textcopyright"]=s; symbols["circledC"]=s; }
{ auto s=UprightSymbolUnicode(QChar(0x2020)).addUprightHtml("&dagger;");
symbols["dagger"]=s; symbols["dag"]=s; symbols["textdagger"]=s; }
{ auto s=UprightSymbolUnicode(QChar(0x2021)).addUprightHtml("&ddagger;");
symbols["ddagger"]=s; symbols["ddag"]=s; symbols["textdaggerdbl"]=s; }
{ auto s=UnicodeSymbol(QChar(0x2138)).addHtml("&daleth;");
symbols["dalet"]=s; symbols["Dalet"]=s; symbols["daleth"]=s; symbols["Daleth"]=s; }
symbols["dd"] = SymbolFullProps(SymbolProps("d", Upright|BoldOff), "d", Upright|BoldOff);
symbols["diamond"]=UprightSymbolUnicode(QChar(0x22C4)).addHtml("&diam;").addWinSymbol(QChar(0xE0));
symbols["dollar"]=UnicodeSymbol(QChar(0x0024));
{ auto s=SimpleTextSymbol(QChar(0x24), "&dollar;");
symbols["dollar"]=s; symbols["$"]=s; }
symbols["dprime"]=UnicodeSymbol(QChar(0x2033)).addHtml("&Prime;").addStd("''");
symbols["complement"] = SymbolFullProps(SymbolProps("C", Upright|BoldOff), "C", Upright|BoldOff).addUnicode(QChar(0x2201), Upright|BoldOff);
symbols["ee"] = SymbolFullProps(SymbolProps("e", Upright|BoldOff), "e", Upright|BoldOff);
{ auto s=UnicodeSymbol(QChar(0x2026)).addHtml("&mldr;").addWinSymbol(QChar(0xBC)).addStd("...");
symbols["ellipsis"]=s; symbols["dots"]=s; symbols["ldots"]=s; }
{ auto s=SimpleTextSymbol(QChar(0x20AC), "&euro;");
symbols["euro"]=s; symbols["EUR"]=s; }
{ auto s=UnicodeSymbol(QChar(0x2109));
symbols["fahrenheit"]=s; symbols["degF"]=s; }
symbols["female"]=UnicodeSymbol(QChar(0x2640)).addHtml("&female;");
symbols["flq"]=UnicodeSymbol(QChar(0x2039)).addHtml("&lsaquo;").addStd("<");
symbols["flqq"]=UnicodeSymbol(QChar(0x00AB)).addHtml("&laquo;").addStd(QChar(0xAB));
//symbols["frown"]=UnicodeSymbol(QChar(0x2322)).addHtml("&frown;");
symbols["frq"]=UnicodeSymbol(QChar(0x203A)).addHtml("&rsaquo;").addStd(">");
symbols["frqq"]=UnicodeSymbol(QChar(0x00BB)).addHtml("&raquo;").addStd(QChar(0xBB));
{ auto s=UnicodeSymbol(QChar(0x2137)).addHtml("&gimel;");
symbols["gimel"]=s; symbols["Gimel"]=s; }
symbols["glq"]=UnicodeSymbol(QChar(0x2018)).addHtml("&OpenCurlyQuote;").addStd("'");
symbols["glqq"]=UnicodeSymbol(QChar(0x201C)).addHtml("&OpenCurlyDoubleQuote;").addStd("\"");
symbols["grq"]=UnicodeSymbol(QChar(0x2019)).addHtml("&CloseCurlyQuote;").addStd("'");
symbols["grqq"]=UnicodeSymbol(QChar(0x201D)).addHtml("&CloseCurlyDoubleQuote;").addStd("\"");
symbols["hbar"]=UprightSymbolUnicode(QChar(0x210F)).addUprightHtml("&hbar;").addStd("h", ItalicOn|DrawLeftHBar).addGlobalFlags(SubscriptCorrection);
symbols["hexagon"]=UprightSymbolUnicode(QChar(0x2394));
symbols["ii"] = SymbolFullProps(SymbolProps("i", Upright|BoldOff), "i", Upright|BoldOff);
symbols["infty"]=UprightSymbolUnicode(QChar(0x221E)).addUprightHtml("&infin;").addUprightWinSymbol(QChar(0xA5)).addUprightStd("8", RotateSymbol90);
symbols["langle"]=UprightSymbolUnicode(QChar(0x2329)).addWinSymbol(QChar(0xE1));
symbols["lceil"]=UprightSymbolUnicode(QChar(0x2308)).addUprightHtml("&LeftCeiling;").addUprightWinSymbol(QChar(0xE9));
symbols["lfloor"]=UprightSymbolUnicode(QChar(0x230A)).addUprightHtml("&LeftFloor;").addUprightWinSymbol(QChar(0xEB));
symbols["lightning"]=UnicodeSymbol(QChar(0x21AF));
symbols["male"]=UnicodeSymbol(QChar(0x2642)).addHtml("&male;");
symbols["measuredangle"]=UprightSymbolUnicode(QChar(0x2221)).addUprightHtml("&measuredangle;");
symbols["micro"] = SimpleTextSymbol(QChar(0xB5), "&micro;");
symbols["ohm"]=UprightSymbolUnicode(QChar(0x2126)).addUprightHtml("&Omega;").addUprightWinSymbol(QChar(0x57));
symbols["partial"]=UprightSymbolUnicode(QChar(0x2202)).addUprightHtml("&part;").addUprightWinSymbol(QChar(0xB6));
{ auto s=UnicodeSymbol(QChar(0x2030)).addHtml("&permil;");
symbols["perthousand"]=s; symbols["permil"]=s; }
symbols["pound"]=SimpleTextSymbol(QChar(0xA3), "&pound;");
symbols["pound"]=UnicodeSymbol(QChar(0x00A3));
symbols["prime"]=UnicodeSymbol(QChar(0x2032)).addHtml("&prime;").addStd("'");
symbols["arcminute"]=UnicodeSymbol(QChar(0x2032)).addHtml("&prime;").addStd("'");
symbols["arcsecond"]=UnicodeSymbol(QChar(0x2033)).addHtml("&dprime;").addStd("'");
symbols["rangle"]=UprightSymbolUnicode(QChar(0x232A)).addUprightWinSymbol(QChar(0xF1));
symbols["rceil"]=UprightSymbolUnicode(QChar(0x2309)).addUprightHtml("&RightCeiling;").addUprightWinSymbol(QChar(0xF9));
{ auto s=SimpleTextSymbol(QChar(0xAE), "&reg;");
symbols["registered"]=s; symbols["textregistered"]=s; symbols["circledR"]=s; }
symbols["rfloor"]=UprightSymbolUnicode(QChar(0x230B)).addUprightHtml("&RightFloor;").addUprightWinSymbol(QChar(0xFB));
symbols["rightangle"]=UprightSymbolUnicode(QChar(0x221F)).addUprightHtml("&angrt;");
//symbols["smile"]=UprightSymbolUnicode(QChar(0x2323)).addUprightHtml("&smile;");
symbols["sphericalangle"]=UprightSymbolUnicode(QChar(0x2222)).addUprightHtml("&angsph;");
symbols["star"]=UprightSymbolUnicode(QChar(0x22C6));
symbols["tcohm"]=UnicodeSymbol(QChar(0x2126));
{ auto s=UnicodeSymbol(QChar(0x2014), "&#11840;");
symbols["dblhyphen"]=s; symbols["textdblhyphen"]=s; symbols["textdblhyphenchar"]=s; }
{ auto s=UnicodeSymbol(QChar(0x2014), "&mdash;");
symbols["---"]=s; symbols["textemdash"]=s; symbols["emdash"]=s; }
{ auto s=UnicodeSymbol(QChar(0x2013), "&ndash;");
symbols["--"]=s; symbols["textendash"]=s; symbols["endash"]=s; }
{ auto s=SimpleTextSymbol("-");
symbols["texthyphen"]=s; symbols["hyphen"]=s; }
symbols["textbar"]=SimpleTextSymbol("|", "&VerticalLine;");
{ auto s=SimpleTextSymbol(QChar(0xB0), "&deg;");
symbols["textdegree"]=s; symbols["degree"] = s; }
symbols["textgreater"]=SimpleTextSymbol(">", "&gt;");
symbols["textless"]=SimpleTextSymbol("<", "&lt;");
symbols["textquestiondown"]=SimpleTextSymbol(QChar(0xBF), "&iquest;");
symbols["textexclamdown"]=SimpleTextSymbol(QChar(0xA1), "&iexcl;");
{ auto s=UnicodeSymbol(QChar(0x231C));
symbols["tlcorner"]=s; symbols["ulcorner"]=s; }
symbols["trademark"]=UnicodeSymbol(QChar(0x2122)).addHtml("&trade;").addWinSymbol(QChar(0xD4)).addStd("(TM)");
symbols["trapezium"]=UnicodeSymbol(QChar(0x23E2)).addHtml("&trpezium;");
{ auto s=UprightSymbolUnicode(QChar(0x231D));
symbols["trcorner"]=s; symbols["urcorner"]=s; }
symbols["trprime"]=UnicodeSymbol(QChar(0x2034)).addHtml("&tprime;").addStd("'''");
symbols["varcarriagereturn"]=UnicodeSymbol(QChar(0x23CE)).addWinSymbol(QChar(0xBF));
symbols["varhexagonlrbonds"]=UnicodeSymbol(QChar(0x232C));
symbols["yen"]=SimpleTextSymbol(QChar(0xA5), "&yen;");
/**************************************************************************************
* STANDARD MathOperator Strings
**************************************************************************************/
symbols["Pr"] = NarrowMathOperatorText("Pr");
symbols["acos"] = NarrowMathOperatorText("acos");
symbols["arccos"] = NarrowMathOperatorText("arccos");
symbols["arcsin"] = NarrowMathOperatorText("arcsin");
symbols["arctan"] = NarrowMathOperatorText("arctan");
symbols["arg"] = NarrowMathOperatorText("arg").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["argmax"] = NarrowMathOperatorText("arg max", "arg&thinsp;max").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["argmin"] = NarrowMathOperatorText("arg min", "arg&thinsp;min").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["asin"] = NarrowMathOperatorText("asin");
symbols["atan"] = NarrowMathOperatorText("atan");
symbols["cos"] = NarrowMathOperatorText("cos");
symbols["cosh"] = NarrowMathOperatorText("cosh");
symbols["cot"] = NarrowMathOperatorText("cot");
symbols["coth"] = NarrowMathOperatorText("coth");
symbols["coth"] = NarrowMathOperatorText("coth");
symbols["deg"] = NarrowMathOperatorText("deg");
symbols["det"] = NarrowMathOperatorText("det");
symbols["dim"] = NarrowMathOperatorText("dim");
symbols["exp"] = NarrowMathOperatorText("exp");
symbols["gcd"] = NarrowMathOperatorText("gcd");
symbols["hom"] = NarrowMathOperatorText("hom");
symbols["ker"] = NarrowMathOperatorText("ker");
symbols["lb"] = NarrowMathOperatorText("lb");
symbols["ld"] = NarrowMathOperatorText("ld");
symbols["lim"] = NarrowMathOperatorText("lim").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["liminf"] = NarrowMathOperatorText("lim inf", "lim&thinsp;inf").addGlobalFlags(SubSuperscriptBelowAboveSymbol).addGlobalFlags(SubscriptCorrection);
symbols["limsup"] = NarrowMathOperatorText("lim sup", "lim&thinsp;sup").addGlobalFlags(SubSuperscriptBelowAboveSymbol).addGlobalFlags(SubscriptCorrection);
symbols["ln"] = NarrowMathOperatorText("ln");
symbols["log"] = NarrowMathOperatorText("log");
symbols["max"] = NarrowMathOperatorText("max");
symbols["median"] = NarrowMathOperatorText("median");
symbols["min"] = NarrowMathOperatorText("min");
symbols["mod"] = NarrowMathOperatorText("mod");
symbols["sec"] = NarrowMathOperatorText("sec");
symbols["sgn"] = NarrowMathOperatorText("sgn");
symbols["sign"] = NarrowMathOperatorText("sign");
symbols["sin"] = NarrowMathOperatorText("sin");
symbols["sinh"] = NarrowMathOperatorText("sinh");
symbols["tan"] = NarrowMathOperatorText("tan");
symbols["tanh"] = NarrowMathOperatorText("tanh");
/**************************************************************************************
* STANDARD MathOperator Symbols
**************************************************************************************/
{ auto s=MathOperatorSymbolUnicode(QChar(0x2217)).addMathOperatorStd("*").addMathOperatorHtml("*");
symbols["*"]=s; symbols["ast"]=s; symbols["asterisk"]=s; }
symbols["/"]=NarrowMathOperatorSymbolStd("/");
symbols["+"]=MathOperatorSymbolUnicode(QChar(0x2B)).addMathOperatorHtml("+").addMathOperatorStd("+");
symbols["-"]=MathOperatorSymbolUnicode(QChar(0x2212)).addMathOperatorHtml("-").addMathOperatorStd("-");
symbols["<"]=MathOperatorSymbol("<", "&lt;");
symbols["="]=MathOperatorSymbol("=");
symbols[">"]=MathOperatorSymbol(">", "&gt;");
symbols["Downarrow"]=UprightSymbolUnicode(QChar(0x21D3)).addUprightHtml("&DoubleDownArrow;").addUprightWinSymbol(QChar(0xDF));
symbols["Leftarrow"]=UprightSymbolUnicode(QChar(0x21D0)).addUprightHtml("&DoubleLeftArrow;").addUprightWinSymbol(QChar(0xDC));
symbols["Rightarrow"]=UprightSymbolUnicode(QChar(0x21D2)).addUprightHtml("&Rightarrow;").addUprightWinSymbol(QChar(0xDE));
symbols["Uparrow"]=UprightSymbolUnicode(QChar(0x21D1)).addUprightHtml("&DoubleUpArrow;").addUprightWinSymbol(QChar(0xDD));
symbols["Updownarrow"]=UprightSymbolUnicode(QChar(0x21D5)).addUprightHtml("&Updownarrow;");
symbols["approx"]=MathOperatorSymbolUnicode(QChar(0x2248)).addMathOperatorHtml("&asymp;").addMathOperatorWinSymbol(QChar(0xBB));
symbols["bbC"]=UnicodeSymbol(QChar(0x2102));
symbols["bbH"]=UnicodeSymbol(QChar(0x210D));
symbols["bbN"]=UnicodeSymbol(QChar(0x2115));
symbols["bbP"]=UnicodeSymbol(QChar(0x2119));
symbols["bbQ"]=UnicodeSymbol(QChar(0x211A));
symbols["bbR"]=UnicodeSymbol(QChar(0x211D));
symbols["bbZ"]=UnicodeSymbol(QChar(0x2124));
symbols["because"]=MathOperatorSymbolUnicode(QChar(0x2235)).addMathOperatorHtml("&because;");
symbols["bigcap"]=NarrowMathOperatorSymbolUnicode(QChar(0x22C2)).addMathOperatorHtml("&Intersection;").addMathOperatorWinSymbol(QChar(0xC7), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["bigcup"]=NarrowMathOperatorSymbolUnicode(QChar(0x22C3)).addMathOperatorHtml("&xcup;").addMathOperatorWinSymbol(QChar(0xC8), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
{ auto s=NarrowMathOperatorSymbolUnicode(QChar(0x22C0)).addMathOperatorHtml("&Wedge;").addMathOperatorWinSymbol(QChar(0xD9), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["bigwedge"]=s; symbols["bighat"]=s; }
symbols["bigvee"]=NarrowMathOperatorSymbolUnicode(QChar(0x22C1)).addMathOperatorHtml("&xvee;").addMathOperatorWinSymbol(QChar(0xDA), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["bigotimes"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A02)).addMathOperatorHtml("&bigotimes;").addMathOperatorWinSymbol(QChar(0xC4), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["bigoplus"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A01)).addMathOperatorHtml("&bigoplus;").addMathOperatorWinSymbol(QChar(0xC5), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["bigodot"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A00)).addMathOperatorHtml("&bigodot;").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["biguplus"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A04)).addMathOperatorHtml("&biguplus;").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["bigsqcup"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A06)).addMathOperatorHtml("&bigsqcup;").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
{ auto s=MathOperatorSymbolUnicode(QChar(0x22A5)).addMathOperatorHtml("&UpTee;");
symbols["bot"]=s; symbols["perp"]=s; }
{ auto s=MathOperatorSymbolUnicode(QChar(0x2229)).addMathOperatorHtml("&cap;").addMathOperatorWinSymbol(QChar(0xC7));
symbols["cap"]=s; symbols["land"]=s; }
symbols["cdot"]=MathOperatorSymbol(QChar(0xB7)).addMathOperatorHtml("&middot;").addMathOperatorWinSymbol(QChar(0xD7));
symbols["cong"]=MathOperatorSymbolUnicode(QChar(0x2245)).addMathOperatorHtml("&TildeFullEqual;");
symbols["coprod"]=NarrowMathOperatorSymbolUnicode(QChar(0x2210)).addMathOperatorHtml("&Coproduct;").addWinSymbol(QChar(0xD5), ItalicOff|BoldOff|FlipSymbolUpDown, 1.8, 0.1).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
{ auto s=MathOperatorSymbolUnicode(QChar(0x222A)).addMathOperatorHtml("&cup;").addMathOperatorWinSymbol(QChar(0xC8));
symbols["cup"]=s; symbols["lor"]=s; }
symbols["ddots"]=UprightSymbolUnicode(QChar(0x22F1)).addMathOperatorHtml("&dtdot;");
symbols["div"]=MathOperatorSymbolUnicode(QChar(0x00F7)).addMathOperatorHtml("&div;").addMathOperatorWinSymbol(QChar(0xB8));
symbols["downarrow"]=UprightSymbolUnicode(QChar(0x2193)).addUprightHtml("&ShortDownArrow;").addUprightWinSymbol(QChar(0xAF));
symbols["downharpoonleft"]=UprightSymbolUnicode(QChar(0x21C3)).addUprightHtml("&LeftDownVector;");
symbols["downharpoonright"]=UprightSymbolUnicode(QChar(0x21C2)).addUprightHtml("&RightDownVector;");
{ auto s=MathOperatorSymbolUnicode(QChar(0x2205)).addMathOperatorHtml("&varnothing;").addMathOperatorWinSymbol(QChar(0xC6)).addStd("0", BoldOff|ItalicOff|DrawSlash);
symbols["emptyset"]=s; symbols["varnothing"]=s; }
symbols["equiv"]=MathOperatorSymbolUnicode(QChar(0x2261)).addMathOperatorHtml("&equiv;").addMathOperatorWinSymbol(QChar(0xBA));
symbols["exists"]=NarrowMathOperatorSymbolUnicode(QChar(0x2203)).addMathOperatorHtml("&exist;").addMathOperatorWinSymbol(QChar(0x24)).addStd("E", ItalicOff|BoldOff|FlipSymbolLeftRight);
symbols["forall"]=NarrowMathOperatorSymbolUnicode(QChar(0x2200)).addMathOperatorHtml("&forall;").addMathOperatorWinSymbol(QChar(0x22)).addStd("A", ItalicOff|BoldOff|FlipSymbolUpDown).addGlobalFlags(SubscriptCorrection);
{ auto s=MathOperatorSymbolUnicode(QChar(0x2265)).addMathOperatorHtml("&GreaterEqual;").addMathOperatorWinSymbol(QChar(0xB3));
symbols["geq"]=s; symbols["ge"]=s; }
symbols["geqq"]=MathOperatorSymbolUnicode(QChar(0x2267)).addMathOperatorHtml("&GreaterFullEqual;");
symbols["gg"]=MathOperatorSymbolUnicode(QChar(0x226B)).addMathOperatorHtml("&NestedGreaterGreater;").addMathOperatorStd(">>");
symbols["iddots"]=UprightSymbolUnicode(QChar(0x22F0)).addMathOperatorHtml("&utdot;");
{ auto s=UprightSymbolUnicode(QChar(0x21D4)).addUprightHtml("&DoubleLeftRightArrow;").addUprightWinSymbol(QChar(0xDB));
symbols["iff"]=s; symbols["Leftrightarrow"]=s; }
symbols["iiint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222D)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("&tint;").addMathOperatorWinSymbol(QString(3, QChar(0xF2)), 1.8, 0.1);
symbols["iint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222C)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("&Int;").addMathOperatorWinSymbol(QString(2, QChar(0xF2)), 1.8, 0.1);
symbols["in"]=MathOperatorSymbolUnicode(QChar(0x2208)).addMathOperatorHtml("&isin;").addMathOperatorWinSymbol(QChar(0xCE));
symbols["int"]=NarrowMathOperatorSymbolUnicode(QChar(0x222B)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("&int;").addMathOperatorWinSymbol(QChar(0xF2), 1.8, 0.1);
symbols["leftarrow"]=UprightSymbolUnicode(QChar(0x2190)).addUprightHtml("&larr;").addUprightWinSymbol(QChar(0xAC));
symbols["longleftarrow"]=UprightSymbolUnicode(QChar(0x27F5)).addUprightHtml("&longleftarrow;");
symbols["longrightarrow"]=UprightSymbolUnicode(QChar(0x27F6)).addUprightHtml("&longrightarrow;");
symbols["longleftrightarrow"]=UprightSymbolUnicode(QChar(0x27F7)).addUprightHtml("&longleftrightarrow;");
symbols["Longleftarrow"]=UprightSymbolUnicode(QChar(0x27F8)).addUprightHtml("&DoubleLongLeftArrow;");
symbols["Longrightarrow"]=UprightSymbolUnicode(QChar(0x27F9)).addUprightHtml("&DoubleLongRightArrow;");
symbols["Longleftrightarrow"]=UprightSymbolUnicode(QChar(0x27FA)).addUprightHtml("&Longleftrightarrow;");
symbols["leftharpoondown"]=UprightSymbolUnicode(QChar(0x21BD)).addUprightHtml("&leftharpoondown;");
symbols["leftharpoonup"]=UprightSymbolUnicode(QChar(0x21BC)).addUprightHtml("&LeftVector;");
symbols["leftrightarrow"]=UprightSymbolUnicode(QChar(0x2194)).addUprightHtml("&harr;").addUprightWinSymbol(QChar(0xAB));
symbols["leftrightharpoon"]=UprightSymbolUnicode(QChar(0x21CB)).addUprightHtml("&ReverseEquilibrium;");
{ auto s=MathOperatorSymbolUnicode(QChar(0x2264)).addMathOperatorHtml("&leq;").addMathOperatorWinSymbol(QChar(0xA3));
symbols["leq"]=s; symbols["le"]=s; }
symbols["leqq"]=MathOperatorSymbolUnicode(QChar(0x2266)).addMathOperatorHtml("&LessFullEqual;");
symbols["ll"]=MathOperatorSymbolUnicode(QChar(0x226A)).addMathOperatorHtml("&NestedLessLess;").addMathOperatorStd("<<");
symbols["lnot"]=MathOperatorSymbolUnicode(QChar(0xAC)).addMathOperatorWinSymbol(QChar(0xD8)).addMathOperatorHtml("&not;");
symbols["mapimage"]=MathOperatorSymbolUnicode(QChar(0x22B7)).addMathOperatorHtml("&imof;");
symbols["maporiginal"]=MathOperatorSymbolUnicode(QChar(0x22B6)).addMathOperatorHtml("&origof;");
symbols["mapsto"]=MathOperatorSymbolUnicode(QChar(0x21A6)).addMathOperatorHtml("&RightTeeArrow;");
symbols["mid"]=MathOperatorSymbolUnicode(QChar(0x2223)).addMathOperatorHtml("&VerticalBar;").addMathOperatorWinSymbol(QChar(0xBD)).addMathOperatorStd("|");
symbols["mp"]=MathOperatorSymbolUnicode(QChar(0x2213)).addMathOperatorHtml("&mp;").addWinSymbol(QChar(0xB1),ItalicOff|BoldOff|FlipSymbolUpDown).addStd(QChar(0xB1),ItalicOff|BoldOff|FlipSymbolUpDown);
symbols["multimap"]=MathOperatorSymbolUnicode(QChar(0x22B8)).addMathOperatorHtml("&mumap;");
symbols["nabla"]=NarrowMathOperatorSymbolUnicode(QChar(0x2207)).addMathOperatorHtml("&nabla;").addMathOperatorWinSymbol(QChar(0xD1)).addGlobalFlags(IntLikeSymbolCorrection);
symbols["ne"]=NarrowMathOperatorSymbolUnicode(QChar(0x2260)).addMathOperatorHtml("&ne;").addMathOperatorWinSymbol(QChar(0xB9));
symbols["nearrow"]=UprightSymbolUnicode(QChar(0x2197)).addUprightHtml("&UpperRightArrow;");
{ auto s=MathOperatorSymbolUnicode(QChar(0x00AC)).addMathOperatorHtml("&not;").addMathOperatorWinSymbol(QChar(0xD8));
symbols["neg"]=s; symbols["lnot"]=s; }
symbols["neq"]=MathOperatorSymbolUnicode(QChar(0x2260)).addMathOperatorHtml("&ne;").addMathOperatorWinSymbol(QChar(0xB9)).addStd("=", ItalicOff|BoldOff|DrawSlash);
symbols["nexists"]=NarrowMathOperatorSymbolUnicode(QChar(0x2204)).addMathOperatorHtml("&NotExists;").addStd("E", ItalicOff|BoldOff|FlipSymbolLeftRight|DrawSlash).addMathOperatorWinSymbol(QChar(0x24), ItalicOff|BoldOff|DrawSlash);
symbols["ni"]=NarrowMathOperatorSymbolUnicode(QChar(0x220B)).addMathOperatorHtml("&ReverseElement;").addMathOperatorWinSymbol(QChar(0xCE), ItalicOff|BoldOff|FlipSymbolLeftRight);
symbols["nmid"]=NarrowMathOperatorSymbolUnicode(QChar(0x2224)).addMathOperatorHtml("&NotVerticalBar;");
symbols["notin"]=NarrowMathOperatorSymbolUnicode(QChar(0x2209)).addMathOperatorHtml("&notin;").addMathOperatorWinSymbol(QChar(0xCF));
symbols["notni"]=NarrowMathOperatorSymbolUnicode(QChar(0x220C)).addMathOperatorHtml("&NotReverseElement;");
symbols["nparallel"]=MathOperatorSymbolUnicode(QChar(0x2226)).addMathOperatorHtml("&NotDoubleVerticalBar;");
symbols["nwarrow"]=UprightSymbolUnicode(QChar(0x2196)).addUprightHtml("&UpperLeftArrow;");
symbols["odot"]=MathOperatorSymbolUnicode(QChar(0x2299)).addMathOperatorHtml("&odot;");
symbols["oiiint"]=NarrowMathOperatorSymbolUnicode(QChar(0x2230)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("&Cconint;");
symbols["oiint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222F)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("&DoubleContourIntegral;");
symbols["oint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222E)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("&ContourIntegral;");
symbols["ominus"]=MathOperatorSymbolUnicode(QChar(0x2296)).addMathOperatorHtml("&ominus;");
symbols["oplus"]=MathOperatorSymbolUnicode(QChar(0x2295)).addMathOperatorHtml("&CirclePlus;").addMathOperatorWinSymbol(QChar(0xC5));
symbols["oslash"]=MathOperatorSymbolUnicode(QChar(0x2298)).addMathOperatorHtml("&osol;");
symbols["otimes"]=MathOperatorSymbolUnicode(QChar(0x2297)).addMathOperatorHtml("&CircleTimes;").addMathOperatorWinSymbol(QChar(0xC4));
symbols["parallel"]=NarrowMathOperatorSymbolUnicode(QChar(0x2225)).addMathOperatorHtml("&shortparallel;").addMathOperatorStd("||");
symbols["pm"] = MathOperatorSymbol(QChar(0xB1), "&plusmn;").addMathOperatorWinSymbol(QChar(0xB1));
symbols["prec"]=MathOperatorSymbolUnicode(QChar(0x227A)).addMathOperatorHtml("&prec;");
symbols["prod"]=NarrowMathOperatorSymbolUnicode(QChar(0x220F)).addMathOperatorWinSymbol(QChar(0xD5), 1.8, 0.1).addMathOperatorHtml("&prod;").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["propto"]=MathOperatorSymbolUnicode(QChar(0x221D)).addMathOperatorWinSymbol(QChar(0xB5)).addMathOperatorHtml("&Proportional;");
symbols["rightharpoondown"]=UprightSymbolUnicode(QChar(0x21C1)).addUprightHtml("&rightharpoondown;");
symbols["rightharpoonup"]=UprightSymbolUnicode(QChar(0x21C0)).addUprightHtml("&RightVector;");
symbols["rightleftharpoon"]=UprightSymbolUnicode(QChar(0x21CC)).addUprightHtml("&Equilibrium;");
symbols["searrow"]=UprightSymbolUnicode(QChar(0x2198)).addUprightHtml("&LowerRightArrow;");
symbols["setminus"]=MathOperatorSymbolUnicode(QChar(0x2216)).addMathOperatorHtml("&smallsetminus;");
{ auto s=MathOperatorSymbolUnicode(QChar(0x223C)).addMathOperatorHtml("&tilde;").addMathOperatorStd("~");
symbols["~"]=s; symbols["sim"]=s; }
symbols["simeq"]=MathOperatorSymbolUnicode(QChar(0x2243)).addMathOperatorHtml("&TildeEqual;");
symbols["sqcap"]=MathOperatorSymbolUnicode(QChar(0x2293)).addMathOperatorHtml("&SquareIntersection;");
symbols["sqcup"]=MathOperatorSymbolUnicode(QChar(0x2294)).addMathOperatorHtml("&SquareUnion;");
symbols["square"]=MathOperatorSymbolUnicode(QChar(0x25A1));
symbols["subset"]=MathOperatorSymbolUnicode(QChar(0x2282)).addMathOperatorHtml("&sub;").addMathOperatorWinSymbol(QChar(0xCC));
symbols["subseteq"]=MathOperatorSymbolUnicode(QChar(0x2286)).addMathOperatorHtml("&SubsetEqual;").addMathOperatorWinSymbol(QChar(0xCD));
symbols["subsetnot"]=MathOperatorSymbolUnicode(QChar(0x2284)).addMathOperatorHtml("&nsub;").addMathOperatorWinSymbol(QChar(0xCB));
symbols["succ"]=MathOperatorSymbolUnicode(QChar(0x227B)).addMathOperatorHtml("&succ;");
symbols["sum"]=NarrowMathOperatorSymbolUnicode(QChar(0x2211)).addMathOperatorWinSymbol(QChar(0xE5), 1.8, 0.1).addMathOperatorHtml("&sum;").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
symbols["supset"]=MathOperatorSymbolUnicode(QChar(0x2283)).addMathOperatorHtml("&sup;").addMathOperatorWinSymbol(QChar(0xC9));
symbols["supseteq"]=MathOperatorSymbolUnicode(QChar(0x2287)).addMathOperatorHtml("&SupersetEqual;").addMathOperatorWinSymbol(QChar(0xCA));
symbols["supsetnot"]=MathOperatorSymbolUnicode(QChar(0x2285)).addMathOperatorHtml("&nsup;");
symbols["swarrow"]=UprightSymbolUnicode(QChar(0x2199)).addUprightHtml("&LowerLeftArrow;");
symbols["therefore"]=MathOperatorSymbolUnicode(QChar(0x2234)).addMathOperatorHtml("&therefore;").addMathOperatorWinSymbol(QChar(0x5C));
symbols["times"] = MathOperatorSymbol(QChar(0xD7), "&times;").addMathOperatorWinSymbol(QChar(0xB4));
{ auto s=UprightSymbolUnicode(QChar(0x2192)).addUprightHtml("&rarr;").addUprightWinSymbol(QChar(0xAE));
symbols["to"]=s; symbols["rightarrow"]=s; }
symbols["top"]=MathOperatorSymbolUnicode(QChar(0x22A4)).addMathOperatorHtml("&top;").addMathOperatorWinSymbol(QChar(0x5E)).addUprightStd("T");
symbols["triangle"]=NarrowMathOperatorSymbolUnicode(QChar(0x2206));
symbols["uparrow"]=UprightSymbolUnicode(QChar(0x2191)).addUprightHtml("&ShortUpArrow;").addUprightWinSymbol(QChar(0xAD));
symbols["updownarrow"]=UprightSymbolUnicode(QChar(0x2195)).addUprightHtml("&updownarrow;");
symbols["upharpoonleft"]=UprightSymbolUnicode(QChar(0x21BF)).addUprightHtml("&LeftUpVector;");
symbols["upharpoonright"]=UprightSymbolUnicode(QChar(0x21BE)).addUprightHtml("&RightUpVector;");
symbols["vartriangleleft"]=NarrowMathOperatorSymbolUnicode(QChar(0x22B2)).addMathOperatorHtml("&LeftTriangle;");
symbols["vdots"]=UprightSymbolUnicode(QChar(0x22EE)).addMathOperatorHtml("&vellip;");
symbols["vee"]=MathOperatorSymbolUnicode(QChar(0x2228)).addMathOperatorHtml("&vee;").addMathOperatorWinSymbol(QChar(0xDA));
symbols["vdash"]=MathOperatorSymbolUnicode(QChar(0x22A2)).addMathOperatorHtml("&vdash;");
symbols["dashv"]=MathOperatorSymbolUnicode(QChar(0x22A3)).addMathOperatorHtml("&dashv;");
symbols["vDash"]=MathOperatorSymbolUnicode(QChar(0x22A8)).addMathOperatorHtml("&DoubleRightTee;");
symbols["nvdash"]=MathOperatorSymbolUnicode(QChar(0x22AC)).addMathOperatorHtml("&nvdash;");
symbols["Vdash"]=MathOperatorSymbolUnicode(QChar(0x22A9)).addMathOperatorHtml("&Vdash;");
symbols["models"]=MathOperatorSymbolUnicode(QChar(0x22A7)).addMathOperatorHtml("&models;");
symbols["wedge"]=MathOperatorSymbolUnicode(QChar(0x2227)).addMathOperatorHtml("&wedge;").addMathOperatorWinSymbol(QChar(0xD9));
/**************************************************************************************
* GREEK letters
**************************************************************************************/
addGreekLetterVariants_WinSymbol_Unicode_Html("alpha", "a", QChar(0x3B1), "&alpha;");
addGreekLetterVariants_WinSymbol_Unicode_Html("beta", "b", QChar(0x3B2), "&beta;");
addGreekLetterVariants_WinSymbol_Unicode_Html("gamma", "g", QChar(0x3B3), "&gamma;");
addGreekLetterVariants_WinSymbol_Unicode_Html("delta", "d", QChar(0x3B4), "&delta;");
addGreekLetterVariants_WinSymbol_Unicode_Html("epsilon", "e", QChar(0x3F5), "&varepsilon;");
addGreekLetterVariants_WinSymbol_Unicode_Html("varepsilon", "e", QChar(0x3B5), "&epsi;");
addGreekLetterVariants_WinSymbol_Unicode_Html("zeta", "z", QChar(0x3B6),"&zeta;");
addGreekLetterVariants_WinSymbol_Unicode_Html("eta", "h", QChar(0x3B7),"&eta;");
addGreekLetterVariants_WinSymbol_Unicode_Html("theta", "q", QChar(0x3B8),"&theta;");
addGreekLetterVariants_WinSymbol_Unicode_Html("vartheta", "J", QChar(0x3D1),"&thetasym;");
addGreekLetterVariants_WinSymbol_Unicode_Html("iota", "i", QChar(0x3B9),"&iota;");
addGreekLetterVariants_WinSymbol_Unicode_Html("kappa", "k", QChar(0x3BA),"&kappa;");
addGreekLetterVariants_WinSymbol_Unicode_Html("lambda", "l", QChar(0x3BB),"&lambda;");
addGreekLetterVariants_WinSymbol_Unicode_Html("mu", "m", QChar(0x3BC),"&mu;");
addGreekLetterVariants_WinSymbol_Unicode_Html("nu", "n", QChar(0x3BD),"&nu;");
addGreekLetterVariants_WinSymbol_Unicode_Html("xi", "x", QChar(0x3BE),"&xi;");
addGreekLetterVariants_WinSymbol_Unicode_Html("pi", "p", QChar(0x3C0),"&pi;");
addGreekLetterVariants_WinSymbol_Unicode_Html("varpi", "v", QChar(0x3D6),"&piv;");
addGreekLetterVariants_WinSymbol_Unicode_Html("rho", "r", QChar(0x3C1),"&rho;");
addGreekLetterVariants_WinSymbol_Unicode_Html("varrho", "r", QChar(0x3F1),"&varrho;");
addGreekLetterVariants_WinSymbol_Unicode_Html("sigma", "s", QChar(0x3C3),"&sigma;");
addGreekLetterVariants_WinSymbol_Unicode_Html("varsigma", "V", QChar(0x3C2),"&varsigma;");
addGreekLetterVariants_WinSymbol_Unicode_Html("tau", "t", QChar(0x3C4),"&tau;");
addGreekLetterVariants_WinSymbol_Unicode_Html("upsilon", "u", QChar(0x3C5),"&upsilon;");
addGreekLetterVariants_WinSymbol_Unicode_Html("phi", "f", QChar(0x3C5),"&straightphi;");
addGreekLetterVariants_WinSymbol_Unicode_Html("varphi", "j", QChar(0x3D6),"&phi;");
addGreekLetterVariants_WinSymbol_Unicode_Html("chi", "c", QChar(0x3C7),"&chi;");
addGreekLetterVariants_WinSymbol_Unicode_Html("psi", "y", QChar(0x3C8),"&psi;");
addGreekLetterVariants_WinSymbol_Unicode_Html("omega", "w", QChar(0x3C9),"&omega;");
addGreekLetterVariants_WinSymbol_Unicode_Html("Gamma", "G", QChar(0x3A3),"&Gamma;");
addGreekLetterVariants_WinSymbol_Unicode_Html("Delta", "D", QChar(0x394),"&Delta;");
addGreekLetterVariants_WinSymbol_Unicode_Html("Theta", "Q", QChar(0x398),"&Theta;");
addGreekLetterVariants_WinSymbol_Unicode_Html("Lambda", "L", QChar(0x39B),"&Lambda;");
addGreekLetterVariants_WinSymbol_Unicode_Html("Omega", "W", QChar(0x3A9),"&Omega;");
addGreekLetterVariants_WinSymbol_Unicode_Html("Xi", "X", QChar(0x39E),"&Xi;");
addGreekLetterVariants_WinSymbol_Unicode_Html("Pi", "P", QChar(0x3A0),"&Pi;");
addGreekLetterVariants_WinSymbol_Unicode_Html("Sigma", "S", QChar(0x3A3),"&Sigma;");
addGreekLetterVariants_WinSymbol_Unicode_Html("Upsilon", "U", QChar(0x3C6),"&Upsilon;");
addGreekLetterVariants_WinSymbol_Unicode_Html("Phi", "F", QChar(0x3A6),"&Phi;");
addGreekLetterVariants_WinSymbol_Unicode_Html("Psi", "Y", QChar(0x3A8),"&Psi;");
/**************************************************************************************
* SYMBOLS from special fonts
**************************************************************************************/
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
QFontDatabase fdb;
const auto fonts=fdb.families();
#else
const auto fonts=QFontDatabase::families();
#endif
if (fonts.contains("Wingdings")) {
{ auto s=SymbolFullProps("Wingdings", QChar(0x46));
symbols["lefthand"]=s; symbols["HandRight"]=s;}
{ auto s=SymbolFullProps("Wingdings", QChar(0x45));
symbols["righthand"]=s; symbols["HandLeft"]=s;}
}
}
JKQTMathTextSymbolNode::SymbolFullProps::SymbolFullProps():

View File

@ -274,7 +274,7 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextSymbolNode: public JKQTMathTextNode {
/** \brief constructs a SymbolProps for a greek letter with the format from outside with the symbol in unicode-encoding \a letterUnicode and in WinSymbol-encoding letterWinWsymbol */
static SymbolFullProps AsOutsiudeGreekLetter_WinSymbol_Unicode_Html(const QString& letterWinSymbol, const QString& letterUnicode, const QString& html);
/** \brief insert GreekLetter_WinSymbol_Unicode_Html() as \a baseInstructionName and UprightGreekLetter_WinSymbol_Unicode_Html and "up"+\a letterWinSymbol into symbols */
static void addGreekLetterVariants_WinSymbol_Unicode_Html(const QString& baseInstructionName, const QString& letterWinSymbol, const QString& letterUnicode, const QString& html);
static void addGreekLetterVariants_WinSymbol_Unicode_Html(QHash<QString, JKQTMathTextSymbolNode::SymbolFullProps>& symbols,const QString& baseInstructionName, const QString& letterWinSymbol, const QString& letterUnicode, const QString& html);
/** \brief constructs a SymbolProps for a symbol with encoding in Standard-fonts a */
static SymbolFullProps StdSymbol(const QString& symbol, const QString& html);
/** \brief constructs a SymbolProps for a symbol with encoding in UnicodeFull-fonts a */
@ -306,10 +306,7 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextSymbolNode: public JKQTMathTextNode {
/** \brief symbols that can be generated in any standard-font */
static QHash<QString, SymbolFullProps> symbols;
/** \brief fill the symbol tables standardTextSymbols, winSymbolSymbol, ... with contents */
static void fillSymbolTables();
static const QHash<QString, SymbolFullProps>& symbols();
/** \brief retrieve the properties to render the given symbol \a symName in the current environment \a currentEv */
SymbolFullProps getSymbolProp(const QString& symName, const JKQTMathTextEnvironment& currentEv) const;

View File

@ -73,37 +73,39 @@ bool JKQTMathTextTextBaseNode::toHtml(QString &html, JKQTMathTextEnvironment cur
QHash<QChar, uint32_t> JKQTMathTextTextNode::blackboardUnicodeTable=QHash<QChar, uint32_t>();
const QHash<QChar, uint32_t>& JKQTMathTextTextNode::blackboardUnicodeTable(){
static QHash<QChar, uint32_t> table=[]() {
QHash<QChar, uint32_t> blackboardUnicodeTable;
void JKQTMathTextTextNode::fillStaticTables() {
static std::mutex sMutex;
std::lock_guard<std::mutex> lock(sMutex);
if (blackboardUnicodeTable.size()>0) return;
const QString ALPHA="ABDEFGIJKLMOSTUVWXYZ";
for (const QChar ch: ALPHA) {
blackboardUnicodeTable[ch]=0x1D538+(ch.unicode()-QChar('A').unicode());
}
const QString alpha="abcdefghijklmnopqrstuvwxyz";
for (const QChar ch: alpha) {
blackboardUnicodeTable[ch]=0x1D552+(ch.unicode()-QChar('a').unicode());
}
const QString nums="0123456789";
for (const QChar ch: nums) {
blackboardUnicodeTable[ch]=0x1D7D8+(ch.unicode()-QChar('0').unicode());
}
blackboardUnicodeTable['C']=0x2102;
blackboardUnicodeTable['H']=0x210D;
blackboardUnicodeTable['N']=0x2115;
blackboardUnicodeTable['P']=0x2119;
blackboardUnicodeTable['Q']=0x211A;
blackboardUnicodeTable['R']=0x211D;
blackboardUnicodeTable['Z']=0x2124;
for (const QChar ch: QString("ABDEFGIJKLMOSTUVWXYZ")) {
blackboardUnicodeTable[ch]=0x1D538+(ch.unicode()-QChar('A').unicode());
}
for (const QChar ch: QString("abcdefghijklmnopqrstuvwxyz")) {
blackboardUnicodeTable[ch]=0x1D552+(ch.unicode()-QChar('a').unicode());
}
for (const QChar ch: QString("0123456789")) {
blackboardUnicodeTable[ch]=0x1D7D8+(ch.unicode()-QChar('0').unicode());
}
blackboardUnicodeTable['C']=0x2102;
blackboardUnicodeTable['H']=0x210D;
blackboardUnicodeTable['N']=0x2115;
blackboardUnicodeTable['P']=0x2119;
blackboardUnicodeTable['Q']=0x211A;
blackboardUnicodeTable['R']=0x211D;
blackboardUnicodeTable['Z']=0x2124;
return blackboardUnicodeTable;
}();
return table;
}
JKQTMathTextTextNode::JKQTMathTextTextNode(JKQTMathText* _parent, const QString& textIn, bool addWhitespace, bool stripInnerWhitepace):
JKQTMathTextTextBaseNode(_parent, "")
{
fillStaticTables();
QString textTransformed=textIn;
if (stripInnerWhitepace) {
@ -240,11 +242,11 @@ void JKQTMathTextTextNode::splitTextForLayout(QPainter &painter, JKQTMathTextEnv
} else if (bbMode==MTBBDMsimulate) {
CFontMode=FMasDefinedOutline;
} else if (bbMode==MTBBDMunicodeCharactersOrSimulate || bbMode==MTBBDMunicodeCharactersOrFontDirectly) {
if (blackboardUnicodeTable.contains(c) && fmRoman.inFontUcs4(blackboardUnicodeTable[c])) {
cs=jkqtp_UnicodeToUTF8Q(blackboardUnicodeTable[c]);
if (blackboardUnicodeTable().contains(c) && fmRoman.inFontUcs4(blackboardUnicodeTable().operator[](c))) {
cs=jkqtp_UnicodeToUTF8Q(blackboardUnicodeTable().operator[](c));
CFontMode=FMroman;
} else if (blackboardUnicodeTable.contains(c) && fmFallbackSym.inFontUcs4(blackboardUnicodeTable[c])) {
cs=jkqtp_UnicodeToUTF8Q(blackboardUnicodeTable[c]);
} else if (blackboardUnicodeTable().contains(c) && fmFallbackSym.inFontUcs4(blackboardUnicodeTable().operator[](c))) {
cs=jkqtp_UnicodeToUTF8Q(blackboardUnicodeTable().operator[](c));
CFontMode=FMfallbackSymbol;
} else {
if (bbMode==MTBBDMunicodeCharactersOrSimulate) {
@ -291,10 +293,10 @@ double JKQTMathTextTextNode::draw(QPainter& painter, double x, double y, JKQTMat
const QFont fUpright=JKQTMathTextGetNonItalic(f);
const QFont fFallbackSym=currentEv.exchangedFontFor(MTEFallbackSymbols).getFont(parentMathText);
const QFont fRoman=currentEv.exchangedFontForRoman().getFont(parentMathText);
const QFontMetricsF fm(f, painter.device());
const QFontMetricsF fmUpright(fUpright, painter.device());
const QFontMetricsF fmFallbackSym(fFallbackSym, painter.device());
const QFontMetricsF fmRoman(fRoman, painter.device());
//const QFontMetricsF fm(f, painter.device());
//const QFontMetricsF fmUpright(fUpright, painter.device());
//const QFontMetricsF fmFallbackSym(fFallbackSym, painter.device());
//const QFontMetricsF fmRoman(fRoman, painter.device());
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.setFont(f);

View File

@ -110,9 +110,7 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextTextNode: public JKQTMathTextTextBaseN
*/
void splitTextForLayout(QPainter &painter, JKQTMathTextEnvironment currentEv, const QString& txt, QStringList& textpart, QList<FontMode>& fontMode) const;
/** \brief translation table for blackboard-font characters from "normal" Latin-1 encoding to unicode-encoding of blackboards */
static QHash<QChar, uint32_t> blackboardUnicodeTable;
/** \brief fill static data */
static void fillStaticTables();
static const QHash<QChar, uint32_t>& blackboardUnicodeTable();
/** \copydoc JKQTMathTextTextBaseNode::textTransform() */
virtual QString textTransform(const QString& text, const JKQTMathTextEnvironment& currentEv) const override;
};

View File

@ -51,15 +51,13 @@ JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode(JKQTMathText *_parent):
JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode(const QString &_type, JKQTMathText *parent):
JKQTMathTextWhitespaceNode(parent)
{
fillSupportedInstructions();
whitespace=supportedInstructions[_type];
whitespace=supportedInstructions()[_type];
}
JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode(const QString &_type, size_t count, JKQTMathText *parent):
JKQTMathTextWhitespaceNode(parent)
{
fillSupportedInstructions();
whitespace=supportedInstructions[_type];
whitespace=supportedInstructions()[_type];
whitespace.count=whitespace.count*count;
}
@ -67,7 +65,6 @@ JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode(Types type, size_t count,
JKQTMathTextNode(parent),
whitespace(type, count)
{
fillSupportedInstructions();
}
JKQTMathTextWhitespaceNode::~JKQTMathTextWhitespaceNode() {
@ -134,31 +131,30 @@ JKQTMathTextNodeSize JKQTMathTextWhitespaceNode::getSizeInternal(QPainter &paint
return s;
}
QHash<QString, JKQTMathTextWhitespaceNode::WhitespaceProps> JKQTMathTextWhitespaceNode::supportedInstructions;
void JKQTMathTextWhitespaceNode::fillSupportedInstructions()
{
static std::mutex sMutex;
std::lock_guard<std::mutex> lock(sMutex);
if (supportedInstructions.size()==0) {
supportedInstructions[" "]=WhitespaceProps(WSTthicker, 1);
supportedInstructions["nbsp"]=WhitespaceProps(WSTNonbreaking, 1);
supportedInstructions["enspace"]=WhitespaceProps(WST1en, 1);
supportedInstructions["enskip"]=WhitespaceProps(WST1en, 1);
supportedInstructions["quad"]=WhitespaceProps(WSTQuad, 1);
supportedInstructions["emspace"]=WhitespaceProps(WSTQuad, 1);
supportedInstructions["qquad"]=WhitespaceProps(WSTQuad, 2);
supportedInstructions[","]=WhitespaceProps(WSTthin, 1);
supportedInstructions["thinspace"]=WhitespaceProps(WSTthin, 1);
supportedInstructions[":"]=WhitespaceProps(WSTmedium, 1);
supportedInstructions["medspace"]=WhitespaceProps(WSTmedium, 1);
supportedInstructions[";"]=WhitespaceProps(WSTthick, 1);
supportedInstructions["thickspace"]=WhitespaceProps(WSTthick, 1);
supportedInstructions["!"]=WhitespaceProps(WSTnegthin, 1);
supportedInstructions["negthinspace"]=WhitespaceProps(WSTnegthin, 1);
supportedInstructions["negmedspace"]=WhitespaceProps(WSTnegmedium, 1);
supportedInstructions["negthickspace"]=WhitespaceProps(WSTnegthick, 1);
}
const QHash<QString, JKQTMathTextWhitespaceNode::WhitespaceProps>& JKQTMathTextWhitespaceNode::supportedInstructions() {
static QHash<QString, JKQTMathTextWhitespaceNode::WhitespaceProps> table=[]()
{
QHash<QString, JKQTMathTextWhitespaceNode::WhitespaceProps> supportedInstructions;
supportedInstructions[" "]=WhitespaceProps(WSTthicker, 1);
supportedInstructions["nbsp"]=WhitespaceProps(WSTNonbreaking, 1);
supportedInstructions["enspace"]=WhitespaceProps(WST1en, 1);
supportedInstructions["enskip"]=WhitespaceProps(WST1en, 1);
supportedInstructions["quad"]=WhitespaceProps(WSTQuad, 1);
supportedInstructions["emspace"]=WhitespaceProps(WSTQuad, 1);
supportedInstructions["qquad"]=WhitespaceProps(WSTQuad, 2);
supportedInstructions[","]=WhitespaceProps(WSTthin, 1);
supportedInstructions["thinspace"]=WhitespaceProps(WSTthin, 1);
supportedInstructions[":"]=WhitespaceProps(WSTmedium, 1);
supportedInstructions["medspace"]=WhitespaceProps(WSTmedium, 1);
supportedInstructions[";"]=WhitespaceProps(WSTthick, 1);
supportedInstructions["thickspace"]=WhitespaceProps(WSTthick, 1);
supportedInstructions["!"]=WhitespaceProps(WSTnegthin, 1);
supportedInstructions["negthinspace"]=WhitespaceProps(WSTnegthin, 1);
supportedInstructions["negmedspace"]=WhitespaceProps(WSTnegmedium, 1);
supportedInstructions["negthickspace"]=WhitespaceProps(WSTnegthick, 1);
return supportedInstructions;
}();
return table;
}
@ -212,8 +208,7 @@ double JKQTMathTextWhitespaceNode::Type2PixelWidth(Types type, JKQTMathTextEnvir
bool JKQTMathTextWhitespaceNode::supportsInstructionName(const QString &instruction)
{
fillSupportedInstructions();
return supportedInstructions.contains(instruction);
return supportedInstructions().contains(instruction);
}
@ -370,13 +365,11 @@ QString JKQTMathTextPhantomNode::Mode2Instruction(Mode mode)
JKQTMathTextPhantomNode::JKQTMathTextPhantomNode(JKQTMathText *parent, const QString &mode, JKQTMathTextNode *child):
JKQTMathTextInstruction1Node(parent, mode, child)
{
fillInstructions();
}
JKQTMathTextPhantomNode::JKQTMathTextPhantomNode(JKQTMathText* _parent, Mode mode, JKQTMathTextNode* child):
JKQTMathTextInstruction1Node(_parent, Mode2Instruction(mode), child)
{
fillInstructions();
}
JKQTMathTextPhantomNode::~JKQTMathTextPhantomNode() {
@ -389,10 +382,9 @@ QString JKQTMathTextPhantomNode::getTypeName() const
}
JKQTMathTextNodeSize JKQTMathTextPhantomNode::getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const {
fillInstructions();
JKQTMathTextNodeSize s=getChild()->getSize(painter, currentEv);
switch(instructions[getInstructionName()]) {
switch(instructions()[getInstructionName()]) {
case FMwidth:
s.overallHeight=0;
s.baselineHeight=0;
@ -415,25 +407,23 @@ double JKQTMathTextPhantomNode::draw(QPainter& painter, double x, double y, JKQT
bool JKQTMathTextPhantomNode::toHtml(QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const {
JKQTMathTextEnvironment ev=currentEv;
fillInstructions();
return "&nbsp;";
}
bool JKQTMathTextPhantomNode::supportsInstructionName(const QString &instructionName)
{
fillInstructions();
return instructions.contains(instructionName);
return instructions().contains(instructionName);
}
QHash<QString, JKQTMathTextPhantomNode::Mode> JKQTMathTextPhantomNode::instructions;
void JKQTMathTextPhantomNode::fillInstructions()
{
static std::mutex sMutex;
std::lock_guard<std::mutex> lock(sMutex);
if (instructions.size()>0) return;
instructions["phantom"] = FMwidthAndHeight;
instructions["hphantom"] = FMwidth;
instructions["vphantom"] = FMheight;
const QHash<QString, JKQTMathTextPhantomNode::Mode>& JKQTMathTextPhantomNode::instructions() {
static QHash<QString, JKQTMathTextPhantomNode::Mode> table=[]()
{
QHash<QString, JKQTMathTextPhantomNode::Mode> instructions;
instructions["phantom"] = FMwidthAndHeight;
instructions["hphantom"] = FMwidth;
instructions["vphantom"] = FMheight;
return instructions;
}();
return table;
}

View File

@ -100,10 +100,11 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextWhitespaceNode: public JKQTMathTextNod
WhitespaceProps whitespace;
/** \brief converts Types \a type into its HTML representation */
static QString Type2HTML(Types type);
/** \brief translation table between latex instruction and WhitespaceProps */
static QHash<QString, WhitespaceProps> supportedInstructions;
/** \brief initializes supportedInstructions */
static void fillSupportedInstructions();
/** \brief translation table between latex instruction and WhitespaceProps
*
* \note This is a customization point for additional whitespace instructions!
*/
static const QHash<QString, WhitespaceProps>& supportedInstructions();
};
@ -187,13 +188,11 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextPhantomNode: public JKQTMathTextInstru
protected:
/** \copydoc JKQTMathTextNode::getSizeInternal() */
virtual JKQTMathTextNodeSize getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const override;
/** \brief fills instructions
/** \brief defines all implemented instructions in this node
*
* \note this is the customization point for new instructions!
*/
static void fillInstructions();
/** \brief defines all implemented instructions in this node */
static QHash<QString, Mode> instructions;
*/
static const QHash<QString, Mode>& instructions();
};
#endif // JKQTMATHTEXTWHITESPACENODE_H

View File

@ -53,6 +53,7 @@
#include "jkqtmathtext/jkqtmathtext.h"
#include "jkqtplotter/jkqtpkey.h"
#include <algorithm>
#include <mutex>
QString JKQTBasePlotter::globalUserSettigsFilename="";
QString JKQTBasePlotter::globalUserSettigsPrefix="";
@ -64,10 +65,11 @@ JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>> JKQTBasePlotter::jkqtpSaveDataAd
void initJKQTBasePlotterResources()
{
static std::mutex sMutex;
std::lock_guard<std::mutex> lock(sMutex);
Q_INIT_RESOURCE(jkqtpbaseplotter);
initJKQTMathTextResources();
static std::once_flag flag;
std::call_once(flag, []() {
Q_INIT_RESOURCE(jkqtpbaseplotter);
initJKQTMathTextResources();
});
}
@ -80,20 +82,20 @@ void JKQTBasePlotter::setDefaultJKQTBasePrinterUserSettings(QString userSettigsF
void JKQTBasePlotter::registerPaintDeviceAdapter(JKQTPPaintDeviceAdapter *adapter)
{
JKQTPSynchronized<QList<JKQTPPaintDeviceAdapter*>>::Locker lock(jkqtpPaintDeviceAdapters);
JKQTPSynchronized<QList<JKQTPPaintDeviceAdapter*>>::WriteLocker lock(jkqtpPaintDeviceAdapters);
jkqtpPaintDeviceAdapters.get().append(adapter);
}
void JKQTBasePlotter::deregisterPaintDeviceAdapter(JKQTPPaintDeviceAdapter *adapter)
{
JKQTPSynchronized<QList<JKQTPPaintDeviceAdapter*>>::Locker lock(jkqtpPaintDeviceAdapters);
JKQTPSynchronized<QList<JKQTPPaintDeviceAdapter*>>::WriteLocker lock(jkqtpPaintDeviceAdapters);
if (jkqtpPaintDeviceAdapters.get().contains(adapter)) jkqtpPaintDeviceAdapters.get().removeAll(adapter);
}
bool JKQTBasePlotter::registerSaveDataAdapter(JKQTPSaveDataAdapter *adapter)
{
if (adapter){
JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>>::Locker lock(jkqtpSaveDataAdapters);
JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>>::WriteLocker lock(jkqtpSaveDataAdapters);
QString format=adapter->getFilter();
for (int i=0; i<jkqtpSaveDataAdapters.get().size(); i++) {
if (jkqtpSaveDataAdapters.get()[i] && jkqtpSaveDataAdapters.get()[i]->getFilter()==format) {
@ -108,7 +110,7 @@ bool JKQTBasePlotter::registerSaveDataAdapter(JKQTPSaveDataAdapter *adapter)
bool JKQTBasePlotter::deregisterSaveDataAdapter(JKQTPSaveDataAdapter *adapter)
{
JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>>::Locker lock(jkqtpSaveDataAdapters);
JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>>::WriteLocker lock(jkqtpSaveDataAdapters);
if (jkqtpSaveDataAdapters.get().contains(adapter)) jkqtpSaveDataAdapters.get().removeAll(adapter);
return true;
}
@ -3285,7 +3287,7 @@ bool JKQTBasePlotter::saveData(const QString& filename, const QString &format) {
QMap<QString, QStringList> saveAdapterFileExtensions;
{
JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>>::Locker lock(jkqtpSaveDataAdapters);
JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>>::ReadLocker lock(jkqtpSaveDataAdapters);
for (int i=0; i<jkqtpSaveDataAdapters.get().size(); i++) {
const QString fid=jkqtpSaveDataAdapters.get()[i]->getFormatID();
fileformats<<jkqtpSaveDataAdapters.get()[i]->getFilter();
@ -3371,7 +3373,7 @@ bool JKQTBasePlotter::saveData(const QString& filename, const QString &format) {
QString fidx=fmt;
fidx=fidx.remove(0,6);
int idx=fidx.toInt();
JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>>::Locker lock(jkqtpSaveDataAdapters);
JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>>::ReadLocker lock(jkqtpSaveDataAdapters);
if (idx>=0 && idx<jkqtpSaveDataAdapters.get().size() && jkqtpSaveDataAdapters.get()[idx]) {
QStringList columnNames;
const QList<QVector<double> > dataset=datastore->getData(&columnNames);
@ -3379,7 +3381,7 @@ bool JKQTBasePlotter::saveData(const QString& filename, const QString &format) {
return true;
}
} else {
JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>>::Locker lock(jkqtpSaveDataAdapters);
JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>>::ReadLocker lock(jkqtpSaveDataAdapters);
for (int i=0; i<jkqtpSaveDataAdapters.get().size(); i++) {
if (fmt == jkqtpSaveDataAdapters.get()[i]->getFormatID()) {
QStringList columnNames;
@ -3583,7 +3585,7 @@ bool JKQTBasePlotter::saveImage(const QString& filename, bool displayPreview) {
// add JKQTPPaintDeviceAdapter exporters
const int filtersIndexFirstExporterPLugin=filterstrings.size();
{
JKQTPSynchronized<QList<JKQTPPaintDeviceAdapter*>>::Locker lock(jkqtpPaintDeviceAdapters);
JKQTPSynchronized<QList<JKQTPPaintDeviceAdapter*>>::ReadLocker lock(jkqtpPaintDeviceAdapters);
for (int i=0; i<jkqtpPaintDeviceAdapters.get().size(); i++) {
filterstrings<<jkqtpPaintDeviceAdapters.get()[i]->getFilter();
filterextensions<<QStringList();
@ -3635,7 +3637,7 @@ bool JKQTBasePlotter::saveImage(const QString& filename, bool displayPreview) {
if (idx<0) idx=findExporterByExtension(fnExt);
return idx;
}();
JKQTPSynchronized<QList<JKQTPPaintDeviceAdapter*>>::Locker lock(jkqtpPaintDeviceAdapters);
JKQTPSynchronized<QList<JKQTPPaintDeviceAdapter*>>::ReadLocker lock(jkqtpPaintDeviceAdapters);
// now we determine whether we selected a jkqtpPaintDeviceAdapters, if not adapterID will be <0
const int adapterID=[&](){
int idx=filtID-filtersIndexFirstExporterPLugin;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB