JKQTMathText:
- NEW: Added the Fira Math fonts as sans-serif symbol font to the library (as a ressource) and added JKQTMathText::useFiraMath() - NEW: Added JKQTMathText::useGuiFonts()</li> JKQTPlotter: - NEW: Using JKQTMathText::useGuiFonts() for FONT rendering by default
@ -7,6 +7,9 @@ endif()
|
||||
if(NOT DEFINED JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
||||
option(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS "Include XITS fonts (SIL OPEN FONT LICENSE Version 1.1) as resources in library" ON)
|
||||
endif()
|
||||
if(NOT DEFINED JKQtPlotter_BUILD_INCLUDE_FIRAMATH_FONTS)
|
||||
option(JKQtPlotter_BUILD_INCLUDE_FIRAMATH_FONTS "Include Fira Math fonts (SIL OPEN FONT LICENSE Version 1.1) as resources in library" ON)
|
||||
endif()
|
||||
if(NOT DEFINED JKQtPlotter_BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE)
|
||||
option(JKQtPlotter_BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE "If set, the build-type (debug/release/...) is appended to the library name" ON)
|
||||
endif()
|
||||
|
@ -50,7 +50,7 @@ if(JKQtPlotter_BUILD_TOOLS)
|
||||
|
||||
add_custom_target(JKQTMathText_GenerateDocImages_listsymbols
|
||||
COMMENT "Building JKQTMathText Documentation Images: LISTSYMBOLS"
|
||||
COMMAND ${JKQTMathText_GenerateDocImages_COMMAND} --listsymbols="${CMAKE_CURRENT_LIST_DIR}/dox/jkqtmathtext_supportedlatexsymbols.dox" --outputdir="${JKQTMathText_GenerateDocImages_OutputDir}/symbols/"
|
||||
COMMAND ${JKQTMathText_GenerateDocImages_COMMAND} --listsymbolsfonts=XITS_MATHANDTEXT,FIRA_MATHANDTEXT --listsymbols="${CMAKE_CURRENT_LIST_DIR}/dox/jkqtmathtext_supportedlatexsymbols.dox" --outputdir="${JKQTMathText_GenerateDocImages_OutputDir}/symbols/"
|
||||
WORKING_DIRECTORY ${JKQtPlotter_QT_BINDIR}
|
||||
DEPENDS jkqtmathtext_render
|
||||
)
|
||||
|
@ -50,6 +50,7 @@ The CMake build system offers several configuration variables that you may set/c
|
||||
- \c JKQtPlotter_BUILD_SHARED_LIBS : Build as shared library (default: \c ON )
|
||||
- \c JKQtPlotter_BUILD_STATIC_LIBS : Build as static library (default: \c ON )
|
||||
- \c JKQtPlotter_BUILD_INCLUDE_XITS_FONTS : Include XITS fonts as resources in library (default: \c ON )
|
||||
- \c JKQtPlotter_BUILD_INCLUDE_FIRAMATH_FONTS : Include Fira Math fonts as resources in library (default: \c ON )
|
||||
- \c JKQtPlotter_BUILD_FORCE_NO_PRINTER_SUPPORT : switches off print-support (when set to \c ON ), even if the current platform supports it (default: \c OFF )
|
||||
- \c JKQtPlotter_BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE : If set, the build-type is appended to the library name (default: \c ON )
|
||||
- \c JKQtPlotter_BUILD_WITH_PRECOMPILED_HEADERS : If set, the build uses precompiled headers to speed up (a bit) (default: \c ON )
|
||||
|
@ -52,12 +52,15 @@
|
||||
- JKQTMathText::useSTIX() use the STIX fonts from <a href="https://www.stixfonts.org/">https://www.stixfonts.org/</a> in math-mode (or math- and text-mode, additionally also as MTEFallbackSymbols)<br>\image html jkqtmathtext/jkqtmathtext_stix.png
|
||||
- JKQTMathText::useXITS() use the XITS fonts from <a href="https://github.com/alif-type/xits">https://github.com/alif-type/xits</a> in math-mode (or math- and text-mode, additionally also as MTEFallbackSymbols). These are included by default in this library and also activated by default.<br>\image html jkqtmathtext/jkqtmathtext_xits.png
|
||||
- JKQTMathText::useASANA() use the ASANA fonts from <a href="https://ctan.org/tex-archive/fonts/Asana-Math/">https://ctan.org/tex-archive/fonts/Asana-Math/</a> in math-mode (or math- and text-mode, additionally also as MTEFallbackSymbols)<br>\image html jkqtmathtext/jkqtmathtext_asana.png
|
||||
- JKQTMathText::useFiraMath() use the Fira Math fonts from <a href="https://github.com/firamath/firamath">https://github.com/firamath/firamath</a> in math-mode (or math- and text-mode, additionally also as MTEFallbackSymbols)<br>\image html jkqtmathtext/jkqtmathtext_usefira.png
|
||||
- JKQTMathText::useGuiFonts() use the default application font (e.g. Segoe UI on Win10/11) for the "roman" and "math-roman" and try to determine mathing fonts for "sans"/"math-sans" and MTEFallbackSymbols.<br>\image html jkqtmathtext/jkqtmathtext_useguifonts.png
|
||||
- JKQTMathText::useAnyUnicode() set fonts for "roman" and "sans" in text- and math-mode with one call
|
||||
- JKQTMathText::useAnyUnicodeForMathOnly() set fonts for "roman" and "sans" in math-mode only with one call, leaves text-mode fonts as is
|
||||
- JKQTMathText::useAnyUnicodeForTextOnly() set fonts for "roman" and "sans" in text-mode only with one call, leaves math-mode fonts as is
|
||||
- JKQTMathText::setFontRomanAndMath() set "roman" font in text- and math-mode
|
||||
- JKQTMathText::setFontRomanOrSpecial() use an object of type JKQTMathTextFontSpecifier or a special string syntax (see struct documentation
|
||||
of JKQTMathTextFontSpecifier) to define the text- and math-mode "roman" fonts
|
||||
- JKQTMathText::setFontSpecial() seit "roman" and "sans" fonts from a parsed specifier, see function documentation for details
|
||||
.
|
||||
|
||||
Here are some examples of using different, widely available, fonts:
|
||||
|
@ -525,8 +525,8 @@ That's all there is to it!
|
||||
JKQTPlotter is mostly self-conatined. The only exceptions are listed below
|
||||
|
||||
\subsection extlicense_xits XITS Fonts for JKQTMathText
|
||||
JKQTMathText comes prepackaged with the XITS fonts from <a href="https://www.stixfonts.org/">https://www.stixfonts.org/</a>. With these it can produceh
|
||||
high-quality math rendering. It is possible to use the class with other fonts, but XITS is highly recommended. XITS fonts are licensed as follows:
|
||||
JKQTMathText comes prepackaged with the XITS fonts from <a href="https://www.stixfonts.org/">https://www.stixfonts.org/</a>. With these it can produce
|
||||
high-quality math rendering with serifs. It is possible to use the class with other fonts, but XITS is highly recommended. XITS fonts are licensed as follows:
|
||||
|
||||
\verbatim
|
||||
XITS is a Times-like typeface for mathematical and scientific publishing,
|
||||
@ -548,10 +548,38 @@ The source for this library can be found here: https://github.com/alif-type/xits
|
||||
|
||||
\note The XITS fonts are distributed in
|
||||
<a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/math_fonts/xits">lib/jkqtplotter/resources/math_fonts/xits</a>
|
||||
and are automatically added to the binary libraries as Qt Resources. You can prevent this by adding the line
|
||||
\code
|
||||
DEFINES += NO_XITS_FONTS
|
||||
\endcode
|
||||
and are automatically added to the binary libraries as Qt Resources.
|
||||
<br/><br/>
|
||||
In a \b CMake-Build you can use the the option \c JKQtPlotter_BUILD_INCLUDE_XITS_FONTS to control whether
|
||||
XITS fonst are linked into the library or not.
|
||||
<br/><br/>
|
||||
For a \b QMake-build, you
|
||||
can prevent this by adding the line \c DEFINES+=NO_XITS_FONTS
|
||||
To the QMake project that you use to build the JKQTPlotter/JKQTMathText libraries (see the ready-made \c .pro -files for static and dynamic libs, which
|
||||
already contain this line, but commented out. QMake will tell you with a message whether XITS is linked in or not.
|
||||
|
||||
|
||||
\subsection extlicense_firamath Fira Math Fonts for JKQTMathText
|
||||
JKQTMathText comes prepackaged with the Fira Math fonts from <a href="https://github.com/firamath/firamath">https://github.com/firamath/firamath</a>. With these it can produce
|
||||
high-quality math rendering in sans-serif style. It is possible to use the class with other fonts, but Fira Math or XITS is highly recommended. Fira Math fonts are licensed as follows:
|
||||
|
||||
\verbatim
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
(https://scripts.sil.org/OFL)
|
||||
|
||||
Copyright (C) 2018–2021 by Xiangdong Zeng.
|
||||
\endverbatim
|
||||
|
||||
The source for this library can be found here: https://github.com/firamath/firamath
|
||||
|
||||
\note The XITS fonts are distributed in
|
||||
<a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/math_fonts/firaMath">lib/jkqtplotter/resources/math_fonts/firaMath</a>
|
||||
and are automatically added to the binary libraries as Qt Resources.
|
||||
<br/><br/>
|
||||
In a \b CMake-Build you can use the the option \c JKQtPlotter_BUILD_INCLUDE_FIRAMATH_FONTS to control whether
|
||||
XITS fonst are linked into the library or not.
|
||||
<br/><br/>
|
||||
For a \b QMake-build, you can prevent this by adding the line \c DEFINES+=NO_FIRAMATH_FONTS
|
||||
To the QMake project that you use to build the JKQTPlotter/JKQTMathText libraries (see the ready-made \c .pro -files for static and dynamic libs, which
|
||||
already contain this line, but commented out. QMake will tell you with a message whether XITS is linked in or not.
|
||||
|
||||
|
@ -42,6 +42,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
|
||||
<li>NEW: added simple scatter plot JKQTPXYScatterGraph</li>
|
||||
<li>NEW: made resize-timer status accessible from outside via JKQTPlotter::isResizeTimerRunning() </li>
|
||||
<li>NEW: made it's delay a global static variable that can be set and red with JKQTPlotter::setGlobalResizeDelay() and JKQTPlotter::getGlobalResizeDelay()</li>
|
||||
<li>NEW: Using JKQTMathText::useGuiFonts() for FONT rendering by default</li>
|
||||
</ul></li>
|
||||
|
||||
<li>JKQTMathText:<ul>
|
||||
@ -110,6 +111,8 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
|
||||
<li>NEW: added environment-modifying commands for font sizes: \c \\tiny ... \c \\normalsize ... \c \\Huge </li>
|
||||
<li>NEW: added environment-modifying commands for text color: \c {\\color{COL}...} </li>
|
||||
<li>NEW: added environment-modifying commands for text formatting: \c {\\bfseries...}, \c {\\itshape...}, \c {\\bf...}, \c {\\it...}, \c {\\sffamily...}, \c {\\ttfamily...}, ... </li>
|
||||
<li>NEW: Added the Fira Math fonts as sans-serif symbol font to the library (as a ressource) and added JKQTMathText::useFiraMath()</li>
|
||||
<li>NEW: Added JKQTMathText::useGuiFonts()</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
|
||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 155 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.7 KiB |
BIN
doc/images/jkqtmathtext/jkqtmathtext_usefira.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
doc/images/jkqtmathtext/jkqtmathtext_useguifonts.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
@ -1,4 +1,8 @@
|
||||
---
|
||||
jkqtmathtext_useguifonts.png
|
||||
--guifonts
|
||||
\textsf{Schrödinger's} equation: $\left[-\frac{\hbar^2}{2m}\frac{\partial^2}{\partial x^2}+V\right]\Psi(x)=\mathrm{i}\hbar\frac{\partial}{\partial t}\Psi(x)$
|
||||
---
|
||||
jkqtmathtext_arial.png
|
||||
--fontroman=Arial --fontmathroman=Arial --sizeincrease=10
|
||||
Schrödinger's equation: $\left[-\frac{\hbar^2}{2m}\frac{\partial^2}{\partial x^2}+V\right]\Psi(x)=\mathrm{i}\hbar\frac{\partial}{\partial t}\Psi(x)$
|
||||
@ -31,6 +35,10 @@ jkqtmathtext_fira.png
|
||||
--fontmathroman=Fira Math --fontroman=Fira Sans --sizeincrease=10
|
||||
Schrödinger's equation: $\left[-\frac{\hbar^2}{2m}\frac{\partial^2}{\partial x^2}+V\right]\Psi(x)=\mathrm{i}\hbar\frac{\partial}{\partial t}\Psi(x),\ \ x\in\mathbb{R}, \Psi(x)\in\mathbb{C}$
|
||||
---
|
||||
jkqtmathtext_usefira.png
|
||||
--fontmathroman=FIRA --sizeincrease=10
|
||||
Schrödinger's equation: $\left[-\frac{\hbar^2}{2m}\frac{\partial^2}{\partial x^2}+V\right]\Psi(x)=\mathrm{i}\hbar\frac{\partial}{\partial t}\Psi(x),\ \ x\in\mathbb{R}, \Psi(x)\in\mathbb{C}$
|
||||
---
|
||||
jkqtmathtext_DejaVuSerif.png
|
||||
--fontmathroman=DejaVu Serif --fontroman=DejaVu Serif --fontfallbacksymbol=DejaVu Serif --sizeincrease=10
|
||||
Schrödinger's equation: $\left[-\frac{\hbar^2}{2m}\frac{\partial^2}{\partial x^2}+V\right]\Psi(x)=\mathrm{i}\hbar\frac{\partial}{\partial t}\Psi(x),\ \ x\in\mathbb{R}, \Psi(x)\in\mathbb{C}$
|
||||
|
@ -632,7 +632,7 @@ void TestForm::updateMath()
|
||||
|
||||
|
||||
mt.setFallbackFontSymbols(ui->cmbUnicodeSymbol->currentFont().family(), static_cast<JKQTMathTextFontEncoding>(ui->cmbEncodingSymbol->currentIndex()));
|
||||
if (ui->cmbFont->currentIndex()<=3) {
|
||||
if (ui->cmbFont->currentIndex()<=4) {
|
||||
mt.setFontRoman(ui->cmbUnicodeSerif->currentFont().family(), static_cast<JKQTMathTextFontEncoding>(ui->cmbEncodingSerif->currentIndex()));
|
||||
mt.setFontSans(ui->cmbUnicodeSans->currentFont().family(), static_cast<JKQTMathTextFontEncoding>(ui->cmbEncodingSans->currentIndex()));
|
||||
mt.setFontMathRoman(ui->cmbUnicodeSerifMath->currentFont().family(), static_cast<JKQTMathTextFontEncoding>(ui->cmbEncodingSerifMath->currentIndex()));
|
||||
@ -643,35 +643,20 @@ void TestForm::updateMath()
|
||||
mt.setFontFraktur(ui->cmbUnicodeFraktur->currentFont().family(), static_cast<JKQTMathTextFontEncoding>(ui->cmbEncodingFraktur->currentIndex()));
|
||||
mt.setFontBlackboard(ui->cmbUnicodeBlackboard->currentFont().family(), static_cast<JKQTMathTextFontEncoding>(ui->cmbEncodingBlackboard->currentIndex()));
|
||||
mt.setFallbackFontSymbols(ui->cmbUnicodeSymbol->currentFont().family(), static_cast<JKQTMathTextFontEncoding>(ui->cmbEncodingSymbol->currentIndex()));
|
||||
} else if (ui->cmbFont->currentIndex()==5 || ui->cmbFont->currentIndex()==6) {
|
||||
mt.setFontRoman(QGuiApplication::font().family());
|
||||
mt.setFontMathRoman(QGuiApplication::font().family());
|
||||
} else if (ui->cmbFont->currentIndex()==7) {
|
||||
} else if (ui->cmbFont->currentIndex()==5) {
|
||||
mt.useXITS();
|
||||
mt.useAnyUnicode("Times New Roman", "Times New Roman");
|
||||
} else if (ui->cmbFont->currentIndex()==8) {
|
||||
} else if (ui->cmbFont->currentIndex()==6) {
|
||||
mt.useXITS();
|
||||
mt.useAnyUnicode("Arial", "Arial");
|
||||
} else if (ui->cmbFont->currentIndex()==9) {
|
||||
} else if (ui->cmbFont->currentIndex()==7) {
|
||||
mt.useXITS();
|
||||
mt.useAnyUnicode("Courier New", "Courier New");
|
||||
} else if (ui->cmbFont->currentIndex()==10) {
|
||||
} else if (ui->cmbFont->currentIndex()==8) {
|
||||
mt.useXITS();
|
||||
mt.useAnyUnicode("Comic Sans MS", "Comic Sans MS");
|
||||
} else if (ui->cmbFont->currentIndex()==11) {
|
||||
mt.useAnyUnicodeForTextOnly("Times New Roman", "Times New Roman");
|
||||
mt.useXITS();
|
||||
} else if (ui->cmbFont->currentIndex()==12) {
|
||||
mt.useAnyUnicodeForTextOnly("Arial", "Arial");
|
||||
mt.useXITS();
|
||||
} else if (ui->cmbFont->currentIndex()==13) {
|
||||
mt.useAnyUnicodeForTextOnly("Courier New", "Courier New");
|
||||
mt.useXITS();
|
||||
} else if (ui->cmbFont->currentIndex()==14) {
|
||||
mt.useAnyUnicodeForTextOnly("Comic Sans MS", "Comic Sans MS");
|
||||
mt.useXITS();
|
||||
} else if (ui->cmbFont->currentIndex()==15) {
|
||||
mt.useXITS(false);
|
||||
} else if (ui->cmbFont->currentIndex()==9) {
|
||||
mt.useGuiFonts();
|
||||
}
|
||||
|
||||
mt.setFontBlackboradMode(String2JKQTMathTextBlackboradDrawingMode(ui->cmdBlackboradMode->currentText()));
|
||||
@ -679,7 +664,7 @@ void TestForm::updateMath()
|
||||
if (ui->cmbFont->currentIndex()==1) qDebug()<<"useXITS: "<<mt.useXITS();
|
||||
else if (ui->cmbFont->currentIndex()==2) qDebug()<<"useSTIX: "<<mt.useSTIX();
|
||||
else if (ui->cmbFont->currentIndex()==3) qDebug()<<"useASANA: "<<mt.useASANA();
|
||||
else if (ui->cmbFont->currentIndex()==6) qDebug()<<"useXITS: "<<mt.useXITS();
|
||||
else if (ui->cmbFont->currentIndex()==4) qDebug()<<"useFiraMath: "<<mt.useFiraMath();
|
||||
ui->tree->clear();
|
||||
ht.start();
|
||||
double durationParse=0;
|
||||
|
@ -632,62 +632,32 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Default-Constructed</string>
|
||||
<string>Below+Math: Fira</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Default-Constructed+SetAppFontRoman+SetAppFontMath</string>
|
||||
<string>useAnyUnicodeForTextOnly("Times New Roman", "Times New Roman")</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Default-Constructed+SetAppFontRoman+SetAppFontMath+XITS</string>
|
||||
<string>useAnyUnicodeForTextOnly("Arial", "Arial")</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>useXITS(true)+useAnyUnicode("Times New Roman", "Times New Roman")</string>
|
||||
<string>useAnyUnicodeForTextOnly("Courier New", "Courier New")</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>useXITS(true)+useAnyUnicode("Arial", "Arial")</string>
|
||||
<string>useAnyUnicodeForTextOnly("Comic Sans MS", "Comic Sans MS")</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>useXITS(true)+useAnyUnicode("Courier New", "Courier New")</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>useXITS(true)+useAnyUnicode("Comic Sans MS", "Comic Sans MS")</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>useAnyUnicodeForTextOnly("Times New Roman", "Times New Roman")+useXITS(true)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>useAnyUnicodeForTextOnly("Arial", "Arial")+useXITS(true)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>useAnyUnicodeForTextOnly("Courier New", "Courier New")+useXITS(true)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>useAnyUnicodeForTextOnly("Comic Sans MS", "Comic Sans MS")+useXITS(true)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>useXITS(false)</string>
|
||||
<string>useGuiFonts()</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
|
@ -347,11 +347,20 @@ void JKQTPStylePlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
|
||||
act->setFont(QFont(JKQTMathTextFontSpecifier::transformFontName(fontName)));
|
||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
||||
menuDefaultFonts->addAction(act);
|
||||
act=new QAction(fontName+"+FIRA");
|
||||
act->setFont(QFont(JKQTMathTextFontSpecifier::transformFontName(fontName)));
|
||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
||||
menuDefaultFonts->addAction(act);
|
||||
fontName="XITS";
|
||||
act=new QAction(fontName);
|
||||
act->setFont(QFont(JKQTMathTextFontSpecifier::getXITSFamilies().fontName()));
|
||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
||||
menuDefaultFonts->addAction(act);
|
||||
fontName="FIRA";
|
||||
act=new QAction(fontName);
|
||||
act->setFont(QFont(JKQTMathTextFontSpecifier::getFIRAFamilies().fontName()));
|
||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
||||
menuDefaultFonts->addAction(act);
|
||||
menuDefaultFonts->addSeparator();
|
||||
fontName=QGuiApplication::font().family();
|
||||
act=new QAction(fontName);
|
||||
@ -362,6 +371,10 @@ void JKQTPStylePlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
|
||||
act->setFont(QFont(fontName));
|
||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
||||
menuDefaultFonts->addAction(act);
|
||||
act=new QAction(fontName+"+FIRA");
|
||||
act->setFont(QFont(fontName));
|
||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
||||
menuDefaultFonts->addAction(act);
|
||||
|
||||
fontName="application";
|
||||
act=new QAction(fontName);
|
||||
@ -372,6 +385,10 @@ void JKQTPStylePlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
|
||||
act->setFont(QFont(JKQTMathTextFontSpecifier::transformFontName(fontName)));
|
||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
||||
menuSystemFonts->addAction(act);
|
||||
act=new QAction(fontName+"+FIRA");
|
||||
act->setFont(QFont(JKQTMathTextFontSpecifier::transformFontName(fontName)));
|
||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
||||
menuSystemFonts->addAction(act);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,2,0)
|
||||
fontName="general";
|
||||
act=new QAction(fontName);
|
||||
@ -403,6 +420,10 @@ void JKQTPStylePlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
|
||||
act->setFont(QFont(JKQTMathTextFontSpecifier::transformFontName(fontName)));
|
||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
||||
menuSystemFonts->addAction(act);
|
||||
act=new QAction(fontName+"+FIRA");
|
||||
act->setFont(QFont(JKQTMathTextFontSpecifier::transformFontName(fontName)));
|
||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
||||
menuSystemFonts->addAction(act);
|
||||
fontName="sans-serif";
|
||||
act=new QAction(fontName);
|
||||
act->setFont(QFont(JKQTMathTextFontSpecifier::transformFontName(fontName)));
|
||||
@ -412,6 +433,10 @@ void JKQTPStylePlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
|
||||
act->setFont(QFont(JKQTMathTextFontSpecifier::transformFontName(fontName)));
|
||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
||||
menuSystemFonts->addAction(act);
|
||||
act=new QAction(fontName+"+FIRA");
|
||||
act->setFont(QFont(JKQTMathTextFontSpecifier::transformFontName(fontName)));
|
||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::changeCurrentLineValueTo), this, act->text()));
|
||||
menuSystemFonts->addAction(act);
|
||||
fontName="cursive";
|
||||
act=new QAction(fontName);
|
||||
act->setFont(QFont(JKQTMathTextFontSpecifier::transformFontName(fontName)));
|
||||
@ -451,6 +476,10 @@ void JKQTPStylePlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
|
||||
act=new QAction(fontName);
|
||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::addMathFontSpecifier), this, act->text()));
|
||||
menuMathFont->addAction(act);
|
||||
fontName="FIRA";
|
||||
act=new QAction(fontName);
|
||||
connect(act, &QAction::triggered, std::bind(std::mem_fn(&JKQTPStylePlainTextEdit::addMathFontSpecifier), this, act->text()));
|
||||
menuMathFont->addAction(act);
|
||||
} else if (currentLinePartsLower[0].endsWith("\\draw_mode1") || currentLinePartsLower[0].endsWith("\\draw_mode2")) {
|
||||
submenu->setEnabled(true);
|
||||
QAction* act;
|
||||
|
@ -112,12 +112,15 @@ set(HEADERS_PARSERS
|
||||
$<INSTALL_INTERFACE:parsers/jkqtmathtextlatexparser.h>
|
||||
)
|
||||
|
||||
set(RESOURCES "")
|
||||
if(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
||||
set(RESOURCES
|
||||
${CMAKE_CURRENT_LIST_DIR}/resources/xits.qrc
|
||||
)
|
||||
list(APPEND RESOURCES ${CMAKE_CURRENT_LIST_DIR}/resources/xits.qrc )
|
||||
endif(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
||||
|
||||
if(JKQtPlotter_BUILD_INCLUDE_FIRAMATH_FONTS)
|
||||
list(APPEND RESOURCES ${CMAKE_CURRENT_LIST_DIR}/resources/firamath.qrc )
|
||||
endif(JKQtPlotter_BUILD_INCLUDE_FIRAMATH_FONTS)
|
||||
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
@ -142,6 +145,9 @@ function(JKQtMathText_setDefaultLibOptions TARGETNAME)
|
||||
if(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
||||
target_compile_definitions(${TARGETNAME} PRIVATE JKQTMATHTEXT_COMPILED_WITH_XITS)
|
||||
endif(JKQtPlotter_BUILD_INCLUDE_XITS_FONTS)
|
||||
if(JKQtPlotter_BUILD_INCLUDE_FIRAMATH_FONTS)
|
||||
target_compile_definitions(${TARGETNAME} PRIVATE JKQTMATHTEXT_COMPILED_WITH_FIRAMATH)
|
||||
endif(JKQtPlotter_BUILD_INCLUDE_FIRAMATH_FONTS)
|
||||
|
||||
# precomiled headers to speed up compilation
|
||||
if (JKQtPlotter_BUILD_WITH_PRECOMPILED_HEADERS)
|
||||
@ -234,4 +240,6 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${libBasename}_Readme.txt" DESTINATIO
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${libBasename}_LICENSE.txt" )
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/lib/jkqtmathtext/resources/xits/OFL.txt" DESTINATION doc/JKQtPlotter RENAME "${libBasename}_XITS_LICENSE.txt" )
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/lib/jkqtmathtext/resources/xits/README.md" DESTINATION doc/JKQtPlotter RENAME "${libBasename}_XITS_README.md" )
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/lib/jkqtmathtext/resources/firaMath/LICENSE" DESTINATION doc/JKQtPlotter RENAME "${libBasename}_FIRAMATH_LICENSE" )
|
||||
install(FILES "${PROJECT_SOURCE_DIR}/lib/jkqtmathtext/resources/firaMath/README.md" DESTINATION doc/JKQtPlotter RENAME "${libBasename}_FIRAMATH_README.md" )
|
||||
|
||||
|
@ -50,8 +50,19 @@
|
||||
#include <QPainterPath>
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------
|
||||
// -- instanciation of the static JKQTMathText members
|
||||
// --------------------------------------------------------------------------------------------------
|
||||
const double JKQTMathText::ABS_MIN_LINEWIDTH=0.02;
|
||||
|
||||
QString JKQTMathText::init_serifFont="serif";
|
||||
QString JKQTMathText::init_sansFont="sans";
|
||||
QString JKQTMathText::init_symbolFont="symbol";
|
||||
QString JKQTMathText::init_scriptFont="script";
|
||||
QString JKQTMathText::init_typewriterFont="typewriter";
|
||||
QString JKQTMathText::init_caligraphicFont="decorative";
|
||||
QString JKQTMathText::init_blackboardFont="blackboard";
|
||||
QString JKQTMathText::init_fracturFont="fraktur";
|
||||
bool JKQTMathText::s_firstStart=true;
|
||||
|
||||
|
||||
|
||||
@ -59,7 +70,7 @@ const double JKQTMathText::ABS_MIN_LINEWIDTH=0.02;
|
||||
// --------------------------------------------------------------------------------------------------
|
||||
// -- implementation of the JKQTMathText methods
|
||||
// --------------------------------------------------------------------------------------------------
|
||||
JKQTMathText::JKQTMathText(QObject* parent):
|
||||
JKQTMathText::JKQTMathText(QObject* parent, bool useFontsForGUI):
|
||||
QObject(parent)
|
||||
{
|
||||
//std::chrono::high_resolution_clock::time_point t0=std::chrono::high_resolution_clock::now();
|
||||
@ -114,20 +125,12 @@ JKQTMathText::JKQTMathText(QObject* parent):
|
||||
blackboradFontMode=MTBBDMdefault;
|
||||
|
||||
|
||||
static QString serifFont="serif";
|
||||
static QString sansFont="sans";
|
||||
static QString symbolFont="symbol";
|
||||
static QString scriptFont="script";
|
||||
static QString typewriterFont="typewriter";
|
||||
static QString decorativeFont="decorative";
|
||||
static QString blackboardFont="blackboard";
|
||||
static QString fracturFont="fraktur";
|
||||
static bool firstStart=true;
|
||||
|
||||
if (firstStart) {
|
||||
|
||||
if (s_firstStart) {
|
||||
//t0=std::chrono::high_resolution_clock::now();
|
||||
|
||||
firstStart=false;
|
||||
s_firstStart=false;
|
||||
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
||||
QFontDatabase fdb;
|
||||
const auto fonts=fdb.families();
|
||||
@ -145,51 +148,51 @@ JKQTMathText::JKQTMathText(QObject* parent):
|
||||
}
|
||||
};
|
||||
|
||||
checkForFonts(serifFont, QStringList {"Times New Roman", "Times", "FreeSerif", "DejaVu Serif"});
|
||||
checkForFonts(init_serifFont, QStringList {"Times New Roman", "Times", "FreeSerif", "DejaVu Serif"});
|
||||
//qDebug()<<"check 1st font: "<<std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now()-t0).count()/1000.0<<"ms";
|
||||
|
||||
checkForFonts(sansFont, QStringList {"Arial Unicode MS", "Arial Unicode", "Lucida Sans Unicode", "Arial", "Helvetica", "FreeSans", "DejaVu Sans", "Lucida Sans"});
|
||||
checkForFonts(symbolFont, QStringList {"SymbolStandard", "Symbol"});
|
||||
checkForFonts(typewriterFont, QStringList {"Courier New", "Courier", "Courier Std", "FreeMono", "CMU Typewriter Text", "UM Typewriter"});
|
||||
checkForFonts(blackboardFont, QStringList {"Double Stroke", "CloisterOpenFace BT", "GoudyHandtooled BT", "Castellar", "MathJax_AMS", "Castellar Standard", "MathJax_AMS Standard", "Colonna MT"});
|
||||
checkForFonts(decorativeFont, QStringList {"Lucida Calligraphy", "Cookie", "Segoe Print", "Comic Sans", "Comic Sans MS", "Gabriola", "Gabriola Standard", "Lucida Handwriting Kursiv", "Lucida Handwriting", "Pristina", "Pristina Standard", "MathJax_Caligraphics"});
|
||||
checkForFonts(scriptFont, QStringList {"Lucida Handwriting", "Dancing Script", "Amazone BT", "ScriptS", "ScriptC", "ScriptC Standard", "Script", "Brush Script MT", "Brush Script MT Kursiv", "MathJax_Script"});
|
||||
checkForFonts(fracturFont, QStringList {"Old English Text MT", "Old English Text MT Standard", "UnifrakturMaguntia Standard", "UnifrakturMaguntia", "MathJax_Fraktur", "UnifrakturCook Fett"});
|
||||
checkForFonts(init_sansFont, QStringList {"Segoe UI", "Arial Unicode MS", "Arial Unicode", "Lucida Sans Unicode", "Arial", "Helvetica", "FreeSans", "DejaVu Sans", "Lucida Sans"});
|
||||
checkForFonts(init_symbolFont, QStringList {"Segoe UI Symbol", "XITS Math", "Cambria Math", "Fira Math", "Lucida Bright Math", "SymbolStandard", "Symbol"});
|
||||
checkForFonts(init_typewriterFont, QStringList {"Courier New", "Courier", "Courier Std", "FreeMono", "CMU Typewriter Text", "UM Typewriter"});
|
||||
checkForFonts(init_blackboardFont, QStringList {"Double Stroke", "CloisterOpenFace BT", "GoudyHandtooled BT", "Castellar", "MathJax_AMS", "Castellar Standard", "MathJax_AMS Standard", "Colonna MT"});
|
||||
checkForFonts(init_caligraphicFont, QStringList {"Lucida Calligraphy", "Cookie", "Segoe Print", "Comic Sans", "Comic Sans MS", "Gabriola", "Gabriola Standard", "Lucida Handwriting Kursiv", "Lucida Handwriting", "Pristina", "Pristina Standard", "MathJax_Caligraphics"});
|
||||
checkForFonts(init_scriptFont, QStringList {"Lucida Handwriting", "Dancing Script", "Amazone BT", "ScriptS", "ScriptC", "ScriptC Standard", "Script", "Brush Script MT", "Brush Script MT Kursiv", "MathJax_Script"});
|
||||
checkForFonts(init_fracturFont, QStringList {"Old English Text MT", "Old English Text MT Standard", "UnifrakturMaguntia Standard", "UnifrakturMaguntia", "MathJax_Fraktur", "UnifrakturCook Fett"});
|
||||
//qDebug()<<"check all font: "<<std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now()-t0).count()/1000.0<<"ms";
|
||||
}
|
||||
|
||||
//t0=std::chrono::high_resolution_clock::now();
|
||||
if (serifFont!="serif") addReplacementFont("serif", serifFont);
|
||||
if (sansFont!="sans") addReplacementFont("sans", sansFont);
|
||||
if (symbolFont!="symbol") addReplacementFont("symbol", symbolFont);
|
||||
if (scriptFont!="script") addReplacementFont("script", scriptFont);
|
||||
if (typewriterFont!="typewriter") addReplacementFont("typewriter", typewriterFont);
|
||||
if (decorativeFont!="decorative") addReplacementFont("decorative", decorativeFont);
|
||||
if (fracturFont!="fraktur") addReplacementFont("fraktur", fracturFont);
|
||||
if (blackboardFont!="blackboard") {
|
||||
addReplacementFont("blackboard", blackboardFont);
|
||||
if (init_serifFont!="serif") addReplacementFont("serif", init_serifFont);
|
||||
if (init_sansFont!="sans") addReplacementFont("sans", init_sansFont);
|
||||
if (init_symbolFont!="symbol") addReplacementFont("symbol", init_symbolFont);
|
||||
if (init_scriptFont!="script") addReplacementFont("script", init_scriptFont);
|
||||
if (init_typewriterFont!="typewriter") addReplacementFont("typewriter", init_typewriterFont);
|
||||
if (init_caligraphicFont!="decorative") addReplacementFont("decorative", init_caligraphicFont);
|
||||
if (init_fracturFont!="fraktur") addReplacementFont("fraktur", init_fracturFont);
|
||||
if (init_blackboardFont!="blackboard") {
|
||||
addReplacementFont("blackboard", init_blackboardFont);
|
||||
}
|
||||
//qDebug()<<"add replacement fonts: "<<std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now()-t0).count()/1000.0<<"ms"; t0=std::chrono::high_resolution_clock::now();
|
||||
setFontSans(sansFont, estimateJKQTMathTextFontEncoding(sansFont));
|
||||
setFontMathSans(sansFont, estimateJKQTMathTextFontEncoding(sansFont));
|
||||
setFontTypewriter(typewriterFont, estimateJKQTMathTextFontEncoding(typewriterFont));
|
||||
setFontRoman(serifFont, estimateJKQTMathTextFontEncoding(serifFont));
|
||||
setFontMathRoman(serifFont, estimateJKQTMathTextFontEncoding(serifFont));
|
||||
setFontCaligraphic(decorativeFont, estimateJKQTMathTextFontEncoding(decorativeFont));
|
||||
if (blackboardFont!="blackboard") {
|
||||
setFontBlackboard(blackboardFont, estimateJKQTMathTextFontEncoding(blackboardFont));
|
||||
setFontSans(init_sansFont, estimateJKQTMathTextFontEncoding(init_sansFont));
|
||||
setFontMathSans(init_sansFont, estimateJKQTMathTextFontEncoding(init_sansFont));
|
||||
setFontTypewriter(init_typewriterFont, estimateJKQTMathTextFontEncoding(init_typewriterFont));
|
||||
setFontRoman(init_serifFont, estimateJKQTMathTextFontEncoding(init_serifFont));
|
||||
setFontMathRoman(init_serifFont, estimateJKQTMathTextFontEncoding(init_serifFont));
|
||||
setFontCaligraphic(init_caligraphicFont, estimateJKQTMathTextFontEncoding(init_caligraphicFont));
|
||||
if (init_blackboardFont!="blackboard") {
|
||||
setFontBlackboard(init_blackboardFont, estimateJKQTMathTextFontEncoding(init_blackboardFont));
|
||||
setFontBlackboradMode(MTBBDMunicodeCharactersOrFontDirectly);
|
||||
} else {
|
||||
setFontBlackboard(sansFont, estimateJKQTMathTextFontEncoding(sansFont));
|
||||
setFontBlackboard(init_sansFont, estimateJKQTMathTextFontEncoding(init_sansFont));
|
||||
setFontBlackboradMode(MTBBDMunicodeCharactersOrSimulate);
|
||||
}
|
||||
setFontScript(scriptFont, estimateJKQTMathTextFontEncoding(scriptFont));
|
||||
setFontFraktur(fracturFont, estimateJKQTMathTextFontEncoding(fracturFont));
|
||||
setFallbackFontSymbols(symbolFont, estimateJKQTMathTextFontEncoding(symbolFont));
|
||||
setFontScript(init_scriptFont, estimateJKQTMathTextFontEncoding(init_scriptFont));
|
||||
setFontFraktur(init_fracturFont, estimateJKQTMathTextFontEncoding(init_fracturFont));
|
||||
setFallbackFontSymbols(init_symbolFont, estimateJKQTMathTextFontEncoding(init_symbolFont));
|
||||
//qDebug()<<"set fonts: "<<std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now()-t0).count()/1000.0<<"ms"; t0=std::chrono::high_resolution_clock::now();
|
||||
useXITS();
|
||||
//qDebug()<<"useXITS: "<<std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now()-t0).count()/1000.0<<"ms"; t0=std::chrono::high_resolution_clock::now();
|
||||
|
||||
if (useFontsForGUI) useGuiFonts();
|
||||
parsedNode=nullptr;
|
||||
|
||||
}
|
||||
@ -334,6 +337,27 @@ bool JKQTMathText::useXITS(bool mathModeOnly, bool useAsFallbackSymbol)
|
||||
return res;
|
||||
}
|
||||
|
||||
bool JKQTMathText::useFiraMath(bool mathModeOnly, bool useAsFallbackSymbol)
|
||||
{
|
||||
const JKQTMathTextFontSpecifier fira=JKQTMathTextFontSpecifier::getFIRAFamilies();
|
||||
bool res=false;
|
||||
qDebug()<<"useFiraMath("<<mathModeOnly<<", "<<useAsFallbackSymbol<<")";
|
||||
|
||||
if (!mathModeOnly && !fira.fontName().isEmpty()) {
|
||||
setFontRoman(fira.fontName(), MTFEUnicode);
|
||||
if (useAsFallbackSymbol) setFallbackFontSymbols(fira.fallbackSymbolsFontName(), MTFEUnicode);
|
||||
res=true;
|
||||
}
|
||||
if (!fira.mathFontName().isEmpty()) {
|
||||
setFontMathRoman(fira.mathFontName(), MTFEUnicode);
|
||||
if (useAsFallbackSymbol) setFallbackFontSymbols(fira.fallbackSymbolsFontName(), MTFEUnicode);
|
||||
res=true;
|
||||
}
|
||||
|
||||
//std::cout<<"useFiraMath("<<mathModeOnly<<", "<<useAsFallbackSymbol<<") roman="<<getFontRoman().toStdString()<<", mathRoman="<<getFontMathRoman().toStdString()<<", symbol="<<getFallbackFontSymbols().toStdString();
|
||||
return res;
|
||||
}
|
||||
|
||||
bool JKQTMathText::useASANA(bool mathModeOnly, bool useAsFallbackSymbol)
|
||||
{
|
||||
|
||||
@ -354,6 +378,19 @@ bool JKQTMathText::useASANA(bool mathModeOnly, bool useAsFallbackSymbol)
|
||||
return res;
|
||||
}
|
||||
|
||||
bool JKQTMathText::useGuiFonts()
|
||||
{
|
||||
const JKQTMathTextFontSpecifier rm=JKQTMathTextFontSpecifier::getAppFontFamilies();
|
||||
const JKQTMathTextFontSpecifier sf=JKQTMathTextFontSpecifier::getAppFontSFFamilies();
|
||||
|
||||
if (rm.hasFontName()) setFontRoman(rm.fontName(), MTFEUnicode);
|
||||
if (rm.hasMathFontName()) setFontMathRoman(rm.mathFontName(), MTFEUnicode);
|
||||
if (rm.hasFallbackSymbolFontName()) setFallbackFontSymbols(rm.fallbackSymbolsFontName(), MTFEUnicode);
|
||||
if (sf.hasFontName()) setFontSans(sf.fontName(), MTFEUnicode);
|
||||
if (sf.hasMathFontName()) setFontMathSans(sf.mathFontName(), MTFEUnicode);
|
||||
return true;
|
||||
}
|
||||
|
||||
void JKQTMathText::useAnyUnicode(QString timesFont, const QString &sansFont, JKQTMathTextFontEncoding encodingTimes, JKQTMathTextFontEncoding encodingSans)
|
||||
{
|
||||
if (!timesFont.isEmpty()) {
|
||||
@ -491,7 +528,45 @@ void JKQTMathText::setFontRomanOrSpecial(const JKQTMathTextFontSpecifier &fontNa
|
||||
setFontRoman(fontName.fontName(), encoding);
|
||||
setFontMathRoman(fontName.mathFontName(), encoding);
|
||||
}
|
||||
if (fontName.hasFallbcakSymbolFontName()) setFallbackFontSymbols(fontName.fallbackSymbolsFontName(), encoding);
|
||||
if (fontName.hasFallbackSymbolFontName()) setFallbackFontSymbols(fontName.fallbackSymbolsFontName(), encoding);
|
||||
}
|
||||
|
||||
void JKQTMathText::setFontSpecial(const QString &fontSpec)
|
||||
{
|
||||
if (fontSpec.trimmed().size()==0) return;
|
||||
QString beforePlus=fontSpec;
|
||||
QString afterPlus="";
|
||||
const int Iplus=fontSpec.lastIndexOf('+');
|
||||
if (Iplus>=0 && Iplus<fontSpec.size()) {
|
||||
beforePlus=fontSpec.left(Iplus);
|
||||
afterPlus=fontSpec.mid(Iplus+1);
|
||||
}
|
||||
if (beforePlus.toUpper()=="GUI") useGuiFonts();
|
||||
else {
|
||||
const QStringList splitSlash=beforePlus.split('/');
|
||||
if (splitSlash.size()==1) {
|
||||
setFontRoman(JKQTMathTextFontSpecifier::transformFontNameAndDecodeSpecialFonts(splitSlash[0]), MTFEUnicode);
|
||||
setFontMathRoman(JKQTMathTextFontSpecifier::transformFontNameAndDecodeSpecialFonts(splitSlash[0]), MTFEUnicode);
|
||||
setFontSans(init_sansFont, estimateJKQTMathTextFontEncoding(init_sansFont));
|
||||
setFontMathSans(init_sansFont, estimateJKQTMathTextFontEncoding(init_sansFont));
|
||||
} else if (splitSlash.size()==2) {
|
||||
setFontRoman(JKQTMathTextFontSpecifier::transformFontNameAndDecodeSpecialFonts(splitSlash[0]), MTFEUnicode);
|
||||
setFontMathRoman(JKQTMathTextFontSpecifier::transformFontNameAndDecodeSpecialFonts(splitSlash[0]), MTFEUnicode);
|
||||
setFontSans(JKQTMathTextFontSpecifier::transformFontNameAndDecodeSpecialFonts(splitSlash[1]), MTFEUnicode);
|
||||
setFontMathSans(JKQTMathTextFontSpecifier::transformFontNameAndDecodeSpecialFonts(splitSlash[1]), MTFEUnicode);
|
||||
} else if (splitSlash.size()==4) {
|
||||
setFontRoman(JKQTMathTextFontSpecifier::transformFontNameAndDecodeSpecialFonts(splitSlash[0]), MTFEUnicode);
|
||||
setFontMathRoman(JKQTMathTextFontSpecifier::transformFontNameAndDecodeSpecialFonts(splitSlash[2]), MTFEUnicode);
|
||||
setFontSans(JKQTMathTextFontSpecifier::transformFontNameAndDecodeSpecialFonts(splitSlash[1]), MTFEUnicode);
|
||||
setFontMathSans(JKQTMathTextFontSpecifier::transformFontNameAndDecodeSpecialFonts(splitSlash[3]), MTFEUnicode);
|
||||
} else {
|
||||
qDebug()<<"JKQTMathText::setFontSpecial(): undecodable fontSpec '"<<fontSpec<<"'";
|
||||
}
|
||||
}
|
||||
if (afterPlus.toUpper()=="XITS") useXITS();
|
||||
if (afterPlus.toUpper()=="STIX") useSTIX();
|
||||
if (afterPlus.toUpper()=="ASANA") useASANA();
|
||||
if (afterPlus.toUpper()=="FIRA") useFiraMath();
|
||||
}
|
||||
|
||||
void JKQTMathText::setFontRoman(const QString &__value, JKQTMathTextFontEncoding encoding)
|
||||
|
@ -187,8 +187,8 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject {
|
||||
static const double ABS_MIN_LINEWIDTH;
|
||||
|
||||
|
||||
/** \brief class constructor */
|
||||
JKQTMathText(QObject * parent = nullptr);
|
||||
/** \brief class constructor with a paren QObject \a parent and calls useGuiFonts() if \a useFontsForGUI \c =true */
|
||||
JKQTMathText(QObject * parent = nullptr, bool useFontsForGUI=false);
|
||||
/** \brief class destructor */
|
||||
~JKQTMathText();
|
||||
|
||||
@ -400,6 +400,25 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject {
|
||||
* \see JKQTMathTextFontSpecifier, setFontRoman(), setFontMathRoman(), \ref jkqtmathtext_fonthandling
|
||||
*/
|
||||
void setFontRomanOrSpecial(const JKQTMathTextFontSpecifier & fontName, JKQTMathTextFontEncoding encoding=JKQTMathTextFontEncoding::MTFEStandard);
|
||||
/*! \brief set font(s) from parsing a font specifier
|
||||
*
|
||||
* This function understands a font-specifier in the following forms:
|
||||
* - \c fontRoman - set "roman" and "math-roman" to fontRoman "sans"/"math-sans" are reset to the default, when constructing the object
|
||||
* - \c fontRoman/fontSans - set "roman" and "math-roman" to fontRoman and "sans" and "math-sans" to fontSans
|
||||
* - \c fontRoman/fontSans/fontMathRoman/fontMathSans - sets all four majpr fonts
|
||||
* - any above with addition:
|
||||
* - \c +XITS use XITS for math/symbols, calls useXITS()
|
||||
* - \c +ASANA use ASANA for math/symbols, calls useASANA()
|
||||
* - \c +STIX use STIX for math/symbols, calls useSTIX()
|
||||
* - \c +FIRA use Fira Math for math/symbols, calls useFiraMath()
|
||||
* .
|
||||
* - \c GUI use GUI-fonts, calls useGuiFonts()
|
||||
* .
|
||||
*
|
||||
* Font names can also be one of the special names, specified in the documentation of JKQTMathTextFontSpecifier and JKQTMathTextFontSpecifier::transformFontNameAndDecodeSpecialFonts()
|
||||
*
|
||||
*/
|
||||
void setFontSpecial(const QString& fontSpec);
|
||||
|
||||
/** \brief set the font \a fontName and it's encoding \a encoding to be used for text in the logical font MTEroman
|
||||
*
|
||||
@ -531,7 +550,7 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject {
|
||||
*
|
||||
* \image html jkqtmathtext/jkqtmathtext_xits.png
|
||||
*
|
||||
* \note The XITS fonts can be compiled into JKQTPlotter, when the CMake-option \c is set to ON (default: ON).
|
||||
* \note The XITS fonts can be compiled into JKQTPlotter, when the CMake-option \c JKQtPlotter_BUILD_INCLUDE_XITS_FONTS is set to ON (default: ON).
|
||||
* Then the XITS fonts are added as Qt-Ressources to the library binary.
|
||||
* If this is not the case, you have to provide the XITS fonts on the target system by other means, if you want
|
||||
* to use them.
|
||||
@ -544,6 +563,28 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject {
|
||||
*/
|
||||
bool useXITS(bool mathModeOnly=true, bool useAsFallbackSymbol=true);
|
||||
|
||||
/** \brief configures the class to use the Fira Math fonts in mathmode
|
||||
*
|
||||
* use Fira Math fonts from <a href="https://github.com/firamath/firamath">https://github.com/firamath/firamath</a> in math-mode
|
||||
* or in math and text-mode (if \a mathModeOnly \c ==false ).
|
||||
*
|
||||
* If \c useAsFallbackSymbol is set \c ==true then the Fira Math fonts are also used as MTEFallbackSymbols
|
||||
*
|
||||
* \image html jkqtmathtext/jkqtmathtext_usefira.png
|
||||
*
|
||||
* \note The Fira Math fonts can be compiled into JKQTPlotter, when the CMake-option \c JKQtPlotter_BUILD_INCLUDE_FIRAMATH_FONTS is set to ON (default: ON).
|
||||
* Then the Fira Math fonts are added as Qt-Ressources to the library binary.
|
||||
* If this is not the case, you have to provide the Fira Math fonts on the target system by other means, if you want
|
||||
* to use them.
|
||||
*
|
||||
* This function does not only use default font-names for Fira Math, but searches
|
||||
* the font database of the system with several different variants, using JKQTMathTextFontSpecifier::getFIRAFamilies().
|
||||
* It also sets the special math-variant of Fira for math mode and the normal variant for text-mode
|
||||
*
|
||||
* \see \ref jkqtmathtext_fonthandling
|
||||
*/
|
||||
bool useFiraMath(bool mathModeOnly=true, bool useAsFallbackSymbol=true);
|
||||
|
||||
/** \brief configures the class to use the ASANA fonts in mathmode
|
||||
*
|
||||
* use the ASANA fonts from <a href="https://ctan.org/tex-archive/fonts/Asana-Math/">https://ctan.org/tex-archive/fonts/Asana-Math/</a> in math-mode
|
||||
@ -561,6 +602,15 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject {
|
||||
*/
|
||||
bool useASANA(bool mathModeOnly=true, bool useAsFallbackSymbol=true);
|
||||
|
||||
/** \brief configures the class to be used for GUI output, i.e. tries to find fonts that are harmonious for the
|
||||
* default GUI font, sets the default GUI font for "roman" and finds an oppposite font for "sans", which means that
|
||||
* "sans" may actually be a serif font,when the app font is sans serif!
|
||||
*
|
||||
*
|
||||
* \see \ref jkqtmathtext_fonthandling
|
||||
*/
|
||||
bool useGuiFonts();
|
||||
|
||||
/** \brief sets \a timesFont (with its encoding \a encodingTimes ) for serif-text and \a sansFont (with its encoding \a encodingSans ) for both mathmode and textmode fonts
|
||||
*
|
||||
* \note use generic Unicode fonts, e.g. "Arial" and "Times New Roman" in math-mode.
|
||||
@ -1001,8 +1051,24 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathText : public QObject {
|
||||
*/
|
||||
double matrix_yPadding_factor;
|
||||
|
||||
|
||||
|
||||
/** \brief initial choice for "serif" font */
|
||||
static QString init_serifFont;
|
||||
/** \brief initial choice for "sans-erif" font */
|
||||
static QString init_sansFont;
|
||||
/** \brief initial choice for "fallback symbol" font */
|
||||
static QString init_symbolFont;
|
||||
/** \brief initial choice for "script" font */
|
||||
static QString init_scriptFont;
|
||||
/** \brief initial choice for "typewriter" font */
|
||||
static QString init_typewriterFont;
|
||||
/** \brief initial choice for "caligraphic" font */
|
||||
static QString init_caligraphicFont;
|
||||
/** \brief initial choice for "blackboard" font */
|
||||
static QString init_blackboardFont;
|
||||
/** \brief initial choice for "fraktur" font */
|
||||
static QString init_fracturFont;
|
||||
/** \brief used to check for the first construction of a JKQTMathText ... if \c true several static variables are initialized in the constructor */
|
||||
static bool s_firstStart;
|
||||
};
|
||||
|
||||
|
||||
|
@ -38,6 +38,9 @@ void initJKQTMathTextResources()
|
||||
if (!initialized) {
|
||||
#ifdef JKQTMATHTEXT_COMPILED_WITH_XITS
|
||||
Q_INIT_RESOURCE(xits);
|
||||
#endif
|
||||
#ifdef JKQTMATHTEXT_COMPILED_WITH_FIRAMATH
|
||||
Q_INIT_RESOURCE(firamath);
|
||||
#endif
|
||||
initialized=true;
|
||||
}
|
||||
@ -48,7 +51,7 @@ JKQTMathTextFontSpecifier::JKQTMathTextFontSpecifier():
|
||||
m_mathFontName(""),
|
||||
m_transformOnOutput(true)
|
||||
{
|
||||
|
||||
initJKQTMathTextResources();
|
||||
}
|
||||
|
||||
JKQTMathTextFontSpecifier::JKQTMathTextFontSpecifier(const QString &_fontName, const QString &_mathFontName):
|
||||
@ -56,7 +59,7 @@ JKQTMathTextFontSpecifier::JKQTMathTextFontSpecifier(const QString &_fontName, c
|
||||
m_mathFontName(_mathFontName),
|
||||
m_transformOnOutput(true)
|
||||
{
|
||||
|
||||
initJKQTMathTextResources();
|
||||
}
|
||||
|
||||
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::fromFontSpec(const QString &fontSpec)
|
||||
@ -117,7 +120,7 @@ QString JKQTMathTextFontSpecifier::transformFontName(const QString &fontName, bo
|
||||
{
|
||||
const QString fnt=fontName.trimmed().toLower();
|
||||
QFont testFnt;
|
||||
if (fnt=="serif") {
|
||||
if (fnt=="serif" || fnt=="times") {
|
||||
testFnt.setStyleHint(QFont::StyleHint::Serif);
|
||||
return testFnt.defaultFamily();
|
||||
}
|
||||
@ -152,6 +155,16 @@ QString JKQTMathTextFontSpecifier::transformFontName(const QString &fontName, bo
|
||||
if (fnt=="default" || fnt=="app" || fnt=="application") {
|
||||
return QGuiApplication::font().family();
|
||||
}
|
||||
if (fnt=="appsf" || fnt=="application sf" || fnt=="application-sf") {
|
||||
const QFont f=QGuiApplication::font().family();
|
||||
if (f.styleHint()==QFont::SansSerif) {
|
||||
testFnt.setStyleHint(QFont::StyleHint::Serif);
|
||||
return testFnt.defaultFamily();
|
||||
} else {
|
||||
testFnt.setStyleHint(QFont::StyleHint::SansSerif);
|
||||
return testFnt.defaultFamily();
|
||||
}
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
||||
if (fnt=="fixed") {
|
||||
return QFontDatabase::systemFont(QFontDatabase::SystemFont::FixedFont).family();
|
||||
@ -186,15 +199,18 @@ QString JKQTMathTextFontSpecifier::transformFontName(const QString &fontName, bo
|
||||
QString JKQTMathTextFontSpecifier::transformFontNameAndDecodeSpecialFonts(const QString &fontName, bool mathmode)
|
||||
{
|
||||
const QString fnt=fontName.toLower().trimmed();
|
||||
if (fnt=="xits") {
|
||||
if (mathmode) return getXITSFamilies().mathFontName();
|
||||
if (fnt=="xits"||fnt=="xits_math") {
|
||||
if (mathmode||fnt=="xits_math") return getXITSFamilies().mathFontName();
|
||||
else return getXITSFamilies().fontName();
|
||||
} else if (fnt=="asana") {
|
||||
if (mathmode) return getASANAFamilies().mathFontName();
|
||||
} else if (fnt=="asana"||fnt=="asana_math") {
|
||||
if (mathmode||fnt=="asana_math") return getASANAFamilies().mathFontName();
|
||||
else return getASANAFamilies().fontName();
|
||||
} else if (fnt=="stix") {
|
||||
if (mathmode) return getSTIXFamilies().mathFontName();
|
||||
} else if (fnt=="stix"||fnt=="stix_math") {
|
||||
if (mathmode||fnt=="stix_math") return getSTIXFamilies().mathFontName();
|
||||
else return getSTIXFamilies().fontName();
|
||||
} else if (fnt=="fira"||fnt=="fira_math") {
|
||||
if (mathmode||fnt=="firs_math") return getFIRAFamilies().mathFontName();
|
||||
else return getFIRAFamilies().fontName();
|
||||
}
|
||||
return transformFontName(fontName, mathmode);
|
||||
}
|
||||
@ -209,13 +225,14 @@ bool JKQTMathTextFontSpecifier::hasMathFontName() const
|
||||
return !m_mathFontName.isEmpty();
|
||||
}
|
||||
|
||||
bool JKQTMathTextFontSpecifier::hasFallbcakSymbolFontName() const
|
||||
bool JKQTMathTextFontSpecifier::hasFallbackSymbolFontName() const
|
||||
{
|
||||
return !m_fallbackSymbolFont.isEmpty();
|
||||
}
|
||||
|
||||
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getXITSFamilies()
|
||||
{
|
||||
initJKQTMathTextResources();
|
||||
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
||||
QFontDatabase fdb;
|
||||
const auto fontFamilies=fdb.families();
|
||||
@ -257,6 +274,7 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getXITSFamilies()
|
||||
|
||||
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getASANAFamilies()
|
||||
{
|
||||
initJKQTMathTextResources();
|
||||
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
||||
QFontDatabase fdb;
|
||||
const auto fontFamilies=fdb.families();
|
||||
@ -295,6 +313,7 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getASANAFamilies()
|
||||
|
||||
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getSTIXFamilies()
|
||||
{
|
||||
initJKQTMathTextResources();
|
||||
static QStringList mathNames{"STIX Two Math", "STIX Math", "STIX Two Math Standard", "STIX Math Standard"};
|
||||
static QStringList textNames{"STIX", "STIXGeneral", "STIX General"};
|
||||
|
||||
@ -343,6 +362,102 @@ JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getSTIXFamilies()
|
||||
return fontSpec;
|
||||
}
|
||||
|
||||
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getFIRAFamilies()
|
||||
{
|
||||
initJKQTMathTextResources();
|
||||
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
||||
QFontDatabase fdb;
|
||||
const auto fontFamilies=fdb.families();
|
||||
#else
|
||||
const auto fontFamilies=QFontDatabase::families();
|
||||
#endif
|
||||
if (!fontFamilies.contains("Fira Math")) {
|
||||
if (QFile::exists(":/JKQTMathText/fonts/FiraMath-Regular.otf")) { QFontDatabase::addApplicationFont(":/JKQTMathText/fonts/FiraMath-Regular.otf"); }
|
||||
}
|
||||
|
||||
static JKQTMathTextFontSpecifier fontSpec;
|
||||
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
|
||||
fontSpec.m_transformOnOutput=false;
|
||||
for (int i=0; i<fontFamilies.size(); i++) {
|
||||
if (fontFamilies.at(i).contains("Fira Math")) {
|
||||
fontSpec.m_mathFontName=fontFamilies.at(i);
|
||||
fontSpec.m_fontName=fontFamilies.at(i);
|
||||
}
|
||||
if (fontFamilies.at(i).contains("Fira Sans")) {
|
||||
fontSpec.m_fontName=fontFamilies.at(i);
|
||||
}
|
||||
if (fontSpec.m_mathFontName.size()>0 && fontSpec.m_fontName.size()>0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fontSpec.m_mathFontName.isEmpty() && !fontSpec.m_fontName.isEmpty()) {
|
||||
fontSpec.m_mathFontName=fontSpec.m_fontName;
|
||||
} else if (!fontSpec.m_mathFontName.isEmpty() && fontSpec.m_fontName.isEmpty()) {
|
||||
fontSpec.m_fontName=fontSpec.m_mathFontName;
|
||||
}
|
||||
fontSpec.m_fallbackSymbolFont=fontSpec.m_mathFontName;
|
||||
}
|
||||
|
||||
return fontSpec;
|
||||
}
|
||||
|
||||
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getAppFontFamilies()
|
||||
{
|
||||
static JKQTMathTextFontSpecifier fontSpec;
|
||||
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
|
||||
#if (QT_VERSION<QT_VERSION_CHECK(6, 0, 0))
|
||||
QFontDatabase fdb;
|
||||
const auto fontFamilies=fdb.families();
|
||||
#else
|
||||
const auto fontFamilies=QFontDatabase::families();
|
||||
#endif
|
||||
const QFont f=QGuiApplication::font().family();
|
||||
fontSpec.m_fontName=f.family();
|
||||
fontSpec.m_mathFontName=f.family();
|
||||
bool set=false;
|
||||
if (f.family().toLower().startsWith("segoe ui")) {
|
||||
if (fontFamilies.contains("Segoe UI Symbol")) {
|
||||
fontSpec.m_fallbackSymbolFont=fontSpec.m_mathFontName="Segoe UI Symbol";
|
||||
set=true;
|
||||
}
|
||||
} else if (f.family().toLower().startsWith("cambria")) {
|
||||
if (fontFamilies.contains("Cambria Math")) {
|
||||
fontSpec.m_fallbackSymbolFont=fontSpec.m_mathFontName="Cambria Math";
|
||||
set=true;
|
||||
}
|
||||
}
|
||||
if (!set) {
|
||||
if (f.styleHint()==QFont::SansSerif) {
|
||||
const JKQTMathTextFontSpecifier fira=getFIRAFamilies();
|
||||
if (fira.hasFallbackSymbolFontName()) fontSpec.m_fallbackSymbolFont=fira.fallbackSymbolsFontName();
|
||||
if (fira.hasMathFontName()) fontSpec.m_mathFontName=fira.mathFontName();
|
||||
} else {
|
||||
const JKQTMathTextFontSpecifier xits=getXITSFamilies();
|
||||
if (xits.hasFallbackSymbolFontName()) fontSpec.m_fallbackSymbolFont=xits.fallbackSymbolsFontName();
|
||||
if (xits.hasMathFontName()) fontSpec.m_mathFontName=xits.mathFontName();
|
||||
}
|
||||
}
|
||||
}
|
||||
return fontSpec;
|
||||
}
|
||||
|
||||
JKQTMathTextFontSpecifier JKQTMathTextFontSpecifier::getAppFontSFFamilies()
|
||||
{
|
||||
static JKQTMathTextFontSpecifier fontSpec;
|
||||
if (fontSpec.m_fontName.isEmpty() && fontSpec.m_mathFontName.isEmpty()) {
|
||||
const QFont f=QGuiApplication::font().family();
|
||||
QFont testFnt;
|
||||
if (f.styleHint()==QFont::SansSerif) {
|
||||
testFnt.setStyleHint(QFont::StyleHint::Serif);
|
||||
fontSpec.m_fontName=fontSpec.m_mathFontName=testFnt.defaultFamily();
|
||||
} else {
|
||||
testFnt.setStyleHint(QFont::StyleHint::SansSerif);
|
||||
fontSpec.m_fontName=fontSpec.m_mathFontName=testFnt.defaultFamily();
|
||||
}
|
||||
}
|
||||
return fontSpec;
|
||||
}
|
||||
|
||||
QString JKQTMathTextFontEncoding2String(JKQTMathTextFontEncoding e)
|
||||
{
|
||||
switch(e) {
|
||||
|
@ -68,6 +68,7 @@ JKQTMATHTEXT_LIB_EXPORT void initJKQTMathTextResources();
|
||||
\section JKQTMathTextFontSpecifier_specialNames Special Font Names
|
||||
This object also implements replacing special font names with actual fonts. Supported special font names are:
|
||||
- \c default / \c app / \c application - the applications default font
|
||||
- \c application-sf - a font for "sans", based on the application font
|
||||
- \c times / \c serif - a general serif font
|
||||
- \c sans-serif - a general sans-serif font
|
||||
- \c typewriter - a general typewrter/monospaced font
|
||||
@ -89,6 +90,7 @@ JKQTMATHTEXT_LIB_EXPORT void initJKQTMathTextResources();
|
||||
- xits XITS fonts
|
||||
- stix STIX fonts
|
||||
- asana ASANA fonts
|
||||
- fira Fira fonts
|
||||
*/
|
||||
struct JKQTMATHTEXT_LIB_EXPORT JKQTMathTextFontSpecifier {
|
||||
JKQTMathTextFontSpecifier();
|
||||
@ -123,7 +125,7 @@ struct JKQTMATHTEXT_LIB_EXPORT JKQTMathTextFontSpecifier {
|
||||
/** \brief leiefert \c true, wenn ein mathFontName() verfügbar ist */
|
||||
bool hasMathFontName() const;
|
||||
/** \brief leiefert \c true, wenn ein fallbcakSymbolsFontName() verfügbar ist */
|
||||
bool hasFallbcakSymbolFontName() const;
|
||||
bool hasFallbackSymbolFontName() const;
|
||||
|
||||
/** \brief initialize with the font-families from the XITS package for text and math */
|
||||
static JKQTMathTextFontSpecifier getXITSFamilies();
|
||||
@ -133,6 +135,25 @@ struct JKQTMATHTEXT_LIB_EXPORT JKQTMathTextFontSpecifier {
|
||||
|
||||
/** \brief initialize with the font-families from the STIX package for text and math */
|
||||
static JKQTMathTextFontSpecifier getSTIXFamilies();
|
||||
|
||||
/** \brief initialize with the font-families from the Fira (Math) package for text and math */
|
||||
static JKQTMathTextFontSpecifier getFIRAFamilies();
|
||||
|
||||
/** \brief initialize with the default app font-families for "roman" text and math and tries to find a matching fallback-font. This may be used to initialize serif-fonts
|
||||
*
|
||||
* This method encodes some pre-coded knowledge of suitable combinations of fonts for different systems.
|
||||
* e.g. on newer windows systems, the font "Segoe UI" is used for the GUI... a suitable math
|
||||
* font with symbols is "Segoe UI Symbol" ...
|
||||
*/
|
||||
static JKQTMathTextFontSpecifier getAppFontFamilies();
|
||||
/** \brief initialize with the default app font-families for "serif" text and math and tries to find a matching fallback-font. This may be used to initialize sans-serif-fonts
|
||||
*
|
||||
* This method encodes some pre-coded knowledge of suitable combinations of fonts for different systems.
|
||||
*
|
||||
* This function e.g. checks whether the default app font is sans-serif and then looks for a serif
|
||||
* font for the "sans" font class (so the two can be distinguished) and vice-versa.
|
||||
*/
|
||||
static JKQTMathTextFontSpecifier getAppFontSFFamilies();
|
||||
private:
|
||||
/** \brief specifies the main font name */
|
||||
QString m_fontName;
|
||||
|
@ -162,7 +162,7 @@ double JKQTMathTextSymbolNode::draw(QPainter& painter, double x, double y, JKQTM
|
||||
double italic_xcorrection=fabs(tbr.width()-tbrNonItalic.width());
|
||||
if (fabs(italic_xcorrection)<1e-6) italic_xcorrection=double(fm.boundingRect(' ').width())*0.4;
|
||||
|
||||
//qDebug()<<"SYMB::draw(): symbolName="<<symbolName<<" font="<<f<<" sym="<<sym<<" yShiftFactor="<<symprops.yShiftFactor;
|
||||
//std::cout<<"SYMB::draw(): symbolName="<<symbolName.toStdString()<<" font="<<f.family().toStdString()<<" sym="<<sym.toStdString()<<"(0x"<<std::hex<<((sym.size()==0)?uint64_t(0):uint64_t(sym[0].unicode()))<<") yShiftFactor="<<symprops.yShiftFactor<<"\n";
|
||||
|
||||
if (!sym.isEmpty()) {
|
||||
// if the symbol has been recognized in the constructor: draw the symbol
|
||||
@ -585,7 +585,7 @@ void JKQTMathTextSymbolNode::fillSymbolTables()
|
||||
symbols["female"]=UnicodeSymbol(QChar(0x2640)).addHtml("♀");
|
||||
symbols["flq"]=UnicodeSymbol(QChar(0x2039)).addHtml("‹").addStd("<");
|
||||
symbols["flqq"]=UnicodeSymbol(QChar(0x00AB)).addHtml("«").addStd(QChar(0xAB));
|
||||
symbols["frown"]=UnicodeSymbol(QChar(0x2322)).addHtml("⌢");
|
||||
//symbols["frown"]=UnicodeSymbol(QChar(0x2322)).addHtml("⌢");
|
||||
symbols["frq"]=UnicodeSymbol(QChar(0x203A)).addHtml("›").addStd(">");
|
||||
symbols["frqq"]=UnicodeSymbol(QChar(0x00BB)).addHtml("»").addStd(QChar(0xBB));
|
||||
{ auto s=UnicodeSymbol(QChar(0x2137)).addHtml("ℷ");
|
||||
@ -620,7 +620,7 @@ void JKQTMathTextSymbolNode::fillSymbolTables()
|
||||
symbols["registered"]=s; symbols["textregistered"]=s; symbols["circledR"]=s; }
|
||||
symbols["rfloor"]=UprightSymbolUnicode(QChar(0x230B)).addUprightHtml("⌋").addUprightWinSymbol(QChar(0xFB));
|
||||
symbols["rightangle"]=UprightSymbolUnicode(QChar(0x221F)).addUprightHtml("∟");
|
||||
symbols["smile"]=UprightSymbolUnicode(QChar(0x2323)).addUprightHtml("⌣");
|
||||
//symbols["smile"]=UprightSymbolUnicode(QChar(0x2323)).addUprightHtml("⌣");
|
||||
symbols["sphericalangle"]=UprightSymbolUnicode(QChar(0x2222)).addUprightHtml("∢");
|
||||
symbols["star"]=UprightSymbolUnicode(QChar(0x22C6));
|
||||
symbols["tcohm"]=UnicodeSymbol(QChar(0x2126));
|
||||
@ -835,7 +835,7 @@ void JKQTMathTextSymbolNode::fillSymbolTables()
|
||||
symbols["times"] = MathOperatorSymbol(QChar(0xD7), "×").addMathOperatorWinSymbol(QChar(0xB4));
|
||||
{ auto s=UprightSymbolUnicode(QChar(0x2192)).addUprightHtml("→").addUprightWinSymbol(QChar(0xAE));
|
||||
symbols["to"]=s; symbols["rightarrow"]=s; }
|
||||
symbols["top"]=MathOperatorSymbolUnicode(QChar(0x22A4)).addMathOperatorHtml("⊤").addMathOperatorWinSymbol(QChar(0x5E));
|
||||
symbols["top"]=MathOperatorSymbolUnicode(QChar(0x22A4)).addMathOperatorHtml("⊤").addMathOperatorWinSymbol(QChar(0x5E)).addUprightStd("T");
|
||||
symbols["triangle"]=NarrowMathOperatorSymbolUnicode(QChar(0x2206));
|
||||
symbols["uparrow"]=UprightSymbolUnicode(QChar(0x2191)).addUprightHtml("↑").addUprightWinSymbol(QChar(0xAD));
|
||||
symbols["updownarrow"]=UprightSymbolUnicode(QChar(0x2195)).addUprightHtml("↕");
|
||||
@ -1211,6 +1211,7 @@ QPair<QFont, JKQTMathTextSymbolNode::SymbolProps> JKQTMathTextSymbolNode::Symbol
|
||||
|
||||
|
||||
outFont=currentEv.getFont(parent);
|
||||
outFont.setStyleStrategy(QFont::PreferDefault);
|
||||
if (outProps.fontScalingFactor!=1) outFont.setPointSizeF(outFont.pointSizeF()*outProps.fontScalingFactor);
|
||||
if (has(outProps.flags, ItalicOn)) outFont.setItalic(true);
|
||||
if (has(outProps.flags, ItalicOff)) outFont.setItalic(false);
|
||||
|
11
lib/jkqtmathtext/resources/firaMath/CHANGELOG.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Changelog of Fira Math
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
More details can be found in the [GitHub commit log](https://github.com/firamath/firamath/compare/aa5993b...main).
|
||||
|
||||
## Before v0.5.0
|
||||
|
||||
Changelog before v0.5.0 can be found in [docs/CHANGELOG.old.md](https://github.com/firamath/firamath/blob/main/docs/CHANGELOG.old.md).
|
BIN
lib/jkqtmathtext/resources/firaMath/FiraMath-Regular.otf
Normal file
92
lib/jkqtmathtext/resources/firaMath/LICENSE
Normal file
@ -0,0 +1,92 @@
|
||||
Copyright (C) 2018--2021 by Xiangdong Zeng <xdzeng96@gmail.com>
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION AND CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
129
lib/jkqtmathtext/resources/firaMath/README.md
Normal file
@ -0,0 +1,129 @@
|
||||
# Fira Math
|
||||
|
||||
[![Build Status](https://github.com/firamath/firamath/workflows/build/badge.svg)](https://github.com/firamath/firamath/actions/workflows/main.yml)
|
||||
[![CTAN](https://img.shields.io/ctan/v/firamath.svg)](https://www.ctan.org/pkg/firamath)
|
||||
[![GitHub release](https://img.shields.io/github/release/firamath/firamath/all.svg)](https://github.com/firamath/firamath/releases/latest)
|
||||
|
||||
Fira Math is a sans-serif font with Unicode math support. This font is a fork of
|
||||
|
||||
- [FiraSans](https://github.com/bBoxType/FiraSans)
|
||||
- [FiraGO](https://github.com/bBoxType/FiraGO)
|
||||
|
||||
## Showcase
|
||||
|
||||
<p align="center">
|
||||
<img src="docs/svg/firamath-demo-2.svg" alt="firamath-demo-2" width=49%>
|
||||
<img src="docs/svg/firamath-demo-3.svg" alt="firamath-demo-3" width=49%>
|
||||
<img src="docs/svg/firamath-demo-4.svg" alt="firamath-demo-4" width=49%>
|
||||
<img src="docs/svg/firamath-demo-5.svg" alt="firamath-demo-5" width=49%>
|
||||
</p>
|
||||
|
||||
## Installation
|
||||
|
||||
### On your system
|
||||
|
||||
Download `FiraMath-Regular.otf` from the [GitHub release](https://github.com/firamath/firamath/releases) page, then:
|
||||
|
||||
- Windows
|
||||
1. Quit related programs, e.g. Microsoft Word.
|
||||
1. Double-click the font file to open it in the Font Previewer.
|
||||
1. Click `Install` bottom to install.
|
||||
1. You can also directly copy all the `.otf` font files into `%WINDOWS%\Fonts\` to install them.
|
||||
- macOS
|
||||
1. Double-click on the font files in Finder.
|
||||
1. It will open in the font previewer. Click Install Font. It will open in the Font Book.
|
||||
1. Close the Font Book. The fonts should now be available.
|
||||
1. Details can be found in [this article](http://support.apple.com/kb/HT2509).
|
||||
- Linux
|
||||
1. Copy the `.otf` font files to your fonts directory.
|
||||
1. Run `sudo fc-cache`.
|
||||
|
||||
### On the TeX distribution
|
||||
|
||||
- If there are no special reasons, you should always install Fira Math via the package manager:
|
||||
|
||||
- TeX Live: run `tlmgr install firamath`
|
||||
- MiKTeX: run `mpm --admin --install=firamath`
|
||||
|
||||
Both distributions have GUI interfaces, you may enjoy them as well.
|
||||
|
||||
- **[NOT RECOMMENDED]** Download `firamath.tds.zip` from [CTAN](https://ctan.org/pkg/firamath) or [GitHub release page](https://github.com/firamath/firamath/releases), extract it in the root of one of your TDS trees, then run `mktexlsr` and `fc-cache` to update the filename database and font cache.
|
||||
|
||||
## Usage
|
||||
|
||||
Fira Math can be used in LaTeX, ConTeXt and Microsoft Word after installed on your OS (or the TeX distribution).
|
||||
|
||||
### LaTeX
|
||||
|
||||
```latex
|
||||
% Compiled with XeLaTeX or LuaLaTeX
|
||||
\documentclass{article}
|
||||
\usepackage{amsmath}
|
||||
\usepackage[mathrm=sym]{unicode-math}
|
||||
\setmathfont{Fira Math}
|
||||
|
||||
\begin{document}
|
||||
\[
|
||||
\int_0^{\mathrm{\pi}} \sin x \, \mathrm{d}x = 2
|
||||
\]
|
||||
\end{document}
|
||||
```
|
||||
|
||||
You may try the [`firamath-otf`](https://ctan.org/pkg/firamath-otf) package as well. - Thanks [Herbert Voß](https://github.com/hvoss49)!
|
||||
|
||||
### ConTeXt
|
||||
|
||||
```tex
|
||||
% Compiled with ConTeXt MkIV
|
||||
\definefontfamily [mainface] [rm] [FiraGO] % Require FiraGO fonts
|
||||
\definefontfamily [mainface] [mm] [Fira Math]
|
||||
\setupbodyfont [mainface]
|
||||
|
||||
\starttext
|
||||
\startformula
|
||||
\int_0^{\mathrm{\pi}} \sin x \, \mathrm{d}x = 2
|
||||
\stopformula
|
||||
\stoptext
|
||||
```
|
||||
|
||||
See <https://tex.stackexchange.com/q/429621>.
|
||||
|
||||
### Microsoft Word
|
||||
|
||||
1. Create a new equation. Then select the little *additional settings* corner.
|
||||
1. In the menu, change the *Default font* to Fira Math.
|
||||
1. In order for the changes to take effect, you will have to create a new equation environment (the current one will not be changed).
|
||||
1. To change the font in existing equations, select the equation text and select an OpenType math-enabled font (such as Fira Math).
|
||||
|
||||
See <https://superuser.com/q/1114697>.
|
||||
|
||||
## Building from source
|
||||
|
||||
To build Fira Math, you may
|
||||
|
||||
```sh
|
||||
python -m pip install -U pip
|
||||
pip install -r requirements.txt
|
||||
patch $(python -c "import os, glyphsLib; print(os.path.join(glyphsLib.__path__[0], 'builder', 'axes.py'))") scripts/axes.py.diff
|
||||
python scripts/build.py
|
||||
```
|
||||
|
||||
Note that Python 3.9+ is required. Since we are using [the dev version of glyphsLib](https://github.com/googlefonts/glyphsLib/pull/652), it's better to use a Python virtual environment.
|
||||
|
||||
To edit the source files, [Glyphs 3](https://glyphsapp.com/) is required.
|
||||
|
||||
### Development builds
|
||||
|
||||
If you just want to download the latest development version, please try the artifacts in [GitHub Actions](https://github.com/firamath/firamath/actions).
|
||||
|
||||
## Contributing
|
||||
|
||||
[Issues](https://github.com/firamath/firamath/issues) and [pull requests](https://github.com/firamath/firamath/pulls) are always welcome.
|
||||
|
||||
## License
|
||||
|
||||
This Font Software is licensed under the [SIL Open Font License](http://scripts.sil.org/OFL), Version 1.1.
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2018–2021 by Xiangdong Zeng.
|
4
lib/jkqtmathtext/resources/firaMath/requirements.txt
Normal file
@ -0,0 +1,4 @@
|
||||
fontmake
|
||||
fontTools
|
||||
glyphsLib
|
||||
toml
|
6
lib/jkqtmathtext/resources/firamath.pri
Normal file
@ -0,0 +1,6 @@
|
||||
contains(DEFINES, NO_FIRAMATH_FONTS) {
|
||||
warning("NO_FIRAMATH_FONTS was defined ==> we do not link Fira Math fonts as ressource ... Think about installing them separately on the target machine")
|
||||
} else {
|
||||
message("Happy joy, we are linking XITS fonts as a ressource")
|
||||
RESOURCES += $$PWD/firamath.qrc
|
||||
}
|
5
lib/jkqtmathtext/resources/firamath.qrc
Normal file
@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/JKQTMathText/fonts">
|
||||
<file alias="FiraMath-Regular.otf">firaMath/FiraMath-Regular.otf</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -126,7 +126,7 @@ bool JKQTPGeoText::getYMinMax(double& miny, double& maxy, double& smallestGreate
|
||||
void JKQTPGeoText::draw(JKQTPEnhancedPainter& painter) {
|
||||
clearHitTestData();
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
parent->getMathText()->setFontRomanOrSpecial(getTextFontName());
|
||||
parent->getMathText()->setFontSpecial(getTextFontName());
|
||||
parent->getMathText()->setFontSize(getTextFontSize()*parent->getFontSizeMultiplier());
|
||||
parent->getMathText()->setFontColor(getTextColor());
|
||||
parent->getMathText()->parse("\\;"+text);
|
||||
|
@ -120,7 +120,7 @@ JKQTBasePlotter::textSizeData JKQTBasePlotter::getTextSizeDetail(const QString &
|
||||
JKQTBasePlotter::textSizeKey dh(fontName, fontSize, text, painter.device());
|
||||
if (s_TextSizeDataCache.contains(dh)) return s_TextSizeDataCache[dh];
|
||||
JKQTBasePlotter::textSizeData d;
|
||||
mathText.setFontRomanOrSpecial(fontName);
|
||||
mathText.setFontSpecial(fontName);
|
||||
mathText.setFontSize(fontSize);
|
||||
mathText.parse(text);
|
||||
mathText.getSizeDetail(painter, d.width, d.ascent, d.descent, d.strikeoutPos);
|
||||
@ -1275,7 +1275,7 @@ void JKQTBasePlotter::drawPlot(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
if (!plotLabel.isEmpty()) {
|
||||
mathText.setFontSize(plotterStyle.plotLabelFontSize*fontSizeMultiplier);
|
||||
mathText.setFontRomanOrSpecial(plotterStyle.plotLabelFontName);
|
||||
mathText.setFontSpecial(plotterStyle.plotLabelFontName);
|
||||
|
||||
mathText.parse(plotLabel);
|
||||
double a=0,d=0,so=0,w=0;
|
||||
@ -4250,7 +4250,7 @@ void JKQTBasePlotter::drawKeyContents(JKQTPEnhancedPainter& painter, double x, d
|
||||
g->drawKeyMarker(painter, markerRect);
|
||||
mathText.setFontColor(plotterStyle.keyStyle.textColor);
|
||||
mathText.setFontSize(plotterStyle.keyStyle.fontSize*fontSizeMultiplier);
|
||||
mathText.setFontRomanOrSpecial(plotterStyle.defaultFontName);
|
||||
mathText.setFontSpecial(plotterStyle.defaultFontName);
|
||||
|
||||
mathText.parse(g->getTitle());
|
||||
QRectF txtRect(x+(plotterStyle.keyStyle.sampleLineLength+plotterStyle.keyStyle.xSeparation)*Xwid,y, key_text_width, itheight);
|
||||
@ -4288,7 +4288,7 @@ void JKQTBasePlotter::drawKeyContents(JKQTPEnhancedPainter& painter, double x, d
|
||||
g->drawKeyMarker(painter, markerRect);
|
||||
mathText.setFontColor(plotterStyle.keyStyle.textColor);
|
||||
mathText.setFontSize(plotterStyle.keyStyle.fontSize*fontSizeMultiplier);
|
||||
mathText.setFontRomanOrSpecial(plotterStyle.defaultFontName);
|
||||
mathText.setFontSpecial(plotterStyle.defaultFontName);
|
||||
|
||||
mathText.parse(g->getTitle());
|
||||
QRectF txtRect(x+(plotterStyle.keyStyle.sampleLineLength+plotterStyle.keyStyle.xSeparation)*Xwid,y, fs.width(), itheight);
|
||||
@ -4336,7 +4336,7 @@ void JKQTBasePlotter::drawKeyContents(JKQTPEnhancedPainter& painter, double x, d
|
||||
g->drawKeyMarker(painter, markerRect);
|
||||
mathText.setFontColor(plotterStyle.keyStyle.textColor);
|
||||
mathText.setFontSize(plotterStyle.keyStyle.fontSize*fontSizeMultiplier);
|
||||
mathText.setFontRomanOrSpecial(plotterStyle.defaultFontName);
|
||||
mathText.setFontSpecial(plotterStyle.defaultFontName);
|
||||
mathText.parse(g->getTitle());
|
||||
//QSizeF fs=mt.getSize(painter);
|
||||
QRectF txtRect(xx+(plotterStyle.keyStyle.sampleLineLength+plotterStyle.keyStyle.xSeparation)*Xwid,yy, key_text_width, key_text_height);
|
||||
|
@ -21,13 +21,13 @@ JKQTBasePlotterStyle::JKQTBasePlotterStyle():
|
||||
plotFrameWidth(2),
|
||||
plotFrameRounding(0),
|
||||
plotFrameVisible(false),
|
||||
plotLabelFontName("application+XITS"),
|
||||
plotLabelFontName("GUI"),
|
||||
plotLabelFontSize(12),
|
||||
useAntiAliasingForSystem(true),
|
||||
useAntiAliasingForText(true),
|
||||
defaultTextColor(QColor("black")),
|
||||
defaultFontSize(8),
|
||||
defaultFontName("application+XITS"),
|
||||
defaultFontName("GUI"),
|
||||
keyStyle(*this),
|
||||
xAxisStyle(*this),
|
||||
yAxisStyle(*this),
|
||||
|
@ -1213,7 +1213,7 @@ void JKQTPVerticalAxis::drawGrids(JKQTPEnhancedPainter& painter) {
|
||||
void JKQTPVerticalAxis::drawTickLabel1(JKQTPEnhancedPainter &painter, double xx, double yy, const QString& label, double fontSize)
|
||||
{
|
||||
getParentMathText()->setFontSize(fontSize*parent->getFontSizeMultiplier());
|
||||
getParentMathText()->setFontRomanOrSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontColor(axisStyle.axisColor);
|
||||
|
||||
getParentMathText()->parse(label);
|
||||
@ -1253,7 +1253,7 @@ void JKQTPVerticalAxis::drawTickLabel1(JKQTPEnhancedPainter &painter, double xx,
|
||||
void JKQTPVerticalAxis::drawTickLabel2(JKQTPEnhancedPainter &painter, double xx, double yy, const QString &label, double fontSize)
|
||||
{
|
||||
getParentMathText()->setFontSize(fontSize*parent->getFontSizeMultiplier());
|
||||
getParentMathText()->setFontRomanOrSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontColor(axisStyle.axisColor);
|
||||
|
||||
getParentMathText()->parse(label);
|
||||
@ -1352,7 +1352,7 @@ void JKQTPVerticalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
|
||||
pmtick.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, axisStyle.minorTickWidth*parent->getLineWidthMultiplier())));
|
||||
|
||||
getParentMathText()->setFontSize(this->axisStyle.tickLabelFontSize*parent->getFontSizeMultiplier());
|
||||
getParentMathText()->setFontRomanOrSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontColor(axisStyle.axisColor);
|
||||
|
||||
painter.setPen(pmain);
|
||||
@ -1524,7 +1524,7 @@ void JKQTPVerticalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
|
||||
JKQTPAutoOutputTimer jkaati(QString("JKQTPEnhancedPainter[%1]::drawAxes(): axisLabel1").arg(objectName()));
|
||||
#endif
|
||||
getParentMathText()->setFontSize(axisStyle.labelFontSize*parent->getFontSizeMultiplier());
|
||||
getParentMathText()->setFontRomanOrSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->parse(axisLabel);
|
||||
double width, ascent, descent, strikeoutPos;
|
||||
getParentMathText()->getSizeDetail(painter, width, ascent, descent, strikeoutPos);
|
||||
@ -1566,7 +1566,7 @@ void JKQTPVerticalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
|
||||
JKQTPAutoOutputTimer jkaati(QString("JKQTPEnhancedPainter[%1]::drawAxes(): axisLabel2").arg(objectName()));
|
||||
#endif
|
||||
getParentMathText()->setFontSize(axisStyle.labelFontSize*parent->getFontSizeMultiplier());
|
||||
getParentMathText()->setFontRomanOrSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->parse(axisLabel);
|
||||
|
||||
|
||||
@ -1845,7 +1845,7 @@ void JKQTPHorizontalAxis::drawGrids(JKQTPEnhancedPainter& painter) {
|
||||
void JKQTPHorizontalAxis::drawTickLabel1(JKQTPEnhancedPainter &painter, double xx, double yy, const QString &label, double fontSize, double ascentMax, double /*descentMax*/)
|
||||
{
|
||||
getParentMathText()->setFontSize(fontSize*parent->getFontSizeMultiplier());
|
||||
getParentMathText()->setFontRomanOrSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontColor(axisStyle.axisColor);
|
||||
|
||||
getParentMathText()->parse(label);
|
||||
@ -1875,7 +1875,7 @@ void JKQTPHorizontalAxis::drawTickLabel1(JKQTPEnhancedPainter &painter, double x
|
||||
void JKQTPHorizontalAxis::drawTickLabel2(JKQTPEnhancedPainter &painter, double xx, double yy, const QString &label, double fontSize, double /*ascentMax*/, double descentMax)
|
||||
{
|
||||
getParentMathText()->setFontSize(fontSize*parent->getFontSizeMultiplier());
|
||||
getParentMathText()->setFontRomanOrSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontColor(axisStyle.axisColor);
|
||||
|
||||
getParentMathText()->parse(label);
|
||||
@ -1958,7 +1958,7 @@ void JKQTPHorizontalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
|
||||
pmtick.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, axisStyle.minorTickWidth*parent->getLineWidthMultiplier())));
|
||||
|
||||
getParentMathText()->setFontSize(this->axisStyle.tickLabelFontSize*parent->getFontSizeMultiplier());
|
||||
getParentMathText()->setFontRomanOrSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontColor(axisStyle.axisColor);
|
||||
|
||||
painter.setPen(pmain);
|
||||
@ -2121,7 +2121,7 @@ void JKQTPHorizontalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
|
||||
JKQTPAutoOutputTimer jkaati(QString("JKQTPHorizontalAxis[%1]::drawAxes(): axisLabel1").arg(objectName()));
|
||||
#endif
|
||||
getParentMathText()->setFontSize(axisStyle.labelFontSize*parent->getFontSizeMultiplier());
|
||||
getParentMathText()->setFontRomanOrSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->parse(axisLabel);
|
||||
double width, ascent, descent, strikeoutPos;
|
||||
getParentMathText()->getSizeDetail(painter, width, ascent, descent, strikeoutPos);
|
||||
@ -2162,7 +2162,7 @@ void JKQTPHorizontalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
|
||||
JKQTPAutoOutputTimer jkaati(QString("JKQTPHorizontalAxis[%1]::drawAxes(): axisLabel2").arg(objectName()));
|
||||
#endif
|
||||
getParentMathText()->setFontSize(axisStyle.labelFontSize*parent->getFontSizeMultiplier());
|
||||
getParentMathText()->setFontRomanOrSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->setFontSpecial(getParent()->getCurrentPlotterStyle().defaultFontName);
|
||||
getParentMathText()->parse(axisLabel);
|
||||
|
||||
|
||||
|
@ -154,7 +154,7 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa
|
||||
|
||||
|
||||
cbParent->getMathText()->setFontSize(imageNameFontSize*cbParent->getFontSizeMultiplier());
|
||||
cbParent->getMathText()->setFontRomanOrSpecial(imageNameFontName);
|
||||
cbParent->getMathText()->setFontSpecial(imageNameFontName);
|
||||
cbParent->getMathText()->parse(imageName);
|
||||
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRectF(rightSpace.x(), rightSpace.y(), rightSpace.width(), (rightSpace.height()-barHeight)/2), cbParent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
@ -213,7 +213,7 @@ void JKQTPColorPaletteStyleAndToolsMixin::cbDrawOutside(JKQTPEnhancedPainter& pa
|
||||
|
||||
|
||||
cbParent->getMathText()->setFontSize(imageNameFontSize*cbParent->getFontSizeMultiplier());
|
||||
cbParent->getMathText()->setFontRomanOrSpecial(imageNameFontName);
|
||||
cbParent->getMathText()->setFontSpecial(imageNameFontName);
|
||||
cbParent->getMathText()->parse(imageName);
|
||||
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRectF(topSpace.right()-(topSpace.width()-barWidth)/2, topSpace.y(), (topSpace.width()-barWidth)/2, topSpace.height()), cbParent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
@ -662,7 +662,7 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbDrawOutside(JKQTPEnhance
|
||||
}
|
||||
|
||||
cbParent->getMathText()->setFontSize(imageNameFontSize*cbParent->getFontSizeMultiplier());
|
||||
cbParent->getMathText()->setFontRomanOrSpecial(cbParent->getCurrentPlotterStyle().defaultFontName);
|
||||
cbParent->getMathText()->setFontSpecial(cbParent->getCurrentPlotterStyle().defaultFontName);
|
||||
cbParent->getMathText()->parse(imageName);
|
||||
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRectF(rightSpace.x(), rightSpace.y(), rightSpace.width(), (rightSpace.height()-barHeight)/2), cbParent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
@ -715,7 +715,7 @@ void JKQTPColorPaletteWithModifierStyleAndToolsMixin::cbDrawOutside(JKQTPEnhance
|
||||
}
|
||||
|
||||
cbParent->getMathText()->setFontSize(imageNameFontSize*cbParent->getFontSizeMultiplier());
|
||||
cbParent->getMathText()->setFontRomanOrSpecial(cbParent->getCurrentPlotterStyle().defaultFontName);
|
||||
cbParent->getMathText()->setFontSpecial(cbParent->getCurrentPlotterStyle().defaultFontName);
|
||||
cbParent->getMathText()->parse(imageName);
|
||||
cbParent->getMathText()->draw(painter, Qt::AlignHCenter|Qt::AlignVCenter, QRectF(topSpace.right()-(topSpace.width()-barWidth)/2, topSpace.y(), (topSpace.width()-barWidth)/2, topSpace.height()), cbParent->getCurrentPlotterStyle().debugShowTextBoxes);
|
||||
|
||||
|
@ -576,7 +576,7 @@ void JKQTPlotter::paintUserAction() {
|
||||
QString txt;
|
||||
double a=0,d=0,so=0,w=0;
|
||||
getPlotter()->getMathText()->setFontSize(plotterStyle.userActionFontSize);
|
||||
getPlotter()->getMathText()->setFontRomanOrSpecial(plotterStyle.userActionFontName);
|
||||
getPlotter()->getMathText()->setFontSpecial(plotterStyle.userActionFontName);
|
||||
|
||||
txt=QString::fromStdString("\\delta_{x}="+jkqtp_floattolatexstr(dx, 3));
|
||||
getPlotter()->getMathText()->parse(txt);
|
||||
@ -654,7 +654,7 @@ void JKQTPlotter::paintUserAction() {
|
||||
QString txt;
|
||||
double ascent=0,descent=0,strikeout=0,width=0;
|
||||
getPlotter()->getMathText()->setFontSize(plotterStyle.userActionFontSize);
|
||||
getPlotter()->getMathText()->setFontRomanOrSpecial(plotterStyle.userActionFontName);
|
||||
getPlotter()->getMathText()->setFontSpecial(plotterStyle.userActionFontName);
|
||||
|
||||
|
||||
for (auto& m: mouseDragMarkers) {
|
||||
|
@ -15,7 +15,7 @@ JKQTPlotterStyle::JKQTPlotterStyle():
|
||||
userActionMarkerPen(QColor("red").darker(), 1, Qt::DotLine),
|
||||
userActionMarkerBrush(QColorWithAlphaF(QColor("red"), 0.2)),
|
||||
userActionMarkerType(jkqtpuamtCircleAndCrossHair),
|
||||
userActionFontName("application+XITS"),
|
||||
userActionFontName("GUI"),
|
||||
userActionFontSize(QApplication::font().pointSizeF()*1.1),
|
||||
userActionMarkerDiameter(12),
|
||||
mousePositionTemplate("(%1; %2)"),
|
||||
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 144 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 155 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 88 KiB |
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 88 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 176 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 77 KiB After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 30 KiB |