mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 01:51:49 +08:00
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:
parent
11b9ac6c8b
commit
9662ed2d69
BIN
doc/images/palettes/palette_alpha.png
Normal file
BIN
doc/images/palettes/palette_alpha.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 155 B |
BIN
doc/images/palettes/palette_invalpha.png
Normal file
BIN
doc/images/palettes/palette_invalpha.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 155 B |
@ -94,10 +94,13 @@ This test results in the following numbers (on my AMD Ryzen5 8/16-core laptop):
|
|||||||
|
|
||||||
[comment]:RESULTS
|
[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/>
|
<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
|
[comment]:RESULTS_END
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "multithreaded_thread.h"
|
#include "multithreaded_thread.h"
|
||||||
#include "jkqtmath/jkqtpstatbasics.h"
|
#include "jkqtmath/jkqtpstatbasics.h"
|
||||||
#include "jkqtpexampleapplication.h"
|
#include "jkqtpexampleapplication.h"
|
||||||
|
#include "jkqtplotter_version.h"
|
||||||
|
|
||||||
#define NUM_SHOWN_PLOTS 3
|
#define NUM_SHOWN_PLOTS 3
|
||||||
#define NUM_PLOTS 8
|
#define NUM_PLOTS 8
|
||||||
@ -129,7 +130,9 @@ int main(int argc, char* argv[])
|
|||||||
const auto iend=md.indexOf("[comment]:RESULTS_END");
|
const auto iend=md.indexOf("[comment]:RESULTS_END");
|
||||||
qDebug()<<" istart="<<istart<<", iend="<<iend;
|
qDebug()<<" istart="<<istart<<", iend="<<iend;
|
||||||
if (istart>=0 && iend>istart) {
|
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";
|
+"\n\n<u><b>PARALLEL RESULTS:</b></u><br/>\n"+par_result.toUtf8()+"\n\n";
|
||||||
md.replace(istart,iend-istart,newResults);
|
md.replace(istart,iend-istart,newResults);
|
||||||
if (f.open(QFile::WriteOnly)) {
|
if (f.open(QFile::WriteOnly)) {
|
||||||
|
@ -40,7 +40,9 @@ const int JKQTPImageTools::NDEFAULTSTEPS = 5;
|
|||||||
|
|
||||||
QMap<int, JKQTPImageTools::LUTData > JKQTPImageTools::global_jkqtpimagetools_lutstore = JKQTPImageTools::getDefaultLUTs();
|
QMap<int, JKQTPImageTools::LUTData > JKQTPImageTools::global_jkqtpimagetools_lutstore = JKQTPImageTools::getDefaultLUTs();
|
||||||
int JKQTPImageTools::global_next_userpalette = JKQTPMathImageFIRST_REGISTERED_USER_PALETTE;
|
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() {
|
QStringList JKQTPImageTools::getPredefinedPalettes() {
|
||||||
std::lock_guard<std::mutex> lock(JKQTPImageTools::lutMutex);
|
QReadLocker lock(&JKQTPImageTools::lutMutex);
|
||||||
static QStringList sl;
|
|
||||||
|
|
||||||
if (sl.size()!=JKQTPImageTools::global_jkqtpimagetools_lutstore.size()) {
|
if (getPredefinedPalettesGlobalList.size()!=JKQTPImageTools::global_jkqtpimagetools_lutstore.size()) {
|
||||||
sl.clear();
|
lock.unlock();
|
||||||
for (auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.begin(); it!=JKQTPImageTools::global_jkqtpimagetools_lutstore.end(); ++it) {
|
QWriteLocker lock(&JKQTPImageTools::lutMutex);
|
||||||
if (it.key()>=0 && it.key()<=JKQTPMathImageLAST_POSSIBLE_REGISTERED_USER_PALETTE) {
|
if (getPredefinedPalettesGlobalList.size()!=JKQTPImageTools::global_jkqtpimagetools_lutstore.size()) {
|
||||||
if (it.value().nameT.size()!=0) sl<<it.value().nameT;
|
getPredefinedPalettesGlobalList.clear();
|
||||||
else if (it.value().name.size()!=0) sl<<it.value().name;
|
for (auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.begin(); it!=JKQTPImageTools::global_jkqtpimagetools_lutstore.end(); ++it) {
|
||||||
else sl<<QString(QObject::tr("Palette")+" #"+QString::number(it.key()));
|
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() {
|
QStringList JKQTPImageTools::getPredefinedPalettesMachineReadable() {
|
||||||
std::lock_guard<std::mutex> lock(JKQTPImageTools::lutMutex);
|
QReadLocker lock(&JKQTPImageTools::lutMutex);
|
||||||
static QStringList sl;
|
|
||||||
|
|
||||||
if (sl.size()!=JKQTPImageTools::global_jkqtpimagetools_lutstore.size()) {
|
if (getPredefinedPalettesMachineReadableGlobalList.size()!=JKQTPImageTools::global_jkqtpimagetools_lutstore.size()) {
|
||||||
sl.clear();
|
lock.unlock();
|
||||||
for (auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.begin(); it!=JKQTPImageTools::global_jkqtpimagetools_lutstore.end(); ++it) {
|
QWriteLocker lock(&JKQTPImageTools::lutMutex);
|
||||||
if (it.key()>=0) {
|
if (getPredefinedPalettesMachineReadableGlobalList.size()!=JKQTPImageTools::global_jkqtpimagetools_lutstore.size()) {
|
||||||
if (it.value().name.size()!=0) sl<<it.value().name;
|
getPredefinedPalettesMachineReadableGlobalList.clear();
|
||||||
else if (it.value().nameT.size()!=0) sl<<it.value().nameT;
|
for (auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.begin(); it!=JKQTPImageTools::global_jkqtpimagetools_lutstore.end(); ++it) {
|
||||||
else sl<<QString("palette #"+QString::number(it.key()));
|
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)
|
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);
|
auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.find(p);
|
||||||
if (it==JKQTPImageTools::global_jkqtpimagetools_lutstore.end()) return QString::number(static_cast<int>(p));
|
if (it==JKQTPImageTools::global_jkqtpimagetools_lutstore.end()) return QString::number(static_cast<int>(p));
|
||||||
else {
|
else {
|
||||||
@ -2091,7 +2099,7 @@ QString JKQTPImageTools::JKQTPMathImageColorPalette2String(JKQTPMathImageColorPa
|
|||||||
|
|
||||||
QString JKQTPImageTools::JKQTPMathImageColorPalette2StringHumanReadable(JKQTPMathImageColorPalette p)
|
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);
|
auto it=JKQTPImageTools::global_jkqtpimagetools_lutstore.find(p);
|
||||||
if (it==JKQTPImageTools::global_jkqtpimagetools_lutstore.end()) return QString::number(static_cast<int>(p));
|
if (it==JKQTPImageTools::global_jkqtpimagetools_lutstore.end()) return QString::number(static_cast<int>(p));
|
||||||
else {
|
else {
|
||||||
@ -2103,7 +2111,7 @@ QString JKQTPImageTools::JKQTPMathImageColorPalette2StringHumanReadable(JKQTPMat
|
|||||||
|
|
||||||
JKQTPMathImageColorPalette JKQTPImageTools::String2JKQTPMathImageColorPalette(const QString &p)
|
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) {
|
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) {
|
if (QString::compare(p, it.value().name, Qt::CaseInsensitive)==0) {
|
||||||
return static_cast<JKQTPMathImageColorPalette>(it.key());
|
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)
|
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++;
|
int id=JKQTPImageTools::global_next_userpalette++;
|
||||||
JKQTPImageTools::global_jkqtpimagetools_lutstore[id].name=name;
|
JKQTPImageTools::global_jkqtpimagetools_lutstore[id].name=name;
|
||||||
JKQTPImageTools::global_jkqtpimagetools_lutstore[id].nameT=((nameT.size()>0)?nameT:name);
|
JKQTPImageTools::global_jkqtpimagetools_lutstore[id].nameT=((nameT.size()>0)?nameT:name);
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <mutex>
|
#include <QReadWriteLock>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "jkqtcommon/jkqtcommon_imexport.h"
|
#include "jkqtcommon/jkqtcommon_imexport.h"
|
||||||
#include "jkqtcommon/jkqtpmathtools.h"
|
#include "jkqtcommon/jkqtpmathtools.h"
|
||||||
@ -341,16 +341,16 @@ enum JKQTPMathImageColorPalette {
|
|||||||
JKQTPMathImagePastel2_STEP, /*!< \image{inline} html palettes/palette_pastel2_step.png */
|
JKQTPMathImagePastel2_STEP, /*!< \image{inline} html palettes/palette_pastel2_step.png */
|
||||||
JKQTPMathImageSet1_STEP, /*!< \image{inline} html palettes/palette_set1_step.png */
|
JKQTPMathImageSet1_STEP, /*!< \image{inline} html palettes/palette_set1_step.png */
|
||||||
JKQTPMathImageSet2_STEP, /*!< \image{inline} html palettes/palette_set2_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 */
|
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 */
|
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() */
|
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()
|
\see registerPalette() registerPalettesFromFile()
|
||||||
*/
|
*/
|
||||||
static JKQTCOMMON_LIB_EXPORT int global_next_userpalette;
|
static JKQTCOMMON_LIB_EXPORT int global_next_userpalette;
|
||||||
/** \brief Mutex to protect global_jkqtpimagetools_lutstore and global_next_userpalette */
|
/** \brief storage for the palette names in getPredefinedPalettes() \internal */
|
||||||
static JKQTCOMMON_LIB_EXPORT std::mutex lutMutex;
|
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
|
/*! \brief returns data of the default LUTs, used to initialize global_jkqtpimagetools_lutstore
|
||||||
|
@ -25,6 +25,9 @@
|
|||||||
#define JKQTPCONCURRENCYTOOLS_H
|
#define JKQTPCONCURRENCYTOOLS_H
|
||||||
|
|
||||||
#include "jkqtcommon/jkqtcommon_imexport.h"
|
#include "jkqtcommon/jkqtcommon_imexport.h"
|
||||||
|
#include <QReadWriteLock>
|
||||||
|
#include <QReadLocker>
|
||||||
|
#include <QWriteLocker>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
/** \brief template class that wraps any datatype and combines it with a mutex, exposes the lock()/unlock()
|
/** \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 {
|
class JKQTPSynchronized {
|
||||||
public:
|
public:
|
||||||
/** \brief Mutex used by this temmplate */
|
/** \brief Mutex used by this temmplate */
|
||||||
typedef std::mutex MutexType;
|
typedef QReadWriteLock MutexType;
|
||||||
/** \brief type of a lock_guard for a JKQTPSynchronized<T> */
|
|
||||||
typedef std::lock_guard<JKQTPSynchronized<T> > Locker;
|
/** \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 */
|
/** \brief contained data type T */
|
||||||
typedef T data_type;
|
typedef T data_type;
|
||||||
/** \brief default constructor, the internal data is default-initialized */
|
/** \brief default constructor, the internal data is default-initialized */
|
||||||
@ -59,18 +92,32 @@ public:
|
|||||||
m_data=std::move(other.m_data);
|
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() {
|
inline void lock() const {
|
||||||
m_mutex.lock();
|
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!
|
* \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();
|
m_mutex.unlock();
|
||||||
}
|
}
|
||||||
/** \brief assign a value to the internal data storage, <b>not thread-safe.</b>
|
/** \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>.
|
/** \brief returns the value in the internal data storage, <b>thread-safe</b>.
|
||||||
*/
|
*/
|
||||||
inline T get_safe() const {
|
inline T get_safe() const {
|
||||||
Locker lck(m_mutex);
|
ReadLocker lck(this);
|
||||||
return m_data;
|
return m_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,14 +556,14 @@ JKQTPSynchronized<QVector<JKQTPCustomGraphSymbolFunctor> > JKQTPlotterDrawingToo
|
|||||||
|
|
||||||
JKQTPGraphSymbols JKQTPRegisterCustomGraphSymbol(JKQTPCustomGraphSymbolFunctor&& f)
|
JKQTPGraphSymbols JKQTPRegisterCustomGraphSymbol(JKQTPCustomGraphSymbolFunctor&& f)
|
||||||
{
|
{
|
||||||
JKQTPlotterDrawingTools::SymbolsLocker lock(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore);
|
JKQTPlotterDrawingTools::SymbolsWriteLocker lock(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore);
|
||||||
JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->push_back(std::move(f));
|
JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->push_back(std::move(f));
|
||||||
return static_cast<JKQTPGraphSymbols>(static_cast<uint64_t>(JKQTPFirstCustomSymbol)+static_cast<uint64_t>(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->size()-1));
|
return static_cast<JKQTPGraphSymbols>(static_cast<uint64_t>(JKQTPFirstCustomSymbol)+static_cast<uint64_t>(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->size()-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTPGraphSymbols JKQTPRegisterCustomGraphSymbol(const JKQTPCustomGraphSymbolFunctor& f)
|
JKQTPGraphSymbols JKQTPRegisterCustomGraphSymbol(const JKQTPCustomGraphSymbolFunctor& f)
|
||||||
{
|
{
|
||||||
JKQTPlotterDrawingTools::SymbolsLocker lock(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore);
|
JKQTPlotterDrawingTools::SymbolsWriteLocker lock(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore);
|
||||||
JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->push_back(f);
|
JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->push_back(f);
|
||||||
return static_cast<JKQTPGraphSymbols>(static_cast<uint64_t>(JKQTPFirstCustomSymbol)+static_cast<uint64_t>(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->size()-1));
|
return static_cast<JKQTPGraphSymbols>(static_cast<uint64_t>(JKQTPFirstCustomSymbol)+static_cast<uint64_t>(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->size()-1));
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,8 @@ struct JKQTPlotterDrawingTools {
|
|||||||
* \internal
|
* \internal
|
||||||
*/
|
*/
|
||||||
static JKQTCOMMON_LIB_EXPORT JKQTPSynchronized<QVector<JKQTPCustomGraphSymbolFunctor> > JKQTPCustomGraphSymbolStore;
|
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);
|
painter.drawPath(path);
|
||||||
}
|
}
|
||||||
if (symbol>=JKQTPFirstCustomSymbol) {
|
if (symbol>=JKQTPFirstCustomSymbol) {
|
||||||
JKQTPlotterDrawingTools::SymbolsLocker lock(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore);
|
JKQTPlotterDrawingTools::SymbolsReadLocker lock(JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore);
|
||||||
const int idx(static_cast<int>(symbol-JKQTPFirstCustomSymbol));
|
const int idx(static_cast<int>(symbol-JKQTPFirstCustomSymbol));
|
||||||
if (idx>=0 && idx<JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->size()) {
|
if (idx>=0 && idx<JKQTPlotterDrawingTools::JKQTPCustomGraphSymbolStore->size()) {
|
||||||
painter.setPen(p);
|
painter.setPen(p);
|
||||||
|
@ -29,22 +29,21 @@
|
|||||||
#include <QFontInfo>
|
#include <QFontInfo>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
|
|
||||||
void initJKQTMathTextResources()
|
void initJKQTMathTextResources()
|
||||||
{
|
{
|
||||||
static bool initialized=false;
|
static std::once_flag flag;
|
||||||
static std::mutex mutex_initialized;
|
std::call_once(flag, []() {
|
||||||
std::lock_guard<std::mutex> lock(mutex_initialized);
|
#ifdef JKQTMATHTEXT_COMPILED_WITH_XITS
|
||||||
if (!initialized) {
|
Q_INIT_RESOURCE(xits);
|
||||||
#ifdef JKQTMATHTEXT_COMPILED_WITH_XITS
|
#endif
|
||||||
Q_INIT_RESOURCE(xits);
|
#ifdef JKQTMATHTEXT_COMPILED_WITH_FIRAMATH
|
||||||
#endif
|
Q_INIT_RESOURCE(firamath);
|
||||||
#ifdef JKQTMATHTEXT_COMPILED_WITH_FIRAMATH
|
#endif
|
||||||
Q_INIT_RESOURCE(firamath);
|
}
|
||||||
#endif
|
);
|
||||||
initialized=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextFontSpecifier::JKQTMathTextFontSpecifier():
|
JKQTMathTextFontSpecifier::JKQTMathTextFontSpecifier():
|
||||||
@ -234,6 +233,8 @@ bool JKQTMathTextFontSpecifier::hasFallbackSymbolFontName() const
|
|||||||
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getXITSFamilies()
|
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getXITSFamilies()
|
||||||
{
|
{
|
||||||
initJKQTMathTextResources();
|
initJKQTMathTextResources();
|
||||||
|
|
||||||
|
|
||||||
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
||||||
QFontDatabase fdb;
|
QFontDatabase fdb;
|
||||||
const auto fontFamilies=fdb.families();
|
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"); }
|
if (QFile::exists(":/JKQTMathText/fonts/xits-regular.otf")) { QFontDatabase::addApplicationFont(":/JKQTMathText/fonts/xits-regular.otf"); }
|
||||||
}
|
}
|
||||||
|
|
||||||
static JKQTMathTextFontSpecifier fontSpec;
|
static JKQTMathTextFontSpecifier fontSpec;
|
||||||
static std::mutex fontSpecMutex;
|
|
||||||
std::lock_guard<std::mutex> lock(fontSpecMutex);
|
|
||||||
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
|
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
|
||||||
fontSpec.m_transformOnOutput=false;
|
fontSpec.m_transformOnOutput=false;
|
||||||
for (int i=0; i<fontFamilies.size(); i++) {
|
for (int i=0; i<fontFamilies.size(); i++) {
|
||||||
@ -277,22 +276,20 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getXITSFamilies()
|
|||||||
|
|
||||||
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getASANAFamilies()
|
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getASANAFamilies()
|
||||||
{
|
{
|
||||||
initJKQTMathTextResources();
|
static JKQTMathTextFontSpecifier fontSpec=[]() -> JKQTMathTextFontSpecifier {
|
||||||
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
initJKQTMathTextResources();
|
||||||
QFontDatabase fdb;
|
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
||||||
const auto fontFamilies=fdb.families();
|
QFontDatabase fdb;
|
||||||
#else
|
const auto fontFamilies=fdb.families();
|
||||||
const auto fontFamilies=QFontDatabase::families();
|
#else
|
||||||
#endif
|
const auto fontFamilies=QFontDatabase::families();
|
||||||
if (!fontFamilies.contains("Asana") && !fontFamilies.contains("Asana Math")) {
|
#endif
|
||||||
if (QFile::exists(":/JKQTMathText/fonts/asana-math.otf")) { /*i=*/QFontDatabase::addApplicationFont(":/JKQTMathText/fonts/asana-math.otf"); }
|
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 fontSpec;
|
||||||
static std::mutex fontSpecMutex;
|
|
||||||
std::lock_guard<std::mutex> lock(fontSpecMutex);
|
|
||||||
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
|
|
||||||
fontSpec.m_transformOnOutput=false;
|
fontSpec.m_transformOnOutput=false;
|
||||||
for (int i=0; i<fontFamilies.size(); i++) {
|
for (int i=0; i<fontFamilies.size(); i++) {
|
||||||
if (fontFamilies.at(i).contains("Asana Math")) {
|
if (fontFamilies.at(i).contains("Asana Math")) {
|
||||||
@ -310,22 +307,19 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getASANAFamilies()
|
|||||||
fontSpec.m_fontName=fontSpec.m_mathFontName;
|
fontSpec.m_fontName=fontSpec.m_mathFontName;
|
||||||
}
|
}
|
||||||
fontSpec.m_fallbackSymbolFont=fontSpec.m_mathFontName;
|
fontSpec.m_fallbackSymbolFont=fontSpec.m_mathFontName;
|
||||||
}
|
return fontSpec;
|
||||||
|
}();
|
||||||
|
|
||||||
return fontSpec;
|
return fontSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getSTIXFamilies()
|
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getSTIXFamilies()
|
||||||
{
|
{
|
||||||
initJKQTMathTextResources();
|
static JKQTMathTextFontSpecifier fontSpec=[]() -> JKQTMathTextFontSpecifier {
|
||||||
static QStringList mathNames{"STIX Two Math", "STIX Math", "STIX Two Math Standard", "STIX Math Standard"};
|
initJKQTMathTextResources();
|
||||||
static QStringList textNames{"STIX", "STIXGeneral", "STIX General"};
|
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 fontSpec;
|
||||||
static std::mutex fontSpecMutex;
|
|
||||||
std::lock_guard<std::mutex> lock(fontSpecMutex);
|
|
||||||
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
|
|
||||||
fontSpec.m_transformOnOutput=false;
|
fontSpec.m_transformOnOutput=false;
|
||||||
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
||||||
QFontDatabase fdb;
|
QFontDatabase fdb;
|
||||||
@ -365,27 +359,26 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getSTIXFamilies()
|
|||||||
fontSpec.m_fontName=fontSpec.m_mathFontName;
|
fontSpec.m_fontName=fontSpec.m_mathFontName;
|
||||||
}
|
}
|
||||||
fontSpec.m_fallbackSymbolFont=fontSpec.m_mathFontName;
|
fontSpec.m_fallbackSymbolFont=fontSpec.m_mathFontName;
|
||||||
}
|
return fontSpec;
|
||||||
|
}();
|
||||||
return fontSpec;
|
return fontSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getFIRAFamilies()
|
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getFIRAFamilies()
|
||||||
{
|
{
|
||||||
initJKQTMathTextResources();
|
static JKQTMathTextFontSpecifier fontSpec=[]() -> JKQTMathTextFontSpecifier {
|
||||||
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
initJKQTMathTextResources();
|
||||||
QFontDatabase fdb;
|
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
||||||
const auto fontFamilies=fdb.families();
|
QFontDatabase fdb;
|
||||||
#else
|
const auto fontFamilies=fdb.families();
|
||||||
const auto fontFamilies=QFontDatabase::families();
|
#else
|
||||||
#endif
|
const auto fontFamilies=QFontDatabase::families();
|
||||||
if (!fontFamilies.contains("Fira Math")) {
|
#endif
|
||||||
if (QFile::exists(":/JKQTMathText/fonts/FiraMath-Regular.otf")) { QFontDatabase::addApplicationFont(":/JKQTMathText/fonts/FiraMath-Regular.otf"); }
|
if (!fontFamilies.contains("Fira Math")) {
|
||||||
}
|
if (QFile::exists(":/JKQTMathText/fonts/FiraMath-Regular.otf")) { QFontDatabase::addApplicationFont(":/JKQTMathText/fonts/FiraMath-Regular.otf"); }
|
||||||
|
}
|
||||||
|
|
||||||
static JKQTMathTextFontSpecifier fontSpec;
|
JKQTMathTextFontSpecifier fontSpec;
|
||||||
static std::mutex fontSpecMutex;
|
|
||||||
std::lock_guard<std::mutex> lock(fontSpecMutex);
|
|
||||||
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
|
|
||||||
fontSpec.m_transformOnOutput=false;
|
fontSpec.m_transformOnOutput=false;
|
||||||
for (int i=0; i<fontFamilies.size(); i++) {
|
for (int i=0; i<fontFamilies.size(); i++) {
|
||||||
if (fontFamilies.at(i).contains("Fira Math")) {
|
if (fontFamilies.at(i).contains("Fira Math")) {
|
||||||
@ -405,17 +398,16 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getFIRAFamilies()
|
|||||||
fontSpec.m_fontName=fontSpec.m_mathFontName;
|
fontSpec.m_fontName=fontSpec.m_mathFontName;
|
||||||
}
|
}
|
||||||
fontSpec.m_fallbackSymbolFont=fontSpec.m_mathFontName;
|
fontSpec.m_fallbackSymbolFont=fontSpec.m_mathFontName;
|
||||||
}
|
return fontSpec;
|
||||||
|
}();
|
||||||
|
|
||||||
return fontSpec;
|
return fontSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getAppFontFamilies()
|
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getAppFontFamilies()
|
||||||
{
|
{
|
||||||
static JKQTMathTextFontSpecifier fontSpec;
|
static JKQTMathTextFontSpecifier fontSpec=[]() -> JKQTMathTextFontSpecifier {
|
||||||
static std::mutex fontSpecMutex;
|
JKQTMathTextFontSpecifier fontSpec;
|
||||||
std::lock_guard<std::mutex> lock(fontSpecMutex);
|
|
||||||
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
|
|
||||||
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
||||||
QFontDatabase fdb;
|
QFontDatabase fdb;
|
||||||
const auto fontFamilies=fdb.families();
|
const auto fontFamilies=fdb.families();
|
||||||
@ -448,16 +440,14 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getAppFontFamilies()
|
|||||||
if (xits.hasMathFontName()) fontSpec.m_mathFontName=xits.mathFontName();
|
if (xits.hasMathFontName()) fontSpec.m_mathFontName=xits.mathFontName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return fontSpec;
|
||||||
|
}();
|
||||||
return fontSpec;
|
return fontSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getAppFontSFFamilies()
|
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getAppFontSFFamilies()
|
||||||
{
|
{
|
||||||
static JKQTMathTextFontSpecifier fontSpec;
|
static JKQTMathTextFontSpecifier fontSpec=[]() -> JKQTMathTextFontSpecifier {
|
||||||
static std::mutex fontSpecMutex;
|
|
||||||
std::lock_guard<std::mutex> lock(fontSpecMutex);
|
|
||||||
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
|
|
||||||
const QFont f=QGuiApplication::font().family();
|
const QFont f=QGuiApplication::font().family();
|
||||||
QFont testFnt;
|
QFont testFnt;
|
||||||
if (f.styleHint()==QFont::SansSerif) {
|
if (f.styleHint()==QFont::SansSerif) {
|
||||||
@ -467,7 +457,8 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getAppFontSFFamilies()
|
|||||||
testFnt.setStyleHint(QFont::StyleHint::SansSerif);
|
testFnt.setStyleHint(QFont::StyleHint::SansSerif);
|
||||||
fontSpec.m_fontName=fontSpec.m_mathFontName=testFnt.defaultFamily();
|
fontSpec.m_fontName=fontSpec.m_mathFontName=testFnt.defaultFamily();
|
||||||
}
|
}
|
||||||
}
|
return fontSpec;
|
||||||
|
}();
|
||||||
return fontSpec;
|
return fontSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
JKQTMathTextBoxInstructionNode::JKQTMathTextBoxInstructionNode(JKQTMathText* _parent, const QString& name, JKQTMathTextNode* child, const QStringList& parameters):
|
JKQTMathTextBoxInstructionNode::JKQTMathTextBoxInstructionNode(JKQTMathText* _parent, const QString& name, JKQTMathTextNode* child, const QStringList& parameters):
|
||||||
JKQTMathTextInstruction1Node(_parent, name, child, parameters)
|
JKQTMathTextInstruction1Node(_parent, name, child, parameters)
|
||||||
{
|
{
|
||||||
fillInstructions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextBoxInstructionNode::~JKQTMathTextBoxInstructionNode() {
|
JKQTMathTextBoxInstructionNode::~JKQTMathTextBoxInstructionNode() {
|
||||||
@ -56,7 +56,7 @@ QString JKQTMathTextBoxInstructionNode::getTypeName() const
|
|||||||
JKQTMathTextNodeSize JKQTMathTextBoxInstructionNode::getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const {
|
JKQTMathTextNodeSize JKQTMathTextBoxInstructionNode::getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const {
|
||||||
JKQTMathTextEnvironment ev=currentEv;
|
JKQTMathTextEnvironment ev=currentEv;
|
||||||
|
|
||||||
const auto& inst=instructions.value(getInstructionName());
|
const auto& inst=instructions().value(getInstructionName());
|
||||||
inst.modifier(ev, getParameters());
|
inst.modifier(ev, getParameters());
|
||||||
const QPen p=inst.pen(ev, getParameters(), parentMathText);
|
const QPen p=inst.pen(ev, getParameters(), parentMathText);
|
||||||
const QBrush b=inst.brush(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);
|
doDrawBoxes(painter, x, y, currentEv);
|
||||||
JKQTMathTextEnvironment ev=currentEv;
|
JKQTMathTextEnvironment ev=currentEv;
|
||||||
|
|
||||||
const auto& inst=instructions.value(getInstructionName());
|
const auto& inst=instructions().value(getInstructionName());
|
||||||
inst.modifier(ev, getParameters());
|
inst.modifier(ev, getParameters());
|
||||||
const QPen p=inst.pen(ev, getParameters(), parentMathText);
|
const QPen p=inst.pen(ev, getParameters(), parentMathText);
|
||||||
const QBrush b=inst.brush(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 {
|
bool JKQTMathTextBoxInstructionNode::toHtml(QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const {
|
||||||
JKQTMathTextEnvironment ev=currentEv;
|
JKQTMathTextEnvironment ev=currentEv;
|
||||||
fillInstructions();
|
|
||||||
const auto& inst=instructions.value(getInstructionName());
|
const auto& inst=instructions().value(getInstructionName());
|
||||||
inst.modifier(ev, getParameters());
|
inst.modifier(ev, getParameters());
|
||||||
const QPen p=inst.pen(ev, getParameters(), parentMathText);
|
const QPen p=inst.pen(ev, getParameters(), parentMathText);
|
||||||
const QBrush b=inst.brush(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)
|
bool JKQTMathTextBoxInstructionNode::supportsInstructionName(const QString &instructionName)
|
||||||
{
|
{
|
||||||
fillInstructions();
|
return instructions().contains(instructionName);
|
||||||
return instructions.contains(instructionName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t JKQTMathTextBoxInstructionNode::countParametersOfInstruction(const QString &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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JKQTMathTextBoxInstructionNode::modifyInMathEnvironment(const QString &instructionName, bool &insideMath, bool& insideMathTextStyle, const QStringList& params)
|
void JKQTMathTextBoxInstructionNode::modifyInMathEnvironment(const QString &instructionName, bool &insideMath, bool& insideMathTextStyle, const QStringList& params)
|
||||||
{
|
{
|
||||||
fillInstructions();
|
|
||||||
if (instructions.contains(instructionName)) {
|
if (instructions().contains(instructionName)) {
|
||||||
JKQTMathTextEnvironment ev;
|
JKQTMathTextEnvironment ev;
|
||||||
ev.insideMath=insideMath;
|
ev.insideMath=insideMath;
|
||||||
ev.insideMathUseTextStyle=insideMathTextStyle;
|
ev.insideMathUseTextStyle=insideMathTextStyle;
|
||||||
instructions[instructionName].modifier(ev, params);
|
instructions()[instructionName].modifier(ev, params);
|
||||||
insideMath=ev.insideMath;
|
insideMath=ev.insideMath;
|
||||||
insideMathTextStyle=ev.insideMathUseTextStyle;
|
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()
|
{
|
||||||
{
|
InstructionProperties i(InstructionProperties::NoModification,
|
||||||
static std::mutex sMutex;
|
InstructionProperties::DefaultPen,
|
||||||
std::lock_guard<std::mutex> lock(sMutex);
|
InstructionProperties::NoBrush,
|
||||||
if (instructions.size()>0) return;
|
InstructionProperties::DefaultPadding,
|
||||||
|
/*Nparams=*/0);
|
||||||
{
|
instructions["fbox"] = i;
|
||||||
InstructionProperties i(InstructionProperties::NoModification,
|
instructions["framebox"] = i;
|
||||||
InstructionProperties::DefaultPen,
|
instructions["boxed"] = i;
|
||||||
InstructionProperties::NoBrush,
|
instructions["framed"] = i;
|
||||||
InstructionProperties::DefaultPadding,
|
}
|
||||||
/*Nparams=*/0);
|
{
|
||||||
instructions["fbox"] = i;
|
InstructionProperties i(InstructionProperties::NoModification,
|
||||||
instructions["framebox"] = i;
|
InstructionProperties::DefaultPen,
|
||||||
instructions["boxed"] = i;
|
InstructionProperties::NoBrush,
|
||||||
instructions["framed"] = i;
|
InstructionProperties::DefaultPadding,
|
||||||
}
|
/*Nparams=*/0);
|
||||||
{
|
i.doubleLine=true;
|
||||||
InstructionProperties i(InstructionProperties::NoModification,
|
instructions["doublebox"] = i;
|
||||||
InstructionProperties::DefaultPen,
|
}
|
||||||
InstructionProperties::NoBrush,
|
{
|
||||||
InstructionProperties::DefaultPadding,
|
InstructionProperties i(InstructionProperties::NoModification,
|
||||||
/*Nparams=*/0);
|
InstructionProperties::DefaultPen,
|
||||||
i.doubleLine=true;
|
InstructionProperties::NoBrush,
|
||||||
instructions["doublebox"] = i;
|
InstructionProperties::DefaultPadding,
|
||||||
}
|
/*Nparams=*/0);
|
||||||
{
|
i.roundingFactor=0.7;
|
||||||
InstructionProperties i(InstructionProperties::NoModification,
|
instructions["ovalbox"] = i;
|
||||||
InstructionProperties::DefaultPen,
|
}
|
||||||
InstructionProperties::NoBrush,
|
{
|
||||||
InstructionProperties::DefaultPadding,
|
InstructionProperties i(InstructionProperties::NoModification,
|
||||||
/*Nparams=*/0);
|
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
|
||||||
i.roundingFactor=0.7;
|
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
|
||||||
instructions["ovalbox"] = i;
|
p.setWidthF(p.widthF()*1.5);
|
||||||
}
|
return p;
|
||||||
{
|
},
|
||||||
InstructionProperties i(InstructionProperties::NoModification,
|
InstructionProperties::NoBrush,
|
||||||
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
|
InstructionProperties::DefaultPadding,
|
||||||
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
|
/*Nparams=*/0);
|
||||||
p.setWidthF(p.widthF()*1.5);
|
i.roundingFactor=0.8;
|
||||||
return p;
|
instructions["Ovalbox"] = i;
|
||||||
},
|
}
|
||||||
InstructionProperties::NoBrush,
|
{
|
||||||
InstructionProperties::DefaultPadding,
|
InstructionProperties i(InstructionProperties::NoModification,
|
||||||
/*Nparams=*/0);
|
InstructionProperties::DefaultPen,
|
||||||
i.roundingFactor=0.8;
|
InstructionProperties::NoBrush,
|
||||||
instructions["Ovalbox"] = i;
|
InstructionProperties::DefaultPadding,
|
||||||
}
|
/*Nparams=*/0);
|
||||||
{
|
i.roundingFactor=0.7;
|
||||||
InstructionProperties i(InstructionProperties::NoModification,
|
i.doubleLine=true;
|
||||||
InstructionProperties::DefaultPen,
|
instructions["ovaldoublebox"] = i;
|
||||||
InstructionProperties::NoBrush,
|
}
|
||||||
InstructionProperties::DefaultPadding,
|
{
|
||||||
/*Nparams=*/0);
|
InstructionProperties i(InstructionProperties::NoModification,
|
||||||
i.roundingFactor=0.7;
|
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
|
||||||
i.doubleLine=true;
|
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
|
||||||
instructions["ovaldoublebox"] = i;
|
p.setColor(jkqtp_String2QColor(parameters.value(0, p.color().name())));
|
||||||
}
|
return p;
|
||||||
{
|
},
|
||||||
InstructionProperties i(InstructionProperties::NoModification,
|
InstructionProperties::NoBrush,
|
||||||
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
|
InstructionProperties::DefaultPadding,
|
||||||
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
|
/*Nparams=*/1);
|
||||||
p.setColor(jkqtp_String2QColor(parameters.value(0, p.color().name())));
|
instructions["colorbox"] = i;
|
||||||
return p;
|
}
|
||||||
},
|
{
|
||||||
InstructionProperties::NoBrush,
|
InstructionProperties i(InstructionProperties::NoModification,
|
||||||
InstructionProperties::DefaultPadding,
|
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
|
||||||
/*Nparams=*/1);
|
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
|
||||||
instructions["colorbox"] = i;
|
p.setStyle(Qt::DashLine);
|
||||||
}
|
return p;
|
||||||
{
|
},
|
||||||
InstructionProperties i(InstructionProperties::NoModification,
|
InstructionProperties::NoBrush,
|
||||||
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
|
InstructionProperties::DefaultPadding,
|
||||||
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
|
/*Nparams=*/0);
|
||||||
p.setStyle(Qt::DashLine);
|
instructions["dashbox"] = i;
|
||||||
return p;
|
instructions["dashedbox"] = i;
|
||||||
},
|
instructions["dbox"] = i;
|
||||||
InstructionProperties::NoBrush,
|
}
|
||||||
InstructionProperties::DefaultPadding,
|
{
|
||||||
/*Nparams=*/0);
|
InstructionProperties i(InstructionProperties::NoModification,
|
||||||
instructions["dashbox"] = i;
|
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
|
||||||
instructions["dashedbox"] = i;
|
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
|
||||||
instructions["dbox"] = i;
|
p.setStyle(Qt::DotLine);
|
||||||
}
|
return p;
|
||||||
{
|
},
|
||||||
InstructionProperties i(InstructionProperties::NoModification,
|
InstructionProperties::NoBrush,
|
||||||
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
|
InstructionProperties::DefaultPadding,
|
||||||
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
|
/*Nparams=*/0);
|
||||||
p.setStyle(Qt::DotLine);
|
instructions["dottedbox"] = i;
|
||||||
return p;
|
instructions["dotbox"] = i;
|
||||||
},
|
}
|
||||||
InstructionProperties::NoBrush,
|
{
|
||||||
InstructionProperties::DefaultPadding,
|
InstructionProperties i(InstructionProperties::NoModification,
|
||||||
/*Nparams=*/0);
|
InstructionProperties::NoPen,
|
||||||
instructions["dottedbox"] = i;
|
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& parameters, JKQTMathText* /*parent*/){
|
||||||
instructions["dotbox"] = i;
|
return QBrush(jkqtp_String2QColor(parameters.value(0, QColor(Qt::transparent).name())), Qt::SolidPattern);
|
||||||
}
|
},
|
||||||
{
|
InstructionProperties::DefaultPadding,
|
||||||
InstructionProperties i(InstructionProperties::NoModification,
|
/*Nparams=*/1);
|
||||||
InstructionProperties::NoPen,
|
instructions["shaded"] = i;
|
||||||
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& parameters, JKQTMathText* /*parent*/){
|
}
|
||||||
return QBrush(jkqtp_String2QColor(parameters.value(0, QColor(Qt::transparent).name())), Qt::SolidPattern);
|
{
|
||||||
},
|
InstructionProperties i(InstructionProperties::NoModification,
|
||||||
InstructionProperties::DefaultPadding,
|
InstructionProperties::NoPen,
|
||||||
/*Nparams=*/1);
|
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& parameters, JKQTMathText* /*parent*/){
|
||||||
instructions["shaded"] = i;
|
return QBrush(jkqtp_String2QColor(parameters.value(0, QColor(Qt::transparent).name())), Qt::SolidPattern);
|
||||||
}
|
},
|
||||||
{
|
0,
|
||||||
InstructionProperties i(InstructionProperties::NoModification,
|
/*Nparams=*/1);
|
||||||
InstructionProperties::NoPen,
|
instructions["snugshade"] = i;
|
||||||
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& parameters, JKQTMathText* /*parent*/){
|
}
|
||||||
return QBrush(jkqtp_String2QColor(parameters.value(0, QColor(Qt::transparent).name())), Qt::SolidPattern);
|
{
|
||||||
},
|
InstructionProperties i(InstructionProperties::NoModification,
|
||||||
0,
|
InstructionProperties::DefaultPen,
|
||||||
/*Nparams=*/1);
|
InstructionProperties::NoBrush,
|
||||||
instructions["snugshade"] = i;
|
0,
|
||||||
}
|
/*Nparams=*/0);
|
||||||
{
|
instructions["snugbox"] = i;
|
||||||
InstructionProperties i(InstructionProperties::NoModification,
|
}
|
||||||
InstructionProperties::DefaultPen,
|
{
|
||||||
InstructionProperties::NoBrush,
|
InstructionProperties i(InstructionProperties::NoModification,
|
||||||
0,
|
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
|
||||||
/*Nparams=*/0);
|
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
|
||||||
instructions["snugbox"] = i;
|
p.setColor(jkqtp_String2QColor(parameters.value(0, p.color().name())));
|
||||||
}
|
return p;
|
||||||
{
|
},
|
||||||
InstructionProperties i(InstructionProperties::NoModification,
|
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& parameters, JKQTMathText* /*parent*/){
|
||||||
[](JKQTMathTextEnvironment& ev, const QStringList& parameters, JKQTMathText* parent){
|
return QBrush(jkqtp_String2QColor(parameters.value(1, QColor(Qt::transparent).name())), Qt::SolidPattern);
|
||||||
QPen p=InstructionProperties::DefaultPen(ev, parameters, parent);
|
},
|
||||||
p.setColor(jkqtp_String2QColor(parameters.value(0, p.color().name())));
|
InstructionProperties::DefaultPadding,
|
||||||
return p;
|
/*Nparams=*/2);
|
||||||
},
|
instructions["fcolorbox"] = i;
|
||||||
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& parameters, JKQTMathText* /*parent*/){
|
}
|
||||||
return QBrush(jkqtp_String2QColor(parameters.value(1, QColor(Qt::transparent).name())), Qt::SolidPattern);
|
return instructions;
|
||||||
},
|
}();
|
||||||
InstructionProperties::DefaultPadding,
|
return table;
|
||||||
/*Nparams=*/2);
|
|
||||||
instructions["fcolorbox"] = i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JKQTMathTextBoxInstructionNode::InstructionProperties::ModifyEnvironmentFunctor JKQTMathTextBoxInstructionNode::InstructionProperties::NoModification=
|
JKQTMathTextBoxInstructionNode::InstructionProperties::ModifyEnvironmentFunctor JKQTMathTextBoxInstructionNode::InstructionProperties::NoModification=
|
||||||
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& /*parameters*/){};
|
[](JKQTMathTextEnvironment& /*ev*/, const QStringList& /*parameters*/){};
|
||||||
|
|
||||||
|
@ -106,13 +106,11 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextBoxInstructionNode: public JKQTMathTex
|
|||||||
double roundingFactor;
|
double roundingFactor;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief fills instructions
|
/** \brief defines all implemented instructions in this node
|
||||||
*
|
*
|
||||||
* \note this is the customization point for new instructions!
|
* \note this is the customization point for new instructions!
|
||||||
*/
|
*/
|
||||||
static void fillInstructions();
|
static const QHash<QString, InstructionProperties>& instructions();
|
||||||
/** \brief defines all implemented instructions in this node */
|
|
||||||
static QHash<QString, InstructionProperties> instructions;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,14 +108,12 @@ QString JKQTMathTextDecoratedNode::DecorationType2String(JKQTMathTextDecoratedNo
|
|||||||
|
|
||||||
JKQTMathTextDecoratedNode::DecorationType JKQTMathTextDecoratedNode::InstructionName2DecorationType(const QString &mode)
|
JKQTMathTextDecoratedNode::DecorationType JKQTMathTextDecoratedNode::InstructionName2DecorationType(const QString &mode)
|
||||||
{
|
{
|
||||||
fillInstructions();
|
return instructions()[mode];
|
||||||
return instructions[mode];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JKQTMathTextDecoratedNode::supportsInstructionName(const QString &instructionName)
|
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;
|
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()
|
instructions["vec"]=MTDvec;
|
||||||
{
|
instructions["overline"]=MTDoverline;
|
||||||
static std::mutex sMutex;
|
instructions["oline"]=MTDoverline;
|
||||||
std::lock_guard<std::mutex> lock(sMutex);
|
instructions["ol"]=MTDoverline;
|
||||||
if (instructions.size()>0) return;
|
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;
|
return instructions;
|
||||||
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 table;
|
||||||
}
|
}
|
||||||
|
|
||||||
double JKQTMathTextDecoratedNode::draw(QPainter& painter, double x, double y, JKQTMathTextEnvironment currentEv) const {
|
double JKQTMathTextDecoratedNode::draw(QPainter& painter, double x, double y, JKQTMathTextEnvironment currentEv) const {
|
||||||
|
@ -104,9 +104,7 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextDecoratedNode: public JKQTMathTextSing
|
|||||||
/** \brief type of decoration that is added to the child node */
|
/** \brief type of decoration that is added to the child node */
|
||||||
DecorationType decoration;
|
DecorationType decoration;
|
||||||
/** \brief lists all supported instructions */
|
/** \brief lists all supported instructions */
|
||||||
static QHash<QString, DecorationType> instructions;
|
static const QHash<QString, DecorationType>& instructions();
|
||||||
/** \brief fills instructions */
|
|
||||||
static void fillInstructions();
|
|
||||||
};
|
};
|
||||||
#endif // JKQTMATHTEXTDECORATEDNODE_H
|
#endif // JKQTMATHTEXTDECORATEDNODE_H
|
||||||
|
|
||||||
|
@ -34,38 +34,36 @@
|
|||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
|
||||||
|
|
||||||
QHash<QString, JKQTMathTextFracNode::FracType> JKQTMathTextFracNode::instructions;
|
const QHash<QString, JKQTMathTextFracNode::FracType>& JKQTMathTextFracNode::instructions() {
|
||||||
|
static QHash<QString, JKQTMathTextFracNode::FracType> table=[]()
|
||||||
|
{
|
||||||
void JKQTMathTextFracNode::fillInstructions()
|
QHash<QString, JKQTMathTextFracNode::FracType> instructions;
|
||||||
{
|
instructions["frac"]=MTFMfrac;
|
||||||
static std::mutex sMutex;
|
instructions["dfrac"] = MTFMdfrac;
|
||||||
std::lock_guard<std::mutex> lock(sMutex);
|
instructions["cfrac"]=MTFMdfrac;
|
||||||
if (instructions.size()>0) return;
|
instructions["sfrac"] = MTFMsfrac;
|
||||||
instructions["frac"]=MTFMfrac;
|
instructions["slantfrac"] = MTFMsfrac;
|
||||||
instructions["dfrac"] = MTFMdfrac;
|
instructions["xfrac"]=MTFMsfrac;
|
||||||
instructions["cfrac"]=MTFMdfrac;
|
instructions["stfrac"] = MTFMstfrac;
|
||||||
instructions["sfrac"] = MTFMsfrac;
|
instructions["nicefrac"] = MTFMstfrac;
|
||||||
instructions["slantfrac"] = MTFMsfrac;
|
instructions["slanttextfrac"] = MTFMstfrac;
|
||||||
instructions["xfrac"]=MTFMsfrac;
|
instructions["xtfrac"]=MTFMstfrac;
|
||||||
instructions["stfrac"] = MTFMstfrac;
|
instructions["tfrac"]=MTFMtfrac;
|
||||||
instructions["nicefrac"] = MTFMstfrac;
|
instructions["stackrel"]=MTFMstackrel;
|
||||||
instructions["slanttextfrac"] = MTFMstfrac;
|
instructions["underbrace"]=MTFMunderbrace;
|
||||||
instructions["xtfrac"]=MTFMstfrac;
|
instructions["underbracket"]=MTFMunderbracket;
|
||||||
instructions["tfrac"]=MTFMtfrac;
|
instructions["underset"]=MTFMunderset;
|
||||||
instructions["stackrel"]=MTFMstackrel;
|
instructions["overbrace"]=MTFMoverbrace;
|
||||||
instructions["underbrace"]=MTFMunderbrace;
|
instructions["overbracket"]=MTFMoverbracket;
|
||||||
instructions["underbracket"]=MTFMunderbracket;
|
instructions["overset"]=MTFMoverset;
|
||||||
instructions["underset"]=MTFMunderset;
|
return instructions;
|
||||||
instructions["overbrace"]=MTFMoverbrace;
|
}();
|
||||||
instructions["overbracket"]=MTFMoverbracket;
|
return table;
|
||||||
instructions["overset"]=MTFMoverset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QString JKQTMathTextFracNode::FracType2String(JKQTMathTextFracNode::FracType mode)
|
QString JKQTMathTextFracNode::FracType2String(JKQTMathTextFracNode::FracType mode)
|
||||||
{
|
{
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
@ -99,14 +97,12 @@ QString JKQTMathTextFracNode::FracType2String(JKQTMathTextFracNode::FracType mod
|
|||||||
|
|
||||||
JKQTMathTextFracNode::FracType JKQTMathTextFracNode::InstructionName2FracType(const QString &mode)
|
JKQTMathTextFracNode::FracType JKQTMathTextFracNode::InstructionName2FracType(const QString &mode)
|
||||||
{
|
{
|
||||||
fillInstructions();
|
return instructions().value(mode, MTFMfrac);
|
||||||
return instructions.value(mode, MTFMfrac);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JKQTMathTextFracNode::supportsInstructionName(const QString &instructionName)
|
bool JKQTMathTextFracNode::supportsInstructionName(const QString &instructionName)
|
||||||
{
|
{
|
||||||
fillInstructions();
|
return instructions().contains(instructionName);
|
||||||
return instructions.contains(instructionName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,9 +90,7 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextFracNode: public JKQTMathTextDualChild
|
|||||||
JKQTMathTextFracNode::FracType getMode() const;
|
JKQTMathTextFracNode::FracType getMode() const;
|
||||||
protected:
|
protected:
|
||||||
/** \brief lists all supported instructions */
|
/** \brief lists all supported instructions */
|
||||||
static QHash<QString, FracType> instructions;
|
static const QHash<QString, FracType>& instructions();
|
||||||
/** \brief fills instructions */
|
|
||||||
static void fillInstructions();
|
|
||||||
/** \copydoc JKQTMathTextNode::getSizeInternal() */
|
/** \copydoc JKQTMathTextNode::getSizeInternal() */
|
||||||
virtual JKQTMathTextNodeSize getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const override;
|
virtual JKQTMathTextNodeSize getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const override;
|
||||||
/** \brief actual display type of fraction object */
|
/** \brief actual display type of fraction object */
|
||||||
|
@ -64,7 +64,6 @@ JKQTMathTextSimpleInstructionNode::JKQTMathTextSimpleInstructionNode(JKQTMathTex
|
|||||||
instructionName(_name),
|
instructionName(_name),
|
||||||
parameters(_parameters)
|
parameters(_parameters)
|
||||||
{
|
{
|
||||||
fillInstructions();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +80,6 @@ QString JKQTMathTextSimpleInstructionNode::getTypeName() const
|
|||||||
double JKQTMathTextSimpleInstructionNode::draw(QPainter &painter, double x, double y, JKQTMathTextEnvironment currentEv) const
|
double JKQTMathTextSimpleInstructionNode::draw(QPainter &painter, double x, double y, JKQTMathTextEnvironment currentEv) const
|
||||||
{
|
{
|
||||||
doDrawBoxes(painter, x, y, currentEv);
|
doDrawBoxes(painter, x, y, currentEv);
|
||||||
fillInstructions();
|
|
||||||
QFont f=currentEv.getFont(parentMathText);
|
QFont f=currentEv.getFont(parentMathText);
|
||||||
f.setStyleStrategy(QFont::PreferDefault);
|
f.setStyleStrategy(QFont::PreferDefault);
|
||||||
const QFontMetricsF fm(f, painter.device());
|
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
|
bool JKQTMathTextSimpleInstructionNode::toHtml(QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const
|
||||||
{
|
{
|
||||||
fillInstructions();
|
|
||||||
const QString txt=executeInstruction();
|
const QString txt=executeInstruction();
|
||||||
html+=txt;
|
html+=txt;
|
||||||
return true;
|
return true;
|
||||||
@ -113,20 +110,17 @@ const QStringList &JKQTMathTextSimpleInstructionNode::getParameters() const
|
|||||||
|
|
||||||
bool JKQTMathTextSimpleInstructionNode::supportsInstructionName(const QString &instructionName)
|
bool JKQTMathTextSimpleInstructionNode::supportsInstructionName(const QString &instructionName)
|
||||||
{
|
{
|
||||||
fillInstructions();
|
return instructions().contains(instructionName);
|
||||||
return instructions.contains(instructionName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t JKQTMathTextSimpleInstructionNode::countParametersOfInstruction(const QString &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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextNodeSize JKQTMathTextSimpleInstructionNode::getSizeInternal(QPainter &painter, JKQTMathTextEnvironment currentEv) const
|
JKQTMathTextNodeSize JKQTMathTextSimpleInstructionNode::getSizeInternal(QPainter &painter, JKQTMathTextEnvironment currentEv) const
|
||||||
{
|
{
|
||||||
fillInstructions();
|
|
||||||
QFont f=currentEv.getFont(parentMathText);
|
QFont f=currentEv.getFont(parentMathText);
|
||||||
f.setStyleStrategy(QFont::PreferDefault);
|
f.setStyleStrategy(QFont::PreferDefault);
|
||||||
const QFontMetricsF fm(f, painter.device());
|
const QFontMetricsF fm(f, painter.device());
|
||||||
@ -140,47 +134,46 @@ JKQTMathTextNodeSize JKQTMathTextSimpleInstructionNode::getSizeInternal(QPainter
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<QString, JKQTMathTextSimpleInstructionNode::InstructionProperties> JKQTMathTextSimpleInstructionNode::instructions;
|
const QHash<QString, JKQTMathTextSimpleInstructionNode::InstructionProperties>& JKQTMathTextSimpleInstructionNode::instructions() {
|
||||||
|
static QHash<QString, JKQTMathTextSimpleInstructionNode::InstructionProperties> table=[]()
|
||||||
void JKQTMathTextSimpleInstructionNode::fillInstructions()
|
{
|
||||||
{
|
QHash<QString, JKQTMathTextSimpleInstructionNode::InstructionProperties> instructions;
|
||||||
static std::mutex sMutex;
|
{
|
||||||
std::lock_guard<std::mutex> lock(sMutex);
|
InstructionProperties i([](const QStringList& parameters) -> QString {
|
||||||
if (instructions.size()>0) return;
|
bool ok=false;
|
||||||
{
|
qlonglong code=parameters.value(0, "0").toLongLong(&ok, 16);
|
||||||
InstructionProperties i([](const QStringList& parameters) -> QString {
|
ok=ok&&(code>=0);
|
||||||
bool ok=false;
|
if (ok&&(code>=0)&&(code<=0xFFFFFFFF)) return QString::fromStdString(jkqtp_UnicodeToUTF8(static_cast<uint32_t>(code)));
|
||||||
qlonglong code=parameters.value(0, "0").toLongLong(&ok, 16);
|
else return QString();
|
||||||
ok=ok&&(code>=0);
|
}, 1);
|
||||||
if (ok&&(code>=0)&&(code<=0xFFFFFFFF)) return QString::fromStdString(jkqtp_UnicodeToUTF8(static_cast<uint32_t>(code)));
|
instructions["unicode"]= i;
|
||||||
else return QString();
|
instructions["usym"]= i;
|
||||||
}, 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);
|
|
||||||
}
|
}
|
||||||
return QChar(0);
|
{
|
||||||
}, 1);
|
InstructionProperties i([](const QStringList& parameters) -> QString {
|
||||||
instructions["utfeight"]= i;
|
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
|
QString JKQTMathTextSimpleInstructionNode::executeInstruction() const
|
||||||
{
|
{
|
||||||
fillInstructions();
|
return instructions().value(getInstructionName(), InstructionProperties()).evaluator(getParameters());
|
||||||
return instructions.value(getInstructionName(), InstructionProperties()).evaluator(getParameters());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextSimpleInstructionNode::InstructionProperties::InstructionProperties():
|
JKQTMathTextSimpleInstructionNode::InstructionProperties::InstructionProperties():
|
||||||
|
@ -103,14 +103,11 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextSimpleInstructionNode: public JKQTMath
|
|||||||
/** \brief output of the instruction */
|
/** \brief output of the instruction */
|
||||||
EvaluateInstructionFunctor evaluator;
|
EvaluateInstructionFunctor evaluator;
|
||||||
};
|
};
|
||||||
|
/** \brief defines all implemented instructions in this node
|
||||||
/** \brief fills instructions
|
|
||||||
*
|
*
|
||||||
* \note this is the customization point for new instructions!
|
* \note this is the customization point for new instructions!
|
||||||
*/
|
*/
|
||||||
static void fillInstructions();
|
static const QHash<QString, InstructionProperties>& instructions();
|
||||||
/** \brief defines all implemented instructions in this node */
|
|
||||||
static QHash<QString, InstructionProperties> instructions;
|
|
||||||
/** \brief executes the instruction on \a ev */
|
/** \brief executes the instruction on \a ev */
|
||||||
QString executeInstruction() const;
|
QString executeInstruction() const;
|
||||||
/** \brief instruction name */
|
/** \brief instruction name */
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -53,15 +53,15 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextModifiedTextPropsInstructionNode: publ
|
|||||||
virtual bool toHtml(QString& html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const override;
|
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
|
/** \brief returns true, if the given \a instructionName can be represented by this node
|
||||||
* \see instructions
|
* \see instructions()
|
||||||
*/
|
*/
|
||||||
static bool supportsInstructionName(const QString& instructionName);
|
static bool supportsInstructionName(const QString& instructionName);
|
||||||
/** \brief returns the number of additional string parameters, required for the given \a 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);
|
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
|
/** \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 ¶ms=QStringList());
|
static void modifyInMathEnvironment(const QString& instructionName, bool& insideMath, bool &insideMathTextStyle, const QStringList ¶ms=QStringList());
|
||||||
|
|
||||||
@ -82,13 +82,11 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextModifiedTextPropsInstructionNode: publ
|
|||||||
ModifyEnvironmentFunctor modifier;
|
ModifyEnvironmentFunctor modifier;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief fills instructions
|
/** \brief defines all implemented instructions in this node
|
||||||
*
|
*
|
||||||
* \note this is the customization point for new instructions!
|
* \note this is the customization point for new instructions!
|
||||||
*/
|
*/
|
||||||
static void fillInstructions();
|
static const QHash<QString, InstructionProperties>& instructions();
|
||||||
/** \brief defines all implemented instructions in this node */
|
|
||||||
static QHash<QString, InstructionProperties> instructions;
|
|
||||||
/** \brief executes the instruction on \a ev */
|
/** \brief executes the instruction on \a ev */
|
||||||
void executeInstruction(JKQTMathTextEnvironment& ev) const;
|
void executeInstruction(JKQTMathTextEnvironment& ev) const;
|
||||||
};
|
};
|
||||||
@ -116,15 +114,15 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextModifiedEnvironmentInstructionNode: pu
|
|||||||
virtual void modifyEnvironment(JKQTMathTextEnvironment& currentEv) const override;
|
virtual void modifyEnvironment(JKQTMathTextEnvironment& currentEv) const override;
|
||||||
|
|
||||||
/** \brief returns true, if the given \a instructionName can be represented by this node
|
/** \brief returns true, if the given \a instructionName can be represented by this node
|
||||||
* \see instructions
|
* \see instructions()
|
||||||
*/
|
*/
|
||||||
static bool supportsInstructionName(const QString& instructionName);
|
static bool supportsInstructionName(const QString& instructionName);
|
||||||
/** \brief returns the number of additional string parameters, required for the given \a 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);
|
static size_t countParametersOfInstruction(const QString& instructionName);
|
||||||
/** \brief sets \a insideMathTextStyle to \c true if textstyle is set inside math
|
/** \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 ¶ms=QStringList());
|
static void modifyInMathTextStyleEnvironment(const QString& instructionName, bool &insideMathTextStyle, JKQTMathText *parentMathText, const QStringList ¶ms=QStringList());
|
||||||
protected:
|
protected:
|
||||||
@ -146,13 +144,11 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextModifiedEnvironmentInstructionNode: pu
|
|||||||
ModifyEnvironmentFunctor modifier;
|
ModifyEnvironmentFunctor modifier;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \brief fills instructions
|
/** \brief defines all implemented instructions in this node
|
||||||
*
|
*
|
||||||
* \note this is the customization point for new instructions!
|
* \note this is the customization point for new instructions!
|
||||||
*/
|
*/
|
||||||
static void fillInstructions();
|
static const QHash<QString, InstructionProperties>& instructions();
|
||||||
/** \brief defines all implemented instructions in this node */
|
|
||||||
static QHash<QString, InstructionProperties> instructions;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
JKQTMathTextSymbolNode::JKQTMathTextSymbolNode(JKQTMathText* _parent, const QString& name):
|
JKQTMathTextSymbolNode::JKQTMathTextSymbolNode(JKQTMathText* _parent, const QString& name):
|
||||||
JKQTMathTextNode(_parent), symbolName(name)
|
JKQTMathTextNode(_parent), symbolName(name)
|
||||||
{
|
{
|
||||||
fillSymbolTables();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextSymbolNode::~JKQTMathTextSymbolNode() {
|
JKQTMathTextSymbolNode::~JKQTMathTextSymbolNode() {
|
||||||
@ -142,7 +141,7 @@ double JKQTMathTextSymbolNode::draw(QPainter& painter, double x, double y, JKQTM
|
|||||||
const NodeSize s=getSymbolSize(painter, currentEv);
|
const NodeSize s=getSymbolSize(painter, currentEv);
|
||||||
doDrawBoxes(painter, x, y, s);
|
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 GlobalSymbolFlags globalFlags=fullProps.globalFlags;
|
||||||
const auto drawProps=fullProps.getDrawingData(currentEv, parentMathText, painter);
|
const auto drawProps=fullProps.getDrawingData(currentEv, parentMathText, painter);
|
||||||
const QFont f=drawProps.first;
|
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 JKQTMathTextSymbolNode::toHtml(QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const {
|
||||||
bool ok=true;
|
bool ok=true;
|
||||||
const auto props=symbols.value(symbolName, SymbolFullProps());
|
const auto props=symbols().value(symbolName, SymbolFullProps());
|
||||||
QString s=props.html.symbol;
|
QString s=props.html.symbol;
|
||||||
JKQTMathTextEnvironment ev=currentEv;
|
JKQTMathTextEnvironment ev=currentEv;
|
||||||
ev.fontSize=ev.fontSize*props.html.fontScalingFactor;
|
ev.fontSize=ev.fontSize*props.html.fontScalingFactor;
|
||||||
@ -235,7 +234,7 @@ JKQTMathTextSymbolNode::NodeSize JKQTMathTextSymbolNode::getSymbolSize(QPainter
|
|||||||
{
|
{
|
||||||
NodeSize s;
|
NodeSize s;
|
||||||
|
|
||||||
const auto fullProps=symbols.value(symbolName, SymbolFullProps());
|
const auto fullProps=symbols().value(symbolName, SymbolFullProps());
|
||||||
const GlobalSymbolFlags globalFlags=fullProps.globalFlags;
|
const GlobalSymbolFlags globalFlags=fullProps.globalFlags;
|
||||||
const auto drawProps=fullProps.getDrawingData(currentEv, parentMathText, painter);
|
const auto drawProps=fullProps.getDrawingData(currentEv, parentMathText, painter);
|
||||||
const QFont f=drawProps.first;
|
const QFont f=drawProps.first;
|
||||||
@ -297,39 +296,34 @@ JKQTMathTextSymbolNode::NodeSize JKQTMathTextSymbolNode::getSymbolSize(QPainter
|
|||||||
|
|
||||||
bool JKQTMathTextSymbolNode::hasSymbol(const QString &symbolName)
|
bool JKQTMathTextSymbolNode::hasSymbol(const QString &symbolName)
|
||||||
{
|
{
|
||||||
fillSymbolTables();
|
return symbols().contains(symbolName);
|
||||||
return symbols.contains(symbolName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList JKQTMathTextSymbolNode::getSymbols()
|
QStringList JKQTMathTextSymbolNode::getSymbols()
|
||||||
{
|
{
|
||||||
fillSymbolTables();
|
return symbols().keys();
|
||||||
return symbols.keys();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JKQTMathTextSymbolNode::isSubSuperscriptBelowAboveSymbol(const QString &symbolName)
|
bool JKQTMathTextSymbolNode::isSubSuperscriptBelowAboveSymbol(const QString &symbolName)
|
||||||
{
|
{
|
||||||
fillSymbolTables();
|
if (symbols().contains(symbolName)) {
|
||||||
if (symbols.contains(symbolName)) {
|
return has(symbols()[symbolName].globalFlags, SubSuperscriptBelowAboveSymbol);
|
||||||
return has(symbols[symbolName].globalFlags, SubSuperscriptBelowAboveSymbol);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JKQTMathTextSymbolNode::isExtendedWidthSymbol(const QString &symbolName)
|
bool JKQTMathTextSymbolNode::isExtendedWidthSymbol(const QString &symbolName)
|
||||||
{
|
{
|
||||||
fillSymbolTables();
|
if (symbols().contains(symbolName)) {
|
||||||
if (symbols.contains(symbolName)) {
|
return has(symbols()[symbolName].globalFlags, ExtendWidthInMathmode) || has(symbols()[symbolName].globalFlags, SmallExtendWidthInMathmode);
|
||||||
return has(symbols[symbolName].globalFlags, ExtendWidthInMathmode) || has(symbols[symbolName].globalFlags, SmallExtendWidthInMathmode);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int JKQTMathTextSymbolNode::getSymbolLength(const QString &symbolName)
|
int JKQTMathTextSymbolNode::getSymbolLength(const QString &symbolName)
|
||||||
{
|
{
|
||||||
fillSymbolTables();
|
if (symbols().contains(symbolName)) {
|
||||||
if (symbols.contains(symbolName)) {
|
return symbols()[symbolName].props.value(MTFEUnicode, symbols()[symbolName].props.value(MTFEStandard, SymbolProps())).symbol.size();
|
||||||
return symbols[symbolName].props.value(MTFEUnicode, symbols[symbolName].props.value(MTFEStandard, SymbolProps())).symbol.size();
|
|
||||||
}
|
}
|
||||||
return 0;
|
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);
|
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("#", "#");
|
||||||
|
symbols["%"]=SimpleTextSymbol("%", "≫");
|
||||||
|
symbols["&"]=SimpleTextSymbol("&", "&");
|
||||||
|
symbols["("]=SimpleUprightTextSymbol("(");
|
||||||
|
symbols[")"]=SimpleUprightTextSymbol(")");
|
||||||
|
symbols["["]=SimpleUprightTextSymbol("[");
|
||||||
|
symbols["]"]=SimpleUprightTextSymbol("]");
|
||||||
|
symbols["_"]=SimpleTextSymbol("_");
|
||||||
|
symbols["{"]=SimpleUprightTextSymbol("{");
|
||||||
|
symbols["|"]=SimpleUprightTextSymbol("||", "‖").addUprightUnicode(QChar(0x2016));
|
||||||
|
symbols["}"]=SimpleUprightTextSymbol("}");
|
||||||
|
symbols["AC"]=UprightSymbolUnicode(QChar(0x223F)).addUprightHtml("∿").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("œ");
|
||||||
|
symbols["OE"]=UnicodeSymbol(QChar(0x152)).addStd("OE").addHtml("Œ");
|
||||||
|
symbols["ss"]=SimpleTextSymbol(QChar(0xDF)).addHtml("ß");
|
||||||
|
symbols["l"]=UnicodeSymbol(QChar(0x141)).addHtml("ł");
|
||||||
|
symbols["L"]=UnicodeSymbol(QChar(0x142)).addHtml("Ł");
|
||||||
|
symbols["o"]=SimpleTextSymbol(QChar(0xF8)).addHtml("ø");
|
||||||
|
symbols["O"]=SimpleTextSymbol(QChar(0xD8)).addHtml("Ø");
|
||||||
|
{ auto s=UprightSymbolUnicode(QChar(0x212B)).addUprightStd(QChar(0xC5));
|
||||||
|
symbols["Angstrom"]=s; symbols["angstrom"]=s; }
|
||||||
|
{ auto s=UnicodeSymbol(QChar(0x2136)).addHtml("ℶ");
|
||||||
|
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("ℑ").addWinSymbol(QChar(0xC1));
|
||||||
|
symbols["No"]=UnicodeSymbol(QChar(0x2116));
|
||||||
|
{ auto s=UprightSymbolUnicode(QChar(0x2126)).addUprightWinSymbol("W").addUprightHtml("Ω");
|
||||||
|
symbols["Ohm"]=s; symbols["ohm"]=s; }
|
||||||
|
symbols["P"]=SimpleTextSymbol(QChar(0xB6)).addHtml("¶");
|
||||||
|
symbols["Re"]=UnicodeSymbol(QChar(0x211C)).addHtml("ℜ").addWinSymbol(QChar(0xC2));
|
||||||
|
{ auto s=SimpleTextSymbol(QChar(0xA7)).addHtml("§");
|
||||||
|
symbols["S"]=s; symbols["§"]=s;}
|
||||||
|
symbols["accurrent"]=UnicodeSymbol(QChar(0x23E6));
|
||||||
|
{ auto s=UnicodeSymbol(QChar(0x2135)).addHtml("ℵ").addWinSymbol(QChar(0xC0));
|
||||||
|
symbols["alef"]=s; symbols["aleph"]=s; symbols["Aleph"]=s; symbols["Alef"]=s; }
|
||||||
|
symbols["angle"]=UprightSymbolUnicode(QChar(0x2220)).addHtml("∠").addWinSymbol(QChar(0xD0));
|
||||||
|
symbols["backslash"]=SimpleTextSymbol("\\");
|
||||||
|
symbols["benzene"]=UprightSymbolUnicode(QChar(0x232C));
|
||||||
|
symbols["benzenr"]=UprightSymbolUnicode(QChar(0x23E3));
|
||||||
|
symbols["blacksquare"]=UprightSymbolUnicode(QChar(0x220E)).addUprightHtml("□");
|
||||||
|
{ 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("•").addUprightWinSymbol(QChar(0xB7));
|
||||||
|
symbols["bullet"]=s; symbols["textbullet"]=s; }
|
||||||
|
symbols["cdots"]=UprightSymbolUnicode(QChar(0x22EF)).addUprightHtml("···").addUprightStd(QString(3, QChar(0xB7)));
|
||||||
|
{ auto s=UnicodeSymbol(QChar(0x2103)).addUprightStd("°C").addUprightHtml("°C");
|
||||||
|
symbols["celsius"]=s; symbols["degC"]=s; symbols["degreeCelsius"]=s; }
|
||||||
|
symbols["ell"]=UprightSymbolUnicode(QChar(0x2113), "ℓ");
|
||||||
|
symbols["wp"]=UprightSymbolUnicode(QChar(0x2118), "℘").addGlobalFlags(SubscriptCorrection);
|
||||||
|
symbols["mho"]=UprightSymbolUnicode(QChar(0x2127), "℧");
|
||||||
|
symbols["lozenge"]=UprightSymbolUnicode(QChar(0x25CA), "◊");
|
||||||
|
symbols["cent"]=SimpleTextSymbol(QChar(0xA2), "¢");
|
||||||
|
symbols["checkmark"]=UprightSymbolStd(QChar(0x2713)).addUprightHtml("✓");
|
||||||
|
symbols["circ"]=UprightSymbolStd(QChar(0x2218)).addUprightHtml("∘").addStd("o", ItalicOff,0.7, -0.25);
|
||||||
|
symbols["co"]=UprightSymbolUnicode(QChar(0x2105));
|
||||||
|
{ auto s=SimpleTextSymbol(QChar(0xA9), "©");
|
||||||
|
symbols["copyright"]=s; symbols["textcopyright"]=s; symbols["circledC"]=s; }
|
||||||
|
{ auto s=UprightSymbolUnicode(QChar(0x2020)).addUprightHtml("†");
|
||||||
|
symbols["dagger"]=s; symbols["dag"]=s; symbols["textdagger"]=s; }
|
||||||
|
{ auto s=UprightSymbolUnicode(QChar(0x2021)).addUprightHtml("‡");
|
||||||
|
symbols["ddagger"]=s; symbols["ddag"]=s; symbols["textdaggerdbl"]=s; }
|
||||||
|
{ auto s=UnicodeSymbol(QChar(0x2138)).addHtml("ℸ");
|
||||||
|
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("⋄").addWinSymbol(QChar(0xE0));
|
||||||
|
symbols["dollar"]=UnicodeSymbol(QChar(0x0024));
|
||||||
|
{ auto s=SimpleTextSymbol(QChar(0x24), "$");
|
||||||
|
symbols["dollar"]=s; symbols["$"]=s; }
|
||||||
|
symbols["dprime"]=UnicodeSymbol(QChar(0x2033)).addHtml("″").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("…").addWinSymbol(QChar(0xBC)).addStd("...");
|
||||||
|
symbols["ellipsis"]=s; symbols["dots"]=s; symbols["ldots"]=s; }
|
||||||
|
{ auto s=SimpleTextSymbol(QChar(0x20AC), "€");
|
||||||
|
symbols["euro"]=s; symbols["EUR"]=s; }
|
||||||
|
{ auto s=UnicodeSymbol(QChar(0x2109));
|
||||||
|
symbols["fahrenheit"]=s; symbols["degF"]=s; }
|
||||||
|
symbols["female"]=UnicodeSymbol(QChar(0x2640)).addHtml("♀");
|
||||||
|
symbols["flq"]=UnicodeSymbol(QChar(0x2039)).addHtml("‹").addStd("<");
|
||||||
|
symbols["flqq"]=UnicodeSymbol(QChar(0x00AB)).addHtml("«").addStd(QChar(0xAB));
|
||||||
|
//symbols["frown"]=UnicodeSymbol(QChar(0x2322)).addHtml("⌢");
|
||||||
|
symbols["frq"]=UnicodeSymbol(QChar(0x203A)).addHtml("›").addStd(">");
|
||||||
|
symbols["frqq"]=UnicodeSymbol(QChar(0x00BB)).addHtml("»").addStd(QChar(0xBB));
|
||||||
|
{ auto s=UnicodeSymbol(QChar(0x2137)).addHtml("ℷ");
|
||||||
|
symbols["gimel"]=s; symbols["Gimel"]=s; }
|
||||||
|
symbols["glq"]=UnicodeSymbol(QChar(0x2018)).addHtml("‘").addStd("'");
|
||||||
|
symbols["glqq"]=UnicodeSymbol(QChar(0x201C)).addHtml("“").addStd("\"");
|
||||||
|
symbols["grq"]=UnicodeSymbol(QChar(0x2019)).addHtml("’").addStd("'");
|
||||||
|
symbols["grqq"]=UnicodeSymbol(QChar(0x201D)).addHtml("”").addStd("\"");
|
||||||
|
symbols["hbar"]=UprightSymbolUnicode(QChar(0x210F)).addUprightHtml("ℏ").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("∞").addUprightWinSymbol(QChar(0xA5)).addUprightStd("8", RotateSymbol90);
|
||||||
|
symbols["langle"]=UprightSymbolUnicode(QChar(0x2329)).addWinSymbol(QChar(0xE1));
|
||||||
|
symbols["lceil"]=UprightSymbolUnicode(QChar(0x2308)).addUprightHtml("⌈").addUprightWinSymbol(QChar(0xE9));
|
||||||
|
symbols["lfloor"]=UprightSymbolUnicode(QChar(0x230A)).addUprightHtml("⌊").addUprightWinSymbol(QChar(0xEB));
|
||||||
|
symbols["lightning"]=UnicodeSymbol(QChar(0x21AF));
|
||||||
|
symbols["male"]=UnicodeSymbol(QChar(0x2642)).addHtml("♂");
|
||||||
|
symbols["measuredangle"]=UprightSymbolUnicode(QChar(0x2221)).addUprightHtml("∡");
|
||||||
|
symbols["micro"] = SimpleTextSymbol(QChar(0xB5), "µ");
|
||||||
|
symbols["ohm"]=UprightSymbolUnicode(QChar(0x2126)).addUprightHtml("Ω").addUprightWinSymbol(QChar(0x57));
|
||||||
|
symbols["partial"]=UprightSymbolUnicode(QChar(0x2202)).addUprightHtml("∂").addUprightWinSymbol(QChar(0xB6));
|
||||||
|
{ auto s=UnicodeSymbol(QChar(0x2030)).addHtml("‰");
|
||||||
|
symbols["perthousand"]=s; symbols["permil"]=s; }
|
||||||
|
symbols["pound"]=SimpleTextSymbol(QChar(0xA3), "£");
|
||||||
|
symbols["pound"]=UnicodeSymbol(QChar(0x00A3));
|
||||||
|
symbols["prime"]=UnicodeSymbol(QChar(0x2032)).addHtml("′").addStd("'");
|
||||||
|
symbols["arcminute"]=UnicodeSymbol(QChar(0x2032)).addHtml("′").addStd("'");
|
||||||
|
symbols["arcsecond"]=UnicodeSymbol(QChar(0x2033)).addHtml("&dprime;").addStd("'");
|
||||||
|
symbols["rangle"]=UprightSymbolUnicode(QChar(0x232A)).addUprightWinSymbol(QChar(0xF1));
|
||||||
|
symbols["rceil"]=UprightSymbolUnicode(QChar(0x2309)).addUprightHtml("⌉").addUprightWinSymbol(QChar(0xF9));
|
||||||
|
{ auto s=SimpleTextSymbol(QChar(0xAE), "®");
|
||||||
|
symbols["registered"]=s; symbols["textregistered"]=s; symbols["circledR"]=s; }
|
||||||
|
symbols["rfloor"]=UprightSymbolUnicode(QChar(0x230B)).addUprightHtml("⌋").addUprightWinSymbol(QChar(0xFB));
|
||||||
|
symbols["rightangle"]=UprightSymbolUnicode(QChar(0x221F)).addUprightHtml("∟");
|
||||||
|
//symbols["smile"]=UprightSymbolUnicode(QChar(0x2323)).addUprightHtml("⌣");
|
||||||
|
symbols["sphericalangle"]=UprightSymbolUnicode(QChar(0x2222)).addUprightHtml("∢");
|
||||||
|
symbols["star"]=UprightSymbolUnicode(QChar(0x22C6));
|
||||||
|
symbols["tcohm"]=UnicodeSymbol(QChar(0x2126));
|
||||||
|
{ auto s=UnicodeSymbol(QChar(0x2014), "⹀");
|
||||||
|
symbols["dblhyphen"]=s; symbols["textdblhyphen"]=s; symbols["textdblhyphenchar"]=s; }
|
||||||
|
{ auto s=UnicodeSymbol(QChar(0x2014), "—");
|
||||||
|
symbols["---"]=s; symbols["textemdash"]=s; symbols["emdash"]=s; }
|
||||||
|
{ auto s=UnicodeSymbol(QChar(0x2013), "–");
|
||||||
|
symbols["--"]=s; symbols["textendash"]=s; symbols["endash"]=s; }
|
||||||
|
{ auto s=SimpleTextSymbol("-");
|
||||||
|
symbols["texthyphen"]=s; symbols["hyphen"]=s; }
|
||||||
|
symbols["textbar"]=SimpleTextSymbol("|", "|");
|
||||||
|
{ auto s=SimpleTextSymbol(QChar(0xB0), "°");
|
||||||
|
symbols["textdegree"]=s; symbols["degree"] = s; }
|
||||||
|
symbols["textgreater"]=SimpleTextSymbol(">", ">");
|
||||||
|
symbols["textless"]=SimpleTextSymbol("<", "<");
|
||||||
|
symbols["textquestiondown"]=SimpleTextSymbol(QChar(0xBF), "¿");
|
||||||
|
symbols["textexclamdown"]=SimpleTextSymbol(QChar(0xA1), "¡");
|
||||||
|
{ auto s=UnicodeSymbol(QChar(0x231C));
|
||||||
|
symbols["tlcorner"]=s; symbols["ulcorner"]=s; }
|
||||||
|
symbols["trademark"]=UnicodeSymbol(QChar(0x2122)).addHtml("™").addWinSymbol(QChar(0xD4)).addStd("(TM)");
|
||||||
|
symbols["trapezium"]=UnicodeSymbol(QChar(0x23E2)).addHtml("⏢");
|
||||||
|
{ auto s=UprightSymbolUnicode(QChar(0x231D));
|
||||||
|
symbols["trcorner"]=s; symbols["urcorner"]=s; }
|
||||||
|
symbols["trprime"]=UnicodeSymbol(QChar(0x2034)).addHtml("‴").addStd("'''");
|
||||||
|
symbols["varcarriagereturn"]=UnicodeSymbol(QChar(0x23CE)).addWinSymbol(QChar(0xBF));
|
||||||
|
symbols["varhexagonlrbonds"]=UnicodeSymbol(QChar(0x232C));
|
||||||
|
symbols["yen"]=SimpleTextSymbol(QChar(0xA5), "¥");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************************
|
||||||
|
* 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 max").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
||||||
|
symbols["argmin"] = NarrowMathOperatorText("arg min", "arg 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 inf").addGlobalFlags(SubSuperscriptBelowAboveSymbol).addGlobalFlags(SubscriptCorrection);
|
||||||
|
symbols["limsup"] = NarrowMathOperatorText("lim sup", "lim 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("<", "<");
|
||||||
|
symbols["="]=MathOperatorSymbol("=");
|
||||||
|
symbols[">"]=MathOperatorSymbol(">", ">");
|
||||||
|
symbols["Downarrow"]=UprightSymbolUnicode(QChar(0x21D3)).addUprightHtml("⇓").addUprightWinSymbol(QChar(0xDF));
|
||||||
|
symbols["Leftarrow"]=UprightSymbolUnicode(QChar(0x21D0)).addUprightHtml("⇐").addUprightWinSymbol(QChar(0xDC));
|
||||||
|
symbols["Rightarrow"]=UprightSymbolUnicode(QChar(0x21D2)).addUprightHtml("⇒").addUprightWinSymbol(QChar(0xDE));
|
||||||
|
symbols["Uparrow"]=UprightSymbolUnicode(QChar(0x21D1)).addUprightHtml("⇑").addUprightWinSymbol(QChar(0xDD));
|
||||||
|
symbols["Updownarrow"]=UprightSymbolUnicode(QChar(0x21D5)).addUprightHtml("⇕");
|
||||||
|
symbols["approx"]=MathOperatorSymbolUnicode(QChar(0x2248)).addMathOperatorHtml("≈").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("∵");
|
||||||
|
symbols["bigcap"]=NarrowMathOperatorSymbolUnicode(QChar(0x22C2)).addMathOperatorHtml("⋂").addMathOperatorWinSymbol(QChar(0xC7), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
||||||
|
symbols["bigcup"]=NarrowMathOperatorSymbolUnicode(QChar(0x22C3)).addMathOperatorHtml("⋃").addMathOperatorWinSymbol(QChar(0xC8), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
||||||
|
{ auto s=NarrowMathOperatorSymbolUnicode(QChar(0x22C0)).addMathOperatorHtml("⋀").addMathOperatorWinSymbol(QChar(0xD9), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
||||||
|
symbols["bigwedge"]=s; symbols["bighat"]=s; }
|
||||||
|
symbols["bigvee"]=NarrowMathOperatorSymbolUnicode(QChar(0x22C1)).addMathOperatorHtml("⋁").addMathOperatorWinSymbol(QChar(0xDA), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
||||||
|
symbols["bigotimes"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A02)).addMathOperatorHtml("⨂").addMathOperatorWinSymbol(QChar(0xC4), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
||||||
|
symbols["bigoplus"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A01)).addMathOperatorHtml("⨁").addMathOperatorWinSymbol(QChar(0xC5), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
||||||
|
symbols["bigodot"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A00)).addMathOperatorHtml("⨀").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
||||||
|
symbols["biguplus"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A04)).addMathOperatorHtml("⨄").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
||||||
|
symbols["bigsqcup"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A06)).addMathOperatorHtml("⨆").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
||||||
|
{ auto s=MathOperatorSymbolUnicode(QChar(0x22A5)).addMathOperatorHtml("⊥");
|
||||||
|
symbols["bot"]=s; symbols["perp"]=s; }
|
||||||
|
{ auto s=MathOperatorSymbolUnicode(QChar(0x2229)).addMathOperatorHtml("∩").addMathOperatorWinSymbol(QChar(0xC7));
|
||||||
|
symbols["cap"]=s; symbols["land"]=s; }
|
||||||
|
symbols["cdot"]=MathOperatorSymbol(QChar(0xB7)).addMathOperatorHtml("·").addMathOperatorWinSymbol(QChar(0xD7));
|
||||||
|
symbols["cong"]=MathOperatorSymbolUnicode(QChar(0x2245)).addMathOperatorHtml("≅");
|
||||||
|
symbols["coprod"]=NarrowMathOperatorSymbolUnicode(QChar(0x2210)).addMathOperatorHtml("∐").addWinSymbol(QChar(0xD5), ItalicOff|BoldOff|FlipSymbolUpDown, 1.8, 0.1).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
||||||
|
{ auto s=MathOperatorSymbolUnicode(QChar(0x222A)).addMathOperatorHtml("∪").addMathOperatorWinSymbol(QChar(0xC8));
|
||||||
|
symbols["cup"]=s; symbols["lor"]=s; }
|
||||||
|
symbols["ddots"]=UprightSymbolUnicode(QChar(0x22F1)).addMathOperatorHtml("⋱");
|
||||||
|
symbols["div"]=MathOperatorSymbolUnicode(QChar(0x00F7)).addMathOperatorHtml("÷").addMathOperatorWinSymbol(QChar(0xB8));
|
||||||
|
symbols["downarrow"]=UprightSymbolUnicode(QChar(0x2193)).addUprightHtml("↓").addUprightWinSymbol(QChar(0xAF));
|
||||||
|
symbols["downharpoonleft"]=UprightSymbolUnicode(QChar(0x21C3)).addUprightHtml("⇃");
|
||||||
|
symbols["downharpoonright"]=UprightSymbolUnicode(QChar(0x21C2)).addUprightHtml("⇂");
|
||||||
|
{ auto s=MathOperatorSymbolUnicode(QChar(0x2205)).addMathOperatorHtml("∅").addMathOperatorWinSymbol(QChar(0xC6)).addStd("0", BoldOff|ItalicOff|DrawSlash);
|
||||||
|
symbols["emptyset"]=s; symbols["varnothing"]=s; }
|
||||||
|
symbols["equiv"]=MathOperatorSymbolUnicode(QChar(0x2261)).addMathOperatorHtml("≡").addMathOperatorWinSymbol(QChar(0xBA));
|
||||||
|
symbols["exists"]=NarrowMathOperatorSymbolUnicode(QChar(0x2203)).addMathOperatorHtml("∃").addMathOperatorWinSymbol(QChar(0x24)).addStd("E", ItalicOff|BoldOff|FlipSymbolLeftRight);
|
||||||
|
symbols["forall"]=NarrowMathOperatorSymbolUnicode(QChar(0x2200)).addMathOperatorHtml("∀").addMathOperatorWinSymbol(QChar(0x22)).addStd("A", ItalicOff|BoldOff|FlipSymbolUpDown).addGlobalFlags(SubscriptCorrection);
|
||||||
|
{ auto s=MathOperatorSymbolUnicode(QChar(0x2265)).addMathOperatorHtml("≥").addMathOperatorWinSymbol(QChar(0xB3));
|
||||||
|
symbols["geq"]=s; symbols["ge"]=s; }
|
||||||
|
symbols["geqq"]=MathOperatorSymbolUnicode(QChar(0x2267)).addMathOperatorHtml("≧");
|
||||||
|
symbols["gg"]=MathOperatorSymbolUnicode(QChar(0x226B)).addMathOperatorHtml("≫").addMathOperatorStd(">>");
|
||||||
|
symbols["iddots"]=UprightSymbolUnicode(QChar(0x22F0)).addMathOperatorHtml("⋰");
|
||||||
|
{ auto s=UprightSymbolUnicode(QChar(0x21D4)).addUprightHtml("⇔").addUprightWinSymbol(QChar(0xDB));
|
||||||
|
symbols["iff"]=s; symbols["Leftrightarrow"]=s; }
|
||||||
|
symbols["iiint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222D)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("∭").addMathOperatorWinSymbol(QString(3, QChar(0xF2)), 1.8, 0.1);
|
||||||
|
symbols["iint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222C)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("∬").addMathOperatorWinSymbol(QString(2, QChar(0xF2)), 1.8, 0.1);
|
||||||
|
symbols["in"]=MathOperatorSymbolUnicode(QChar(0x2208)).addMathOperatorHtml("∈").addMathOperatorWinSymbol(QChar(0xCE));
|
||||||
|
symbols["int"]=NarrowMathOperatorSymbolUnicode(QChar(0x222B)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("∫").addMathOperatorWinSymbol(QChar(0xF2), 1.8, 0.1);
|
||||||
|
symbols["leftarrow"]=UprightSymbolUnicode(QChar(0x2190)).addUprightHtml("←").addUprightWinSymbol(QChar(0xAC));
|
||||||
|
symbols["longleftarrow"]=UprightSymbolUnicode(QChar(0x27F5)).addUprightHtml("⟵");
|
||||||
|
symbols["longrightarrow"]=UprightSymbolUnicode(QChar(0x27F6)).addUprightHtml("⟶");
|
||||||
|
symbols["longleftrightarrow"]=UprightSymbolUnicode(QChar(0x27F7)).addUprightHtml("⟷");
|
||||||
|
symbols["Longleftarrow"]=UprightSymbolUnicode(QChar(0x27F8)).addUprightHtml("⟸");
|
||||||
|
symbols["Longrightarrow"]=UprightSymbolUnicode(QChar(0x27F9)).addUprightHtml("⟹");
|
||||||
|
symbols["Longleftrightarrow"]=UprightSymbolUnicode(QChar(0x27FA)).addUprightHtml("⟺");
|
||||||
|
symbols["leftharpoondown"]=UprightSymbolUnicode(QChar(0x21BD)).addUprightHtml("↽");
|
||||||
|
symbols["leftharpoonup"]=UprightSymbolUnicode(QChar(0x21BC)).addUprightHtml("↼");
|
||||||
|
symbols["leftrightarrow"]=UprightSymbolUnicode(QChar(0x2194)).addUprightHtml("↔").addUprightWinSymbol(QChar(0xAB));
|
||||||
|
symbols["leftrightharpoon"]=UprightSymbolUnicode(QChar(0x21CB)).addUprightHtml("⇋");
|
||||||
|
{ auto s=MathOperatorSymbolUnicode(QChar(0x2264)).addMathOperatorHtml("≤").addMathOperatorWinSymbol(QChar(0xA3));
|
||||||
|
symbols["leq"]=s; symbols["le"]=s; }
|
||||||
|
symbols["leqq"]=MathOperatorSymbolUnicode(QChar(0x2266)).addMathOperatorHtml("≦");
|
||||||
|
symbols["ll"]=MathOperatorSymbolUnicode(QChar(0x226A)).addMathOperatorHtml("≪").addMathOperatorStd("<<");
|
||||||
|
symbols["lnot"]=MathOperatorSymbolUnicode(QChar(0xAC)).addMathOperatorWinSymbol(QChar(0xD8)).addMathOperatorHtml("¬");
|
||||||
|
symbols["mapimage"]=MathOperatorSymbolUnicode(QChar(0x22B7)).addMathOperatorHtml("⊷");
|
||||||
|
symbols["maporiginal"]=MathOperatorSymbolUnicode(QChar(0x22B6)).addMathOperatorHtml("⊶");
|
||||||
|
symbols["mapsto"]=MathOperatorSymbolUnicode(QChar(0x21A6)).addMathOperatorHtml("↦");
|
||||||
|
symbols["mid"]=MathOperatorSymbolUnicode(QChar(0x2223)).addMathOperatorHtml("∣").addMathOperatorWinSymbol(QChar(0xBD)).addMathOperatorStd("|");
|
||||||
|
symbols["mp"]=MathOperatorSymbolUnicode(QChar(0x2213)).addMathOperatorHtml("∓").addWinSymbol(QChar(0xB1),ItalicOff|BoldOff|FlipSymbolUpDown).addStd(QChar(0xB1),ItalicOff|BoldOff|FlipSymbolUpDown);
|
||||||
|
symbols["multimap"]=MathOperatorSymbolUnicode(QChar(0x22B8)).addMathOperatorHtml("⊸");
|
||||||
|
symbols["nabla"]=NarrowMathOperatorSymbolUnicode(QChar(0x2207)).addMathOperatorHtml("∇").addMathOperatorWinSymbol(QChar(0xD1)).addGlobalFlags(IntLikeSymbolCorrection);
|
||||||
|
symbols["ne"]=NarrowMathOperatorSymbolUnicode(QChar(0x2260)).addMathOperatorHtml("≠").addMathOperatorWinSymbol(QChar(0xB9));
|
||||||
|
symbols["nearrow"]=UprightSymbolUnicode(QChar(0x2197)).addUprightHtml("↗");
|
||||||
|
{ auto s=MathOperatorSymbolUnicode(QChar(0x00AC)).addMathOperatorHtml("¬").addMathOperatorWinSymbol(QChar(0xD8));
|
||||||
|
symbols["neg"]=s; symbols["lnot"]=s; }
|
||||||
|
symbols["neq"]=MathOperatorSymbolUnicode(QChar(0x2260)).addMathOperatorHtml("≠").addMathOperatorWinSymbol(QChar(0xB9)).addStd("=", ItalicOff|BoldOff|DrawSlash);
|
||||||
|
symbols["nexists"]=NarrowMathOperatorSymbolUnicode(QChar(0x2204)).addMathOperatorHtml("∄").addStd("E", ItalicOff|BoldOff|FlipSymbolLeftRight|DrawSlash).addMathOperatorWinSymbol(QChar(0x24), ItalicOff|BoldOff|DrawSlash);
|
||||||
|
symbols["ni"]=NarrowMathOperatorSymbolUnicode(QChar(0x220B)).addMathOperatorHtml("∋").addMathOperatorWinSymbol(QChar(0xCE), ItalicOff|BoldOff|FlipSymbolLeftRight);
|
||||||
|
symbols["nmid"]=NarrowMathOperatorSymbolUnicode(QChar(0x2224)).addMathOperatorHtml("∤");
|
||||||
|
symbols["notin"]=NarrowMathOperatorSymbolUnicode(QChar(0x2209)).addMathOperatorHtml("∉").addMathOperatorWinSymbol(QChar(0xCF));
|
||||||
|
symbols["notni"]=NarrowMathOperatorSymbolUnicode(QChar(0x220C)).addMathOperatorHtml("∌");
|
||||||
|
symbols["nparallel"]=MathOperatorSymbolUnicode(QChar(0x2226)).addMathOperatorHtml("∦");
|
||||||
|
symbols["nwarrow"]=UprightSymbolUnicode(QChar(0x2196)).addUprightHtml("↖");
|
||||||
|
symbols["odot"]=MathOperatorSymbolUnicode(QChar(0x2299)).addMathOperatorHtml("⊙");
|
||||||
|
symbols["oiiint"]=NarrowMathOperatorSymbolUnicode(QChar(0x2230)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("∰");
|
||||||
|
symbols["oiint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222F)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("∯");
|
||||||
|
symbols["oint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222E)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("∮");
|
||||||
|
symbols["ominus"]=MathOperatorSymbolUnicode(QChar(0x2296)).addMathOperatorHtml("⊖");
|
||||||
|
symbols["oplus"]=MathOperatorSymbolUnicode(QChar(0x2295)).addMathOperatorHtml("⊕").addMathOperatorWinSymbol(QChar(0xC5));
|
||||||
|
symbols["oslash"]=MathOperatorSymbolUnicode(QChar(0x2298)).addMathOperatorHtml("⊘");
|
||||||
|
symbols["otimes"]=MathOperatorSymbolUnicode(QChar(0x2297)).addMathOperatorHtml("⊗").addMathOperatorWinSymbol(QChar(0xC4));
|
||||||
|
symbols["parallel"]=NarrowMathOperatorSymbolUnicode(QChar(0x2225)).addMathOperatorHtml("∥").addMathOperatorStd("||");
|
||||||
|
symbols["pm"] = MathOperatorSymbol(QChar(0xB1), "±").addMathOperatorWinSymbol(QChar(0xB1));
|
||||||
|
symbols["prec"]=MathOperatorSymbolUnicode(QChar(0x227A)).addMathOperatorHtml("≺");
|
||||||
|
symbols["prod"]=NarrowMathOperatorSymbolUnicode(QChar(0x220F)).addMathOperatorWinSymbol(QChar(0xD5), 1.8, 0.1).addMathOperatorHtml("∏").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
||||||
|
symbols["propto"]=MathOperatorSymbolUnicode(QChar(0x221D)).addMathOperatorWinSymbol(QChar(0xB5)).addMathOperatorHtml("∝");
|
||||||
|
symbols["rightharpoondown"]=UprightSymbolUnicode(QChar(0x21C1)).addUprightHtml("⇁");
|
||||||
|
symbols["rightharpoonup"]=UprightSymbolUnicode(QChar(0x21C0)).addUprightHtml("⇀");
|
||||||
|
symbols["rightleftharpoon"]=UprightSymbolUnicode(QChar(0x21CC)).addUprightHtml("⇌");
|
||||||
|
symbols["searrow"]=UprightSymbolUnicode(QChar(0x2198)).addUprightHtml("↘");
|
||||||
|
symbols["setminus"]=MathOperatorSymbolUnicode(QChar(0x2216)).addMathOperatorHtml("∖");
|
||||||
|
{ auto s=MathOperatorSymbolUnicode(QChar(0x223C)).addMathOperatorHtml("˜").addMathOperatorStd("~");
|
||||||
|
symbols["~"]=s; symbols["sim"]=s; }
|
||||||
|
symbols["simeq"]=MathOperatorSymbolUnicode(QChar(0x2243)).addMathOperatorHtml("≃");
|
||||||
|
symbols["sqcap"]=MathOperatorSymbolUnicode(QChar(0x2293)).addMathOperatorHtml("⊓");
|
||||||
|
symbols["sqcup"]=MathOperatorSymbolUnicode(QChar(0x2294)).addMathOperatorHtml("⊔");
|
||||||
|
symbols["square"]=MathOperatorSymbolUnicode(QChar(0x25A1));
|
||||||
|
symbols["subset"]=MathOperatorSymbolUnicode(QChar(0x2282)).addMathOperatorHtml("⊂").addMathOperatorWinSymbol(QChar(0xCC));
|
||||||
|
symbols["subseteq"]=MathOperatorSymbolUnicode(QChar(0x2286)).addMathOperatorHtml("⊆").addMathOperatorWinSymbol(QChar(0xCD));
|
||||||
|
symbols["subsetnot"]=MathOperatorSymbolUnicode(QChar(0x2284)).addMathOperatorHtml("⊄").addMathOperatorWinSymbol(QChar(0xCB));
|
||||||
|
symbols["succ"]=MathOperatorSymbolUnicode(QChar(0x227B)).addMathOperatorHtml("≻");
|
||||||
|
symbols["sum"]=NarrowMathOperatorSymbolUnicode(QChar(0x2211)).addMathOperatorWinSymbol(QChar(0xE5), 1.8, 0.1).addMathOperatorHtml("∑").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
||||||
|
symbols["supset"]=MathOperatorSymbolUnicode(QChar(0x2283)).addMathOperatorHtml("⊃").addMathOperatorWinSymbol(QChar(0xC9));
|
||||||
|
symbols["supseteq"]=MathOperatorSymbolUnicode(QChar(0x2287)).addMathOperatorHtml("⊇").addMathOperatorWinSymbol(QChar(0xCA));
|
||||||
|
symbols["supsetnot"]=MathOperatorSymbolUnicode(QChar(0x2285)).addMathOperatorHtml("⊅");
|
||||||
|
symbols["swarrow"]=UprightSymbolUnicode(QChar(0x2199)).addUprightHtml("↙");
|
||||||
|
symbols["therefore"]=MathOperatorSymbolUnicode(QChar(0x2234)).addMathOperatorHtml("∴").addMathOperatorWinSymbol(QChar(0x5C));
|
||||||
|
symbols["times"] = MathOperatorSymbol(QChar(0xD7), "×").addMathOperatorWinSymbol(QChar(0xB4));
|
||||||
|
{ auto s=UprightSymbolUnicode(QChar(0x2192)).addUprightHtml("→").addUprightWinSymbol(QChar(0xAE));
|
||||||
|
symbols["to"]=s; symbols["rightarrow"]=s; }
|
||||||
|
symbols["top"]=MathOperatorSymbolUnicode(QChar(0x22A4)).addMathOperatorHtml("⊤").addMathOperatorWinSymbol(QChar(0x5E)).addUprightStd("T");
|
||||||
|
symbols["triangle"]=NarrowMathOperatorSymbolUnicode(QChar(0x2206));
|
||||||
|
symbols["uparrow"]=UprightSymbolUnicode(QChar(0x2191)).addUprightHtml("↑").addUprightWinSymbol(QChar(0xAD));
|
||||||
|
symbols["updownarrow"]=UprightSymbolUnicode(QChar(0x2195)).addUprightHtml("↕");
|
||||||
|
symbols["upharpoonleft"]=UprightSymbolUnicode(QChar(0x21BF)).addUprightHtml("↿");
|
||||||
|
symbols["upharpoonright"]=UprightSymbolUnicode(QChar(0x21BE)).addUprightHtml("↾");
|
||||||
|
symbols["vartriangleleft"]=NarrowMathOperatorSymbolUnicode(QChar(0x22B2)).addMathOperatorHtml("⊲");
|
||||||
|
symbols["vdots"]=UprightSymbolUnicode(QChar(0x22EE)).addMathOperatorHtml("⋮");
|
||||||
|
symbols["vee"]=MathOperatorSymbolUnicode(QChar(0x2228)).addMathOperatorHtml("∨").addMathOperatorWinSymbol(QChar(0xDA));
|
||||||
|
symbols["vdash"]=MathOperatorSymbolUnicode(QChar(0x22A2)).addMathOperatorHtml("⊢");
|
||||||
|
symbols["dashv"]=MathOperatorSymbolUnicode(QChar(0x22A3)).addMathOperatorHtml("⊣");
|
||||||
|
symbols["vDash"]=MathOperatorSymbolUnicode(QChar(0x22A8)).addMathOperatorHtml("⊨");
|
||||||
|
symbols["nvdash"]=MathOperatorSymbolUnicode(QChar(0x22AC)).addMathOperatorHtml("⊬");
|
||||||
|
symbols["Vdash"]=MathOperatorSymbolUnicode(QChar(0x22A9)).addMathOperatorHtml("⊩");
|
||||||
|
symbols["models"]=MathOperatorSymbolUnicode(QChar(0x22A7)).addMathOperatorHtml("⊧");
|
||||||
|
symbols["wedge"]=MathOperatorSymbolUnicode(QChar(0x2227)).addMathOperatorHtml("∧").addMathOperatorWinSymbol(QChar(0xD9));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************************
|
||||||
|
* GREEK letters
|
||||||
|
**************************************************************************************/
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "alpha", "a", QChar(0x3B1), "α");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "beta", "b", QChar(0x3B2), "β");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "gamma", "g", QChar(0x3B3), "γ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "delta", "d", QChar(0x3B4), "δ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "epsilon", "e", QChar(0x3F5), "ϵ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "varepsilon", "e", QChar(0x3B5), "ε");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "zeta", "z", QChar(0x3B6),"ζ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "eta", "h", QChar(0x3B7),"η");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "theta", "q", QChar(0x3B8),"θ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "vartheta", "J", QChar(0x3D1),"ϑ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "iota", "i", QChar(0x3B9),"ι");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "kappa", "k", QChar(0x3BA),"κ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "lambda", "l", QChar(0x3BB),"λ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "mu", "m", QChar(0x3BC),"μ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "nu", "n", QChar(0x3BD),"ν");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "xi", "x", QChar(0x3BE),"ξ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "pi", "p", QChar(0x3C0),"π");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "varpi", "v", QChar(0x3D6),"ϖ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "rho", "r", QChar(0x3C1),"ρ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "varrho", "r", QChar(0x3F1),"ϱ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "sigma", "s", QChar(0x3C3),"σ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "varsigma", "V", QChar(0x3C2),"ς");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "tau", "t", QChar(0x3C4),"τ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "upsilon", "u", QChar(0x3C5),"υ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "phi", "f", QChar(0x3C5),"ϕ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "varphi", "j", QChar(0x3D6),"φ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "chi", "c", QChar(0x3C7),"χ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "psi", "y", QChar(0x3C8),"ψ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "omega", "w", QChar(0x3C9),"ω");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Gamma", "G", QChar(0x3A3),"Γ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Delta", "D", QChar(0x394),"Δ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Theta", "Q", QChar(0x398),"Θ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Lambda", "L", QChar(0x39B),"Λ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Omega", "W", QChar(0x3A9),"Ω");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Xi", "X", QChar(0x39E),"Ξ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Pi", "P", QChar(0x3A0),"Π");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Sigma", "S", QChar(0x3A3),"Σ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Upsilon", "U", QChar(0x3C6),"Υ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Phi", "F", QChar(0x3A6),"Φ");
|
||||||
|
addGreekLetterVariants_WinSymbol_Unicode_Html(symbols, "Psi", "Y", QChar(0x3A8),"Ψ");
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************************
|
||||||
|
* 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)
|
JKQTMathTextSymbolNode::SymbolFullProps JKQTMathTextSymbolNode::MathOperatorSymbolUnicode(const QString &unicode)
|
||||||
{
|
{
|
||||||
return SymbolFullProps(MTFEUnicode, SymbolProps(unicode, ItalicOff|BoldOff, 1.0, 0.0)).addGlobalFlags(ExtendWidthInMathmode|MakeWhitespaceHalf);
|
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);
|
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[baseInstructionName]=MathGreekLetter_WinSymbol_Unicode_Html(letterWinSymbol, letterUnicode, html).addGlobalFlags(SubscriptCorrection);
|
||||||
symbols["text"+baseInstructionName]=AsOutsiudeGreekLetter_WinSymbol_Unicode_Html(letterWinSymbol, letterUnicode, html);
|
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("#", "#");
|
|
||||||
symbols["%"]=SimpleTextSymbol("%", "≫");
|
|
||||||
symbols["&"]=SimpleTextSymbol("&", "&");
|
|
||||||
symbols["("]=SimpleUprightTextSymbol("(");
|
|
||||||
symbols[")"]=SimpleUprightTextSymbol(")");
|
|
||||||
symbols["["]=SimpleUprightTextSymbol("[");
|
|
||||||
symbols["]"]=SimpleUprightTextSymbol("]");
|
|
||||||
symbols["_"]=SimpleTextSymbol("_");
|
|
||||||
symbols["{"]=SimpleUprightTextSymbol("{");
|
|
||||||
symbols["|"]=SimpleUprightTextSymbol("||", "‖").addUprightUnicode(QChar(0x2016));
|
|
||||||
symbols["}"]=SimpleUprightTextSymbol("}");
|
|
||||||
symbols["AC"]=UprightSymbolUnicode(QChar(0x223F)).addUprightHtml("∿").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("œ");
|
|
||||||
symbols["OE"]=UnicodeSymbol(QChar(0x152)).addStd("OE").addHtml("Œ");
|
|
||||||
symbols["ss"]=SimpleTextSymbol(QChar(0xDF)).addHtml("ß");
|
|
||||||
symbols["l"]=UnicodeSymbol(QChar(0x141)).addHtml("ł");
|
|
||||||
symbols["L"]=UnicodeSymbol(QChar(0x142)).addHtml("Ł");
|
|
||||||
symbols["o"]=SimpleTextSymbol(QChar(0xF8)).addHtml("ø");
|
|
||||||
symbols["O"]=SimpleTextSymbol(QChar(0xD8)).addHtml("Ø");
|
|
||||||
{ auto s=UprightSymbolUnicode(QChar(0x212B)).addUprightStd(QChar(0xC5));
|
|
||||||
symbols["Angstrom"]=s; symbols["angstrom"]=s; }
|
|
||||||
{ auto s=UnicodeSymbol(QChar(0x2136)).addHtml("ℶ");
|
|
||||||
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("ℑ").addWinSymbol(QChar(0xC1));
|
|
||||||
symbols["No"]=UnicodeSymbol(QChar(0x2116));
|
|
||||||
{ auto s=UprightSymbolUnicode(QChar(0x2126)).addUprightWinSymbol("W").addUprightHtml("Ω");
|
|
||||||
symbols["Ohm"]=s; symbols["ohm"]=s; }
|
|
||||||
symbols["P"]=SimpleTextSymbol(QChar(0xB6)).addHtml("¶");
|
|
||||||
symbols["Re"]=UnicodeSymbol(QChar(0x211C)).addHtml("ℜ").addWinSymbol(QChar(0xC2));
|
|
||||||
{ auto s=SimpleTextSymbol(QChar(0xA7)).addHtml("§");
|
|
||||||
symbols["S"]=s; symbols["§"]=s;}
|
|
||||||
symbols["accurrent"]=UnicodeSymbol(QChar(0x23E6));
|
|
||||||
{ auto s=UnicodeSymbol(QChar(0x2135)).addHtml("ℵ").addWinSymbol(QChar(0xC0));
|
|
||||||
symbols["alef"]=s; symbols["aleph"]=s; symbols["Aleph"]=s; symbols["Alef"]=s; }
|
|
||||||
symbols["angle"]=UprightSymbolUnicode(QChar(0x2220)).addHtml("∠").addWinSymbol(QChar(0xD0));
|
|
||||||
symbols["backslash"]=SimpleTextSymbol("\\");
|
|
||||||
symbols["benzene"]=UprightSymbolUnicode(QChar(0x232C));
|
|
||||||
symbols["benzenr"]=UprightSymbolUnicode(QChar(0x23E3));
|
|
||||||
symbols["blacksquare"]=UprightSymbolUnicode(QChar(0x220E)).addUprightHtml("□");
|
|
||||||
{ 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("•").addUprightWinSymbol(QChar(0xB7));
|
|
||||||
symbols["bullet"]=s; symbols["textbullet"]=s; }
|
|
||||||
symbols["cdots"]=UprightSymbolUnicode(QChar(0x22EF)).addUprightHtml("···").addUprightStd(QString(3, QChar(0xB7)));
|
|
||||||
{ auto s=UnicodeSymbol(QChar(0x2103)).addUprightStd("°C").addUprightHtml("°C");
|
|
||||||
symbols["celsius"]=s; symbols["degC"]=s; symbols["degreeCelsius"]=s; }
|
|
||||||
symbols["ell"]=UprightSymbolUnicode(QChar(0x2113), "ℓ");
|
|
||||||
symbols["wp"]=UprightSymbolUnicode(QChar(0x2118), "℘").addGlobalFlags(SubscriptCorrection);
|
|
||||||
symbols["mho"]=UprightSymbolUnicode(QChar(0x2127), "℧");
|
|
||||||
symbols["lozenge"]=UprightSymbolUnicode(QChar(0x25CA), "◊");
|
|
||||||
symbols["cent"]=SimpleTextSymbol(QChar(0xA2), "¢");
|
|
||||||
symbols["checkmark"]=UprightSymbolStd(QChar(0x2713)).addUprightHtml("✓");
|
|
||||||
symbols["circ"]=UprightSymbolStd(QChar(0x2218)).addUprightHtml("∘").addStd("o", ItalicOff,0.7, -0.25);
|
|
||||||
symbols["co"]=UprightSymbolUnicode(QChar(0x2105));
|
|
||||||
{ auto s=SimpleTextSymbol(QChar(0xA9), "©");
|
|
||||||
symbols["copyright"]=s; symbols["textcopyright"]=s; symbols["circledC"]=s; }
|
|
||||||
{ auto s=UprightSymbolUnicode(QChar(0x2020)).addUprightHtml("†");
|
|
||||||
symbols["dagger"]=s; symbols["dag"]=s; symbols["textdagger"]=s; }
|
|
||||||
{ auto s=UprightSymbolUnicode(QChar(0x2021)).addUprightHtml("‡");
|
|
||||||
symbols["ddagger"]=s; symbols["ddag"]=s; symbols["textdaggerdbl"]=s; }
|
|
||||||
{ auto s=UnicodeSymbol(QChar(0x2138)).addHtml("ℸ");
|
|
||||||
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("⋄").addWinSymbol(QChar(0xE0));
|
|
||||||
symbols["dollar"]=UnicodeSymbol(QChar(0x0024));
|
|
||||||
{ auto s=SimpleTextSymbol(QChar(0x24), "$");
|
|
||||||
symbols["dollar"]=s; symbols["$"]=s; }
|
|
||||||
symbols["dprime"]=UnicodeSymbol(QChar(0x2033)).addHtml("″").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("…").addWinSymbol(QChar(0xBC)).addStd("...");
|
|
||||||
symbols["ellipsis"]=s; symbols["dots"]=s; symbols["ldots"]=s; }
|
|
||||||
{ auto s=SimpleTextSymbol(QChar(0x20AC), "€");
|
|
||||||
symbols["euro"]=s; symbols["EUR"]=s; }
|
|
||||||
{ auto s=UnicodeSymbol(QChar(0x2109));
|
|
||||||
symbols["fahrenheit"]=s; symbols["degF"]=s; }
|
|
||||||
symbols["female"]=UnicodeSymbol(QChar(0x2640)).addHtml("♀");
|
|
||||||
symbols["flq"]=UnicodeSymbol(QChar(0x2039)).addHtml("‹").addStd("<");
|
|
||||||
symbols["flqq"]=UnicodeSymbol(QChar(0x00AB)).addHtml("«").addStd(QChar(0xAB));
|
|
||||||
//symbols["frown"]=UnicodeSymbol(QChar(0x2322)).addHtml("⌢");
|
|
||||||
symbols["frq"]=UnicodeSymbol(QChar(0x203A)).addHtml("›").addStd(">");
|
|
||||||
symbols["frqq"]=UnicodeSymbol(QChar(0x00BB)).addHtml("»").addStd(QChar(0xBB));
|
|
||||||
{ auto s=UnicodeSymbol(QChar(0x2137)).addHtml("ℷ");
|
|
||||||
symbols["gimel"]=s; symbols["Gimel"]=s; }
|
|
||||||
symbols["glq"]=UnicodeSymbol(QChar(0x2018)).addHtml("‘").addStd("'");
|
|
||||||
symbols["glqq"]=UnicodeSymbol(QChar(0x201C)).addHtml("“").addStd("\"");
|
|
||||||
symbols["grq"]=UnicodeSymbol(QChar(0x2019)).addHtml("’").addStd("'");
|
|
||||||
symbols["grqq"]=UnicodeSymbol(QChar(0x201D)).addHtml("”").addStd("\"");
|
|
||||||
symbols["hbar"]=UprightSymbolUnicode(QChar(0x210F)).addUprightHtml("ℏ").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("∞").addUprightWinSymbol(QChar(0xA5)).addUprightStd("8", RotateSymbol90);
|
|
||||||
symbols["langle"]=UprightSymbolUnicode(QChar(0x2329)).addWinSymbol(QChar(0xE1));
|
|
||||||
symbols["lceil"]=UprightSymbolUnicode(QChar(0x2308)).addUprightHtml("⌈").addUprightWinSymbol(QChar(0xE9));
|
|
||||||
symbols["lfloor"]=UprightSymbolUnicode(QChar(0x230A)).addUprightHtml("⌊").addUprightWinSymbol(QChar(0xEB));
|
|
||||||
symbols["lightning"]=UnicodeSymbol(QChar(0x21AF));
|
|
||||||
symbols["male"]=UnicodeSymbol(QChar(0x2642)).addHtml("♂");
|
|
||||||
symbols["measuredangle"]=UprightSymbolUnicode(QChar(0x2221)).addUprightHtml("∡");
|
|
||||||
symbols["micro"] = SimpleTextSymbol(QChar(0xB5), "µ");
|
|
||||||
symbols["ohm"]=UprightSymbolUnicode(QChar(0x2126)).addUprightHtml("Ω").addUprightWinSymbol(QChar(0x57));
|
|
||||||
symbols["partial"]=UprightSymbolUnicode(QChar(0x2202)).addUprightHtml("∂").addUprightWinSymbol(QChar(0xB6));
|
|
||||||
{ auto s=UnicodeSymbol(QChar(0x2030)).addHtml("‰");
|
|
||||||
symbols["perthousand"]=s; symbols["permil"]=s; }
|
|
||||||
symbols["pound"]=SimpleTextSymbol(QChar(0xA3), "£");
|
|
||||||
symbols["pound"]=UnicodeSymbol(QChar(0x00A3));
|
|
||||||
symbols["prime"]=UnicodeSymbol(QChar(0x2032)).addHtml("′").addStd("'");
|
|
||||||
symbols["arcminute"]=UnicodeSymbol(QChar(0x2032)).addHtml("′").addStd("'");
|
|
||||||
symbols["arcsecond"]=UnicodeSymbol(QChar(0x2033)).addHtml("&dprime;").addStd("'");
|
|
||||||
symbols["rangle"]=UprightSymbolUnicode(QChar(0x232A)).addUprightWinSymbol(QChar(0xF1));
|
|
||||||
symbols["rceil"]=UprightSymbolUnicode(QChar(0x2309)).addUprightHtml("⌉").addUprightWinSymbol(QChar(0xF9));
|
|
||||||
{ auto s=SimpleTextSymbol(QChar(0xAE), "®");
|
|
||||||
symbols["registered"]=s; symbols["textregistered"]=s; symbols["circledR"]=s; }
|
|
||||||
symbols["rfloor"]=UprightSymbolUnicode(QChar(0x230B)).addUprightHtml("⌋").addUprightWinSymbol(QChar(0xFB));
|
|
||||||
symbols["rightangle"]=UprightSymbolUnicode(QChar(0x221F)).addUprightHtml("∟");
|
|
||||||
//symbols["smile"]=UprightSymbolUnicode(QChar(0x2323)).addUprightHtml("⌣");
|
|
||||||
symbols["sphericalangle"]=UprightSymbolUnicode(QChar(0x2222)).addUprightHtml("∢");
|
|
||||||
symbols["star"]=UprightSymbolUnicode(QChar(0x22C6));
|
|
||||||
symbols["tcohm"]=UnicodeSymbol(QChar(0x2126));
|
|
||||||
{ auto s=UnicodeSymbol(QChar(0x2014), "⹀");
|
|
||||||
symbols["dblhyphen"]=s; symbols["textdblhyphen"]=s; symbols["textdblhyphenchar"]=s; }
|
|
||||||
{ auto s=UnicodeSymbol(QChar(0x2014), "—");
|
|
||||||
symbols["---"]=s; symbols["textemdash"]=s; symbols["emdash"]=s; }
|
|
||||||
{ auto s=UnicodeSymbol(QChar(0x2013), "–");
|
|
||||||
symbols["--"]=s; symbols["textendash"]=s; symbols["endash"]=s; }
|
|
||||||
{ auto s=SimpleTextSymbol("-");
|
|
||||||
symbols["texthyphen"]=s; symbols["hyphen"]=s; }
|
|
||||||
symbols["textbar"]=SimpleTextSymbol("|", "|");
|
|
||||||
{ auto s=SimpleTextSymbol(QChar(0xB0), "°");
|
|
||||||
symbols["textdegree"]=s; symbols["degree"] = s; }
|
|
||||||
symbols["textgreater"]=SimpleTextSymbol(">", ">");
|
|
||||||
symbols["textless"]=SimpleTextSymbol("<", "<");
|
|
||||||
symbols["textquestiondown"]=SimpleTextSymbol(QChar(0xBF), "¿");
|
|
||||||
symbols["textexclamdown"]=SimpleTextSymbol(QChar(0xA1), "¡");
|
|
||||||
{ auto s=UnicodeSymbol(QChar(0x231C));
|
|
||||||
symbols["tlcorner"]=s; symbols["ulcorner"]=s; }
|
|
||||||
symbols["trademark"]=UnicodeSymbol(QChar(0x2122)).addHtml("™").addWinSymbol(QChar(0xD4)).addStd("(TM)");
|
|
||||||
symbols["trapezium"]=UnicodeSymbol(QChar(0x23E2)).addHtml("⏢");
|
|
||||||
{ auto s=UprightSymbolUnicode(QChar(0x231D));
|
|
||||||
symbols["trcorner"]=s; symbols["urcorner"]=s; }
|
|
||||||
symbols["trprime"]=UnicodeSymbol(QChar(0x2034)).addHtml("‴").addStd("'''");
|
|
||||||
symbols["varcarriagereturn"]=UnicodeSymbol(QChar(0x23CE)).addWinSymbol(QChar(0xBF));
|
|
||||||
symbols["varhexagonlrbonds"]=UnicodeSymbol(QChar(0x232C));
|
|
||||||
symbols["yen"]=SimpleTextSymbol(QChar(0xA5), "¥");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************************
|
|
||||||
* 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 max").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
|
||||||
symbols["argmin"] = NarrowMathOperatorText("arg min", "arg 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 inf").addGlobalFlags(SubSuperscriptBelowAboveSymbol).addGlobalFlags(SubscriptCorrection);
|
|
||||||
symbols["limsup"] = NarrowMathOperatorText("lim sup", "lim 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("<", "<");
|
|
||||||
symbols["="]=MathOperatorSymbol("=");
|
|
||||||
symbols[">"]=MathOperatorSymbol(">", ">");
|
|
||||||
symbols["Downarrow"]=UprightSymbolUnicode(QChar(0x21D3)).addUprightHtml("⇓").addUprightWinSymbol(QChar(0xDF));
|
|
||||||
symbols["Leftarrow"]=UprightSymbolUnicode(QChar(0x21D0)).addUprightHtml("⇐").addUprightWinSymbol(QChar(0xDC));
|
|
||||||
symbols["Rightarrow"]=UprightSymbolUnicode(QChar(0x21D2)).addUprightHtml("⇒").addUprightWinSymbol(QChar(0xDE));
|
|
||||||
symbols["Uparrow"]=UprightSymbolUnicode(QChar(0x21D1)).addUprightHtml("⇑").addUprightWinSymbol(QChar(0xDD));
|
|
||||||
symbols["Updownarrow"]=UprightSymbolUnicode(QChar(0x21D5)).addUprightHtml("⇕");
|
|
||||||
symbols["approx"]=MathOperatorSymbolUnicode(QChar(0x2248)).addMathOperatorHtml("≈").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("∵");
|
|
||||||
symbols["bigcap"]=NarrowMathOperatorSymbolUnicode(QChar(0x22C2)).addMathOperatorHtml("⋂").addMathOperatorWinSymbol(QChar(0xC7), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
|
||||||
symbols["bigcup"]=NarrowMathOperatorSymbolUnicode(QChar(0x22C3)).addMathOperatorHtml("⋃").addMathOperatorWinSymbol(QChar(0xC8), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
|
||||||
{ auto s=NarrowMathOperatorSymbolUnicode(QChar(0x22C0)).addMathOperatorHtml("⋀").addMathOperatorWinSymbol(QChar(0xD9), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
|
||||||
symbols["bigwedge"]=s; symbols["bighat"]=s; }
|
|
||||||
symbols["bigvee"]=NarrowMathOperatorSymbolUnicode(QChar(0x22C1)).addMathOperatorHtml("⋁").addMathOperatorWinSymbol(QChar(0xDA), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
|
||||||
symbols["bigotimes"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A02)).addMathOperatorHtml("⨂").addMathOperatorWinSymbol(QChar(0xC4), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
|
||||||
symbols["bigoplus"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A01)).addMathOperatorHtml("⨁").addMathOperatorWinSymbol(QChar(0xC5), 1.8).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
|
||||||
symbols["bigodot"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A00)).addMathOperatorHtml("⨀").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
|
||||||
symbols["biguplus"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A04)).addMathOperatorHtml("⨄").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
|
||||||
symbols["bigsqcup"]=NarrowMathOperatorSymbolUnicode(QChar(0x2A06)).addMathOperatorHtml("⨆").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
|
||||||
{ auto s=MathOperatorSymbolUnicode(QChar(0x22A5)).addMathOperatorHtml("⊥");
|
|
||||||
symbols["bot"]=s; symbols["perp"]=s; }
|
|
||||||
{ auto s=MathOperatorSymbolUnicode(QChar(0x2229)).addMathOperatorHtml("∩").addMathOperatorWinSymbol(QChar(0xC7));
|
|
||||||
symbols["cap"]=s; symbols["land"]=s; }
|
|
||||||
symbols["cdot"]=MathOperatorSymbol(QChar(0xB7)).addMathOperatorHtml("·").addMathOperatorWinSymbol(QChar(0xD7));
|
|
||||||
symbols["cong"]=MathOperatorSymbolUnicode(QChar(0x2245)).addMathOperatorHtml("≅");
|
|
||||||
symbols["coprod"]=NarrowMathOperatorSymbolUnicode(QChar(0x2210)).addMathOperatorHtml("∐").addWinSymbol(QChar(0xD5), ItalicOff|BoldOff|FlipSymbolUpDown, 1.8, 0.1).addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
|
||||||
{ auto s=MathOperatorSymbolUnicode(QChar(0x222A)).addMathOperatorHtml("∪").addMathOperatorWinSymbol(QChar(0xC8));
|
|
||||||
symbols["cup"]=s; symbols["lor"]=s; }
|
|
||||||
symbols["ddots"]=UprightSymbolUnicode(QChar(0x22F1)).addMathOperatorHtml("⋱");
|
|
||||||
symbols["div"]=MathOperatorSymbolUnicode(QChar(0x00F7)).addMathOperatorHtml("÷").addMathOperatorWinSymbol(QChar(0xB8));
|
|
||||||
symbols["downarrow"]=UprightSymbolUnicode(QChar(0x2193)).addUprightHtml("↓").addUprightWinSymbol(QChar(0xAF));
|
|
||||||
symbols["downharpoonleft"]=UprightSymbolUnicode(QChar(0x21C3)).addUprightHtml("⇃");
|
|
||||||
symbols["downharpoonright"]=UprightSymbolUnicode(QChar(0x21C2)).addUprightHtml("⇂");
|
|
||||||
{ auto s=MathOperatorSymbolUnicode(QChar(0x2205)).addMathOperatorHtml("∅").addMathOperatorWinSymbol(QChar(0xC6)).addStd("0", BoldOff|ItalicOff|DrawSlash);
|
|
||||||
symbols["emptyset"]=s; symbols["varnothing"]=s; }
|
|
||||||
symbols["equiv"]=MathOperatorSymbolUnicode(QChar(0x2261)).addMathOperatorHtml("≡").addMathOperatorWinSymbol(QChar(0xBA));
|
|
||||||
symbols["exists"]=NarrowMathOperatorSymbolUnicode(QChar(0x2203)).addMathOperatorHtml("∃").addMathOperatorWinSymbol(QChar(0x24)).addStd("E", ItalicOff|BoldOff|FlipSymbolLeftRight);
|
|
||||||
symbols["forall"]=NarrowMathOperatorSymbolUnicode(QChar(0x2200)).addMathOperatorHtml("∀").addMathOperatorWinSymbol(QChar(0x22)).addStd("A", ItalicOff|BoldOff|FlipSymbolUpDown).addGlobalFlags(SubscriptCorrection);
|
|
||||||
{ auto s=MathOperatorSymbolUnicode(QChar(0x2265)).addMathOperatorHtml("≥").addMathOperatorWinSymbol(QChar(0xB3));
|
|
||||||
symbols["geq"]=s; symbols["ge"]=s; }
|
|
||||||
symbols["geqq"]=MathOperatorSymbolUnicode(QChar(0x2267)).addMathOperatorHtml("≧");
|
|
||||||
symbols["gg"]=MathOperatorSymbolUnicode(QChar(0x226B)).addMathOperatorHtml("≫").addMathOperatorStd(">>");
|
|
||||||
symbols["iddots"]=UprightSymbolUnicode(QChar(0x22F0)).addMathOperatorHtml("⋰");
|
|
||||||
{ auto s=UprightSymbolUnicode(QChar(0x21D4)).addUprightHtml("⇔").addUprightWinSymbol(QChar(0xDB));
|
|
||||||
symbols["iff"]=s; symbols["Leftrightarrow"]=s; }
|
|
||||||
symbols["iiint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222D)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("∭").addMathOperatorWinSymbol(QString(3, QChar(0xF2)), 1.8, 0.1);
|
|
||||||
symbols["iint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222C)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("∬").addMathOperatorWinSymbol(QString(2, QChar(0xF2)), 1.8, 0.1);
|
|
||||||
symbols["in"]=MathOperatorSymbolUnicode(QChar(0x2208)).addMathOperatorHtml("∈").addMathOperatorWinSymbol(QChar(0xCE));
|
|
||||||
symbols["int"]=NarrowMathOperatorSymbolUnicode(QChar(0x222B)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("∫").addMathOperatorWinSymbol(QChar(0xF2), 1.8, 0.1);
|
|
||||||
symbols["leftarrow"]=UprightSymbolUnicode(QChar(0x2190)).addUprightHtml("←").addUprightWinSymbol(QChar(0xAC));
|
|
||||||
symbols["longleftarrow"]=UprightSymbolUnicode(QChar(0x27F5)).addUprightHtml("⟵");
|
|
||||||
symbols["longrightarrow"]=UprightSymbolUnicode(QChar(0x27F6)).addUprightHtml("⟶");
|
|
||||||
symbols["longleftrightarrow"]=UprightSymbolUnicode(QChar(0x27F7)).addUprightHtml("⟷");
|
|
||||||
symbols["Longleftarrow"]=UprightSymbolUnicode(QChar(0x27F8)).addUprightHtml("⟸");
|
|
||||||
symbols["Longrightarrow"]=UprightSymbolUnicode(QChar(0x27F9)).addUprightHtml("⟹");
|
|
||||||
symbols["Longleftrightarrow"]=UprightSymbolUnicode(QChar(0x27FA)).addUprightHtml("⟺");
|
|
||||||
symbols["leftharpoondown"]=UprightSymbolUnicode(QChar(0x21BD)).addUprightHtml("↽");
|
|
||||||
symbols["leftharpoonup"]=UprightSymbolUnicode(QChar(0x21BC)).addUprightHtml("↼");
|
|
||||||
symbols["leftrightarrow"]=UprightSymbolUnicode(QChar(0x2194)).addUprightHtml("↔").addUprightWinSymbol(QChar(0xAB));
|
|
||||||
symbols["leftrightharpoon"]=UprightSymbolUnicode(QChar(0x21CB)).addUprightHtml("⇋");
|
|
||||||
{ auto s=MathOperatorSymbolUnicode(QChar(0x2264)).addMathOperatorHtml("≤").addMathOperatorWinSymbol(QChar(0xA3));
|
|
||||||
symbols["leq"]=s; symbols["le"]=s; }
|
|
||||||
symbols["leqq"]=MathOperatorSymbolUnicode(QChar(0x2266)).addMathOperatorHtml("≦");
|
|
||||||
symbols["ll"]=MathOperatorSymbolUnicode(QChar(0x226A)).addMathOperatorHtml("≪").addMathOperatorStd("<<");
|
|
||||||
symbols["lnot"]=MathOperatorSymbolUnicode(QChar(0xAC)).addMathOperatorWinSymbol(QChar(0xD8)).addMathOperatorHtml("¬");
|
|
||||||
symbols["mapimage"]=MathOperatorSymbolUnicode(QChar(0x22B7)).addMathOperatorHtml("⊷");
|
|
||||||
symbols["maporiginal"]=MathOperatorSymbolUnicode(QChar(0x22B6)).addMathOperatorHtml("⊶");
|
|
||||||
symbols["mapsto"]=MathOperatorSymbolUnicode(QChar(0x21A6)).addMathOperatorHtml("↦");
|
|
||||||
symbols["mid"]=MathOperatorSymbolUnicode(QChar(0x2223)).addMathOperatorHtml("∣").addMathOperatorWinSymbol(QChar(0xBD)).addMathOperatorStd("|");
|
|
||||||
symbols["mp"]=MathOperatorSymbolUnicode(QChar(0x2213)).addMathOperatorHtml("∓").addWinSymbol(QChar(0xB1),ItalicOff|BoldOff|FlipSymbolUpDown).addStd(QChar(0xB1),ItalicOff|BoldOff|FlipSymbolUpDown);
|
|
||||||
symbols["multimap"]=MathOperatorSymbolUnicode(QChar(0x22B8)).addMathOperatorHtml("⊸");
|
|
||||||
symbols["nabla"]=NarrowMathOperatorSymbolUnicode(QChar(0x2207)).addMathOperatorHtml("∇").addMathOperatorWinSymbol(QChar(0xD1)).addGlobalFlags(IntLikeSymbolCorrection);
|
|
||||||
symbols["ne"]=NarrowMathOperatorSymbolUnicode(QChar(0x2260)).addMathOperatorHtml("≠").addMathOperatorWinSymbol(QChar(0xB9));
|
|
||||||
symbols["nearrow"]=UprightSymbolUnicode(QChar(0x2197)).addUprightHtml("↗");
|
|
||||||
{ auto s=MathOperatorSymbolUnicode(QChar(0x00AC)).addMathOperatorHtml("¬").addMathOperatorWinSymbol(QChar(0xD8));
|
|
||||||
symbols["neg"]=s; symbols["lnot"]=s; }
|
|
||||||
symbols["neq"]=MathOperatorSymbolUnicode(QChar(0x2260)).addMathOperatorHtml("≠").addMathOperatorWinSymbol(QChar(0xB9)).addStd("=", ItalicOff|BoldOff|DrawSlash);
|
|
||||||
symbols["nexists"]=NarrowMathOperatorSymbolUnicode(QChar(0x2204)).addMathOperatorHtml("∄").addStd("E", ItalicOff|BoldOff|FlipSymbolLeftRight|DrawSlash).addMathOperatorWinSymbol(QChar(0x24), ItalicOff|BoldOff|DrawSlash);
|
|
||||||
symbols["ni"]=NarrowMathOperatorSymbolUnicode(QChar(0x220B)).addMathOperatorHtml("∋").addMathOperatorWinSymbol(QChar(0xCE), ItalicOff|BoldOff|FlipSymbolLeftRight);
|
|
||||||
symbols["nmid"]=NarrowMathOperatorSymbolUnicode(QChar(0x2224)).addMathOperatorHtml("∤");
|
|
||||||
symbols["notin"]=NarrowMathOperatorSymbolUnicode(QChar(0x2209)).addMathOperatorHtml("∉").addMathOperatorWinSymbol(QChar(0xCF));
|
|
||||||
symbols["notni"]=NarrowMathOperatorSymbolUnicode(QChar(0x220C)).addMathOperatorHtml("∌");
|
|
||||||
symbols["nparallel"]=MathOperatorSymbolUnicode(QChar(0x2226)).addMathOperatorHtml("∦");
|
|
||||||
symbols["nwarrow"]=UprightSymbolUnicode(QChar(0x2196)).addUprightHtml("↖");
|
|
||||||
symbols["odot"]=MathOperatorSymbolUnicode(QChar(0x2299)).addMathOperatorHtml("⊙");
|
|
||||||
symbols["oiiint"]=NarrowMathOperatorSymbolUnicode(QChar(0x2230)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("∰");
|
|
||||||
symbols["oiint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222F)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("∯");
|
|
||||||
symbols["oint"]=NarrowMathOperatorSymbolUnicode(QChar(0x222E)).addGlobalFlags(IntLikeSymbolCorrection | SubSuperscriptBelowAboveSymbol).addMathOperatorHtml("∮");
|
|
||||||
symbols["ominus"]=MathOperatorSymbolUnicode(QChar(0x2296)).addMathOperatorHtml("⊖");
|
|
||||||
symbols["oplus"]=MathOperatorSymbolUnicode(QChar(0x2295)).addMathOperatorHtml("⊕").addMathOperatorWinSymbol(QChar(0xC5));
|
|
||||||
symbols["oslash"]=MathOperatorSymbolUnicode(QChar(0x2298)).addMathOperatorHtml("⊘");
|
|
||||||
symbols["otimes"]=MathOperatorSymbolUnicode(QChar(0x2297)).addMathOperatorHtml("⊗").addMathOperatorWinSymbol(QChar(0xC4));
|
|
||||||
symbols["parallel"]=NarrowMathOperatorSymbolUnicode(QChar(0x2225)).addMathOperatorHtml("∥").addMathOperatorStd("||");
|
|
||||||
symbols["pm"] = MathOperatorSymbol(QChar(0xB1), "±").addMathOperatorWinSymbol(QChar(0xB1));
|
|
||||||
symbols["prec"]=MathOperatorSymbolUnicode(QChar(0x227A)).addMathOperatorHtml("≺");
|
|
||||||
symbols["prod"]=NarrowMathOperatorSymbolUnicode(QChar(0x220F)).addMathOperatorWinSymbol(QChar(0xD5), 1.8, 0.1).addMathOperatorHtml("∏").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
|
||||||
symbols["propto"]=MathOperatorSymbolUnicode(QChar(0x221D)).addMathOperatorWinSymbol(QChar(0xB5)).addMathOperatorHtml("∝");
|
|
||||||
symbols["rightharpoondown"]=UprightSymbolUnicode(QChar(0x21C1)).addUprightHtml("⇁");
|
|
||||||
symbols["rightharpoonup"]=UprightSymbolUnicode(QChar(0x21C0)).addUprightHtml("⇀");
|
|
||||||
symbols["rightleftharpoon"]=UprightSymbolUnicode(QChar(0x21CC)).addUprightHtml("⇌");
|
|
||||||
symbols["searrow"]=UprightSymbolUnicode(QChar(0x2198)).addUprightHtml("↘");
|
|
||||||
symbols["setminus"]=MathOperatorSymbolUnicode(QChar(0x2216)).addMathOperatorHtml("∖");
|
|
||||||
{ auto s=MathOperatorSymbolUnicode(QChar(0x223C)).addMathOperatorHtml("˜").addMathOperatorStd("~");
|
|
||||||
symbols["~"]=s; symbols["sim"]=s; }
|
|
||||||
symbols["simeq"]=MathOperatorSymbolUnicode(QChar(0x2243)).addMathOperatorHtml("≃");
|
|
||||||
symbols["sqcap"]=MathOperatorSymbolUnicode(QChar(0x2293)).addMathOperatorHtml("⊓");
|
|
||||||
symbols["sqcup"]=MathOperatorSymbolUnicode(QChar(0x2294)).addMathOperatorHtml("⊔");
|
|
||||||
symbols["square"]=MathOperatorSymbolUnicode(QChar(0x25A1));
|
|
||||||
symbols["subset"]=MathOperatorSymbolUnicode(QChar(0x2282)).addMathOperatorHtml("⊂").addMathOperatorWinSymbol(QChar(0xCC));
|
|
||||||
symbols["subseteq"]=MathOperatorSymbolUnicode(QChar(0x2286)).addMathOperatorHtml("⊆").addMathOperatorWinSymbol(QChar(0xCD));
|
|
||||||
symbols["subsetnot"]=MathOperatorSymbolUnicode(QChar(0x2284)).addMathOperatorHtml("⊄").addMathOperatorWinSymbol(QChar(0xCB));
|
|
||||||
symbols["succ"]=MathOperatorSymbolUnicode(QChar(0x227B)).addMathOperatorHtml("≻");
|
|
||||||
symbols["sum"]=NarrowMathOperatorSymbolUnicode(QChar(0x2211)).addMathOperatorWinSymbol(QChar(0xE5), 1.8, 0.1).addMathOperatorHtml("∑").addGlobalFlags(SubSuperscriptBelowAboveSymbol);
|
|
||||||
symbols["supset"]=MathOperatorSymbolUnicode(QChar(0x2283)).addMathOperatorHtml("⊃").addMathOperatorWinSymbol(QChar(0xC9));
|
|
||||||
symbols["supseteq"]=MathOperatorSymbolUnicode(QChar(0x2287)).addMathOperatorHtml("⊇").addMathOperatorWinSymbol(QChar(0xCA));
|
|
||||||
symbols["supsetnot"]=MathOperatorSymbolUnicode(QChar(0x2285)).addMathOperatorHtml("⊅");
|
|
||||||
symbols["swarrow"]=UprightSymbolUnicode(QChar(0x2199)).addUprightHtml("↙");
|
|
||||||
symbols["therefore"]=MathOperatorSymbolUnicode(QChar(0x2234)).addMathOperatorHtml("∴").addMathOperatorWinSymbol(QChar(0x5C));
|
|
||||||
symbols["times"] = MathOperatorSymbol(QChar(0xD7), "×").addMathOperatorWinSymbol(QChar(0xB4));
|
|
||||||
{ auto s=UprightSymbolUnicode(QChar(0x2192)).addUprightHtml("→").addUprightWinSymbol(QChar(0xAE));
|
|
||||||
symbols["to"]=s; symbols["rightarrow"]=s; }
|
|
||||||
symbols["top"]=MathOperatorSymbolUnicode(QChar(0x22A4)).addMathOperatorHtml("⊤").addMathOperatorWinSymbol(QChar(0x5E)).addUprightStd("T");
|
|
||||||
symbols["triangle"]=NarrowMathOperatorSymbolUnicode(QChar(0x2206));
|
|
||||||
symbols["uparrow"]=UprightSymbolUnicode(QChar(0x2191)).addUprightHtml("↑").addUprightWinSymbol(QChar(0xAD));
|
|
||||||
symbols["updownarrow"]=UprightSymbolUnicode(QChar(0x2195)).addUprightHtml("↕");
|
|
||||||
symbols["upharpoonleft"]=UprightSymbolUnicode(QChar(0x21BF)).addUprightHtml("↿");
|
|
||||||
symbols["upharpoonright"]=UprightSymbolUnicode(QChar(0x21BE)).addUprightHtml("↾");
|
|
||||||
symbols["vartriangleleft"]=NarrowMathOperatorSymbolUnicode(QChar(0x22B2)).addMathOperatorHtml("⊲");
|
|
||||||
symbols["vdots"]=UprightSymbolUnicode(QChar(0x22EE)).addMathOperatorHtml("⋮");
|
|
||||||
symbols["vee"]=MathOperatorSymbolUnicode(QChar(0x2228)).addMathOperatorHtml("∨").addMathOperatorWinSymbol(QChar(0xDA));
|
|
||||||
symbols["vdash"]=MathOperatorSymbolUnicode(QChar(0x22A2)).addMathOperatorHtml("⊢");
|
|
||||||
symbols["dashv"]=MathOperatorSymbolUnicode(QChar(0x22A3)).addMathOperatorHtml("⊣");
|
|
||||||
symbols["vDash"]=MathOperatorSymbolUnicode(QChar(0x22A8)).addMathOperatorHtml("⊨");
|
|
||||||
symbols["nvdash"]=MathOperatorSymbolUnicode(QChar(0x22AC)).addMathOperatorHtml("⊬");
|
|
||||||
symbols["Vdash"]=MathOperatorSymbolUnicode(QChar(0x22A9)).addMathOperatorHtml("⊩");
|
|
||||||
symbols["models"]=MathOperatorSymbolUnicode(QChar(0x22A7)).addMathOperatorHtml("⊧");
|
|
||||||
symbols["wedge"]=MathOperatorSymbolUnicode(QChar(0x2227)).addMathOperatorHtml("∧").addMathOperatorWinSymbol(QChar(0xD9));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************************
|
|
||||||
* GREEK letters
|
|
||||||
**************************************************************************************/
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("alpha", "a", QChar(0x3B1), "α");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("beta", "b", QChar(0x3B2), "β");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("gamma", "g", QChar(0x3B3), "γ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("delta", "d", QChar(0x3B4), "δ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("epsilon", "e", QChar(0x3F5), "ϵ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("varepsilon", "e", QChar(0x3B5), "ε");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("zeta", "z", QChar(0x3B6),"ζ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("eta", "h", QChar(0x3B7),"η");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("theta", "q", QChar(0x3B8),"θ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("vartheta", "J", QChar(0x3D1),"ϑ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("iota", "i", QChar(0x3B9),"ι");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("kappa", "k", QChar(0x3BA),"κ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("lambda", "l", QChar(0x3BB),"λ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("mu", "m", QChar(0x3BC),"μ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("nu", "n", QChar(0x3BD),"ν");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("xi", "x", QChar(0x3BE),"ξ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("pi", "p", QChar(0x3C0),"π");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("varpi", "v", QChar(0x3D6),"ϖ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("rho", "r", QChar(0x3C1),"ρ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("varrho", "r", QChar(0x3F1),"ϱ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("sigma", "s", QChar(0x3C3),"σ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("varsigma", "V", QChar(0x3C2),"ς");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("tau", "t", QChar(0x3C4),"τ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("upsilon", "u", QChar(0x3C5),"υ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("phi", "f", QChar(0x3C5),"ϕ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("varphi", "j", QChar(0x3D6),"φ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("chi", "c", QChar(0x3C7),"χ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("psi", "y", QChar(0x3C8),"ψ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("omega", "w", QChar(0x3C9),"ω");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("Gamma", "G", QChar(0x3A3),"Γ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("Delta", "D", QChar(0x394),"Δ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("Theta", "Q", QChar(0x398),"Θ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("Lambda", "L", QChar(0x39B),"Λ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("Omega", "W", QChar(0x3A9),"Ω");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("Xi", "X", QChar(0x39E),"Ξ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("Pi", "P", QChar(0x3A0),"Π");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("Sigma", "S", QChar(0x3A3),"Σ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("Upsilon", "U", QChar(0x3C6),"Υ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("Phi", "F", QChar(0x3A6),"Φ");
|
|
||||||
addGreekLetterVariants_WinSymbol_Unicode_Html("Psi", "Y", QChar(0x3A8),"Ψ");
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************************
|
|
||||||
* 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():
|
JKQTMathTextSymbolNode::SymbolFullProps::SymbolFullProps():
|
||||||
|
@ -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 */
|
/** \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);
|
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 */
|
/** \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 */
|
/** \brief constructs a SymbolProps for a symbol with encoding in Standard-fonts a */
|
||||||
static SymbolFullProps StdSymbol(const QString& symbol, const QString& html);
|
static SymbolFullProps StdSymbol(const QString& symbol, const QString& html);
|
||||||
/** \brief constructs a SymbolProps for a symbol with encoding in UnicodeFull-fonts a */
|
/** \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 */
|
/** \brief symbols that can be generated in any standard-font */
|
||||||
static QHash<QString, SymbolFullProps> symbols;
|
static const QHash<QString, SymbolFullProps>& symbols();
|
||||||
|
|
||||||
/** \brief fill the symbol tables standardTextSymbols, winSymbolSymbol, ... with contents */
|
|
||||||
static void fillSymbolTables();
|
|
||||||
|
|
||||||
/** \brief retrieve the properties to render the given symbol \a symName in the current environment \a currentEv */
|
/** \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;
|
SymbolFullProps getSymbolProp(const QString& symName, const JKQTMathTextEnvironment& currentEv) const;
|
||||||
|
@ -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() {
|
const QString ALPHA="ABDEFGIJKLMOSTUVWXYZ";
|
||||||
static std::mutex sMutex;
|
for (const QChar ch: ALPHA) {
|
||||||
std::lock_guard<std::mutex> lock(sMutex);
|
blackboardUnicodeTable[ch]=0x1D538+(ch.unicode()-QChar('A').unicode());
|
||||||
if (blackboardUnicodeTable.size()>0) return;
|
}
|
||||||
|
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")) {
|
return blackboardUnicodeTable;
|
||||||
blackboardUnicodeTable[ch]=0x1D538+(ch.unicode()-QChar('A').unicode());
|
}();
|
||||||
}
|
return table;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextTextNode::JKQTMathTextTextNode(JKQTMathText* _parent, const QString& textIn, bool addWhitespace, bool stripInnerWhitepace):
|
JKQTMathTextTextNode::JKQTMathTextTextNode(JKQTMathText* _parent, const QString& textIn, bool addWhitespace, bool stripInnerWhitepace):
|
||||||
JKQTMathTextTextBaseNode(_parent, "")
|
JKQTMathTextTextBaseNode(_parent, "")
|
||||||
{
|
{
|
||||||
fillStaticTables();
|
|
||||||
QString textTransformed=textIn;
|
QString textTransformed=textIn;
|
||||||
|
|
||||||
if (stripInnerWhitepace) {
|
if (stripInnerWhitepace) {
|
||||||
@ -240,11 +242,11 @@ void JKQTMathTextTextNode::splitTextForLayout(QPainter &painter, JKQTMathTextEnv
|
|||||||
} else if (bbMode==MTBBDMsimulate) {
|
} else if (bbMode==MTBBDMsimulate) {
|
||||||
CFontMode=FMasDefinedOutline;
|
CFontMode=FMasDefinedOutline;
|
||||||
} else if (bbMode==MTBBDMunicodeCharactersOrSimulate || bbMode==MTBBDMunicodeCharactersOrFontDirectly) {
|
} else if (bbMode==MTBBDMunicodeCharactersOrSimulate || bbMode==MTBBDMunicodeCharactersOrFontDirectly) {
|
||||||
if (blackboardUnicodeTable.contains(c) && fmRoman.inFontUcs4(blackboardUnicodeTable[c])) {
|
if (blackboardUnicodeTable().contains(c) && fmRoman.inFontUcs4(blackboardUnicodeTable().operator[](c))) {
|
||||||
cs=jkqtp_UnicodeToUTF8Q(blackboardUnicodeTable[c]);
|
cs=jkqtp_UnicodeToUTF8Q(blackboardUnicodeTable().operator[](c));
|
||||||
CFontMode=FMroman;
|
CFontMode=FMroman;
|
||||||
} else if (blackboardUnicodeTable.contains(c) && fmFallbackSym.inFontUcs4(blackboardUnicodeTable[c])) {
|
} else if (blackboardUnicodeTable().contains(c) && fmFallbackSym.inFontUcs4(blackboardUnicodeTable().operator[](c))) {
|
||||||
cs=jkqtp_UnicodeToUTF8Q(blackboardUnicodeTable[c]);
|
cs=jkqtp_UnicodeToUTF8Q(blackboardUnicodeTable().operator[](c));
|
||||||
CFontMode=FMfallbackSymbol;
|
CFontMode=FMfallbackSymbol;
|
||||||
} else {
|
} else {
|
||||||
if (bbMode==MTBBDMunicodeCharactersOrSimulate) {
|
if (bbMode==MTBBDMunicodeCharactersOrSimulate) {
|
||||||
@ -291,10 +293,10 @@ double JKQTMathTextTextNode::draw(QPainter& painter, double x, double y, JKQTMat
|
|||||||
const QFont fUpright=JKQTMathTextGetNonItalic(f);
|
const QFont fUpright=JKQTMathTextGetNonItalic(f);
|
||||||
const QFont fFallbackSym=currentEv.exchangedFontFor(MTEFallbackSymbols).getFont(parentMathText);
|
const QFont fFallbackSym=currentEv.exchangedFontFor(MTEFallbackSymbols).getFont(parentMathText);
|
||||||
const QFont fRoman=currentEv.exchangedFontForRoman().getFont(parentMathText);
|
const QFont fRoman=currentEv.exchangedFontForRoman().getFont(parentMathText);
|
||||||
const QFontMetricsF fm(f, painter.device());
|
//const QFontMetricsF fm(f, painter.device());
|
||||||
const QFontMetricsF fmUpright(fUpright, painter.device());
|
//const QFontMetricsF fmUpright(fUpright, painter.device());
|
||||||
const QFontMetricsF fmFallbackSym(fFallbackSym, painter.device());
|
//const QFontMetricsF fmFallbackSym(fFallbackSym, painter.device());
|
||||||
const QFontMetricsF fmRoman(fRoman, painter.device());
|
//const QFontMetricsF fmRoman(fRoman, painter.device());
|
||||||
|
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setFont(f);
|
painter.setFont(f);
|
||||||
|
@ -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;
|
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 */
|
/** \brief translation table for blackboard-font characters from "normal" Latin-1 encoding to unicode-encoding of blackboards */
|
||||||
static QHash<QChar, uint32_t> blackboardUnicodeTable;
|
static const QHash<QChar, uint32_t>& blackboardUnicodeTable();
|
||||||
/** \brief fill static data */
|
|
||||||
static void fillStaticTables();
|
|
||||||
/** \copydoc JKQTMathTextTextBaseNode::textTransform() */
|
/** \copydoc JKQTMathTextTextBaseNode::textTransform() */
|
||||||
virtual QString textTransform(const QString& text, const JKQTMathTextEnvironment& currentEv) const override;
|
virtual QString textTransform(const QString& text, const JKQTMathTextEnvironment& currentEv) const override;
|
||||||
};
|
};
|
||||||
|
@ -51,15 +51,13 @@ JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode(JKQTMathText *_parent):
|
|||||||
JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode(const QString &_type, JKQTMathText *parent):
|
JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode(const QString &_type, JKQTMathText *parent):
|
||||||
JKQTMathTextWhitespaceNode(parent)
|
JKQTMathTextWhitespaceNode(parent)
|
||||||
{
|
{
|
||||||
fillSupportedInstructions();
|
whitespace=supportedInstructions()[_type];
|
||||||
whitespace=supportedInstructions[_type];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode(const QString &_type, size_t count, JKQTMathText *parent):
|
JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode(const QString &_type, size_t count, JKQTMathText *parent):
|
||||||
JKQTMathTextWhitespaceNode(parent)
|
JKQTMathTextWhitespaceNode(parent)
|
||||||
{
|
{
|
||||||
fillSupportedInstructions();
|
whitespace=supportedInstructions()[_type];
|
||||||
whitespace=supportedInstructions[_type];
|
|
||||||
whitespace.count=whitespace.count*count;
|
whitespace.count=whitespace.count*count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +65,6 @@ JKQTMathTextWhitespaceNode::JKQTMathTextWhitespaceNode(Types type, size_t count,
|
|||||||
JKQTMathTextNode(parent),
|
JKQTMathTextNode(parent),
|
||||||
whitespace(type, count)
|
whitespace(type, count)
|
||||||
{
|
{
|
||||||
fillSupportedInstructions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextWhitespaceNode::~JKQTMathTextWhitespaceNode() {
|
JKQTMathTextWhitespaceNode::~JKQTMathTextWhitespaceNode() {
|
||||||
@ -134,31 +131,30 @@ JKQTMathTextNodeSize JKQTMathTextWhitespaceNode::getSizeInternal(QPainter &paint
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<QString, JKQTMathTextWhitespaceNode::WhitespaceProps> JKQTMathTextWhitespaceNode::supportedInstructions;
|
const QHash<QString, JKQTMathTextWhitespaceNode::WhitespaceProps>& JKQTMathTextWhitespaceNode::supportedInstructions() {
|
||||||
|
static QHash<QString, JKQTMathTextWhitespaceNode::WhitespaceProps> table=[]()
|
||||||
void JKQTMathTextWhitespaceNode::fillSupportedInstructions()
|
{
|
||||||
{
|
QHash<QString, JKQTMathTextWhitespaceNode::WhitespaceProps> supportedInstructions;
|
||||||
static std::mutex sMutex;
|
supportedInstructions[" "]=WhitespaceProps(WSTthicker, 1);
|
||||||
std::lock_guard<std::mutex> lock(sMutex);
|
supportedInstructions["nbsp"]=WhitespaceProps(WSTNonbreaking, 1);
|
||||||
if (supportedInstructions.size()==0) {
|
supportedInstructions["enspace"]=WhitespaceProps(WST1en, 1);
|
||||||
supportedInstructions[" "]=WhitespaceProps(WSTthicker, 1);
|
supportedInstructions["enskip"]=WhitespaceProps(WST1en, 1);
|
||||||
supportedInstructions["nbsp"]=WhitespaceProps(WSTNonbreaking, 1);
|
supportedInstructions["quad"]=WhitespaceProps(WSTQuad, 1);
|
||||||
supportedInstructions["enspace"]=WhitespaceProps(WST1en, 1);
|
supportedInstructions["emspace"]=WhitespaceProps(WSTQuad, 1);
|
||||||
supportedInstructions["enskip"]=WhitespaceProps(WST1en, 1);
|
supportedInstructions["qquad"]=WhitespaceProps(WSTQuad, 2);
|
||||||
supportedInstructions["quad"]=WhitespaceProps(WSTQuad, 1);
|
supportedInstructions[","]=WhitespaceProps(WSTthin, 1);
|
||||||
supportedInstructions["emspace"]=WhitespaceProps(WSTQuad, 1);
|
supportedInstructions["thinspace"]=WhitespaceProps(WSTthin, 1);
|
||||||
supportedInstructions["qquad"]=WhitespaceProps(WSTQuad, 2);
|
supportedInstructions[":"]=WhitespaceProps(WSTmedium, 1);
|
||||||
supportedInstructions[","]=WhitespaceProps(WSTthin, 1);
|
supportedInstructions["medspace"]=WhitespaceProps(WSTmedium, 1);
|
||||||
supportedInstructions["thinspace"]=WhitespaceProps(WSTthin, 1);
|
supportedInstructions[";"]=WhitespaceProps(WSTthick, 1);
|
||||||
supportedInstructions[":"]=WhitespaceProps(WSTmedium, 1);
|
supportedInstructions["thickspace"]=WhitespaceProps(WSTthick, 1);
|
||||||
supportedInstructions["medspace"]=WhitespaceProps(WSTmedium, 1);
|
supportedInstructions["!"]=WhitespaceProps(WSTnegthin, 1);
|
||||||
supportedInstructions[";"]=WhitespaceProps(WSTthick, 1);
|
supportedInstructions["negthinspace"]=WhitespaceProps(WSTnegthin, 1);
|
||||||
supportedInstructions["thickspace"]=WhitespaceProps(WSTthick, 1);
|
supportedInstructions["negmedspace"]=WhitespaceProps(WSTnegmedium, 1);
|
||||||
supportedInstructions["!"]=WhitespaceProps(WSTnegthin, 1);
|
supportedInstructions["negthickspace"]=WhitespaceProps(WSTnegthick, 1);
|
||||||
supportedInstructions["negthinspace"]=WhitespaceProps(WSTnegthin, 1);
|
return supportedInstructions;
|
||||||
supportedInstructions["negmedspace"]=WhitespaceProps(WSTnegmedium, 1);
|
}();
|
||||||
supportedInstructions["negthickspace"]=WhitespaceProps(WSTnegthick, 1);
|
return table;
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,8 +208,7 @@ double JKQTMathTextWhitespaceNode::Type2PixelWidth(Types type, JKQTMathTextEnvir
|
|||||||
|
|
||||||
bool JKQTMathTextWhitespaceNode::supportsInstructionName(const QString &instruction)
|
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):
|
JKQTMathTextPhantomNode::JKQTMathTextPhantomNode(JKQTMathText *parent, const QString &mode, JKQTMathTextNode *child):
|
||||||
JKQTMathTextInstruction1Node(parent, mode, child)
|
JKQTMathTextInstruction1Node(parent, mode, child)
|
||||||
{
|
{
|
||||||
fillInstructions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextPhantomNode::JKQTMathTextPhantomNode(JKQTMathText* _parent, Mode mode, JKQTMathTextNode* child):
|
JKQTMathTextPhantomNode::JKQTMathTextPhantomNode(JKQTMathText* _parent, Mode mode, JKQTMathTextNode* child):
|
||||||
JKQTMathTextInstruction1Node(_parent, Mode2Instruction(mode), child)
|
JKQTMathTextInstruction1Node(_parent, Mode2Instruction(mode), child)
|
||||||
{
|
{
|
||||||
fillInstructions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextPhantomNode::~JKQTMathTextPhantomNode() {
|
JKQTMathTextPhantomNode::~JKQTMathTextPhantomNode() {
|
||||||
@ -389,10 +382,9 @@ QString JKQTMathTextPhantomNode::getTypeName() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
JKQTMathTextNodeSize JKQTMathTextPhantomNode::getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const {
|
JKQTMathTextNodeSize JKQTMathTextPhantomNode::getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const {
|
||||||
fillInstructions();
|
|
||||||
JKQTMathTextNodeSize s=getChild()->getSize(painter, currentEv);
|
JKQTMathTextNodeSize s=getChild()->getSize(painter, currentEv);
|
||||||
|
|
||||||
switch(instructions[getInstructionName()]) {
|
switch(instructions()[getInstructionName()]) {
|
||||||
case FMwidth:
|
case FMwidth:
|
||||||
s.overallHeight=0;
|
s.overallHeight=0;
|
||||||
s.baselineHeight=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 {
|
bool JKQTMathTextPhantomNode::toHtml(QString &html, JKQTMathTextEnvironment currentEv, JKQTMathTextEnvironment defaultEv) const {
|
||||||
JKQTMathTextEnvironment ev=currentEv;
|
JKQTMathTextEnvironment ev=currentEv;
|
||||||
fillInstructions();
|
|
||||||
return " ";
|
return " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JKQTMathTextPhantomNode::supportsInstructionName(const QString &instructionName)
|
bool JKQTMathTextPhantomNode::supportsInstructionName(const QString &instructionName)
|
||||||
{
|
{
|
||||||
fillInstructions();
|
return instructions().contains(instructionName);
|
||||||
return instructions.contains(instructionName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<QString, JKQTMathTextPhantomNode::Mode> JKQTMathTextPhantomNode::instructions;
|
const QHash<QString, JKQTMathTextPhantomNode::Mode>& JKQTMathTextPhantomNode::instructions() {
|
||||||
|
static QHash<QString, JKQTMathTextPhantomNode::Mode> table=[]()
|
||||||
void JKQTMathTextPhantomNode::fillInstructions()
|
{
|
||||||
{
|
QHash<QString, JKQTMathTextPhantomNode::Mode> instructions;
|
||||||
static std::mutex sMutex;
|
instructions["phantom"] = FMwidthAndHeight;
|
||||||
std::lock_guard<std::mutex> lock(sMutex);
|
instructions["hphantom"] = FMwidth;
|
||||||
if (instructions.size()>0) return;
|
instructions["vphantom"] = FMheight;
|
||||||
instructions["phantom"] = FMwidthAndHeight;
|
return instructions;
|
||||||
instructions["hphantom"] = FMwidth;
|
}();
|
||||||
instructions["vphantom"] = FMheight;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,10 +100,11 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextWhitespaceNode: public JKQTMathTextNod
|
|||||||
WhitespaceProps whitespace;
|
WhitespaceProps whitespace;
|
||||||
/** \brief converts Types \a type into its HTML representation */
|
/** \brief converts Types \a type into its HTML representation */
|
||||||
static QString Type2HTML(Types type);
|
static QString Type2HTML(Types type);
|
||||||
/** \brief translation table between latex instruction and WhitespaceProps */
|
/** \brief translation table between latex instruction and WhitespaceProps
|
||||||
static QHash<QString, WhitespaceProps> supportedInstructions;
|
*
|
||||||
/** \brief initializes supportedInstructions */
|
* \note This is a customization point for additional whitespace instructions!
|
||||||
static void fillSupportedInstructions();
|
*/
|
||||||
|
static const QHash<QString, WhitespaceProps>& supportedInstructions();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -187,13 +188,11 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextPhantomNode: public JKQTMathTextInstru
|
|||||||
protected:
|
protected:
|
||||||
/** \copydoc JKQTMathTextNode::getSizeInternal() */
|
/** \copydoc JKQTMathTextNode::getSizeInternal() */
|
||||||
virtual JKQTMathTextNodeSize getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const override;
|
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!
|
* \note this is the customization point for new instructions!
|
||||||
*/
|
*/
|
||||||
static void fillInstructions();
|
static const QHash<QString, Mode>& instructions();
|
||||||
/** \brief defines all implemented instructions in this node */
|
|
||||||
static QHash<QString, Mode> instructions;
|
|
||||||
};
|
};
|
||||||
#endif // JKQTMATHTEXTWHITESPACENODE_H
|
#endif // JKQTMATHTEXTWHITESPACENODE_H
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include "jkqtmathtext/jkqtmathtext.h"
|
#include "jkqtmathtext/jkqtmathtext.h"
|
||||||
#include "jkqtplotter/jkqtpkey.h"
|
#include "jkqtplotter/jkqtpkey.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
QString JKQTBasePlotter::globalUserSettigsFilename="";
|
QString JKQTBasePlotter::globalUserSettigsFilename="";
|
||||||
QString JKQTBasePlotter::globalUserSettigsPrefix="";
|
QString JKQTBasePlotter::globalUserSettigsPrefix="";
|
||||||
@ -64,10 +65,11 @@ JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>> JKQTBasePlotter::jkqtpSaveDataAd
|
|||||||
|
|
||||||
void initJKQTBasePlotterResources()
|
void initJKQTBasePlotterResources()
|
||||||
{
|
{
|
||||||
static std::mutex sMutex;
|
static std::once_flag flag;
|
||||||
std::lock_guard<std::mutex> lock(sMutex);
|
std::call_once(flag, []() {
|
||||||
Q_INIT_RESOURCE(jkqtpbaseplotter);
|
Q_INIT_RESOURCE(jkqtpbaseplotter);
|
||||||
initJKQTMathTextResources();
|
initJKQTMathTextResources();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -80,20 +82,20 @@ void JKQTBasePlotter::setDefaultJKQTBasePrinterUserSettings(QString userSettigsF
|
|||||||
|
|
||||||
void JKQTBasePlotter::registerPaintDeviceAdapter(JKQTPPaintDeviceAdapter *adapter)
|
void JKQTBasePlotter::registerPaintDeviceAdapter(JKQTPPaintDeviceAdapter *adapter)
|
||||||
{
|
{
|
||||||
JKQTPSynchronized<QList<JKQTPPaintDeviceAdapter*>>::Locker lock(jkqtpPaintDeviceAdapters);
|
JKQTPSynchronized<QList<JKQTPPaintDeviceAdapter*>>::WriteLocker lock(jkqtpPaintDeviceAdapters);
|
||||||
jkqtpPaintDeviceAdapters.get().append(adapter);
|
jkqtpPaintDeviceAdapters.get().append(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JKQTBasePlotter::deregisterPaintDeviceAdapter(JKQTPPaintDeviceAdapter *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);
|
if (jkqtpPaintDeviceAdapters.get().contains(adapter)) jkqtpPaintDeviceAdapters.get().removeAll(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JKQTBasePlotter::registerSaveDataAdapter(JKQTPSaveDataAdapter *adapter)
|
bool JKQTBasePlotter::registerSaveDataAdapter(JKQTPSaveDataAdapter *adapter)
|
||||||
{
|
{
|
||||||
if (adapter){
|
if (adapter){
|
||||||
JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>>::Locker lock(jkqtpSaveDataAdapters);
|
JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>>::WriteLocker lock(jkqtpSaveDataAdapters);
|
||||||
QString format=adapter->getFilter();
|
QString format=adapter->getFilter();
|
||||||
for (int i=0; i<jkqtpSaveDataAdapters.get().size(); i++) {
|
for (int i=0; i<jkqtpSaveDataAdapters.get().size(); i++) {
|
||||||
if (jkqtpSaveDataAdapters.get()[i] && jkqtpSaveDataAdapters.get()[i]->getFilter()==format) {
|
if (jkqtpSaveDataAdapters.get()[i] && jkqtpSaveDataAdapters.get()[i]->getFilter()==format) {
|
||||||
@ -108,7 +110,7 @@ bool JKQTBasePlotter::registerSaveDataAdapter(JKQTPSaveDataAdapter *adapter)
|
|||||||
|
|
||||||
bool JKQTBasePlotter::deregisterSaveDataAdapter(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);
|
if (jkqtpSaveDataAdapters.get().contains(adapter)) jkqtpSaveDataAdapters.get().removeAll(adapter);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3285,7 +3287,7 @@ bool JKQTBasePlotter::saveData(const QString& filename, const QString &format) {
|
|||||||
|
|
||||||
QMap<QString, QStringList> saveAdapterFileExtensions;
|
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++) {
|
for (int i=0; i<jkqtpSaveDataAdapters.get().size(); i++) {
|
||||||
const QString fid=jkqtpSaveDataAdapters.get()[i]->getFormatID();
|
const QString fid=jkqtpSaveDataAdapters.get()[i]->getFormatID();
|
||||||
fileformats<<jkqtpSaveDataAdapters.get()[i]->getFilter();
|
fileformats<<jkqtpSaveDataAdapters.get()[i]->getFilter();
|
||||||
@ -3371,7 +3373,7 @@ bool JKQTBasePlotter::saveData(const QString& filename, const QString &format) {
|
|||||||
QString fidx=fmt;
|
QString fidx=fmt;
|
||||||
fidx=fidx.remove(0,6);
|
fidx=fidx.remove(0,6);
|
||||||
int idx=fidx.toInt();
|
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]) {
|
if (idx>=0 && idx<jkqtpSaveDataAdapters.get().size() && jkqtpSaveDataAdapters.get()[idx]) {
|
||||||
QStringList columnNames;
|
QStringList columnNames;
|
||||||
const QList<QVector<double> > dataset=datastore->getData(&columnNames);
|
const QList<QVector<double> > dataset=datastore->getData(&columnNames);
|
||||||
@ -3379,7 +3381,7 @@ bool JKQTBasePlotter::saveData(const QString& filename, const QString &format) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>>::Locker lock(jkqtpSaveDataAdapters);
|
JKQTPSynchronized<QList<JKQTPSaveDataAdapter*>>::ReadLocker lock(jkqtpSaveDataAdapters);
|
||||||
for (int i=0; i<jkqtpSaveDataAdapters.get().size(); i++) {
|
for (int i=0; i<jkqtpSaveDataAdapters.get().size(); i++) {
|
||||||
if (fmt == jkqtpSaveDataAdapters.get()[i]->getFormatID()) {
|
if (fmt == jkqtpSaveDataAdapters.get()[i]->getFormatID()) {
|
||||||
QStringList columnNames;
|
QStringList columnNames;
|
||||||
@ -3583,7 +3585,7 @@ bool JKQTBasePlotter::saveImage(const QString& filename, bool displayPreview) {
|
|||||||
// add JKQTPPaintDeviceAdapter exporters
|
// add JKQTPPaintDeviceAdapter exporters
|
||||||
const int filtersIndexFirstExporterPLugin=filterstrings.size();
|
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++) {
|
for (int i=0; i<jkqtpPaintDeviceAdapters.get().size(); i++) {
|
||||||
filterstrings<<jkqtpPaintDeviceAdapters.get()[i]->getFilter();
|
filterstrings<<jkqtpPaintDeviceAdapters.get()[i]->getFilter();
|
||||||
filterextensions<<QStringList();
|
filterextensions<<QStringList();
|
||||||
@ -3635,7 +3637,7 @@ bool JKQTBasePlotter::saveImage(const QString& filename, bool displayPreview) {
|
|||||||
if (idx<0) idx=findExporterByExtension(fnExt);
|
if (idx<0) idx=findExporterByExtension(fnExt);
|
||||||
return idx;
|
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
|
// now we determine whether we selected a jkqtpPaintDeviceAdapters, if not adapterID will be <0
|
||||||
const int adapterID=[&](){
|
const int adapterID=[&](){
|
||||||
int idx=filtID-filtersIndexFirstExporterPLugin;
|
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 |
Loading…
Reference in New Issue
Block a user