diff --git a/examples/jkqtmathtext_test/testform.cpp b/examples/jkqtmathtext_test/testform.cpp
index 86a5a58c6d..7489aa2165 100644
--- a/examples/jkqtmathtext_test/testform.cpp
+++ b/examples/jkqtmathtext_test/testform.cpp
@@ -39,8 +39,17 @@ TestForm::TestForm(QWidget *parent) :
ui->cmbTestset->addItem("arrowtest 2", "$\\nwarrow \\nearrow \\searrow \\swarrow \\mapsto \\leftharpoonup \\rightharpoonup \\upharpoonleft \\downharpoonleft \\leftrightharpoon \\rightleftharpoon \\leftharpoondown \\rightharpoondown \\upharpoonright \\downharpoonright $");
ui->cmbTestset->addItem("math: blackboard", "$\\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
ui->cmbTestset->addItem("math: bf", "$\\mathbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
+ ui->cmbTestset->addItem("math: it", "$\\mathit{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
+ ui->cmbTestset->addItem("math: sf", "$\\mathsf{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
ui->cmbTestset->addItem("math: rm", "$\\mathrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
ui->cmbTestset->addItem("math: cal", "$\\mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
+ ui->cmbTestset->addItem("math: tt", "$\\mathtt{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}$");
+ ui->cmbTestset->addItem("bf", "\\textbf{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}");
+ ui->cmbTestset->addItem("it", "\\textit{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}");
+ ui->cmbTestset->addItem("sf", "\\textsf{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}");
+ ui->cmbTestset->addItem("rm", "\\textrm{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}");
+ ui->cmbTestset->addItem("cal", "\\textcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}");
+ ui->cmbTestset->addItem("tt", "\\texttt{ABCDEFGHIJKLMNOPQRSTUVWXYZ120}");
ui->cmbTestset->addItem("subscript test", "$r_{123}\\ \\ r_{\\frac{1}{2}}$");
ui->cmbTestset->addItem("subscript0 test", "$r_{123}$");
ui->cmbTestset->addItem("subscript1 test", "$r_{123}\\ $");
@@ -254,7 +263,7 @@ QTreeWidgetItem *TestForm::createTree(JKQTMathText::MTnode *node, QTreeWidgetIte
ti->addChild(createTree(list[i], ti));
}
} else if (symN) {
- name=QString("MTsymbolNode: \'%1\'").arg(symN->getSymbolName());
+ name=QString("MTsymbolNode: \'%1\' (%2)").arg(symN->getSymbolName()).arg(symN->getSymbolFontName());
} else if (spN) {
name=QString("MTwhitespaceNode :\'%1\'").arg(txtN->getText());
} else if (txtN) {
@@ -322,19 +331,20 @@ void TestForm::updateMath()
ht.start();
+
mt.setFontRoman(ui->cmbUnicodeSerif->currentFont().family());
- mt.setFontMathRoman(ui->cmbUnicodeSerif->currentFont().family());
mt.setFontSans(ui->cmbUnicodeSans->currentFont().family());
- mt.setFontMathSans(ui->cmbUnicodeSans->currentFont().family());
mt.setFontTypewriter(ui->cmbUnicodeFixed->currentFont().family());
mt.setFontSymbol(ui->cmbUnicodeSymbol->currentFont().family());
+ mt.setFontCaligraphic(ui->cmbCaligraphic->currentFont().family());
switch (ui->cmbFont->currentIndex()) {
case 1: mt.useXITS(); break;
case 2: mt.useSTIX(); break;
- case 3: mt.useAnyUnicode(ui->cmbUnicodeSans->currentFont().family(),ui->cmbUnicodeSerif->currentFont().family()); break;
- case 4: mt.useLatexFonts(ui->edtLatexPrefix->text(), ui->edtLatexPostfix->text()); break;
- case 5: mt.useASANA(); break;
+ case 3: mt.useAnyUnicode(ui->cmbUnicodeSerif->currentFont().family(),ui->cmbUnicodeSans->currentFont().family(), false); break;
+ case 4: mt.useAnyUnicode(ui->cmbUnicodeSerif->currentFont().family(),ui->cmbUnicodeSans->currentFont().family(), true); break;
+ case 5: mt.useLatexFonts(ui->edtLatexPrefix->text(), ui->edtLatexPostfix->text()); break;
+ case 6: mt.useASANA(); break;
}
diff --git a/examples/jkqtmathtext_test/testform.ui b/examples/jkqtmathtext_test/testform.ui
index dfc55d2a8f..cfb9894e2b 100644
--- a/examples/jkqtmathtext_test/testform.ui
+++ b/examples/jkqtmathtext_test/testform.ui
@@ -6,7 +6,7 @@
0
0
- 1238
+ 1518
742
@@ -24,7 +24,7 @@
0
0
- 605
+ 745
616
@@ -104,7 +104,12 @@
-
- Unicode
+ Unicode, limited
+
+
+ -
+
+ Unicode, full
-
@@ -290,7 +295,7 @@
-
- Symbol/Unicode fonts:
+ Symbol/Unicode fonts: rm:
@@ -303,6 +308,13 @@
+ -
+
+
+ sf:
+
+
+
-
@@ -312,6 +324,13 @@
+ -
+
+
+ tt:
+
+
+
-
@@ -321,6 +340,22 @@
+ -
+
+
+ cal:
+
+
+
+ -
+
+
+
+ Script
+
+
+
+
-
diff --git a/lib/jkqtmathtext/jkqtmathtext.cpp b/lib/jkqtmathtext/jkqtmathtext.cpp
index e1f8a3c474..6d5cdcd689 100644
--- a/lib/jkqtmathtext/jkqtmathtext.cpp
+++ b/lib/jkqtmathtext/jkqtmathtext.cpp
@@ -139,14 +139,12 @@ QFont JKQTMathText::MTenvironment::getFont(JKQTMathText* parent) const {
QFont f;
switch (font) {
case MTEsans:
- if (insideMath) f.setFamily(parent->getFontMathSans());
- else f.setFamily(parent->getFontSans());
+ f.setFamily(parent->getFontSans());
break;
case MTEtypewriter: f.setFamily(parent->getFontTypewriter()); break;
case MTEscript: f.setFamily(parent->getFontScript()); break;
case MTEroman:
- if (insideMath) f.setFamily(parent->getFontMathRoman());
- else f.setFamily(parent->getFontRoman());
+ f.setFamily(parent->getFontRoman());
break;
case MTEcaligraphic: f.setFamily(parent->getFontCaligraphic()); break;
case MTEblackboard: f.setFamily(parent->getFontBlackboard()); break;
@@ -386,7 +384,7 @@ QString JKQTMathText::MTtextNode::getTypeName() const
QString JKQTMathText::MTtextNode::textTransform(const QString &text, JKQTMathText::MTenvironment currentEv, bool /*forSize*/)
{
QString txt=text;
- if (parent->getFontEncoding()==MTFEunicode) {
+ if (parent->getFontEncoding()==MTFEunicode || parent->getFontEncoding()==MTFEunicodeLimited) {
if (currentEv.insideMath) {
txt="";
for (int i=0; igetFontEncoding()==MTFEunicode) {
- txt="";
- for (int i=0; igetSubShiftFactor()*tbr.height();
if (prevNodeSize!=nullptr && prevNodeSize->overallHeight-prevNodeSize->baselineHeight>shift) {
- qDebug()<<"oldshift="<overallHeight="<overallHeight<<", prevNodeSize->baselineHeight="<baselineHeight;
+ //qDebug()<<"oldshift="<overallHeight="<overallHeight<<", prevNodeSize->baselineHeight="<baselineHeight;
shift=-1.0*(prevNodeSize->overallHeight-prevNodeSize->baselineHeight-shift);
- qDebug()<<"newshift="< winSymbolSymbol;
- if (winSymbolSymbol.isEmpty()) {
+ if (winSymbolSymbol.isEmpty()) {
winSymbolSymbol.insert("leftrightarrow", QChar(0xAB));
winSymbolSymbol.insert("leftarrow", QChar(0xAC));
winSymbolSymbol.insert("rightarrow", QChar(0xAE));
@@ -2203,7 +2175,7 @@ JKQTMathText::MTsymbolNode::MTsymbolNode(JKQTMathText* parent, const QString& na
winSymbolSymbol.insert("cent", "c");
}
-
+
static QHash unicodeGreek;
if (unicodeGreek.isEmpty()) {
unicodeGreek.insert("alpha", QChar(0x3B1));
@@ -2247,7 +2219,7 @@ JKQTMathText::MTsymbolNode::MTsymbolNode(JKQTMathText* parent, const QString& na
unicodeGreek.insert("Phi", QChar(0x3A6));
unicodeGreek.insert("Psi", QChar(0x3A8));
}
-
+
static QHash unicodeSymbol;
if (unicodeSymbol.isEmpty()) {
unicodeSymbol.insert("leftrightarrow", QChar(0x2194));
@@ -2264,15 +2236,9 @@ JKQTMathText::MTsymbolNode::MTsymbolNode(JKQTMathText* parent, const QString& na
unicodeSymbol.insert("Uparrow", QChar(0x21D1));
unicodeSymbol.insert("Downarrow", QChar(0x21D3));
unicodeSymbol.insert("Updownarrow", QChar(0x21D5));
- unicodeSymbol.insert("pm", QChar(0x00B1));
unicodeSymbol.insert("mp", QChar(0x2213));
- unicodeSymbol.insert("leq", QChar(0x2264));
- unicodeSymbol.insert("geq", QChar(0x2265));
unicodeSymbol.insert("ll", QChar(0x226A));
unicodeSymbol.insert("gg", QChar(0x226B));
- unicodeSymbol.insert("hbar", QChar(0x210F));
- unicodeSymbol.insert("euro", QChar(0x20AC));
- unicodeSymbol.insert("Angstrom", QChar(0x212B));
unicodeSymbol.insert("Alef", QChar(0x2135));
unicodeSymbol.insert("Bet", QChar(0x2136));
unicodeSymbol.insert("Gimel", QChar(0x2137));
@@ -2284,7 +2250,6 @@ JKQTMathText::MTsymbolNode::MTsymbolNode(JKQTMathText* parent, const QString& na
unicodeSymbol.insert("nexists", QChar(0x2204));
unicodeSymbol.insert("ni", QChar(0x220B));
unicodeSymbol.insert("notni", QChar(0x220C));
- unicodeSymbol.insert("circ", QChar(0x2218));
unicodeSymbol.insert("tilde", QChar(0x223C));
unicodeSymbol.insert("emptyset", QChar(0x2300));
unicodeSymbol.insert("varnothing", QChar(0x2300));
@@ -2298,12 +2263,9 @@ JKQTMathText::MTsymbolNode::MTsymbolNode(JKQTMathText* parent, const QString& na
unicodeSymbol.insert("DC", QChar(0x2393));
unicodeSymbol.insert("bot", QChar(0x22A4));
unicodeSymbol.insert("mid", QChar(0xFF5C));
- unicodeSymbol.insert("cdots", QString(QChar(0x00B7)) + QString(QChar(0x00B7)) + QString(QChar(0x00B7)));
unicodeSymbol.insert("vdots", QChar(0x22EE));
unicodeSymbol.insert("iddots", QChar(0x22F0));
unicodeSymbol.insert("ddots", QChar(0x22F1));
- unicodeSymbol.insert("dots", "...");
- unicodeSymbol.insert("ldots", "...");
unicodeSymbol.insert("perthousand", QChar(0x2030));
unicodeSymbol.insert("leftharpoonup", QChar(0x21BC));
unicodeSymbol.insert("rightharpoonup", QChar(0x21C0));
@@ -2320,22 +2282,14 @@ JKQTMathText::MTsymbolNode::MTsymbolNode(JKQTMathText* parent, const QString& na
unicodeSymbol.insert("searrow", QChar(0x2198));
unicodeSymbol.insert("swarrow", QChar(0x2199));
unicodeSymbol.insert("mapsto", QChar(0x21A6));
- unicodeSymbol.insert("cent", QChar(0x00A2));
- unicodeSymbol.insert("pound", QChar(0x00A3));
- unicodeSymbol.insert("yen", QChar(0x00A5));
unicodeSymbol.insert("div", QChar(0x00F7));
unicodeSymbol.insert("multimap", QChar(0x22B8));
unicodeSymbol.insert("maporiginal", QChar(0x22B6));
unicodeSymbol.insert("mapimage", QChar(0x22B7));
unicodeSymbol.insert("benzene", QChar(0x232C));
- unicodeSymbol.insert("times", QChar(0x2A2F));
unicodeSymbol.insert("propto", QChar(0x221D));
- unicodeSymbol.insert("partial", QChar(0x2202));
- unicodeSymbol.insert("bullet", QChar(0x2219));
- unicodeSymbol.insert("neq", QChar(0x2260));
unicodeSymbol.insert("ne", QChar(0x2260));
unicodeSymbol.insert("equiv", QChar(0x2261));
- unicodeSymbol.insert("approx", QChar(0x2245));
unicodeSymbol.insert("ellipsis", QChar(0x2026));
unicodeSymbol.insert("Im", QChar(0x2111));
unicodeSymbol.insert("Re", QChar(0x211C));
@@ -2355,24 +2309,48 @@ JKQTMathText::MTsymbolNode::MTsymbolNode(JKQTMathText* parent, const QString& na
unicodeSymbol.insert("notin", QChar(0x2209));
unicodeSymbol.insert("angle", QChar(0x2221));
unicodeSymbol.insert("nabla", QChar(0x2207));
- unicodeSymbol.insert("copyright", QChar(0x00A9));
- unicodeSymbol.insert("registered", QChar(0x00AE));
- unicodeSymbol.insert("trademark", QChar(0x2122));
- unicodeSymbol.insert("cdot", QChar(0x00B7));
unicodeSymbol.insert("neg", QChar(0x00AC));
unicodeSymbol.insert("wedge", QChar(0x2227));
unicodeSymbol.insert("vee", QChar(0x2228));
- unicodeSymbol.insert("diamond", QChar(0xE0));
unicodeSymbol.insert("langle", QChar(0x2329));
unicodeSymbol.insert("rangle", QChar(0x232A));
- unicodeSymbol.insert("infty", QChar(0x221E));
unicodeSymbol.insert("forall", QChar(0x2200));
unicodeSymbol.insert("exists", QChar(0x2203));
unicodeSymbol.insert("cong", QChar(0x2245));
unicodeSymbol.insert("bot", QChar(0x22A5));
}
-
+
+ static QHash unicodeBaseSymbol;
+ if (unicodeBaseSymbol.isEmpty()) {
+
+ unicodeBaseSymbol.insert("diamond", QChar(0xE0));
+ unicodeBaseSymbol.insert("infty", QChar(0x221E));
+ unicodeBaseSymbol.insert("partial", QChar(0x2202));
+ unicodeBaseSymbol.insert("times", QChar(0x2A2F));
+ unicodeBaseSymbol.insert("bullet", QChar(0x2219));
+ unicodeBaseSymbol.insert("copyright", QChar(0x00A9));
+ unicodeBaseSymbol.insert("registered", QChar(0x00AE));
+ unicodeBaseSymbol.insert("trademark", QChar(0x2122));
+ unicodeBaseSymbol.insert("cdot", QChar(0x00B7));
+ unicodeBaseSymbol.insert("pm", QChar(0x00B1));
+ unicodeBaseSymbol.insert("leq", QChar(0x2264));
+ unicodeBaseSymbol.insert("geq", QChar(0x2265));
+ unicodeBaseSymbol.insert("hbar", QChar(0x210F));
+ unicodeBaseSymbol.insert("euro", QChar(0x20AC));
+ unicodeBaseSymbol.insert("circ", QChar(0x2218));
+ unicodeBaseSymbol.insert("cent", QChar(0x00A2));
+ unicodeBaseSymbol.insert("pound", QChar(0x00A3));
+ unicodeBaseSymbol.insert("yen", QChar(0x00A5));
+ unicodeBaseSymbol.insert("neq", QChar(0x2260));
+ unicodeBaseSymbol.insert("Angstrom", QChar(0x212B));
+ unicodeBaseSymbol.insert("cdots", QString(QChar(0x00B7)) + QString(QChar(0x00B7)) + QString(QChar(0x00B7)));
+ unicodeBaseSymbol.insert("dots", "...");
+ unicodeBaseSymbol.insert("ldots", "...");
+ unicodeBaseSymbol.insert("approx", QChar(0x2248));
+
+ }
+
static QHash latexSimpleSymbol;
if (latexSimpleSymbol.isEmpty()) {
latexSimpleSymbol.insert("_", "_");
@@ -2388,7 +2366,7 @@ JKQTMathText::MTsymbolNode::MTsymbolNode(JKQTMathText* parent, const QString& na
latexSimpleSymbol.insert("glqq", QChar(0x5C));
latexSimpleSymbol.insert("grqq", "\"");
}
-
+
static QHash latexGreek;
if (latexGreek.isEmpty()) {
latexGreek.insert("alpha", QChar(0xAE));
@@ -2437,7 +2415,7 @@ JKQTMathText::MTsymbolNode::MTsymbolNode(JKQTMathText* parent, const QString& na
latexGreek.insert("neg", QChar(0xAC));
latexGreek.insert("star", QChar(0x3F));
}
-
+
static QHash latexSymbol;
if (latexSymbol.isEmpty()) {
latexSymbol.insert("leftrightarrow", QChar(0x24));
@@ -2590,8 +2568,7 @@ JKQTMathText::MTsymbolNode::MTsymbolNode(JKQTMathText* parent, const QString& na
//else if (n=="") { symbol=QChar(); font=MTSFdefault; }
//else if (n=="") symbol=QChar(0x);
}
- }
- else if (parent->getFontEncoding() == MTFEunicode) { // use UNICODE encoding for special characters
+ } else if (parent->getFontEncoding() == MTFEunicode) { // use UNICODE encoding for special characters
// first we start with greek characters
font = MTSFdefault; //MTSFgreek;
//std::cout<<"encoding unicode\n";
@@ -2602,9 +2579,13 @@ JKQTMathText::MTsymbolNode::MTsymbolNode(JKQTMathText* parent, const QString& na
// now we set the symbols from the Symbol font
font = MTSFsymbol;
QHash::iterator itsymbol = unicodeSymbol.find(n);
- if (itsymbol!=unicodeSymbol.end()) {
+ QHash::iterator itbasesymbol = unicodeBaseSymbol.find(n);
+ if (itbasesymbol!=unicodeBaseSymbol.end()) {
+ symbol = itbasesymbol.value();
+ } else if (itsymbol!=unicodeSymbol.end()) {
symbol = itsymbol.value();
- } if (n == "sum") { symbol = QChar(0x2211); heightIsAscent = true; exactAscent = true; }
+ }
+ else if (n == "sum") { symbol = QChar(0x2211); heightIsAscent = true; exactAscent = true; }
else if (n == "prod") { symbol = QChar(0x220F); heightIsAscent = true; exactAscent = true; }
else if (n == "bbC") { symbol = QChar(0x2102); italic = -1; }
else if (n == "bbH") { symbol = QChar(0x210D); italic = -1; }
@@ -2613,17 +2594,17 @@ JKQTMathText::MTsymbolNode::MTsymbolNode(JKQTMathText* parent, const QString& na
else if (n == "bbQ") { symbol = QChar(0x211A); italic = -1; }
else if (n == "bbR") { symbol = QChar(0x211D); italic = -1; }
else if (n == "bbZ") { symbol = QChar(0x2124); italic = -1; }
- else if (n == "iint") { symbol = QChar(0x222C); fontFactor = mathFontFactor; /*yfactor=+0.1;;*/ heightIsAscent = true; exactAscent = true; }
- else if (n == "iiint") { symbol = QChar(0x222D); fontFactor = mathFontFactor; /*yfactor=+0.1;;*/ heightIsAscent = true; exactAscent = true; }
- else if (n == "oint") { symbol = QChar(0x222E); fontFactor = mathFontFactor; /*yfactor=+0.1;;*/ heightIsAscent = true; exactAscent = true; }
- else if (n == "oiint") { symbol = QChar(0x222F); fontFactor = mathFontFactor; /*yfactor=+0.1;;*/ heightIsAscent = true; exactAscent = true; }
- else if (n == "oiiint") { symbol = QChar(0x2230); fontFactor = mathFontFactor; /*yfactor=+0.1;;*/ heightIsAscent = true; exactAscent = true; }
+ else if (n == "iint") { symbol = QChar(0x222C); fontFactor = mathFontFactor; /*yfactor=+0.1;*/ heightIsAscent = true; exactAscent = true; }
+ else if (n == "iiint") { symbol = QChar(0x222D); fontFactor = mathFontFactor; /*yfactor=+0.1;*/ heightIsAscent = true; exactAscent = true; }
+ else if (n == "oint") { symbol = QChar(0x222E); fontFactor = mathFontFactor; /*yfactor=+0.1;*/ heightIsAscent = true; exactAscent = true; }
+ else if (n == "oiint") { symbol = QChar(0x222F); fontFactor = mathFontFactor; /*yfactor=+0.1;*/ heightIsAscent = true; exactAscent = true; }
+ else if (n == "oiiint") { symbol = QChar(0x2230); fontFactor = mathFontFactor; /*yfactor=+0.1;*/ heightIsAscent = true; exactAscent = true; }
else if (n == "coprod") { symbol = QChar(0x2210); heightIsAscent = true; exactAscent = true; }
- else if (n == "bigcap") { symbol = QChar(0x22C2); heightIsAscent = true; exactAscent = true;; heightIsAscent = true; exactAscent = true; }
- else if (n == "bigcup") { symbol = QChar(0x22C3); heightIsAscent = true; exactAscent = true;; heightIsAscent = true; exactAscent = true; }
- else if (n == "bigvee") { symbol = QChar(0x22C1); heightIsAscent = true; exactAscent = true;; heightIsAscent = true; exactAscent = true; }
- else if (n == "bighat") { symbol = QChar(0x22C0); heightIsAscent = true; exactAscent = true;; heightIsAscent = true; exactAscent = true; }
- else if (n == "int") { symbol = QChar(0x222B); fontFactor = mathFontFactor; /*yfactor=+0.1;;*/ heightIsAscent = true; exactAscent = true; }
+ else if (n == "bigcap") { symbol = QChar(0x22C2); heightIsAscent = true; exactAscent = true; heightIsAscent = true; exactAscent = true; }
+ else if (n == "bigcup") { symbol = QChar(0x22C3); heightIsAscent = true; exactAscent = true; heightIsAscent = true; exactAscent = true; }
+ else if (n == "bigvee") { symbol = QChar(0x22C1); heightIsAscent = true; exactAscent = true; heightIsAscent = true; exactAscent = true; }
+ else if (n == "bighat") { symbol = QChar(0x22C0); heightIsAscent = true; exactAscent = true; heightIsAscent = true; exactAscent = true; }
+ else if (n == "int") { symbol = QChar(0x222B); fontFactor = mathFontFactor; /*yfactor=+0.1;*/ heightIsAscent = true; exactAscent = true; }
else { // here are text mode symbols, i.e. bold and italic won't be touched
bold = -1;
@@ -2651,8 +2632,79 @@ JKQTMathText::MTsymbolNode::MTsymbolNode(JKQTMathText* parent, const QString& na
//else if (n=="") { symbol=QChar(); font=MTSFdefault; }
//else if (n=="") symbol=QChar(0x);
}
- }
- else if (parent->getFontEncoding() == MTFElatex) { // use UNICODE encoding for special characters
+ } else if (parent->getFontEncoding() == MTFEunicodeLimited) { // use UNICODE encoding for special characters
+
+ // now we set the symbols from the Symbol font
+ font = MTSFdefault;
+ QHash::iterator itsymbol = unicodeBaseSymbol.find(n);
+ if (itsymbol!=unicodeBaseSymbol.end()) {
+ symbol = itsymbol.value();
+ //qDebug()<<"unicodeBaseSymbol: "<::iterator itgreek = winSymbolGreek.find(n);
+ if (itgreek!=winSymbolGreek.end()) {
+ symbol = itgreek.value();
+ //qDebug()<<"winSymbolGreek: "<::iterator itsymbol = winSymbolSymbol.find(n);
+ if (itsymbol!=winSymbolSymbol.end()) {
+ symbol = itsymbol.value();
+ //qDebug()<<"winSymbolSymbol: "<getFontEncoding() == MTFElatex) { // use UNICODE encoding for special characters
// first we start with greek characters
font = MTSFdefault; //MTSFgreek;
//std::cout<<"encoding unicode\n";
@@ -2719,7 +2771,7 @@ QString JKQTMathText::MTsymbolNode::getTypeName() const
return QLatin1String("MTsymbolNode(")+symbolName+QLatin1String(")");
}
-QFont JKQTMathText::MTsymbolNode::getFontName(symbolFont f, QFont& fi) {
+QFont JKQTMathText::MTsymbolNode::getFontName(symbolFont f, QFont& fi) const {
QFont fr=fi;
switch(f) {
case MTSFgreek: fr.setFamily(parent->getFontGreek()); break;
@@ -3116,6 +3168,21 @@ bool JKQTMathText::MTsymbolNode::toHtml(QString &html, JKQTMathText::MTenvironme
return ok;
}
+QString JKQTMathText::MTsymbolNode::getSymbolFontName() const {
+ QFont f;
+ switch(font) {
+ case MTSFsymbol: return "symbol["+getFontName(font, f).family()+"]";
+ case MTSFgreek: return "greek["+getFontName(font, f).family()+"]";
+ case MTSFbraces: return "braces["+getFontName(font, f).family()+"]";
+ case MTSFintegrals: return "integrals["+getFontName(font, f).family()+"]";
+ case MTSFcaligraphic: return "caligraphic["+getFontName(font, f).family()+"]";
+ case MTSFblackboard: return "blackboard["+getFontName(font, f).family()+"]";
+ default:
+ case MTSFdefault:
+ return "default["+getFontName(font, f).family()+"]";
+ }
+}
+
// --------------------------------------------------------------------------------------------------
// -- implementation of the JKQTMathText methods
@@ -3133,7 +3200,7 @@ JKQTMathText::JKQTMathText(QObject* parent):
QString typewriterFont="typewriter";
QString decorativeFont="decorative";
- QStringList fonts=fontdb.families();
+ QStringList fonts=fontdb.families();
//qDebug()<<"fonts:\n"<parse(lastText)<<"\n "<getErrorList().join("\n")<<"\n\n";
if (!m_mathText->parse(lastText)) {
- qDebug()<<"JKQTMathTextLabel::internalPaint(): parse '"<parse(lastText)<<"\n "<getErrorList().join("\n")<<"\n\n";
+ //qDebug()<<"JKQTMathTextLabel::internalPaint(): parse '"<parse(lastText)<<"\n "<getErrorList().join("\n")<<"\n\n";
}
if (buffer.width()<=0 || buffer.height()<=0) buffer=QPixmap(1000,100);
diff --git a/lib/jkqtmathtext/jkqtmathtext.h b/lib/jkqtmathtext/jkqtmathtext.h
index c56c3e090a..858e283fd4 100644
--- a/lib/jkqtmathtext/jkqtmathtext.h
+++ b/lib/jkqtmathtext/jkqtmathtext.h
@@ -180,8 +180,8 @@ JKQTP_LIB_EXPORT void initJKQTMathTextResources();
\section JKQTMathTextSuppoertedFonts Font Handling
Several fonts are defined as properties to the class:
- - A "roman" font used as the standard font ( setFontRoman() in math-mode setFontMathRoman() )
- - A "sans-serif" font which may be activated with \c \\sf ... ( setFontSans() in math-mode setFontMathSans() )
+ - A "roman" font used as the standard font ( setFontRoman() )
+ - A "sans-serif" font which may be activated with \c \\sf ... ( setFontSans() )
- A "typewriter" font which may be activated with \c \\tt ... ( setFontTypewriter() )
- A "script" font which may be activated with \c \\script ... ( setFontScript() )
- A greek font which is used to display greek letters \c \\alpha ... ( setFontGreek() )
@@ -282,8 +282,11 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
*
setAnyUnicode("Arial", "Arial")
:
\image html jkqtmathparser_arial.png
* setAnyUnicode("Courier New", "Courier New")
:
\image html jkqtmathparser_couriernew.png
* setAnyUnicode("Comic Sans MS", "Comic Sans MS")
:
\image html jkqtmathparser_comicsans.png
+ *
+ * The parameter \a fullMathUnicodeFont specifies, whether the unicode fonts encode also math symbols, or are
+ * limited to latin+greek+basic symbols.
*/
- void useAnyUnicode(QString timesFont=QString(""), const QString& sansFont=QString(""));
+ void useAnyUnicode(QString timesFont=QString(""), const QString& sansFont=QString(""), bool fullMathUnicodeFont=false);
void useLatexFonts(QString prefix=QString(""), const QString& postfix=QString(""));
@@ -296,11 +299,14 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
- \c MTFElatex: This assumes that symbols shal be taken from the CM (computer modern) fonts, used by LaTeX
- \c MTFEunicode: This assumes that symbols shall be taken from a Unicode font
(e.g. the STIX fonts from http://www.stixfonts.org/)
+ - \c MTFEunicodeLimited: This assumes that the fonts used are Unicode, but only offer a limited set of symbols.
+ Especially math symbols are missing from this encoding
.
*/
enum MTfontEncoding {
MTFEwinSymbol,
MTFEunicode,
+ MTFEunicodeLimited,
MTFElatex
};
@@ -335,10 +341,6 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
\see fontRoman for more information */
void setFontRomanOrSpecial(const QString & __value);
- /*! \brief sets the property fontRoman ( \copybrief fontRoman ) to \a __value, or calls useXITS() if \a __value \c =="XITS". calls useSTIX() if \a __value \c =="STIX", ...
-
- \see fontRoman for more information */
- void setFontRomanOrSpecial(const QString & roman, const QString & math);
/*! \copydoc fontRoman \see fontRoman */
inline QString getFontRoman() const
{
@@ -434,26 +436,6 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
{
return this->fontBlackboard;
}
- /*! \copydoc fontMathRoman \see fontMathRoman */
- inline void setFontMathRoman(const QString & __value)
- {
- this->fontMathRoman = __value;
- }
- /*! \copydoc fontMathRoman \see fontMathRoman */
- inline QString getFontMathRoman() const
- {
- return this->fontMathRoman;
- }
- /*! \copydoc fontMathSans \see fontMathSans */
- inline void setFontMathSans(const QString & __value)
- {
- this->fontMathSans = __value;
- }
- /*! \copydoc fontMathSans \see fontMathSans */
- inline QString getFontMathSans() const
- {
- return this->fontMathSans;
- }
/*! \copydoc fontLatexPrefix \see fontLatexPrefix */
inline void setFontLatexPrefix(const QString & __value)
{
@@ -479,10 +461,10 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
{
this->fontEncoding = __value;
}
- /*! \copydoc fontEncoding \see fontEncoding */
+ /*! \copydoc fontEncoding \see fontEncoding */
inline MTfontEncoding getFontEncoding() const
{
- return this->fontEncoding;
+ return this->fontEncoding;
}
/*! \brief returns the property useSTIXfonts ( \copybrief useSTIXfonts ).
\details Description of the parameter useSTIXfonts is: \copydoc useSTIXfonts
.
@@ -859,9 +841,10 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
/*! \brief returns the property symbolName ( \copybrief symbolName ).
\details Description of the parameter symbolName is: \copydoc symbolName
.
\see symbolName for more information */
- inline QString getSymbolName() const {
- return this->symbolName;
+ inline QString getSymbolName() const {
+ return this->symbolName;
}
+ QString getSymbolFontName() const;
protected:
/** \copydoc MTnode::getSizeInternal() */
virtual void getSizeInternal(QPainter& painter, MTenvironment currentEv, double& width, double& baselineHeight, double& overallHeight, double& strikeoutPos, const MTnodeSize* prevNodeSize=nullptr) override;
@@ -872,7 +855,7 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
/** \brief these fonts may be used for symbols */
enum symbolFont { MTSFdefault, MTSFsymbol, MTSFgreek, MTSFbraces, MTSFintegrals, MTSFcaligraphic, MTSFblackboard };
/** \brief changes the font name according to a given symbolFont value */
- QFont getFontName(symbolFont f, QFont& fi);
+ QFont getFontName(symbolFont f, QFont& fi) const;
/** \brief magnification factor for the font size */
symbolFont font;
/** \brief magnification factor for the font size */
@@ -1279,16 +1262,6 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
/*! \brief default value for property fontBlackboard.
\see fontBlackboard for more information */
QString default_fontBlackboard;
- /** \brief roman font for math environment */
- QString fontMathRoman;
- /*! \brief default value for property fontMathRoman.
- \see fontMathRoman for more information */
- QString default_fontMathRoman;
- /** \brief sans font for math environment */
- QString fontMathSans;
- /*! \brief default value for property fontMathSans.
- \see fontMathSans for more information */
- QString default_fontMathSans;
/** \brief prefix for LaTeX fonts */
QString fontLatexPrefix;
/*! \brief default value for property fontLatexPrefix.