IMPROVED JKQTMathText: tokenizing and parsing of text in text-mode: now a lot of accents with commands like \"a, \'e and variants (e.g. {\"a}, \"{a}, ...) are supported now

NEW in JKQTMathText: added \acute{X}, \grave{X}, \acute{X}
This commit is contained in:
jkriege2 2022-07-10 22:01:11 +02:00
parent 24cb74fc06
commit a8da6caf0d
12 changed files with 529 additions and 137 deletions

View File

@ -40,6 +40,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
<li>IMPROVED: added x-correction for sub/superscript above/below/besides integrals</li> <li>IMPROVED: added x-correction for sub/superscript above/below/besides integrals</li>
<li>IMPROVED: rendering of sqrt</li> <li>IMPROVED: rendering of sqrt</li>
<li>IMPROVED: rendering and size calculation of decorations</li> <li>IMPROVED: rendering and size calculation of decorations</li>
<li>IMPROVED: tokenizing and parsing of text in text-mode: now a lot of accents with commands like \"a, \'e and variants (e.g. {\"a}, \"{a}, ...) are supported now</li>
<li>IMPROVED/breaking: refactored symbol node JKQTMathTextSymbolNode and changed font-lookup!</li> <li>IMPROVED/breaking: refactored symbol node JKQTMathTextSymbolNode and changed font-lookup!</li>
<li>IMPROVED/NEW/breaking: refactored whitespace-processing node JKQTMathTextWhitespaceNode, now all major LaTeX whitespace commands are supported properly</li> <li>IMPROVED/NEW/breaking: refactored whitespace-processing node JKQTMathTextWhitespaceNode, now all major LaTeX whitespace commands are supported properly</li>
<li>IMPROVED/NEW/breaking: refactored LaTeX parser in JKQTMathText</li> <li>IMPROVED/NEW/breaking: refactored LaTeX parser in JKQTMathText</li>
@ -56,6 +57,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
<li>NEW: added top-corner (\ulcorner/\urcorner) and bottom-corner brackets (\llcorner/\lrcorner)</li> <li>NEW: added top-corner (\ulcorner/\urcorner) and bottom-corner brackets (\llcorner/\lrcorner)</li>
<li>NEW: added \overbracket and \underbracket</li> <li>NEW: added \overbracket and \underbracket</li>
<li>NEW: added \shaded{color}{...}</li> <li>NEW: added \shaded{color}{...}</li>
<li>NEW: added \acute{X}, \grave{X}, \acute{X}</li>
<li>NEW: added functions to set the font-size in pixels (as alternative to the existing functions that set them in points), implements request <a href="https://github.com/jkriege2/JKQtPlotter/issues/76">#76</a> from <a href="https://github.com/igormironchik">user:igormironchik</a> </li> <li>NEW: added functions to set the font-size in pixels (as alternative to the existing functions that set them in points), implements request <a href="https://github.com/jkriege2/JKQtPlotter/issues/76">#76</a> from <a href="https://github.com/igormironchik">user:igormironchik</a> </li>
</ul> </ul>
</ul> </ul>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -40,6 +40,9 @@
\begin{document} \begin{document}
\begin{itemize} \begin{itemize}
\item\textbf{Text: Umlaute \& fonts: } rm: \textrm{\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S}, sf: \textsf{\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S}, tt: \texttt{\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S}, cal: \textcal{\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S}, scr: \textscr{\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S}, bb: \textbb{\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S}, frak: \textfrak{\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S},
\item\textbf{text: Umlaute}:\"A\"a\`A\`a\'A\'a\^A\^a\~A\~a\r{A}\r{a}\u{A}\u{a}\=A\=a\AA\aa{\AE}{\ae}\v{C}\v{c}\"E\"e\.e\L\l\"O\"o\`O\`o\'O\'o\^O\^o\~O\~o\O\o{\OE}{\ae}\v{S}\v{s}\ss\"U\"u\`U\`u\'U\'u\^U\^u\~U\~u
\item\textbf{math: Umlaute and fonts} base: $\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S$, rm: $\mathrm{\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S}$, sf: $\mathsf{\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S}$, tt: $\mathtt{\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S}$, cal: $\mathcal{\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S}$, scr: $\mathscr{\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S}$, bb: $\mathbb{\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S}$, frak: $\mathfrak{\"Aq{\"u}\"{a}t{\oe}r00, 123-45+6.0\%\S}$
\item\textbf{std dev:} \[\sigma_x=\sqrt{\langle (x-\langle x\rangle)^2\rangle}=\sqrt{\frac{1}{N-1}\cdot\left( \sum_{i=1}^N{x_i}^2-\frac{1}{N}\cdot\left(\sum_{i=1}^Nx_i\right)^2\right)} \] \item\textbf{std dev:} \[\sigma_x=\sqrt{\langle (x-\langle x\rangle)^2\rangle}=\sqrt{\frac{1}{N-1}\cdot\left( \sum_{i=1}^N{x_i}^2-\frac{1}{N}\cdot\left(\sum_{i=1}^Nx_i\right)^2\right)} \]
\item\textbf{std dev 2:} \[\sigma_x=\sqrt{\langle (x-\langle x\rangle)^2\rangle}=\sqrt{\frac{1}{N-1}\cdot\left( \sum_{i=1}^Nx_i^2-\frac{1}{N}\cdot\left(\sum_{i=1}^Nx_i\right)^2\right)} \] \item\textbf{std dev 2:} \[\sigma_x=\sqrt{\langle (x-\langle x\rangle)^2\rangle}=\sqrt{\frac{1}{N-1}\cdot\left( \sum_{i=1}^Nx_i^2-\frac{1}{N}\cdot\left(\sum_{i=1}^Nx_i\right)^2\right)} \]

View File

@ -20,8 +20,18 @@ TestForm::TestForm(QWidget *parent) :
ui(new Ui::TestForm) ui(new Ui::TestForm)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->cmbTestset->addItem("text: fonts", "rm: \\textrm{ABCabc123}, sf: \\textsf{ABCabc123}, tt: \\texttt{ABCabc123}, cal: \\textcal{ABCabc123}, scr: \\textscr{ABCabc123}, bb: \\textbb{ABCabc123}, frak: \\textfrak{ABCabc123}, "); const QString testText="ABCabc00, 123-45+6.0\\%\\S";
ui->cmbTestset->addItem("math-fonts", "rm: $\\mathrm{ABCabc123}$, sf: $\\mathsf{ABCabc123}$, tt: $\\mathtt{ABCabc123}$, cal: $\\mathcal{ABCabc123}$, scr: $\\mathscr{ABCabc123}$, bb: $\\mathbb{ABCabc123}$, frak: $\\mathfrak{ABCabc123}$, "); const QString umla="\\\"A\\\"a\\`A\\`a\\'A\\'a\\^A\\^a\\~A\\~a\\r{A}\\r{a}\\u{A}\\u{a}\\=A\\=a\\AA\\aa{\\AE}{\\ae}\\v{C}\\v{c}\\\"E\\\"e\\.e\\L\\l\\\"O\\\"o\\`O\\`o\\'O\\'o\\^O\\^o\\~O\\~o\\O\\o{\\OE}{\\ae}\\v{S}\\v{s}\\ss\\\"U\\\"u\\`U\\`u\\'U\\'u\\^U\\^u\\~U\\~u";
const QString testTextUmla="\\\"Aq{\\\"u}\\\"{a}t{\\oe}r00, 123-45+6.0\\%\\S";
const QString umla_math="\\ddot{A}\\ddot{a}\\grave{A}\\grave{a}\\acute{A}\\acute{a}\\hat{A}\\hat{a}\\tilde{A}\\tilde{a}\\r{A}\\r{a}\\u{A}\\u{a}\\bar{A}\\bar{a}\\AA\\aa{\\AE}{\\ae}\\check{C}\\check{c}\\ddot{E}\\ddot{e}\\dot{e}\\L\\l\\ddot{O}\\ddot{o}\\grave{O}\\grave{o}\\acute{O}\\acute{o}\\hat{O}\\hat{o}\\tilde{O}\\tilde{o}\\O\\o{\\OE}{\\ae}\\check{S}\\check{s}\\ss\\ddot{U}\\ddot{u}\\grave{U}\\grave{u}\\acute{U}\\acute{u}\\hat{U}\\hat{u}\\tilde{U}\\tilde{u}";
const QString testTextUmla_math="\\ddot{A}q{\\ddot{u}}\\ddot{{}a}t{\\oe}r00, 123-45+6.0\\%\\S";
ui->cmbTestset->addItem("text: fonts", "rm: \\textrm{"+testText+"}, sf: \\textsf{"+testText+"}, tt: \\texttt{"+testText+"}, cal: \\textcal{"+testText+"}, scr: \\textscr{"+testText+"}, bb: \\textbb{"+testText+"}, frak: \\textfrak{"+testText+"}, ");
ui->cmbTestset->addItem("text: umlaute", umla);
ui->cmbTestset->addItem("text: umlaute and fonts", "rm: \\textrm{"+testTextUmla+"}, sf: \\textsf{"+testTextUmla+"}, tt: \\texttt{"+testTextUmla+"}, cal: \\textcal{"+testTextUmla+"}, scr: \\textscr{"+testTextUmla+"}, bb: \\textbb{"+testTextUmla+"}, frak: \\textfrak{"+testTextUmla+"}, ");
ui->cmbTestset->addItem("math: fonts", "base: $"+testText+"$, rm: $\\mathrm{"+testText+"}$, sf: $\\mathsf{"+testText+"}$, tt: $\\mathtt{"+testText+"}$, cal: $\\mathcal{"+testText+"}$, scr: $\\mathscr{"+testText+"}$, bb: $\\mathbb{"+testText+"}$, frak: $\\mathfrak{"+testText+"}$, ");
ui->cmbTestset->addItem("math: umlaute", "$"+umla_math+"$");
ui->cmbTestset->addItem("math: umlaute and \\text{...}", "\\${\\backslash}text{...}\\$: $\\text{"+umla+"}\\ \\ \\ \\$...\\$: "+umla+"$");
ui->cmbTestset->addItem("math: umlaute and fonts", "base: $"+testTextUmla_math+"$, rm: $\\mathrm{"+testTextUmla_math+"}$, sf: $\\mathsf{"+testTextUmla_math+"}$, tt: $\\mathtt{"+testTextUmla_math+"}$, cal: $\\mathcal{"+testTextUmla_math+"}$, scr: $\\mathscr{"+testTextUmla_math+"}$, bb: $\\mathbb{"+testTextUmla_math+"}$, frak: $\\mathfrak{"+testTextUmla_math+"}$, ");
ui->cmbTestset->addItem("math: simple relations", "$a{\\leq}b$, $a{\\geq}b$, $a{\\equiv}b$, $a=b$, $a{\\neq}b$, $a<b$, $a>b$"); ui->cmbTestset->addItem("math: simple relations", "$a{\\leq}b$, $a{\\geq}b$, $a{\\equiv}b$, $a=b$, $a{\\neq}b$, $a<b$, $a>b$");
const auto wsExample=[](const QStringList& spaces, const QString before, const QString& after)->QString { const auto wsExample=[](const QStringList& spaces, const QString before, const QString& after)->QString {
QString s; QString s;
@ -57,7 +67,7 @@ TestForm::TestForm(QWidget *parent) :
ui->cmbTestset->addItem("text 1", "text \\mathbf{bold}"); ui->cmbTestset->addItem("text 1", "text \\mathbf{bold}");
ui->cmbTestset->addItem("text 2", "text \\mathbf{bold}\\textcolor{red}{RED}"); ui->cmbTestset->addItem("text 2", "text \\mathbf{bold}\\textcolor{red}{RED}");
const auto mathDecoExample=[](const QString& deco)->QString { return "\\"+deco+"{x}\\"+deco+"{i}\\"+deco+"{X}\\"+deco+"{\\psi}\\"+deco+"{abc}"; }; const auto mathDecoExample=[](const QString& deco)->QString { return "\\"+deco+"{x}\\"+deco+"{i}\\"+deco+"{X}\\"+deco+"{\\psi}\\"+deco+"{abc}"; };
ui->cmbTestset->addItem("decoration: math", "$"+mathDecoExample("vec")+" -- "+mathDecoExample("dot")+" -- "+mathDecoExample("ddot")+" -- "+mathDecoExample("ocirc")+" -- "+mathDecoExample("overline")+" -- "+mathDecoExample("underline")+" -- "+mathDecoExample("hat")+" -- "+mathDecoExample("widehat")+" -- "+mathDecoExample("check")+" -- "+mathDecoExample("widecheck")+" -- "+mathDecoExample("breve")+" -- "+mathDecoExample("tilde")+" -- "+mathDecoExample("widetilde")+" -- "+mathDecoExample("uul")+" -- "+mathDecoExample("ool")+" -- "+mathDecoExample("bar")+" -- "+mathDecoExample("arrow")+" -- "+mathDecoExample("cancel")+" -- "+mathDecoExample("bcancel")+" -- "+mathDecoExample("xcancel")+" -- "+mathDecoExample("sout")+"$"); ui->cmbTestset->addItem("decoration: math", "$"+mathDecoExample("vec")+" -- "+mathDecoExample("grave")+" -- "+mathDecoExample("acute")+" -- "+mathDecoExample("dot")+" -- "+mathDecoExample("ddot")+" -- "+mathDecoExample("ocirc")+" -- "+mathDecoExample("overline")+" -- "+mathDecoExample("underline")+" -- "+mathDecoExample("hat")+" -- "+mathDecoExample("widehat")+" -- "+mathDecoExample("check")+" -- "+mathDecoExample("widecheck")+" -- "+mathDecoExample("breve")+" -- "+mathDecoExample("tilde")+" -- "+mathDecoExample("widetilde")+" -- "+mathDecoExample("uul")+" -- "+mathDecoExample("ool")+" -- "+mathDecoExample("bar")+" -- "+mathDecoExample("arrow")+" -- "+mathDecoExample("cancel")+" -- "+mathDecoExample("bcancel")+" -- "+mathDecoExample("xcancel")+" -- "+mathDecoExample("sout")+"$");
ui->cmbTestset->addItem("decoration: text", "Text \\ul{underlined Text Equator} -- \\ol{overlined Text Equator} -- \\sout{striked out Text Equator} -- \\cancel{canceled out Text Equator} -- \\bcancel{b-canceled out Text Equator} -- \\xcancel{x-canceled out Text Equator}"); ui->cmbTestset->addItem("decoration: text", "Text \\ul{underlined Text Equator} -- \\ol{overlined Text Equator} -- \\sout{striked out Text Equator} -- \\cancel{canceled out Text Equator} -- \\bcancel{b-canceled out Text Equator} -- \\xcancel{x-canceled out Text Equator}");
ui->cmbTestset->addItem("mathtest", "This is normal text: $this is math:\\langle r^2(\\tau)\\rangle=\\left\\langle (\\vec{r}(t)-\\vec{r}(t+\\tau) )^2\\right\\rangle\\ \\ \\ g(\\tau)=\\frac{1}{N}\\cdot\\left(1+\\frac{2}{3}\\frac{\\langle r^2(\\tau)\\rangle}{w_{xy}^2}\\right)^{-1} \\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\left\\{\\vec{a}\\left|\\|\\vec{a}\\|_2\\geq2\\right.\\right\\} \\vec{r}\\vec{R}\\frac{\\sqrt{\\sqrt{\\sqrt{\\sum_{i=0}^\\infty \\hat{i}^2}+y^\\alpha}+1}}{\\dot{v}\\equiv\\ddot{r}}\\argmin_{\\vec{k}}\\sum_{\\sqrt{i}=0}^{N}\\int_{x_0}^{x_1}\\left(\\left(\\left(x\\right)\\right)\\right)\\underbrace{\\left[\\left\\{\\frac{\\partial f}{\\partial x}\\right\\}\\cdot\\frac{1}{2}\\right]}{\\text{underbraced text \\hbar}}\\cdots\\frac{\\sqrt{\\sum_{i=0}^2 \\hat{i}^2}+y^\\alpha}{\\dot{v}\\equiv\\ddot{r}}, \\hat{t}\\hat{T} \\overbrace{\\left|\\sqrt{x\\cdot Y}\\right|}{\\propto\\bbN\\circ\\bbZ} \\left<\\arrow{x(\\tau)}\\cdot\\vec{R}(t+\\bar{\\tau})\\right> \\alpha\\beta\\gamma\\delta\\epsilon\\Gamma\\Delta\\Theta\\Omega \\left\\_\\left~\\cbrt{\\hbar\\omega}\\right~\\right\\_$"); ui->cmbTestset->addItem("mathtest", "This is normal text: $this is math:\\langle r^2(\\tau)\\rangle=\\left\\langle (\\vec{r}(t)-\\vec{r}(t+\\tau) )^2\\right\\rangle\\ \\ \\ g(\\tau)=\\frac{1}{N}\\cdot\\left(1+\\frac{2}{3}\\frac{\\langle r^2(\\tau)\\rangle}{w_{xy}^2}\\right)^{-1} \\lfloor\\rfloor\\lceil\\rceil\\langle\\rangle\\left\\{\\vec{a}\\left|\\|\\vec{a}\\|_2\\geq2\\right.\\right\\} \\vec{r}\\vec{R}\\frac{\\sqrt{\\sqrt{\\sqrt{\\sum_{i=0}^\\infty \\hat{i}^2}+y^\\alpha}+1}}{\\dot{v}\\equiv\\ddot{r}}\\argmin_{\\vec{k}}\\sum_{\\sqrt{i}=0}^{N}\\int_{x_0}^{x_1}\\left(\\left(\\left(x\\right)\\right)\\right)\\underbrace{\\left[\\left\\{\\frac{\\partial f}{\\partial x}\\right\\}\\cdot\\frac{1}{2}\\right]}{\\text{underbraced text \\hbar}}\\cdots\\frac{\\sqrt{\\sum_{i=0}^2 \\hat{i}^2}+y^\\alpha}{\\dot{v}\\equiv\\ddot{r}}, \\hat{t}\\hat{T} \\overbrace{\\left|\\sqrt{x\\cdot Y}\\right|}{\\propto\\bbN\\circ\\bbZ} \\left<\\arrow{x(\\tau)}\\cdot\\vec{R}(t+\\bar{\\tau})\\right> \\alpha\\beta\\gamma\\delta\\epsilon\\Gamma\\Delta\\Theta\\Omega \\left\\_\\left~\\cbrt{\\hbar\\omega}\\right~\\right\\_$");
ui->cmbTestset->addItem("math: upper/lower parantheses test:", "$\\text{bblabla} \\frac{1}{2}\\cdot\\left(\\frac{1}{\\mathrm{e}^x+\\mathrm{e}^{-x}}\\right)\\cdot\\left(\\frac{1}{\\frac{1+2}{5+x}}\\right)\\cdot\\left(\\frac{1}{\\exp\\left[-\\frac{y^2}{\\sqrt{x}}\\right]\\cdot\\exp\\left[-\\frac{1}{\\frac{1}{2}}\\right]}\\right) $"); ui->cmbTestset->addItem("math: upper/lower parantheses test:", "$\\text{bblabla} \\frac{1}{2}\\cdot\\left(\\frac{1}{\\mathrm{e}^x+\\mathrm{e}^{-x}}\\right)\\cdot\\left(\\frac{1}{\\frac{1+2}{5+x}}\\right)\\cdot\\left(\\frac{1}{\\exp\\left[-\\frac{y^2}{\\sqrt{x}}\\right]\\cdot\\exp\\left[-\\frac{1}{\\frac{1}{2}}\\right]}\\right) $");

View File

@ -996,16 +996,288 @@ JKQTMathText::tokenType JKQTMathText::getToken() {
static QSet<QChar> TokenCharacters; static QSet<QChar> TokenCharacters;
static QSet<QChar> mathEnvironmentSpecialChars, mathEnvironmentSpecialEndChars; static QSet<QChar> mathEnvironmentSpecialChars, mathEnvironmentSpecialEndChars;
static QSet<QChar> SingleCharInstructions; static QSet<QChar> SingleCharInstructions;
static QHash<QString, QChar> accentLetters;
static QSet<int> accentLetters_LenBackslash;
static QSet<int> accentLetters_LenCurly;
if (TokenCharacters.size()==0) { if (TokenCharacters.size()==0) {
mathEnvironmentSpecialChars<<'(' << '[' << '|' << ')' << ']' << '+' << '-' << '*' << '/' << '<' << '>' << '='; mathEnvironmentSpecialChars<<'(' << '[' << '|' << ')' << ']' << '+' << '-' << '*' << '/' << '<' << '>' << '=';
mathEnvironmentSpecialEndChars<<'(' << '&' << '[' << '|' << ')' << ']' << '\\' << '$' << '{' << '}' << '_' << '^' << '+' << '-' << '/' << '*' << '=' << '<' << '>'; mathEnvironmentSpecialEndChars<<'(' << '&' << '[' << '|' << ')' << ']' << '\\' << '$' << '{' << '}' << '_' << '^' << '+' << '-' << '/' << '*' << '=' << '<' << '>';
TokenCharacters<<'_'<<'^'<<'\\'<<'$'<<'&'<<'}'<<'{'<<'['<<']'; TokenCharacters<<'_'<<'^'<<'\\'<<'$'<<'&'<<'}'<<'{'<<'['<<']';
SingleCharInstructions<<'|'<<';'<<':'<<'!'<<','<<'_'<<'\\'<<'$'<<'%'<<'&'<<'#'<<'}'<<'{'<<' '<<'['<<']'; SingleCharInstructions<<'|'<<';'<<':'<<'!'<<','<<'_'<<'\\'<<'$'<<'%'<<'&'<<'#'<<'}'<<'{'<<' '<<'['<<']';
auto fAddUml=[](const QString& cmd, const QChar& letter, const QChar& ch) {
QString i;
if (cmd.size()>0 && !letter.isNull()) {
i="\\"+cmd+letter;
accentLetters[i]=ch; accentLetters_LenBackslash.insert(i.size());
i="{\\"+cmd+letter+"}";
accentLetters[i]=ch; accentLetters_LenCurly.insert(i.size());
i="\\"+cmd+"{"+letter+"}";
accentLetters[i]=ch; accentLetters_LenBackslash.insert(i.size());
} else if (cmd.size()>0 && letter.isNull()) {
i="\\"+cmd+" ";
accentLetters[i]=ch; accentLetters_LenBackslash.insert(i.size());
i="\\"+cmd+"\t";
accentLetters[i]=ch; accentLetters_LenBackslash.insert(i.size());
i="\\"+cmd+"\n";
accentLetters[i]=ch; accentLetters_LenBackslash.insert(i.size());
i="\\"+cmd+"\\";
accentLetters[i]=ch; accentLetters_LenBackslash.insert(i.size());
i="{\\"+cmd+"}";
accentLetters[i]=ch; accentLetters_LenCurly.insert(i.size());
}
};
// instructions like \"{a}
fAddUml("\"", 'A', QChar(0xC4));
fAddUml("\"", 'E', QChar(0xCB));
fAddUml("\"", 'I', QChar(0xCF));
fAddUml("\"", 'O', QChar(0xD6));
fAddUml("\"", 'U', QChar(0xDC));
fAddUml("\"", 'Y', QChar(0x178));
fAddUml("\"", 'a', QChar(0xE4));
fAddUml("\"", 'e', QChar(0xEB));
fAddUml("\"", 'i', QChar(0xEF));
fAddUml("\"", 'o', QChar(0xF6));
fAddUml("\"", 'u', QChar(0xFC));
fAddUml("\"", 'y', QChar(0xFF));
fAddUml("'", 'A', QChar(0xC1));
fAddUml("'", 'E', QChar(0xC9));
fAddUml("'", 'I', QChar(0xCD));
fAddUml("'", 'O', QChar(0xD3));
fAddUml("'", 'U', QChar(0xDA));
fAddUml("'", 'Y', QChar(0xDD));
fAddUml("'", 'a', QChar(0xE1));
fAddUml("'", 'e', QChar(0xE9));
fAddUml("'", 'i', QChar(0xED));
fAddUml("'", 'o', QChar(0xF3));
fAddUml("'", 'u', QChar(0xFA));
fAddUml("'", 'y', QChar(0xFD));
fAddUml("'", 'C', QChar(0x106));
fAddUml("'", 'c', QChar(0x107));
fAddUml("'", 'L', QChar(0x139));
fAddUml("'", 'l', QChar(0x13A));
fAddUml("'", 'N', QChar(0x143));
fAddUml("'", 'n', QChar(0x144));
fAddUml("'", 'R', QChar(0x154));
fAddUml("'", 'r', QChar(0x155));
fAddUml("'", 'S', QChar(0x15A));
fAddUml("'", 's', QChar(0x15B));
fAddUml("'", 'Z', QChar(0x179));
fAddUml("'", 'z', QChar(0x17A));
fAddUml("'", 'G', QChar(0x1F4));
fAddUml("'", 'g', QChar(0x1F5));
fAddUml("`", 'A', QChar(0xC0));
fAddUml("`", 'E', QChar(0xC8));
fAddUml("`", 'I', QChar(0xCC));
fAddUml("`", 'O', QChar(0xD2));
fAddUml("`", 'U', QChar(0xD9));
fAddUml("`", 'a', QChar(0xE0));
fAddUml("`", 'e', QChar(0xE8));
fAddUml("`", 'i', QChar(0xEC));
fAddUml("`", 'o', QChar(0xF2));
fAddUml("`", 'u', QChar(0xF9));
fAddUml("`", 'N', QChar(0x1F8));
fAddUml("`", 'n', QChar(0x1F9));
fAddUml("^", 'A', QChar(0xC2));
fAddUml("^", 'E', QChar(0xCA));
fAddUml("^", 'I', QChar(0xCE));
fAddUml("^", 'O', QChar(0xD4));
fAddUml("^", 'U', QChar(0xDB));
fAddUml("^", 'a', QChar(0xE2));
fAddUml("^", 'e', QChar(0xEA));
fAddUml("^", 'i', QChar(0xEE));
fAddUml("^", 'o', QChar(0xF4));
fAddUml("^", 'u', QChar(0xFB));
fAddUml("^", 'C', QChar(0x108));
fAddUml("^", 'c', QChar(0x109));
fAddUml("^", 'G', QChar(0x11C));
fAddUml("^", 'g', QChar(0x11D));
fAddUml("^", 'H', QChar(0x124));
fAddUml("^", 'h', QChar(0x125));
fAddUml("^", 'J', QChar(0x134));
fAddUml("^", 'j', QChar(0x135));
fAddUml("^", 'S', QChar(0x15C));
fAddUml("^", 's', QChar(0x15D));
fAddUml("^", 'W', QChar(0x174));
fAddUml("^", 'w', QChar(0x175));
fAddUml("^", 'Y', QChar(0x176));
fAddUml("^", 'y', QChar(0x177));
fAddUml("v", 'C', QChar(0x10C));
fAddUml("v", 'c', QChar(0x10D));
fAddUml("v", 'D', QChar(0x10E));
fAddUml("v", 'd', QChar(0x10F));
fAddUml("v", 'E', QChar(0x11A));
fAddUml("v", 'e', QChar(0x11B));
fAddUml("v", 'L', QChar(0x13D));
fAddUml("v", 'l', QChar(0x13E));
fAddUml("v", 'N', QChar(0x147));
fAddUml("v", 'n', QChar(0x148));
fAddUml("v", 'R', QChar(0x158));
fAddUml("v", 'r', QChar(0x159));
fAddUml("v", 'S', QChar(0x160));
fAddUml("v", 's', QChar(0x161));
fAddUml("v", 'T', QChar(0x164));
fAddUml("v", 't', QChar(0x165));
fAddUml("v", 'Z', QChar(0x17D));
fAddUml("v", 'z', QChar(0x17E));
fAddUml("v", 'A', QChar(0x1CD));
fAddUml("v", 'a', QChar(0x1CE));
fAddUml("v", 'I', QChar(0x1CF));
fAddUml("v", 'i', QChar(0x1D0));
fAddUml("v", 'O', QChar(0x1D1));
fAddUml("v", 'o', QChar(0x1D2));
fAddUml("v", 'U', QChar(0x1D3));
fAddUml("v", 'u', QChar(0x1D4));
fAddUml("v", 'G', QChar(0x1E6));
fAddUml("v", 'g', QChar(0x1E7));
fAddUml("v", 'K', QChar(0x1E8));
fAddUml("v", 'k', QChar(0x1E9));
fAddUml("v", 'j', QChar(0x1F0));
fAddUml("v", 'H', QChar(0x21E));
fAddUml("v", 'h', QChar(0x21F));
fAddUml("~", 'A', QChar(0xC3));
fAddUml("~", 'N', QChar(0xD1));
fAddUml("~", 'O', QChar(0xD5));
fAddUml("~", 'a', QChar(0xE3));
fAddUml("~", 'n', QChar(0xF1));
fAddUml("~", 'o', QChar(0xF5));
fAddUml("~", 'I', QChar(0x128));
fAddUml("~", 'i', QChar(0x129));
fAddUml("~", 'U', QChar(0x168));
fAddUml("~", 'u', QChar(0x169));
fAddUml("r", 'A', QChar(0xC5));
fAddUml("r", 'a', QChar(0xE5));
fAddUml("r", 'U', QChar(0x16E));
fAddUml("r", 'u', QChar(0x16F));
fAddUml("=", 'A', QChar(0xC2));
fAddUml("=", 'E', QChar(0xCA));
fAddUml("=", 'I', QChar(0xCE));
fAddUml("=", 'O', QChar(0xD4));
fAddUml("=", 'U', QChar(0xDB));
fAddUml("=", 'a', QChar(0xE2));
fAddUml("=", 'e', QChar(0xEA));
fAddUml("=", 'i', QChar(0xEE));
fAddUml("=", 'o', QChar(0xF4));
fAddUml("=", 'u', QChar(0xFB));
fAddUml("=", 'Y', QChar(0x108));
fAddUml("=", 'y', QChar(0x109));
fAddUml(".", 'C', QChar(0x10A));
fAddUml(".", 'c', QChar(0x10B));
fAddUml(".", 'E', QChar(0x116));
fAddUml(".", 'e', QChar(0x117));
fAddUml(".", 'G', QChar(0x120));
fAddUml(".", 'g', QChar(0x121));
fAddUml(".", 'I', QChar(0x130));
fAddUml(".", 'Z', QChar(0x17B));
fAddUml(".", 'z', QChar(0x17C));
fAddUml(".", 'A', QChar(0x226));
fAddUml(".", 'a', QChar(0x227));
fAddUml(".", 'O', QChar(0x22E));
fAddUml(".", 'o', QChar(0x22F));
fAddUml(".", 'B', QChar(0x1E02));
fAddUml(".", 'b', QChar(0x1E03));
fAddUml(".", 'D', QChar(0x1E0A));
fAddUml(".", 'd', QChar(0x1E0B));
fAddUml(".", 'F', QChar(0x1E1E));
fAddUml(".", 'f', QChar(0x1E1F));
fAddUml(".", 'H', QChar(0x1E22));
fAddUml(".", 'h', QChar(0x1E23));
fAddUml(".", 'M', QChar(0x1E40));
fAddUml(".", 'm', QChar(0x1E41));
fAddUml(".", 'N', QChar(0x1E44));
fAddUml(".", 'n', QChar(0x1E45));
fAddUml(".", 'P', QChar(0x1E56));
fAddUml(".", 'p', QChar(0x1E57));
fAddUml(".", 'R', QChar(0x1E58));
fAddUml(".", 'r', QChar(0x1E59));
fAddUml(".", 'S', QChar(0x1E60));
fAddUml(".", 's', QChar(0x1E61));
fAddUml(".", 'T', QChar(0x1E6A));
fAddUml(".", 't', QChar(0x1E6B));
fAddUml(".", 'W', QChar(0x1E86));
fAddUml(".", 'w', QChar(0x1E87));
fAddUml(".", 'X', QChar(0x1E8A));
fAddUml(".", 'x', QChar(0x1E8B));
fAddUml(".", 'Y', QChar(0x1E8E));
fAddUml(".", 'y', QChar(0x1E8F));
fAddUml("u", 'A', QChar(0x102));
fAddUml("u", 'a', QChar(0x103));
fAddUml("u", 'E', QChar(0x114));
fAddUml("u", 'e', QChar(0x115));
fAddUml("u", 'G', QChar(0x11E));
fAddUml("u", 'g', QChar(0x11F));
fAddUml("u", 'I', QChar(0x12C));
fAddUml("u", 'i', QChar(0x12D));
fAddUml("u", 'O', QChar(0x14E));
fAddUml("u", 'o', QChar(0x14F));
fAddUml("u", 'U', QChar(0x16C));
fAddUml("u", 'u', QChar(0x16D));
fAddUml("c", 'C', QChar(0xC7));
fAddUml("c", 'c', QChar(0xE7));
fAddUml("c", 'G', QChar(0x122));
fAddUml("c", 'g', QChar(0x123));
fAddUml("c", 'K', QChar(0x136));
fAddUml("c", 'k', QChar(0x137));
fAddUml("c", 'L', QChar(0x13B));
fAddUml("c", 'l', QChar(0x13C));
fAddUml("c", 'N', QChar(0x145));
fAddUml("c", 'n', QChar(0x146));
fAddUml("c", 'R', QChar(0x156));
fAddUml("c", 'r', QChar(0x157));
fAddUml("c", 'S', QChar(0x15E));
fAddUml("c", 's', QChar(0x15F));
fAddUml("c", 'T', QChar(0x162));
fAddUml("c", 't', QChar(0x163));
fAddUml("c", 'E', QChar(0x228));
fAddUml("c", 'e', QChar(0x229));
fAddUml("c", 'D', QChar(0x1E10));
fAddUml("c", 'd', QChar(0x1E11));
fAddUml("c", 'H', QChar(0x1E28));
fAddUml("c", 'h', QChar(0x1E29));
// ligatures, instructions without {letter}
fAddUml("ss", QChar(), QChar(0xDF));
fAddUml("ae", QChar(), QChar(0xE6));
fAddUml("AE", QChar(), QChar(0xC6));
fAddUml("oe", QChar(), QChar(0x153));
fAddUml("OE", QChar(), QChar(0x152));
fAddUml("o", QChar(), QChar(0xF8));
fAddUml("O", QChar(), QChar(0xD8));
fAddUml("S", QChar(), QChar(0xA7));
fAddUml("l", QChar(), QChar(0x142));
fAddUml("L", QChar(), QChar(0x141));
fAddUml("aa", QChar(), QChar(0xE5));
fAddUml("AA", QChar(), QChar(0xC5));
} }
//---------------------------------------------------------- //----------------------------------------------------------
// read an instruction name // read an instruction name
if (c=='\\') { if (c=='\\') {
//----------------------------------------------------------
// parsing accent instructions like \ss \"{a} ...
if (!parsingMathEnvironment){
for (int len: accentLetters_LenBackslash) {
const QString acc=parseString.mid(currentTokenID, len);
if (acc.size()==len && accentLetters.contains(acc)) {
currentTokenName=accentLetters[acc];
currentTokenID+=acc.trimmed().size()-1; // forward the instruction, omit trailing whitespace in instruction
if (acc.endsWith('\\')) currentTokenID--;
return currentToken=MTTtext;
}
}
}
currentTokenID++; currentTokenID++;
if (currentTokenID>=parseString.size()-1) return currentToken=MTTnone; if (currentTokenID>=parseString.size()-1) return currentToken=MTTnone;
c=parseString[currentTokenID]; c=parseString[currentTokenID];
@ -1042,32 +1314,39 @@ JKQTMathText::tokenType JKQTMathText::getToken() {
//---------------------------------------------------------- //----------------------------------------------------------
// check for { character // check for { character
} else if (c=='{') { } else if (c=='{') {
//std::cout<<"found openbrace\n"; //----------------------------------------------------------
// parsing accent instructions like {\ss}
if (!parsingMathEnvironment){
for (int len: accentLetters_LenCurly) {
const QString acc=parseString.mid(currentTokenID, len);
if (acc.size()==len && accentLetters.contains(acc)) {
currentTokenName=accentLetters[acc];
currentTokenID+=acc.trimmed().size()-1; // forward the instruction, omit trailing whitespace in instruction
if (acc.endsWith('\\')) currentTokenID--;
return currentToken=MTTtext;
}
}
}
return currentToken=MTTopenbrace; return currentToken=MTTopenbrace;
//---------------------------------------------------------- //----------------------------------------------------------
// check for } character // check for } character
} else if (c=='}') { } else if (c=='}') {
//std::cout<<"found closebrace\n";
return currentToken=MTTclosebrace; return currentToken=MTTclosebrace;
//---------------------------------------------------------- //----------------------------------------------------------
// check for [ character // check for [ character
} else if (c=='[') { } else if (c=='[') {
//std::cout<<"found openbracket\n";
return currentToken=MTTopenbracket; return currentToken=MTTopenbracket;
//---------------------------------------------------------- //----------------------------------------------------------
// check for ] character // check for ] character
} else if (c==']') { } else if (c==']') {
//std::cout<<"found closebracket\n";
return currentToken=MTTclosebracket; return currentToken=MTTclosebracket;
//---------------------------------------------------------- //----------------------------------------------------------
// check for _ character // check for _ character
} else if (c=='_') { } else if (c=='_') {
//std::cout<<"found underscore\n";
return currentToken=MTTunderscore; return currentToken=MTTunderscore;
//---------------------------------------------------------- //----------------------------------------------------------
// check for ^ character // check for ^ character
} else if (c=='^') { } else if (c=='^') {
//std::cout<<"found hat\n";
return currentToken=MTThat; return currentToken=MTThat;
//---------------------------------------------------------- //----------------------------------------------------------
// check for whitespace character // check for whitespace character
@ -1142,9 +1421,27 @@ JKQTMathTextNode* JKQTMathText::parseLatexString(bool get, JKQTMathTextBraceType
while (currentToken!=MTTnone) { while (currentToken!=MTTnone) {
getNew=true; getNew=true;
if (currentToken==MTTtext) { if (currentToken==MTTtext) {
const QString text=currentTokenName; QString text=currentTokenName;
const bool addWhite=(getToken()==MTTwhitespace) && (!parsingMathEnvironment); bool addWhite=false;
getNew=addWhite; if (!parsingMathEnvironment) {
getToken();
getNew=false;
while (currentToken==MTTtext || currentToken==MTTwhitespace) {
if (currentToken==MTTtext) {
text+=currentTokenName;
getNew=true;
} else if (currentToken==MTTwhitespace) {
text+=" ";
getNew=true;
}
getToken();
getNew=false;
}
if (text.size()>0 && text[text.size()-1].isSpace()) {
addWhite=true;
text=text.left(text.size()-1);
}
}
if (parsingMathEnvironment) { if (parsingMathEnvironment) {
if (mathEnvironmentSpecialText.contains(text.trimmed()) && JKQTMathTextSymbolNode::hasSymbol(text.trimmed())) { if (mathEnvironmentSpecialText.contains(text.trimmed()) && JKQTMathTextSymbolNode::hasSymbol(text.trimmed())) {
nl->addChild(new JKQTMathTextSymbolNode(this, text.trimmed())); nl->addChild(new JKQTMathTextSymbolNode(this, text.trimmed()));

View File

@ -140,7 +140,7 @@ class JKQTMathTextNode; // forward
symbols may differ (there are not all symbols defined in the MS Windows Symbol symbols may differ (there are not all symbols defined in the MS Windows Symbol
font!). Best coverage should be given by Unicode font encoding with a good font!). Best coverage should be given by Unicode font encoding with a good
unicode font installed!<br>\image html jkqtmathtext/jkqtmathtext_symbols.png unicode font installed!<br>\image html jkqtmathtext/jkqtmathtext_symbols.png
- <code>\\vec{x} \\dot{x} \\ddot{x} \\overline{x} \\underline{x} \\hat{x} \\tilde{x} \\uul{x} \\ool{x} \\bar{x} \\arrow{x} </code>: Decorations over/under symbols \image html jkqtmathtext/jkqtmathtext_mathdeco.png - <code>\\vec{x} \\dot{x} \\ddot{x} \\overline{x} \\underline{x} \\hat{x} \\tilde{x} \\uul{x} \\ool{x} \\bar{x} \\arrow{x} \\widehat{x} \\widetilde{x} ...</code>: Decorations over/under symbols \image html jkqtmathtext/jkqtmathtext_mathdeco.png
- <code>\\verb{don't parse this _aaa\\LaTeX} </code>: interpret enclosed text as verbose \image html jkqtmathtext/jkqtmathtext_verb.png - <code>\\verb{don't parse this _aaa\\LaTeX} </code>: interpret enclosed text as verbose \image html jkqtmathtext/jkqtmathtext_verb.png
. .

View File

@ -42,6 +42,10 @@ QString JKQTMathTextDecoratedNode::DecorationType2String(JKQTMathTextDecoratedNo
switch(mode) { switch(mode) {
case MTDvec: case MTDvec:
return "vec"; return "vec";
case MTDgrave:
return "grave";
case MTDacute:
return "acute";
case MTDtilde: case MTDtilde:
return "tilde"; return "tilde";
case MTDbreve: case MTDbreve:
@ -171,11 +175,16 @@ void JKQTMathTextDecoratedNode::fillInstructions()
instructions["v"]=MTDcheck; instructions["v"]=MTDcheck;
instructions["widecheck"]=MTDwidecheck; instructions["widecheck"]=MTDwidecheck;
instructions["bar"]=MTDbar; instructions["bar"]=MTDbar;
instructions["="]=MTDbar;
instructions["dot"]=MTDdot; instructions["dot"]=MTDdot;
instructions["."]=MTDdot; instructions["."]=MTDdot;
instructions["ocirc"]=MTDocirc; instructions["ocirc"]=MTDocirc;
instructions["tilde"]=MTDtilde; instructions["tilde"]=MTDtilde;
instructions["~"]=MTDtilde; instructions["~"]=MTDtilde;
instructions["acute"]=MTDacute;
instructions["'"]=MTDacute;
instructions["grave"]=MTDgrave;
instructions["`"]=MTDgrave;
instructions["breve"]=MTDbreve; instructions["breve"]=MTDbreve;
instructions["u"]=MTDbreve; instructions["u"]=MTDbreve;
instructions["widetilde"]=MTDwidetilde; instructions["widetilde"]=MTDwidetilde;
@ -210,6 +219,7 @@ double JKQTMathTextDecoratedNode::draw(QPainter& painter, double x, double y, JK
const double deco_width=std::max<double>(width_x*0.5,cwidth-2.0*deco_xoffset-italic_xcorrection); const double deco_width=std::max<double>(width_x*0.5,cwidth-2.0*deco_xoffset-italic_xcorrection);
const double deco_vecwidth=width_x*0.33; const double deco_vecwidth=width_x*0.33;
const double deco_vecheight=deco_height*0.33; const double deco_vecheight=deco_height*0.33;
const double deco_accentwidth=deco_height/4.0;
const double deco_miniwidth=((decoration==MTDtilde||decoration==MTDbreve)?fm.boundingRect("j").width():fm.boundingRect("^").width())-italic_xcorrection; const double deco_miniwidth=((decoration==MTDtilde||decoration==MTDbreve)?fm.boundingRect("j").width():fm.boundingRect("^").width())-italic_xcorrection;
const double decotop_xcenter=x+italic_xcorrection+(cwidth-italic_xcorrection)/2.0; const double decotop_xcenter=x+italic_xcorrection+(cwidth-italic_xcorrection)/2.0;
const double decotop_xstart=decotop_xcenter-deco_width/2.0+linewidth/2.0; const double decotop_xstart=decotop_xcenter-deco_width/2.0+linewidth/2.0;
@ -217,9 +227,9 @@ double JKQTMathTextDecoratedNode::draw(QPainter& painter, double x, double y, JK
const double decobot_xstart=x+linewidth/2.0; const double decobot_xstart=x+linewidth/2.0;
const double decobot_xend=x+cwidth-italic_xcorrection-linewidth/2.0; const double decobot_xend=x+cwidth-italic_xcorrection-linewidth/2.0;
const double decobot_xcenter=(decobot_xstart+decobot_xend)/2.0; const double decobot_xcenter=(decobot_xstart+decobot_xend)/2.0;
const double deco_ypos=y-cbaselineHeight-decoSeparation-linewidth/2.0; const double deco_ytopbot=y-cbaselineHeight-decoSeparation-linewidth/2.0;
const double deco_ytop=y-cbaselineHeight-decoSeparation-deco_height+linewidth/2.0; const double deco_ytoptop=y-cbaselineHeight-decoSeparation-deco_height+linewidth/2.0;
const double deco_ycenter=y-cbaselineHeight-decoSeparation-deco_height/2.0; const double deco_ytopcenter=y-cbaselineHeight-decoSeparation-deco_height/2.0;
@ -232,15 +242,55 @@ double JKQTMathTextDecoratedNode::draw(QPainter& painter, double x, double y, JK
double xnew=getChild()->draw(painter, x, y, ev); double xnew=getChild()->draw(painter, x, y, ev);
auto fDrawFontAccent=[&](QChar aDirect=QChar(), QChar aFallback=QChar()) -> bool {
if (!aDirect.isNull() && fm.inFont(aDirect)) {
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
const QRectF tbra=fm.tightBoundingRect(aDirect);
painter.translate(decotop_xcenter-tbra.width()/2.0, (deco_ytopcenter+deco_ytopbot)/2.0);
//painter.setPen("red");
//painter.drawEllipse(0-2,0-2,4,4);
painter.translate(-tbra.x(), -tbra.y());
//painter.setPen("magenta");
//painter.drawEllipse(0-2,0-2,4,4);
if (tbra.width()>0 && tbra.height()>0) {
painter.setFont(font);
painter.drawText(0,0,aDirect);
//painter.setPen("blue");
//painter.drawRect(tbra);
//painter.drawEllipse(0-2,0-2,4,4);
return true;
}
}
if (!aFallback.isNull() && fm.inFont(aFallback)) {
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
const QRectF tbra=fm.tightBoundingRect(aFallback);
painter.translate(decotop_xcenter-tbra.width()/2.0, deco_ytopcenter);
//painter.setPen("yellow");
//painter.drawEllipse(0-2,0-2,4,4);
painter.translate(-tbra.x(), -tbra.y());
//painter.setPen("cyan");
//painter.drawEllipse(0-2,0-2,4,4);
if (tbra.width()>0 && tbra.height()>0) {
painter.setFont(font);
painter.drawText(0,0,aFallback);
//painter.setPen("green");
//painter.drawRect(tbra);
//painter.drawEllipse(0-2,0-2,4,4);
return true;
}
}
return false;
};
if (decoration==MTDvec) { if (decoration==MTDvec) {
painter.setPen(p); painter.setPen(p);
QPolygonF poly; QPolygonF poly;
poly<<QPointF(decotop_xstart, deco_ypos)<<QPointF(decotop_xend, deco_ypos)<<QPointF(decotop_xend-deco_vecwidth, deco_ypos-deco_vecheight); poly<<QPointF(decotop_xstart, deco_ytopbot)<<QPointF(decotop_xend, deco_ytopbot)<<QPointF(decotop_xend-deco_vecwidth, deco_ytopbot-deco_vecheight);
painter.drawPolyline(poly); painter.drawPolyline(poly);
painter.setPen(pold); painter.setPen(pold);
} else if (decoration==MTDoverline) { } else if (decoration==MTDoverline) {
painter.setPen(p); painter.setPen(p);
const QLineF l(decotop_xstart, deco_ypos, decotop_xend, deco_ypos); const QLineF l(decotop_xstart, deco_ytopbot, decotop_xend, deco_ytopbot);
if (l.length()>0) painter.drawLine(l); if (l.length()>0) painter.drawLine(l);
painter.setPen(pold); painter.setPen(pold);
} else if (decoration==MTDbar) { } else if (decoration==MTDbar) {
@ -250,9 +300,9 @@ double JKQTMathTextDecoratedNode::draw(QPainter& painter, double x, double y, JK
painter.setPen(pold); painter.setPen(pold);
} else if (decoration==MTDdoubleoverline) { } else if (decoration==MTDdoubleoverline) {
painter.setPen(p); painter.setPen(p);
const QLineF l(decotop_xstart, deco_ypos, decotop_xend, deco_ypos); const QLineF l(decotop_xstart, deco_ytopbot, decotop_xend, deco_ytopbot);
if (l.length()>0) painter.drawLine(l); if (l.length()>0) painter.drawLine(l);
const QLineF l2(decotop_xstart, deco_ypos-2.0*p.widthF(), decotop_xend, deco_ypos-2.0*p.widthF()); const QLineF l2(decotop_xstart, deco_ytopbot-2.0*p.widthF(), decotop_xend, deco_ytopbot-2.0*p.widthF());
if (l2.length()>0) painter.drawLine(l2); if (l2.length()>0) painter.drawLine(l2);
painter.setPen(pold); painter.setPen(pold);
} else if (decoration==MTDunderline) { } else if (decoration==MTDunderline) {
@ -269,77 +319,98 @@ double JKQTMathTextDecoratedNode::draw(QPainter& painter, double x, double y, JK
painter.setPen(pold); painter.setPen(pold);
} else if (decoration==MTDarrow) { } else if (decoration==MTDarrow) {
painter.setPen(p); painter.setPen(p);
const QLineF l(decotop_xstart, deco_ycenter, decotop_xend, deco_ycenter); const QLineF l(decotop_xstart, deco_ytopcenter, decotop_xend, deco_ytopcenter);
if (l.length()>0) painter.drawLine(l); if (l.length()>0) painter.drawLine(l);
QPolygonF poly; QPolygonF poly;
poly<<QPointF(decotop_xend-deco_vecwidth, deco_ypos)<<QPointF(decotop_xend, deco_ycenter)<<QPointF(decotop_xend-deco_vecwidth, deco_ytop); poly<<QPointF(decotop_xend-deco_vecwidth, deco_ytopbot)<<QPointF(decotop_xend, deco_ytopcenter)<<QPointF(decotop_xend-deco_vecwidth, deco_ytoptop);
painter.drawPolyline(poly); painter.drawPolyline(poly);
painter.setPen(pold); painter.setPen(pold);
} else if (decoration==MTDhat) { } else if (decoration==MTDhat) {
if (!fDrawFontAccent(QChar(0x302), QChar(0x2c6))) {
painter.setPen(p); painter.setPen(p);
QPolygonF poly; QPolygonF poly;
poly<<QPointF(decotop_xcenter-0.5*deco_miniwidth, deco_ypos)<<QPointF(decotop_xcenter, deco_ycenter)<<QPointF(decotop_xcenter+0.5*deco_miniwidth, deco_ypos); poly<<QPointF(decotop_xcenter-0.5*deco_miniwidth, deco_ytopbot)<<QPointF(decotop_xcenter, deco_ytopcenter)<<QPointF(decotop_xcenter+0.5*deco_miniwidth, deco_ytopbot);
painter.drawPolyline(poly); painter.drawPolyline(poly);
painter.setPen(pold); painter.setPen(pold);
}
} else if (decoration==MTDwidehat) { } else if (decoration==MTDwidehat) {
painter.setPen(p); painter.setPen(p);
QPolygonF poly; QPolygonF poly;
poly<<QPointF(decotop_xstart, deco_ypos)<<QPointF(decotop_xcenter, deco_ytop)<<QPointF(decotop_xend, deco_ypos); poly<<QPointF(decotop_xstart, deco_ytopbot)<<QPointF(decotop_xcenter, deco_ytoptop)<<QPointF(decotop_xend, deco_ytopbot);
painter.drawPolyline(poly); painter.drawPolyline(poly);
painter.setPen(pold); painter.setPen(pold);
} else if (decoration==MTDcheck) { } else if (decoration==MTDcheck) {
if (!fDrawFontAccent(QChar(0x30C), QChar(0x2C7))) {
painter.setPen(p); painter.setPen(p);
QPolygonF poly; QPolygonF poly;
poly<<QPointF(decotop_xcenter-0.5*deco_miniwidth, deco_ycenter)<<QPointF(decotop_xcenter, deco_ypos)<<QPointF(decotop_xcenter+0.5*deco_miniwidth, deco_ycenter); poly<<QPointF(decotop_xcenter-0.5*deco_miniwidth, deco_ytopcenter)<<QPointF(decotop_xcenter, deco_ytopbot)<<QPointF(decotop_xcenter+0.5*deco_miniwidth, deco_ytopcenter);
painter.drawPolyline(poly); painter.drawPolyline(poly);
painter.setPen(pold); painter.setPen(pold);
}
} else if (decoration==MTDwidecheck) { } else if (decoration==MTDwidecheck) {
painter.setPen(p); painter.setPen(p);
QPolygonF poly; QPolygonF poly;
poly<<QPointF(decotop_xstart, deco_ytop)<<QPointF(decotop_xcenter, deco_ypos)<<QPointF(decotop_xend, deco_ytop); poly<<QPointF(decotop_xstart, deco_ytoptop)<<QPointF(decotop_xcenter, deco_ytopbot)<<QPointF(decotop_xend, deco_ytoptop);
painter.drawPolyline(poly); painter.drawPolyline(poly);
painter.setPen(pold); painter.setPen(pold);
} else if (decoration==MTDbreve) { } else if (decoration==MTDbreve) {
if (!fDrawFontAccent(QChar(0x306), QChar(0x2D8))) {
painter.setPen(p); painter.setPen(p);
QPainterPath path; QPainterPath path;
const double x0=decotop_xcenter-deco_miniwidth/2.0; const double x0=decotop_xcenter-deco_miniwidth/2.0;
const double x1=decotop_xcenter+deco_miniwidth/2.0; const double x1=decotop_xcenter+deco_miniwidth/2.0;
path.moveTo(x0, deco_ypos); path.moveTo(x0, deco_ytopbot);
path.cubicTo(x0, deco_ytop, x1, deco_ytop , x1, deco_ypos); path.cubicTo(x0, deco_ytoptop, x1, deco_ytoptop , x1, deco_ytopbot);
painter.drawPath(path); painter.drawPath(path);
painter.setPen(pold); painter.setPen(pold);
}
} else if (decoration==MTDtilde) { } else if (decoration==MTDtilde) {
if (!fDrawFontAccent(QChar(0x2DC), QChar('~'))) {
painter.setPen(p); painter.setPen(p);
QPainterPath path; QPainterPath path;
const double x0=decotop_xcenter-deco_miniwidth/2.0; const double x0=decotop_xcenter-deco_miniwidth/2.0;
const double x1=decotop_xcenter+deco_miniwidth/2.0; const double x1=decotop_xcenter+deco_miniwidth/2.0;
path.moveTo(x0, deco_ycenter); path.moveTo(x0, deco_ytopcenter);
path.cubicTo((x0+x1)/2.0, deco_ypos, (x0+x1)/2.0, deco_ytop , x1, deco_ycenter); path.cubicTo((x0+x1)/2.0, deco_ytopbot, (x0+x1)/2.0, deco_ytoptop , x1, deco_ytopcenter);
painter.drawPath(path); painter.drawPath(path);
painter.setPen(pold); painter.setPen(pold);
}
} else if (decoration==MTDacute) {
if (!fDrawFontAccent(QChar(0x301), QChar(0x2CA))) {
painter.setPen(p);
painter.drawLine(QLineF(decotop_xcenter, deco_ytopbot, decotop_xcenter-deco_accentwidth, deco_ytopcenter));
painter.setPen(pold);
}
} else if (decoration==MTDgrave) {
if (!fDrawFontAccent(QChar(0x300), QChar(0x2CB))) {
painter.setPen(p);
painter.drawLine(QLineF(decotop_xcenter, deco_ytopbot, decotop_xcenter+deco_accentwidth, deco_ytopcenter));
painter.setPen(pold);
}
} else if (decoration==MTDwidetilde) { } else if (decoration==MTDwidetilde) {
painter.setPen(p); painter.setPen(p);
QPainterPath path; QPainterPath path;
const double x0=decotop_xstart; const double x0=decotop_xstart;
const double x1=decotop_xend; const double x1=decotop_xend;
path.moveTo(x0, deco_ycenter); path.moveTo(x0, deco_ytopcenter);
path.cubicTo((x0+x1)/2.0, deco_ypos, (x0+x1)/2.0, deco_ytop , x1, deco_ycenter); path.cubicTo((x0+x1)/2.0, deco_ytopbot, (x0+x1)/2.0, deco_ytoptop , x1, deco_ytopcenter);
painter.drawPath(path); painter.drawPath(path);
painter.setPen(pold); painter.setPen(pold);
} else if (decoration==MTDocirc) { } else if (decoration==MTDocirc) {
if (!fDrawFontAccent(QChar(0x2DA), QChar(0xBA))) {
painter.setPen(p); painter.setPen(p);
const QBrush bold=painter.brush(); const QBrush bold=painter.brush();
painter.setBrush(Qt::NoBrush); painter.setBrush(Qt::NoBrush);
const double r=qMin(width_dot/1.5, deco_height/2.0-linewidth/2.0); const double r=qMin(width_dot/1.5, deco_height/2.0-linewidth/2.0);
painter.drawEllipse(QPointF(decotop_xcenter, deco_ycenter), r, r); painter.drawEllipse(QPointF(decotop_xcenter, deco_ytopcenter), r, r);
painter.setBrush(bold); painter.setBrush(bold);
painter.setPen(pold); painter.setPen(pold);
}
} else if (decoration==MTDdot) { } else if (decoration==MTDdot) {
if (!fDrawFontAccent(QChar(0x2D9), QChar('.'))) {
p.setWidthF(0.01); p.setWidthF(0.01);
painter.setPen(p); painter.setPen(p);
QBrush b=painter.brush(); QBrush b=painter.brush();
@ -347,10 +418,12 @@ double JKQTMathTextDecoratedNode::draw(QPainter& painter, double x, double y, JK
b.setColor(ev.color); b.setColor(ev.color);
b.setStyle(Qt::SolidPattern); b.setStyle(Qt::SolidPattern);
painter.setBrush(b); painter.setBrush(b);
painter.drawEllipse(QPointF(decotop_xcenter, deco_ycenter), width_dot/2.0, width_dot/2.0); painter.drawEllipse(QPointF(decotop_xcenter, deco_ytopcenter), width_dot/2.0, width_dot/2.0);
painter.setBrush(bold); painter.setBrush(bold);
painter.setPen(pold); painter.setPen(pold);
}
} else if (decoration==MTDddot) { } else if (decoration==MTDddot) {
if (!fDrawFontAccent(QChar(0x308))) {
p.setWidthF(0.01); p.setWidthF(0.01);
painter.setPen(p); painter.setPen(p);
QBrush b=painter.brush(); QBrush b=painter.brush();
@ -358,11 +431,12 @@ double JKQTMathTextDecoratedNode::draw(QPainter& painter, double x, double y, JK
b.setColor(ev.color); b.setColor(ev.color);
b.setStyle(Qt::SolidPattern); b.setStyle(Qt::SolidPattern);
painter.setBrush(b); painter.setBrush(b);
painter.drawEllipse(QPointF(decotop_xcenter-width_dot, deco_ycenter), width_dot/2.0, width_dot/2.0); painter.drawEllipse(QPointF(decotop_xcenter-width_dot, deco_ytopcenter), width_dot/2.0, width_dot/2.0);
painter.drawEllipse(QPointF(decotop_xcenter+width_dot, deco_ycenter), width_dot/2.0, width_dot/2.0); painter.drawEllipse(QPointF(decotop_xcenter+width_dot, deco_ytopcenter), width_dot/2.0, width_dot/2.0);
painter.setBrush(bold); painter.setBrush(bold);
painter.setPen(pold); painter.setPen(pold);
painter.setBrush(bold); painter.setBrush(bold);
}
} else if (decoration==MTDstrike) { } else if (decoration==MTDstrike) {
painter.setPen(p); painter.setPen(p);
const QLineF l((decotop_xstart+decobot_xstart)/2.0, strike_ypos, (decotop_xend+decobot_xend)/2.0, strike_ypos); const QLineF l((decotop_xstart+decobot_xstart)/2.0, strike_ypos, (decotop_xend+decobot_xend)/2.0, strike_ypos);
@ -370,19 +444,19 @@ double JKQTMathTextDecoratedNode::draw(QPainter& painter, double x, double y, JK
painter.setPen(pold); painter.setPen(pold);
} else if (decoration==MTDcancel) { } else if (decoration==MTDcancel) {
painter.setPen(p); painter.setPen(p);
const QLineF l(decobot_xstart, decobelow_ypos, decotop_xend, deco_ypos); const QLineF l(decobot_xstart, decobelow_ypos, decotop_xend, deco_ytopbot);
if (l.length()>0) painter.drawLine(l); if (l.length()>0) painter.drawLine(l);
painter.setPen(pold); painter.setPen(pold);
} else if (decoration==MTDbcancel) { } else if (decoration==MTDbcancel) {
painter.setPen(p); painter.setPen(p);
const QLineF l(decobot_xstart, deco_ypos, decotop_xend, decobelow_ypos); const QLineF l(decobot_xstart, deco_ytopbot, decotop_xend, decobelow_ypos);
if (l.length()>0) painter.drawLine(l); if (l.length()>0) painter.drawLine(l);
painter.setPen(pold); painter.setPen(pold);
} else if (decoration==MTDxcancel) { } else if (decoration==MTDxcancel) {
painter.setPen(p); painter.setPen(p);
const QLineF l(decobot_xstart, deco_ypos, decotop_xend, decobelow_ypos); const QLineF l(decobot_xstart, deco_ytopbot, decotop_xend, decobelow_ypos);
if (l.length()>0) painter.drawLine(l); if (l.length()>0) painter.drawLine(l);
const QLineF l1(decobot_xstart, decobelow_ypos, decotop_xend, deco_ypos); const QLineF l1(decobot_xstart, decobelow_ypos, decotop_xend, deco_ytopbot);
if (l1.length()>0) painter.drawLine(l1); if (l1.length()>0) painter.drawLine(l1);
painter.setPen(pold); painter.setPen(pold);
} }

View File

@ -48,7 +48,7 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextDecoratedNode: public JKQTMathTextSing
MTDwidehat, /*!< \brief full-width hat over block \image html jkqtmathtext/MTDwidehat.png */ MTDwidehat, /*!< \brief full-width hat over block \image html jkqtmathtext/MTDwidehat.png */
MTDcheck, /*!< \brief small v over block \image html jkqtmathtext/MTDcheck.png */ MTDcheck, /*!< \brief small v over block \image html jkqtmathtext/MTDcheck.png */
MTDwidecheck, /*!< \brief full-width v over block \image html jkqtmathtext/MTDwidecheck.png */ MTDwidecheck, /*!< \brief full-width v over block \image html jkqtmathtext/MTDwidecheck.png */
MTDbreve, /*!< \brief small tilde over block \image html jkqtmathtext/MTDbreve.png */ MTDbreve, /*!< \brief small cup (breve) over block \image html jkqtmathtext/MTDbreve.png */
MTDocirc, /*!< \brief single circle over block \image html jkqtmathtext/MTDocirc.png */ MTDocirc, /*!< \brief single circle over block \image html jkqtmathtext/MTDocirc.png */
MTDdot, /*!< \brief single dot over block \image html jkqtmathtext/MTDvec.png */ MTDdot, /*!< \brief single dot over block \image html jkqtmathtext/MTDvec.png */
MTDddot, /*!< \brief double dot over block \image html jkqtmathtext/MTDddot.png */ MTDddot, /*!< \brief double dot over block \image html jkqtmathtext/MTDddot.png */
@ -60,6 +60,8 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextDecoratedNode: public JKQTMathTextSing
MTDdoubleunderline, /*!< \brief double underline under block \image html jkqtmathtext/MTDdoubleunderline.png */ MTDdoubleunderline, /*!< \brief double underline under block \image html jkqtmathtext/MTDdoubleunderline.png */
MTDtilde, /*!< \brief small tilde over block \image html jkqtmathtext/MTDtilde.png */ MTDtilde, /*!< \brief small tilde over block \image html jkqtmathtext/MTDtilde.png */
MTDwidetilde, /*!< \brief full width tilde over block \image html jkqtmathtext/MTDwidetilde.png */ MTDwidetilde, /*!< \brief full width tilde over block \image html jkqtmathtext/MTDwidetilde.png */
MTDacute, /*!< \brief small acute accent over block \image html jkqtmathtext/MTDacute.png */
MTDgrave, /*!< \brief small grave accent over block \image html jkqtmathtext/MTDgrave.png */
MTDcancel, /*!< \brief cancel text with sloped line \image html jkqtmathtext/MTDcancel.png */ MTDcancel, /*!< \brief cancel text with sloped line \image html jkqtmathtext/MTDcancel.png */
MTDbcancel, /*!< \brief cancel text with backward sloped line \image html jkqtmathtext/MTDbcancel.png */ MTDbcancel, /*!< \brief cancel text with backward sloped line \image html jkqtmathtext/MTDbcancel.png */
MTDxcancel, /*!< \brief cancel text with X \image html jkqtmathtext/MTDxcancel.png */ MTDxcancel, /*!< \brief cancel text with X \image html jkqtmathtext/MTDxcancel.png */

View File

@ -378,22 +378,22 @@ void JKQTMathTextSymbolNode::addGreekLetterVariants_WinSymbol_Unicode_Html(const
symbols["up"+baseInstructionName]=UprightGreekLetter_WinSymbol_Unicode_Html(letterWinSymbol, letterUnicode, html); symbols["up"+baseInstructionName]=UprightGreekLetter_WinSymbol_Unicode_Html(letterWinSymbol, letterUnicode, html);
} }
JKQTMathTextSymbolNode::SymbolFullProps JKQTMathTextSymbolNode::SymbolStd(const QString &symbol, const QString &html) JKQTMathTextSymbolNode::SymbolFullProps JKQTMathTextSymbolNode::StdSymbol(const QString &symbol, const QString &html)
{ {
return SymbolFullProps(MTFEStandard, SymbolProps(symbol), html); return SymbolFullProps(MTFEStandard, SymbolProps(symbol), html);
} }
JKQTMathTextSymbolNode::SymbolFullProps JKQTMathTextSymbolNode::SymbolUnicode(const QString &symbol, SymbolFlags _flags, double _fontScalingFactor, double _yShiftFactor) JKQTMathTextSymbolNode::SymbolFullProps JKQTMathTextSymbolNode::UnicodeSymbol(const QString &symbol, SymbolFlags _flags, double _fontScalingFactor, double _yShiftFactor)
{ {
return SymbolFullProps(MTFEUnicode, SymbolProps(symbol, _flags, _fontScalingFactor, _yShiftFactor)); return SymbolFullProps(MTFEUnicode, SymbolProps(symbol, _flags, _fontScalingFactor, _yShiftFactor));
} }
JKQTMathTextSymbolNode::SymbolFullProps JKQTMathTextSymbolNode::SymbolUnicode(const QString &symbol, const QString &html) JKQTMathTextSymbolNode::SymbolFullProps JKQTMathTextSymbolNode::UnicodeSymbol(const QString &symbol, const QString &html)
{ {
return SymbolFullProps(MTFEUnicode, SymbolProps(symbol), html); return SymbolFullProps(MTFEUnicode, SymbolProps(symbol), html);
} }
JKQTMathTextSymbolNode::SymbolFullProps JKQTMathTextSymbolNode::SymbolStd(const QString &symbol, SymbolFlags _flags, double _fontScalingFactor, double _yShiftFactor) JKQTMathTextSymbolNode::SymbolFullProps JKQTMathTextSymbolNode::StdSymbol(const QString &symbol, SymbolFlags _flags, double _fontScalingFactor, double _yShiftFactor)
{ {
return SymbolFullProps(MTFEStandard, SymbolProps(symbol, _flags, _fontScalingFactor, _yShiftFactor), symbol); return SymbolFullProps(MTFEStandard, SymbolProps(symbol, _flags, _fontScalingFactor, _yShiftFactor), symbol);
} }
@ -455,26 +455,30 @@ void JKQTMathTextSymbolNode::fillSymbolTables()
symbols["ae"]=SimpleTextSymbol(QChar(0xE6)); symbols["ae"]=SimpleTextSymbol(QChar(0xE6));
symbols["AE"]=SimpleTextSymbol(QChar(0xC6)); symbols["AE"]=SimpleTextSymbol(QChar(0xC6));
symbols["AA"]=SimpleTextSymbol(QChar(0xC5)); symbols["AA"]=SimpleTextSymbol(QChar(0xC5));
symbols["oe"]=SymbolUnicode(QChar(0x153)).addStd("oe").addHtml("&oelig;"); symbols["oe"]=UnicodeSymbol(QChar(0x153)).addStd("oe").addHtml("&oelig;");
symbols["OE"]=SymbolUnicode(QChar(0x152)).addStd("OE").addHtml("&OElig;"); symbols["OE"]=UnicodeSymbol(QChar(0x152)).addStd("OE").addHtml("&OElig;");
symbols["ss"]=SimpleTextSymbol(QChar(0xDF)).addHtml("&szlig;"); symbols["ss"]=SimpleTextSymbol(QChar(0xDF)).addHtml("&szlig;");
symbols["l"]=UnicodeSymbol(QChar(0x141)).addHtml("&lstrok;");
symbols["L"]=UnicodeSymbol(QChar(0x142)).addHtml("&Lstrok;");
symbols["o"]=SimpleTextSymbol(QChar(0xF8)).addHtml("&oslash;");
symbols["O"]=SimpleTextSymbol(QChar(0xD8)).addHtml("&Oslash;");
{ auto s=UprightSymbolUnicode(QChar(0x212B)).addUprightStd(QChar(0xC5)); { auto s=UprightSymbolUnicode(QChar(0x212B)).addUprightStd(QChar(0xC5));
symbols["Angstrom"]=s; symbols["Angstroem"]=s; } symbols["Angstrom"]=s; symbols["Angstroem"]=s; }
{ auto s=SymbolUnicode(QChar(0x2136)).addHtml("&beth;"); { auto s=UnicodeSymbol(QChar(0x2136)).addHtml("&beth;");
symbols["Beth"]=s; symbols["Bet"]=s; symbols["beth"]=s; symbols["bet"]=s; } symbols["Beth"]=s; symbols["Bet"]=s; symbols["beth"]=s; symbols["bet"]=s; }
symbols["Box"]=UprightSymbolUnicode(QChar(0x25A1)); symbols["Box"]=UprightSymbolUnicode(QChar(0x25A1));
symbols["DC"]=SymbolUnicode(QChar(0x2393)).addWinSymbol(QChar(0xBB)).addStd("="); symbols["DC"]=UnicodeSymbol(QChar(0x2393)).addWinSymbol(QChar(0xBB)).addStd("=");
symbols["EUR"]=SymbolUnicode(QChar(0x20AC)); symbols["EUR"]=UnicodeSymbol(QChar(0x20AC));
symbols["Im"]=UprightSymbolUnicode(QChar(0x2111)).addHtml("&image;").addWinSymbol(QChar(0xC1)); symbols["Im"]=UprightSymbolUnicode(QChar(0x2111)).addHtml("&image;").addWinSymbol(QChar(0xC1));
symbols["No"]=SymbolUnicode(QChar(0x2116)); symbols["No"]=UnicodeSymbol(QChar(0x2116));
{ auto s=UprightSymbolUnicode(QChar(0x2126)).addUprightWinSymbol("W").addUprightHtml("&Omega;"); { auto s=UprightSymbolUnicode(QChar(0x2126)).addUprightWinSymbol("W").addUprightHtml("&Omega;");
symbols["Ohm"]=s; symbols["ohm"]=s; } symbols["Ohm"]=s; symbols["ohm"]=s; }
symbols["P"]=SimpleTextSymbol(QChar(0xB6)).addHtml("&para;"); symbols["P"]=SimpleTextSymbol(QChar(0xB6)).addHtml("&para;");
symbols["Re"]=SymbolUnicode(QChar(0x211C)).addHtml("&Rfr;").addWinSymbol(QChar(0xC2)); symbols["Re"]=UnicodeSymbol(QChar(0x211C)).addHtml("&Rfr;").addWinSymbol(QChar(0xC2));
{ auto s=SimpleTextSymbol(QChar(0xA7)).addHtml("&sect;"); { auto s=SimpleTextSymbol(QChar(0xA7)).addHtml("&sect;");
symbols["S"]=s; symbols["§"]=s;} symbols["S"]=s; symbols["§"]=s;}
symbols["accurrent"]=SymbolUnicode(QChar(0x23E6)); symbols["accurrent"]=UnicodeSymbol(QChar(0x23E6));
{ auto s=SymbolUnicode(QChar(0x2135)).addHtml("&aleph;").addWinSymbol(QChar(0xC0)); { auto s=UnicodeSymbol(QChar(0x2135)).addHtml("&aleph;").addWinSymbol(QChar(0xC0));
symbols["alef"]=s; symbols["aleph"]=s; symbols["Aleph"]=s; symbols["Alef"]=s; } symbols["alef"]=s; symbols["aleph"]=s; symbols["Aleph"]=s; symbols["Alef"]=s; }
symbols["angle"]=UprightSymbolUnicode(QChar(0x2220)).addHtml("&angle;").addWinSymbol(QChar(0xD0)); symbols["angle"]=UprightSymbolUnicode(QChar(0x2220)).addHtml("&angle;").addWinSymbol(QChar(0xD0));
symbols["backslash"]=SimpleTextSymbol("\\"); symbols["backslash"]=SimpleTextSymbol("\\");
@ -486,8 +490,8 @@ void JKQTMathTextSymbolNode::fillSymbolTables()
{ auto s=UprightSymbolUnicode(QChar(0x231F)); { auto s=UprightSymbolUnicode(QChar(0x231F));
symbols["brcorner"]=s; symbols["lrcorner"]=s; } symbols["brcorner"]=s; symbols["lrcorner"]=s; }
symbols["bullet"]=UprightSymbolUnicode(QChar(0x2022)).addUprightHtml("&bull;").addUprightWinSymbol(QChar(0xB7)); symbols["bullet"]=UprightSymbolUnicode(QChar(0x2022)).addUprightHtml("&bull;").addUprightWinSymbol(QChar(0xB7));
symbols["cdots"]=SymbolUnicode(QChar(0x22EF)).addHtml("&middot;&middot;&middot;").addStd(QString(3, QChar(0xB7))); symbols["cdots"]=UnicodeSymbol(QChar(0x22EF)).addHtml("&middot;&middot;&middot;").addStd(QString(3, QChar(0xB7)));
{ auto s=SymbolUnicode(QChar(0x2103)).addUprightStd("°C").addUprightHtml("&deg;C"); { auto s=UnicodeSymbol(QChar(0x2103)).addUprightStd("°C").addUprightHtml("&deg;C");
symbols["celsius"]=s; symbols["degC"]=s; } symbols["celsius"]=s; symbols["degC"]=s; }
symbols["cent"]=SimpleTextSymbol(QChar(0xA2), "&cent;"); symbols["cent"]=SimpleTextSymbol(QChar(0xA2), "&cent;");
symbols["checkmark"]=UprightSymbolStd(QChar(0x2713)).addUprightHtml("&check;"); symbols["checkmark"]=UprightSymbolStd(QChar(0x2713)).addUprightHtml("&check;");
@ -499,53 +503,53 @@ void JKQTMathTextSymbolNode::fillSymbolTables()
symbols["dagger"]=s; symbols["dag"]=s; symbols["textdagger"]=s; } symbols["dagger"]=s; symbols["dag"]=s; symbols["textdagger"]=s; }
{ auto s=UprightSymbolUnicode(QChar(0x2021)).addUprightHtml("&ddagger;"); { auto s=UprightSymbolUnicode(QChar(0x2021)).addUprightHtml("&ddagger;");
symbols["ddagger"]=s; symbols["ddag"]=s; symbols["textdaggerdbl"]=s; } symbols["ddagger"]=s; symbols["ddag"]=s; symbols["textdaggerdbl"]=s; }
{ auto s=SymbolUnicode(QChar(0x2138)).addHtml("&daleth;"); { auto s=UnicodeSymbol(QChar(0x2138)).addHtml("&daleth;");
symbols["dalet"]=s; symbols["Dalet"]=s; symbols["daleth"]=s; symbols["Daleth"]=s; } symbols["dalet"]=s; symbols["Dalet"]=s; symbols["daleth"]=s; symbols["Daleth"]=s; }
symbols["dd"] = SymbolFullProps(SymbolProps("d", Upright|BoldOff), "d", Upright|BoldOff); symbols["dd"] = SymbolFullProps(SymbolProps("d", Upright|BoldOff), "d", Upright|BoldOff);
symbols["diamond"]=UprightSymbolUnicode(QChar(0x22C4)).addHtml("&diam;").addWinSymbol(QChar(0xE0)); symbols["diamond"]=UprightSymbolUnicode(QChar(0x22C4)).addHtml("&diam;").addWinSymbol(QChar(0xE0));
symbols["dollar"]=SymbolUnicode(QChar(0x0024)); symbols["dollar"]=UnicodeSymbol(QChar(0x0024));
{ auto s=SimpleTextSymbol(QChar(0x24), "&dollar;"); { auto s=SimpleTextSymbol(QChar(0x24), "&dollar;");
symbols["dollar"]=s; symbols["$"]=s; } symbols["dollar"]=s; symbols["$"]=s; }
symbols["dprime"]=SymbolUnicode(QChar(0x2033)).addHtml("&Prime;").addStd("''"); symbols["dprime"]=UnicodeSymbol(QChar(0x2033)).addHtml("&Prime;").addStd("''");
symbols["ee"] = SymbolFullProps(SymbolProps("e", Upright|BoldOff), "e", Upright|BoldOff); symbols["ee"] = SymbolFullProps(SymbolProps("e", Upright|BoldOff), "e", Upright|BoldOff);
{ auto s=SymbolUnicode(QChar(0x2026)).addHtml("&mldr;").addWinSymbol(QChar(0xBC)).addStd("..."); { auto s=UnicodeSymbol(QChar(0x2026)).addHtml("&mldr;").addWinSymbol(QChar(0xBC)).addStd("...");
symbols["ellipsis"]=s; symbols["dots"]=s; symbols["ldots"]=s; } symbols["ellipsis"]=s; symbols["dots"]=s; symbols["ldots"]=s; }
{ auto s=SimpleTextSymbol(QChar(0x20AC), "&euro;"); { auto s=SimpleTextSymbol(QChar(0x20AC), "&euro;");
symbols["euro"]=s; symbols["EUR"]=s; } symbols["euro"]=s; symbols["EUR"]=s; }
{ auto s=SymbolUnicode(QChar(0x2109)); { auto s=UnicodeSymbol(QChar(0x2109));
symbols["fahrenheit"]=s; symbols["degF"]=s; } symbols["fahrenheit"]=s; symbols["degF"]=s; }
symbols["female"]=SymbolUnicode(QChar(0x2640)).addHtml("&female;"); symbols["female"]=UnicodeSymbol(QChar(0x2640)).addHtml("&female;");
symbols["flq"]=SymbolUnicode(QChar(0x2039)).addHtml("&lsaquo;").addStd("<"); symbols["flq"]=UnicodeSymbol(QChar(0x2039)).addHtml("&lsaquo;").addStd("<");
symbols["flqq"]=SymbolUnicode(QChar(0x00AB)).addHtml("&laquo;").addStd(QChar(0xAB)); symbols["flqq"]=UnicodeSymbol(QChar(0x00AB)).addHtml("&laquo;").addStd(QChar(0xAB));
symbols["frown"]=SymbolUnicode(QChar(0x2322)).addHtml("&frown;"); symbols["frown"]=UnicodeSymbol(QChar(0x2322)).addHtml("&frown;");
symbols["frq"]=SymbolUnicode(QChar(0x203A)).addHtml("&rsaquo;").addStd(">"); symbols["frq"]=UnicodeSymbol(QChar(0x203A)).addHtml("&rsaquo;").addStd(">");
symbols["frqq"]=SymbolUnicode(QChar(0x00BB)).addHtml("&raquo;").addStd(QChar(0xBB)); symbols["frqq"]=UnicodeSymbol(QChar(0x00BB)).addHtml("&raquo;").addStd(QChar(0xBB));
{ auto s=SymbolUnicode(QChar(0x2137)).addHtml("&gimel;"); { auto s=UnicodeSymbol(QChar(0x2137)).addHtml("&gimel;");
symbols["gimel"]=s; symbols["Gimel"]=s; } symbols["gimel"]=s; symbols["Gimel"]=s; }
symbols["glq"]=SymbolUnicode(QChar(0x2018)).addHtml("&OpenCurlyQuote;").addStd("'"); symbols["glq"]=UnicodeSymbol(QChar(0x2018)).addHtml("&OpenCurlyQuote;").addStd("'");
symbols["glqq"]=SymbolUnicode(QChar(0x201C)).addHtml("&OpenCurlyDoubleQuote;").addStd("\""); symbols["glqq"]=UnicodeSymbol(QChar(0x201C)).addHtml("&OpenCurlyDoubleQuote;").addStd("\"");
symbols["grq"]=SymbolUnicode(QChar(0x2019)).addHtml("&CloseCurlyQuote;").addStd("'"); symbols["grq"]=UnicodeSymbol(QChar(0x2019)).addHtml("&CloseCurlyQuote;").addStd("'");
symbols["grqq"]=SymbolUnicode(QChar(0x201D)).addHtml("&CloseCurlyDoubleQuote;").addStd("\""); symbols["grqq"]=UnicodeSymbol(QChar(0x201D)).addHtml("&CloseCurlyDoubleQuote;").addStd("\"");
symbols["hbar"]=UprightSymbolUnicode(QChar(0x210F)).addUprightHtml("&hbar;").addStd("h", ItalicOn|DrawLeftHBar); symbols["hbar"]=UprightSymbolUnicode(QChar(0x210F)).addUprightHtml("&hbar;").addStd("h", ItalicOn|DrawLeftHBar);
symbols["hexagon"]=UprightSymbolUnicode(QChar(0x2394)); symbols["hexagon"]=UprightSymbolUnicode(QChar(0x2394));
symbols["ii"] = SymbolFullProps(SymbolProps("i", Upright|BoldOff), "i", Upright|BoldOff); symbols["ii"] = SymbolFullProps(SymbolProps("i", Upright|BoldOff), "i", Upright|BoldOff);
symbols["infty"]=SymbolUnicode(QChar(0x221E)).addHtml("&infin;").addWinSymbol(QChar(0xA5)).addStd("8", RotateSymbol90); symbols["infty"]=UnicodeSymbol(QChar(0x221E)).addHtml("&infin;").addWinSymbol(QChar(0xA5)).addStd("8", RotateSymbol90);
symbols["langle"]=UprightSymbolUnicode(QChar(0x2329)).addWinSymbol(QChar(0xE1)); symbols["langle"]=UprightSymbolUnicode(QChar(0x2329)).addWinSymbol(QChar(0xE1));
symbols["lceil"]=UprightSymbolUnicode(QChar(0x2308)).addHtml("&LeftCeiling;").addWinSymbol(QChar(0xE9)); symbols["lceil"]=UprightSymbolUnicode(QChar(0x2308)).addHtml("&LeftCeiling;").addWinSymbol(QChar(0xE9));
{ auto s=SimpleTextSymbol("...").addUnicode(QChar(0x2026)).addWinSymbol(QChar(0xB6)); { auto s=SimpleTextSymbol("...").addUnicode(QChar(0x2026)).addWinSymbol(QChar(0xB6));
symbols["ldots"]=s; symbols["dots"]=s; } symbols["ldots"]=s; symbols["dots"]=s; }
symbols["lfloor"]=UprightSymbolUnicode(QChar(0x230A)).addHtml("&LeftFloor;").addWinSymbol(QChar(0xEB)); symbols["lfloor"]=UprightSymbolUnicode(QChar(0x230A)).addHtml("&LeftFloor;").addWinSymbol(QChar(0xEB));
symbols["lightning"]=SymbolUnicode(QChar(0x21AF)); symbols["lightning"]=UnicodeSymbol(QChar(0x21AF));
symbols["male"]=SymbolUnicode(QChar(0x2642)).addHtml("&male;"); symbols["male"]=UnicodeSymbol(QChar(0x2642)).addHtml("&male;");
symbols["measuredangle"]=UprightSymbolUnicode(QChar(0x2221)).addHtml("&measuredangle;"); symbols["measuredangle"]=UprightSymbolUnicode(QChar(0x2221)).addHtml("&measuredangle;");
symbols["micro"] = SimpleTextSymbol(QChar(0xB5), "&micro;"); symbols["micro"] = SimpleTextSymbol(QChar(0xB5), "&micro;");
symbols["ohm"]=UprightSymbolUnicode(QChar(0x2126)).addUprightHtml("&Omega;").addUprightWinSymbol(QChar(0x57)); symbols["ohm"]=UprightSymbolUnicode(QChar(0x2126)).addUprightHtml("&Omega;").addUprightWinSymbol(QChar(0x57));
symbols["partial"]=UprightSymbolUnicode(QChar(0x2202)).addUprightHtml("&part;").addUprightWinSymbol(QChar(0xB6)); symbols["partial"]=UprightSymbolUnicode(QChar(0x2202)).addUprightHtml("&part;").addUprightWinSymbol(QChar(0xB6));
{ auto s=SymbolUnicode(QChar(0x2030)).addHtml("&permil;"); { auto s=UnicodeSymbol(QChar(0x2030)).addHtml("&permil;");
symbols["perthousand"]=s; symbols["permil"]=s; } symbols["perthousand"]=s; symbols["permil"]=s; }
symbols["pound"]=SimpleTextSymbol(QChar(0xA3), "&pound;"); symbols["pound"]=SimpleTextSymbol(QChar(0xA3), "&pound;");
symbols["pound"]=SymbolUnicode(QChar(0x00A3)); symbols["pound"]=UnicodeSymbol(QChar(0x00A3));
symbols["prime"]=SymbolUnicode(QChar(0x2032)).addHtml("&prime;").addStd("'"); symbols["prime"]=UnicodeSymbol(QChar(0x2032)).addHtml("&prime;").addStd("'");
symbols["rangle"]=UprightSymbolUnicode(QChar(0x232A)).addWinSymbol(QChar(0xF1)); symbols["rangle"]=UprightSymbolUnicode(QChar(0x232A)).addWinSymbol(QChar(0xF1));
symbols["rceil"]=UprightSymbolUnicode(QChar(0x2309)).addHtml("&RightCeiling;").addWinSymbol(QChar(0xF9)); symbols["rceil"]=UprightSymbolUnicode(QChar(0x2309)).addHtml("&RightCeiling;").addWinSymbol(QChar(0xF9));
{ auto s=SimpleTextSymbol(QChar(0xAA), "&reg;"); { auto s=SimpleTextSymbol(QChar(0xAA), "&reg;");
@ -555,21 +559,21 @@ void JKQTMathTextSymbolNode::fillSymbolTables()
symbols["smile"]=UprightSymbolUnicode(QChar(0x2323)).addHtml("&smile;"); symbols["smile"]=UprightSymbolUnicode(QChar(0x2323)).addHtml("&smile;");
symbols["sphericalangle"]=UprightSymbolUnicode(QChar(0x2222)).addHtml("&angsph;"); symbols["sphericalangle"]=UprightSymbolUnicode(QChar(0x2222)).addHtml("&angsph;");
symbols["star"]=UprightSymbolUnicode(QChar(0x22C6)); symbols["star"]=UprightSymbolUnicode(QChar(0x22C6));
symbols["tcohm"]=SymbolUnicode(QChar(0x2126)); symbols["tcohm"]=UnicodeSymbol(QChar(0x2126));
symbols["textbar"]=SimpleTextSymbol("|", "&VerticalLine;"); symbols["textbar"]=SimpleTextSymbol("|", "&VerticalLine;");
{ auto s=SimpleTextSymbol(QChar(0xB0), "&deg;"); { auto s=SimpleTextSymbol(QChar(0xB0), "&deg;");
symbols["textdegree"]=s; symbols["degree"] = s; } symbols["textdegree"]=s; symbols["degree"] = s; }
symbols["textgreater"]=SimpleTextSymbol(">", "&gt;"); symbols["textgreater"]=SimpleTextSymbol(">", "&gt;");
symbols["textless"]=SimpleTextSymbol("<", "&lt;"); symbols["textless"]=SimpleTextSymbol("<", "&lt;");
{ auto s=SymbolUnicode(QChar(0x231C)); { auto s=UnicodeSymbol(QChar(0x231C));
symbols["tlcorner"]=s; symbols["ulcorner"]=s; } symbols["tlcorner"]=s; symbols["ulcorner"]=s; }
symbols["trademark"]=SymbolUnicode(QChar(0x2122)).addHtml("&trade;").addWinSymbol(QChar(0xD4)).addStd("(TM)"); symbols["trademark"]=UnicodeSymbol(QChar(0x2122)).addHtml("&trade;").addWinSymbol(QChar(0xD4)).addStd("(TM)");
symbols["trapezium"]=SymbolUnicode(QChar(0x23E2)).addHtml("&trpezium;"); symbols["trapezium"]=UnicodeSymbol(QChar(0x23E2)).addHtml("&trpezium;");
{ auto s=UprightSymbolUnicode(QChar(0x231D)); { auto s=UprightSymbolUnicode(QChar(0x231D));
symbols["trcorner"]=s; symbols["urcorner"]=s; } symbols["trcorner"]=s; symbols["urcorner"]=s; }
symbols["trprime"]=SymbolUnicode(QChar(0x2034)).addHtml("&tprime;").addStd("'''"); symbols["trprime"]=UnicodeSymbol(QChar(0x2034)).addHtml("&tprime;").addStd("'''");
symbols["varcarriagereturn"]=SymbolUnicode(QChar(0x23CE)).addWinSymbol(QChar(0xBF)); symbols["varcarriagereturn"]=UnicodeSymbol(QChar(0x23CE)).addWinSymbol(QChar(0xBF));
symbols["varhexagonlrbonds"]=SymbolUnicode(QChar(0x232C)); symbols["varhexagonlrbonds"]=UnicodeSymbol(QChar(0x232C));
symbols["yen"]=SimpleTextSymbol(QChar(0xA5), "&yen;"); symbols["yen"]=SimpleTextSymbol(QChar(0xA5), "&yen;");
@ -636,7 +640,7 @@ void JKQTMathTextSymbolNode::fillSymbolTables()
symbols["Uparrow"]=UprightSymbolUnicode(QChar(0x21D1)).addUprightHtml("&DoubleUpArrow;").addUprightWinSymbol(QChar(0xDD)); symbols["Uparrow"]=UprightSymbolUnicode(QChar(0x21D1)).addUprightHtml("&DoubleUpArrow;").addUprightWinSymbol(QChar(0xDD));
symbols["Updownarrow"]=UprightSymbolUnicode(QChar(0x21D5)).addUprightHtml("&Updownarrow;"); symbols["Updownarrow"]=UprightSymbolUnicode(QChar(0x21D5)).addUprightHtml("&Updownarrow;");
symbols["approx"]=MathOperatorSymbolUnicode(QChar(0x2248)).addMathOperatorHtml("&asymp;").addMathOperatorWinSymbol(QChar(0xBB)); symbols["approx"]=MathOperatorSymbolUnicode(QChar(0x2248)).addMathOperatorHtml("&asymp;").addMathOperatorWinSymbol(QChar(0xBB));
symbols["bbC"]=SymbolUnicode(QChar(0x2102)); symbols["bbC"]=UnicodeSymbol(QChar(0x2102));
symbols["bbH"]=MathOperatorSymbolUnicode(QChar(0x210D)); symbols["bbH"]=MathOperatorSymbolUnicode(QChar(0x210D));
symbols["bbN"]=MathOperatorSymbolUnicode(QChar(0x2115)); symbols["bbN"]=MathOperatorSymbolUnicode(QChar(0x2115));
symbols["bbP"]=MathOperatorSymbolUnicode(QChar(0x2119)); symbols["bbP"]=MathOperatorSymbolUnicode(QChar(0x2119));

View File

@ -262,13 +262,13 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextSymbolNode: public JKQTMathTextNode {
/** \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(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 SymbolStd(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 */
static SymbolFullProps SymbolUnicode(const QString& symbol, const QString& html); static SymbolFullProps UnicodeSymbol(const QString& symbol, 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 SymbolStd(const QString& symbol, SymbolFlags _flags=AsOutside, double _fontScalingFactor=1.0, double _yShiftFactor=0.0); static SymbolFullProps StdSymbol(const QString& symbol, SymbolFlags _flags=AsOutside, double _fontScalingFactor=1.0, double _yShiftFactor=0.0);
/** \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 */
static SymbolFullProps SymbolUnicode(const QString& symbol, SymbolFlags _flags=AsOutside, double _fontScalingFactor=1.0, double _yShiftFactor=0.0); static SymbolFullProps UnicodeSymbol(const QString& symbol, SymbolFlags _flags=AsOutside, double _fontScalingFactor=1.0, double _yShiftFactor=0.0);
/** \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 UprightSymbolStd(const QString& symbol, const QString& html=QString()); static SymbolFullProps UprightSymbolStd(const QString& symbol, const QString& html=QString());
/** \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 */