diff --git a/cmake/jkqtplotter_cmake_options.cmake b/cmake/jkqtplotter_cmake_options.cmake index 3a34dd539c..fee92eb2a3 100644 --- a/cmake/jkqtplotter_cmake_options.cmake +++ b/cmake/jkqtplotter_cmake_options.cmake @@ -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() diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 3442384230..043a2893cb 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -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 ) diff --git a/doc/dox/buildinstructions_cmake.dox b/doc/dox/buildinstructions_cmake.dox index f6b6dffac8..376f8ff15c 100644 --- a/doc/dox/buildinstructions_cmake.dox +++ b/doc/dox/buildinstructions_cmake.dox @@ -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 ) diff --git a/doc/dox/jkqtmathtext_fonthandling.dox b/doc/dox/jkqtmathtext_fonthandling.dox index 3b8a96819e..81c08072f9 100644 --- a/doc/dox/jkqtmathtext_fonthandling.dox +++ b/doc/dox/jkqtmathtext_fonthandling.dox @@ -52,12 +52,15 @@ - JKQTMathText::useSTIX() use the STIX fonts from https://www.stixfonts.org/ in math-mode (or math- and text-mode, additionally also as MTEFallbackSymbols)
\image html jkqtmathtext/jkqtmathtext_stix.png - JKQTMathText::useXITS() use the XITS fonts from https://github.com/alif-type/xits 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.
\image html jkqtmathtext/jkqtmathtext_xits.png - JKQTMathText::useASANA() use the ASANA fonts from https://ctan.org/tex-archive/fonts/Asana-Math/ in math-mode (or math- and text-mode, additionally also as MTEFallbackSymbols)
\image html jkqtmathtext/jkqtmathtext_asana.png + - JKQTMathText::useFiraMath() use the Fira Math fonts from https://github.com/firamath/firamath in math-mode (or math- and text-mode, additionally also as MTEFallbackSymbols)
\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.
\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: diff --git a/doc/dox/license.dox b/doc/dox/license.dox index 0319229a58..d9c64e44fc 100644 --- a/doc/dox/license.dox +++ b/doc/dox/license.dox @@ -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 https://www.stixfonts.org/. 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 https://www.stixfonts.org/. 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 lib/jkqtplotter/resources/math_fonts/xits - 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. +

+ 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. +

+ 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 https://github.com/firamath/firamath. 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 + lib/jkqtplotter/resources/math_fonts/firaMath + and are automatically added to the binary libraries as Qt Resources. +

+ 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. +

+ 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. diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox index 593dd53f1b..8b73278180 100644 --- a/doc/dox/whatsnew.dox +++ b/doc/dox/whatsnew.dox @@ -42,6 +42,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
  • NEW: added simple scatter plot JKQTPXYScatterGraph
  • NEW: made resize-timer status accessible from outside via JKQTPlotter::isResizeTimerRunning()
  • NEW: made it's delay a global static variable that can be set and red with JKQTPlotter::setGlobalResizeDelay() and JKQTPlotter::getGlobalResizeDelay()
  • +
  • NEW: Using JKQTMathText::useGuiFonts() for FONT rendering by default
  • JKQTMathText:
  • diff --git a/doc/images/JKQTPBarHorizontalGraph.png b/doc/images/JKQTPBarHorizontalGraph.png index f2d15034e1..56afb8a708 100644 Binary files a/doc/images/JKQTPBarHorizontalGraph.png and b/doc/images/JKQTPBarHorizontalGraph.png differ diff --git a/doc/images/JKQTPBarHorizontalGraph_small.png b/doc/images/JKQTPBarHorizontalGraph_small.png index 9141b2b96c..83b1212479 100644 Binary files a/doc/images/JKQTPBarHorizontalGraph_small.png and b/doc/images/JKQTPBarHorizontalGraph_small.png differ diff --git a/doc/images/JKQTPBarVerticalGraph.png b/doc/images/JKQTPBarVerticalGraph.png index 4775d38e01..75872ce8dd 100644 Binary files a/doc/images/JKQTPBarVerticalGraph.png and b/doc/images/JKQTPBarVerticalGraph.png differ diff --git a/doc/images/JKQTPBarVerticalGraph_small.png b/doc/images/JKQTPBarVerticalGraph_small.png index 40d060a10f..24a933407e 100644 Binary files a/doc/images/JKQTPBarVerticalGraph_small.png and b/doc/images/JKQTPBarVerticalGraph_small.png differ diff --git a/doc/images/JKQTPFilledCurveXGraph.png b/doc/images/JKQTPFilledCurveXGraph.png index 738aed3b4e..dbc45e5878 100644 Binary files a/doc/images/JKQTPFilledCurveXGraph.png and b/doc/images/JKQTPFilledCurveXGraph.png differ diff --git a/doc/images/JKQTPFilledCurveXGraph_small.png b/doc/images/JKQTPFilledCurveXGraph_small.png index 8843ea1e2f..43795d4650 100644 Binary files a/doc/images/JKQTPFilledCurveXGraph_small.png and b/doc/images/JKQTPFilledCurveXGraph_small.png differ diff --git a/doc/images/JKQTPFilledCurveXGraph_wiggle.png b/doc/images/JKQTPFilledCurveXGraph_wiggle.png index 5745525df0..abbad88a40 100644 Binary files a/doc/images/JKQTPFilledCurveXGraph_wiggle.png and b/doc/images/JKQTPFilledCurveXGraph_wiggle.png differ diff --git a/doc/images/JKQTPFilledCurveYGraph.png b/doc/images/JKQTPFilledCurveYGraph.png index 5ed7a9ac3c..bc28bdc410 100644 Binary files a/doc/images/JKQTPFilledCurveYGraph.png and b/doc/images/JKQTPFilledCurveYGraph.png differ diff --git a/doc/images/JKQTPFilledCurveYGraph_small.png b/doc/images/JKQTPFilledCurveYGraph_small.png index 15f3fb4be4..9ba88c8a38 100644 Binary files a/doc/images/JKQTPFilledCurveYGraph_small.png and b/doc/images/JKQTPFilledCurveYGraph_small.png differ diff --git a/doc/images/JKQTPFilledCurveYGraph_wiggle.png b/doc/images/JKQTPFilledCurveYGraph_wiggle.png index 59494a07ea..a2dc953e6e 100644 Binary files a/doc/images/JKQTPFilledCurveYGraph_wiggle.png and b/doc/images/JKQTPFilledCurveYGraph_wiggle.png differ diff --git a/doc/images/JKQTPXYFunctionLineGraph.png b/doc/images/JKQTPXYFunctionLineGraph.png index 8547008d5b..9ec9b0a04a 100644 Binary files a/doc/images/JKQTPXYFunctionLineGraph.png and b/doc/images/JKQTPXYFunctionLineGraph.png differ diff --git a/doc/images/JKQTPXYFunctionLineGraph_small.png b/doc/images/JKQTPXYFunctionLineGraph_small.png index b8196609f4..a3682af6ca 100644 Binary files a/doc/images/JKQTPXYFunctionLineGraph_small.png and b/doc/images/JKQTPXYFunctionLineGraph_small.png differ diff --git a/doc/images/JKQTPXYLineGraph.png b/doc/images/JKQTPXYLineGraph.png index 0ed89425b7..172f8b7e62 100644 Binary files a/doc/images/JKQTPXYLineGraph.png and b/doc/images/JKQTPXYLineGraph.png differ diff --git a/doc/images/JKQTPXYLineGraph_small.png b/doc/images/JKQTPXYLineGraph_small.png index 5910487b09..8c4b458f3f 100644 Binary files a/doc/images/JKQTPXYLineGraph_small.png and b/doc/images/JKQTPXYLineGraph_small.png differ diff --git a/doc/images/JKQTPXYScatterErrorGraph.png b/doc/images/JKQTPXYScatterErrorGraph.png index b25283986c..08e17cf16c 100644 Binary files a/doc/images/JKQTPXYScatterErrorGraph.png and b/doc/images/JKQTPXYScatterErrorGraph.png differ diff --git a/doc/images/JKQTPXYScatterErrorGraph_small.png b/doc/images/JKQTPXYScatterErrorGraph_small.png index 01ff2e9551..26256ee05d 100644 Binary files a/doc/images/JKQTPXYScatterErrorGraph_small.png and b/doc/images/JKQTPXYScatterErrorGraph_small.png differ diff --git a/doc/images/JKQTPXYScatterGraph.png b/doc/images/JKQTPXYScatterGraph.png index ac84f35681..f0923bd2f9 100644 Binary files a/doc/images/JKQTPXYScatterGraph.png and b/doc/images/JKQTPXYScatterGraph.png differ diff --git a/doc/images/JKQTPXYScatterGraph_small.png b/doc/images/JKQTPXYScatterGraph_small.png index fb7f5c47c3..c3d79ce335 100644 Binary files a/doc/images/JKQTPXYScatterGraph_small.png and b/doc/images/JKQTPXYScatterGraph_small.png differ diff --git a/doc/images/JKQTPbarHorizontalGraphStacked.png b/doc/images/JKQTPbarHorizontalGraphStacked.png index 7d6197aab3..bd4255af52 100644 Binary files a/doc/images/JKQTPbarHorizontalGraphStacked.png and b/doc/images/JKQTPbarHorizontalGraphStacked.png differ diff --git a/doc/images/JKQTPbarHorizontalGraphStacked_small.png b/doc/images/JKQTPbarHorizontalGraphStacked_small.png index 45525c1bdc..91b573c0f0 100644 Binary files a/doc/images/JKQTPbarHorizontalGraphStacked_small.png and b/doc/images/JKQTPbarHorizontalGraphStacked_small.png differ diff --git a/doc/images/JKQTPbarVerticalGraphStacked.png b/doc/images/JKQTPbarVerticalGraphStacked.png index f663295c67..d6793f8c9d 100644 Binary files a/doc/images/JKQTPbarVerticalGraphStacked.png and b/doc/images/JKQTPbarVerticalGraphStacked.png differ diff --git a/doc/images/JKQTPbarVerticalGraphStacked_small.png b/doc/images/JKQTPbarVerticalGraphStacked_small.png index 54d9fed2c5..b6c960f5d8 100644 Binary files a/doc/images/JKQTPbarVerticalGraphStacked_small.png and b/doc/images/JKQTPbarVerticalGraphStacked_small.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_fonts.png b/doc/images/jkqtmathtext/jkqtmathtext_fonts.png index 0773624966..87fa614f77 100644 Binary files a/doc/images/jkqtmathtext/jkqtmathtext_fonts.png and b/doc/images/jkqtmathtext/jkqtmathtext_fonts.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_usefira.png b/doc/images/jkqtmathtext/jkqtmathtext_usefira.png new file mode 100644 index 0000000000..ba21d72fe5 Binary files /dev/null and b/doc/images/jkqtmathtext/jkqtmathtext_usefira.png differ diff --git a/doc/images/jkqtmathtext/jkqtmathtext_useguifonts.png b/doc/images/jkqtmathtext/jkqtmathtext_useguifonts.png new file mode 100644 index 0000000000..68e451cfd3 Binary files /dev/null and b/doc/images/jkqtmathtext/jkqtmathtext_useguifonts.png differ diff --git a/doc/jkqtmathtext_docimages_specialfonts.jkmt b/doc/jkqtmathtext_docimages_specialfonts.jkmt index 9101f1c3f7..dc4345a507 100644 --- a/doc/jkqtmathtext_docimages_specialfonts.jkmt +++ b/doc/jkqtmathtext_docimages_specialfonts.jkmt @@ -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}$ diff --git a/examples/jkqtmathtext_test/testform.cpp b/examples/jkqtmathtext_test/testform.cpp index eeed2915cc..4c7c6d7d97 100644 --- a/examples/jkqtmathtext_test/testform.cpp +++ b/examples/jkqtmathtext_test/testform.cpp @@ -632,7 +632,7 @@ void TestForm::updateMath() mt.setFallbackFontSymbols(ui->cmbUnicodeSymbol->currentFont().family(), static_cast(ui->cmbEncodingSymbol->currentIndex())); - if (ui->cmbFont->currentIndex()<=3) { + if (ui->cmbFont->currentIndex()<=4) { mt.setFontRoman(ui->cmbUnicodeSerif->currentFont().family(), static_cast(ui->cmbEncodingSerif->currentIndex())); mt.setFontSans(ui->cmbUnicodeSans->currentFont().family(), static_cast(ui->cmbEncodingSans->currentIndex())); mt.setFontMathRoman(ui->cmbUnicodeSerifMath->currentFont().family(), static_cast(ui->cmbEncodingSerifMath->currentIndex())); @@ -643,35 +643,20 @@ void TestForm::updateMath() mt.setFontFraktur(ui->cmbUnicodeFraktur->currentFont().family(), static_cast(ui->cmbEncodingFraktur->currentIndex())); mt.setFontBlackboard(ui->cmbUnicodeBlackboard->currentFont().family(), static_cast(ui->cmbEncodingBlackboard->currentIndex())); mt.setFallbackFontSymbols(ui->cmbUnicodeSymbol->currentFont().family(), static_cast(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: "<cmbFont->currentIndex()==2) qDebug()<<"useSTIX: "<cmbFont->currentIndex()==3) qDebug()<<"useASANA: "<cmbFont->currentIndex()==6) qDebug()<<"useXITS: "<cmbFont->currentIndex()==4) qDebug()<<"useFiraMath: "<tree->clear(); ht.start(); double durationParse=0; diff --git a/examples/jkqtmathtext_test/testform.ui b/examples/jkqtmathtext_test/testform.ui index 05e3073b4f..e131d2064a 100644 --- a/examples/jkqtmathtext_test/testform.ui +++ b/examples/jkqtmathtext_test/testform.ui @@ -632,62 +632,32 @@ - Default-Constructed + Below+Math: Fira - Default-Constructed+SetAppFontRoman+SetAppFontMath + useAnyUnicodeForTextOnly("Times New Roman", "Times New Roman") - Default-Constructed+SetAppFontRoman+SetAppFontMath+XITS + useAnyUnicodeForTextOnly("Arial", "Arial") - useXITS(true)+useAnyUnicode("Times New Roman", "Times New Roman") + useAnyUnicodeForTextOnly("Courier New", "Courier New") - useXITS(true)+useAnyUnicode("Arial", "Arial") + useAnyUnicodeForTextOnly("Comic Sans MS", "Comic Sans MS") - useXITS(true)+useAnyUnicode("Courier New", "Courier New") - - - - - useXITS(true)+useAnyUnicode("Comic Sans MS", "Comic Sans MS") - - - - - useAnyUnicodeForTextOnly("Times New Roman", "Times New Roman")+useXITS(true) - - - - - useAnyUnicodeForTextOnly("Arial", "Arial")+useXITS(true) - - - - - useAnyUnicodeForTextOnly("Courier New", "Courier New")+useXITS(true) - - - - - useAnyUnicodeForTextOnly("Comic Sans MS", "Comic Sans MS")+useXITS(true) - - - - - useXITS(false) + useGuiFonts() diff --git a/examples/styling/jkqtpstyleplaintextedit.cpp b/examples/styling/jkqtpstyleplaintextedit.cpp index b53f2cd9f2..a61ba4bcae 100644 --- a/examples/styling/jkqtpstyleplaintextedit.cpp +++ b/examples/styling/jkqtpstyleplaintextedit.cpp @@ -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; diff --git a/lib/jkqtmathtext/CMakeLists.txt b/lib/jkqtmathtext/CMakeLists.txt index 6a68973d51..0de9b2e293 100644 --- a/lib/jkqtmathtext/CMakeLists.txt +++ b/lib/jkqtmathtext/CMakeLists.txt @@ -112,12 +112,15 @@ set(HEADERS_PARSERS $ ) +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" ) diff --git a/lib/jkqtmathtext/jkqtmathtext.cpp b/lib/jkqtmathtext/jkqtmathtext.cpp index 7393bc52f5..3cc5732c94 100644 --- a/lib/jkqtmathtext/jkqtmathtext.cpp +++ b/lib/jkqtmathtext/jkqtmathtext.cpp @@ -50,8 +50,19 @@ #include +// -------------------------------------------------------------------------------------------------- +// -- 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(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::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::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::high_resolution_clock::now()-t0).count()/1000.0<<"ms"; t0=std::chrono::high_resolution_clock::now(); useXITS(); //qDebug()<<"useXITS: "<(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("<=0 && Iplushttps://github.com/firamath/firamath 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 https://ctan.org/tex-archive/fonts/Asana-Math/ 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; }; diff --git a/lib/jkqtmathtext/jkqtmathtexttools.cpp b/lib/jkqtmathtext/jkqtmathtexttools.cpp index be82831173..6d7eff0a06 100644 --- a/lib/jkqtmathtext/jkqtmathtexttools.cpp +++ b/lib/jkqtmathtext/jkqtmathtexttools.cpp @@ -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_VERSION0 && 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"); 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 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); diff --git a/lib/jkqtmathtext/resources/firaMath/CHANGELOG.md b/lib/jkqtmathtext/resources/firaMath/CHANGELOG.md new file mode 100644 index 0000000000..733438ed40 --- /dev/null +++ b/lib/jkqtmathtext/resources/firaMath/CHANGELOG.md @@ -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). diff --git a/lib/jkqtmathtext/resources/firaMath/FiraMath-Regular.otf b/lib/jkqtmathtext/resources/firaMath/FiraMath-Regular.otf new file mode 100644 index 0000000000..f1f9d40c2c Binary files /dev/null and b/lib/jkqtmathtext/resources/firaMath/FiraMath-Regular.otf differ diff --git a/lib/jkqtmathtext/resources/firaMath/LICENSE b/lib/jkqtmathtext/resources/firaMath/LICENSE new file mode 100644 index 0000000000..c4c3da6e4b --- /dev/null +++ b/lib/jkqtmathtext/resources/firaMath/LICENSE @@ -0,0 +1,92 @@ +Copyright (C) 2018--2021 by Xiangdong Zeng + +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. diff --git a/lib/jkqtmathtext/resources/firaMath/README.md b/lib/jkqtmathtext/resources/firaMath/README.md new file mode 100644 index 0000000000..5c87646491 --- /dev/null +++ b/lib/jkqtmathtext/resources/firaMath/README.md @@ -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 + +

    + firamath-demo-2 + firamath-demo-3 + firamath-demo-4 + firamath-demo-5 +

    + +## 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 . + +### 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 . + +## 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. diff --git a/lib/jkqtmathtext/resources/firaMath/requirements.txt b/lib/jkqtmathtext/resources/firaMath/requirements.txt new file mode 100644 index 0000000000..cd110e0950 --- /dev/null +++ b/lib/jkqtmathtext/resources/firaMath/requirements.txt @@ -0,0 +1,4 @@ +fontmake +fontTools +glyphsLib +toml diff --git a/lib/jkqtmathtext/resources/firamath.pri b/lib/jkqtmathtext/resources/firamath.pri new file mode 100644 index 0000000000..694bd89f2a --- /dev/null +++ b/lib/jkqtmathtext/resources/firamath.pri @@ -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 +} diff --git a/lib/jkqtmathtext/resources/firamath.qrc b/lib/jkqtmathtext/resources/firamath.qrc new file mode 100644 index 0000000000..dfcf0012c4 --- /dev/null +++ b/lib/jkqtmathtext/resources/firamath.qrc @@ -0,0 +1,5 @@ + + + firaMath/FiraMath-Regular.otf + + diff --git a/lib/jkqtplotter/graphs/jkqtpgeoannotations.cpp b/lib/jkqtplotter/graphs/jkqtpgeoannotations.cpp index e413f76332..ec8c019d8f 100644 --- a/lib/jkqtplotter/graphs/jkqtpgeoannotations.cpp +++ b/lib/jkqtplotter/graphs/jkqtpgeoannotations.cpp @@ -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); diff --git a/lib/jkqtplotter/jkqtpbaseplotter.cpp b/lib/jkqtplotter/jkqtpbaseplotter.cpp index 08ab8bbff8..c87f0c98ba 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.cpp +++ b/lib/jkqtplotter/jkqtpbaseplotter.cpp @@ -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); diff --git a/lib/jkqtplotter/jkqtpbaseplotterstyle.cpp b/lib/jkqtplotter/jkqtpbaseplotterstyle.cpp index 1d4b199b91..3755de5bf8 100644 --- a/lib/jkqtplotter/jkqtpbaseplotterstyle.cpp +++ b/lib/jkqtplotter/jkqtpbaseplotterstyle.cpp @@ -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), diff --git a/lib/jkqtplotter/jkqtpcoordinateaxes.cpp b/lib/jkqtplotter/jkqtpcoordinateaxes.cpp index 7b41a035e8..d1410da5c4 100644 --- a/lib/jkqtplotter/jkqtpcoordinateaxes.cpp +++ b/lib/jkqtplotter/jkqtpcoordinateaxes.cpp @@ -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); diff --git a/lib/jkqtplotter/jkqtpimagetools.cpp b/lib/jkqtplotter/jkqtpimagetools.cpp index 01ab3dd9e5..1545736ee1 100644 --- a/lib/jkqtplotter/jkqtpimagetools.cpp +++ b/lib/jkqtplotter/jkqtpimagetools.cpp @@ -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); diff --git a/lib/jkqtplotter/jkqtplotter.cpp b/lib/jkqtplotter/jkqtplotter.cpp index faf01f7643..769c105228 100644 --- a/lib/jkqtplotter/jkqtplotter.cpp +++ b/lib/jkqtplotter/jkqtplotter.cpp @@ -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) { diff --git a/lib/jkqtplotter/jkqtplotterstyle.cpp b/lib/jkqtplotter/jkqtplotterstyle.cpp index 43fa96c33e..2be3043149 100644 --- a/lib/jkqtplotter/jkqtplotterstyle.cpp +++ b/lib/jkqtplotter/jkqtplotterstyle.cpp @@ -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)"), diff --git a/screenshots/barchart.png b/screenshots/barchart.png index fa5dd78152..5688a0ea7e 100644 Binary files a/screenshots/barchart.png and b/screenshots/barchart.png differ diff --git a/screenshots/barchart_hor.png b/screenshots/barchart_hor.png index 9e15db9cd9..4c1312d1a4 100644 Binary files a/screenshots/barchart_hor.png and b/screenshots/barchart_hor.png differ diff --git a/screenshots/barchart_hor_small.png b/screenshots/barchart_hor_small.png index 9141b2b96c..83b1212479 100644 Binary files a/screenshots/barchart_hor_small.png and b/screenshots/barchart_hor_small.png differ diff --git a/screenshots/barchart_small.png b/screenshots/barchart_small.png index 40d060a10f..24a933407e 100644 Binary files a/screenshots/barchart_small.png and b/screenshots/barchart_small.png differ diff --git a/screenshots/boxplot.png b/screenshots/boxplot.png index d861977b02..343019fe38 100644 Binary files a/screenshots/boxplot.png and b/screenshots/boxplot.png differ diff --git a/screenshots/boxplot_small.png b/screenshots/boxplot_small.png index c48605e63e..cebee372b9 100644 Binary files a/screenshots/boxplot_small.png and b/screenshots/boxplot_small.png differ diff --git a/screenshots/dateaxes.png b/screenshots/dateaxes.png index ba1390515e..fe3ab3fd19 100644 Binary files a/screenshots/dateaxes.png and b/screenshots/dateaxes.png differ diff --git a/screenshots/dateaxes_small.png b/screenshots/dateaxes_small.png index 28aa7e8091..99eae154cb 100644 Binary files a/screenshots/dateaxes_small.png and b/screenshots/dateaxes_small.png differ diff --git a/screenshots/dateaxes_timeaxis.png b/screenshots/dateaxes_timeaxis.png index 8045b68bcf..5eedcc5407 100644 Binary files a/screenshots/dateaxes_timeaxis.png and b/screenshots/dateaxes_timeaxis.png differ diff --git a/screenshots/dateaxes_timeaxis_small.png b/screenshots/dateaxes_timeaxis_small.png index df4eb5cda8..f9294c8efb 100644 Binary files a/screenshots/dateaxes_timeaxis_small.png and b/screenshots/dateaxes_timeaxis_small.png differ diff --git a/screenshots/errorbarstyles.png b/screenshots/errorbarstyles.png index 428b591e57..099a918ead 100644 Binary files a/screenshots/errorbarstyles.png and b/screenshots/errorbarstyles.png differ diff --git a/screenshots/errorbarstyles_small.png b/screenshots/errorbarstyles_small.png index 6653ce7696..d34b5d92b0 100644 Binary files a/screenshots/errorbarstyles_small.png and b/screenshots/errorbarstyles_small.png differ diff --git a/screenshots/evalcurve.png b/screenshots/evalcurve.png index 8547008d5b..9ec9b0a04a 100644 Binary files a/screenshots/evalcurve.png and b/screenshots/evalcurve.png differ diff --git a/screenshots/evalcurve_small.png b/screenshots/evalcurve_small.png index b8196609f4..a3682af6ca 100644 Binary files a/screenshots/evalcurve_small.png and b/screenshots/evalcurve_small.png differ diff --git a/screenshots/filledgraphs.png b/screenshots/filledgraphs.png index 4c0c039beb..13a1776a2b 100644 Binary files a/screenshots/filledgraphs.png and b/screenshots/filledgraphs.png differ diff --git a/screenshots/filledgraphs_small.png b/screenshots/filledgraphs_small.png index 8843ea1e2f..43795d4650 100644 Binary files a/screenshots/filledgraphs_small.png and b/screenshots/filledgraphs_small.png differ diff --git a/screenshots/filledgraphs_y.png b/screenshots/filledgraphs_y.png index a9cdca7e4e..37cb42d2f8 100644 Binary files a/screenshots/filledgraphs_y.png and b/screenshots/filledgraphs_y.png differ diff --git a/screenshots/filledgraphs_y_small.png b/screenshots/filledgraphs_y_small.png index 15f3fb4be4..9ba88c8a38 100644 Binary files a/screenshots/filledgraphs_y_small.png and b/screenshots/filledgraphs_y_small.png differ diff --git a/screenshots/functionplot.png b/screenshots/functionplot.png index 9bdc79cdb0..28afce5408 100644 Binary files a/screenshots/functionplot.png and b/screenshots/functionplot.png differ diff --git a/screenshots/functionplot_fy.png b/screenshots/functionplot_fy.png index b1b1fea03e..212cb715bc 100644 Binary files a/screenshots/functionplot_fy.png and b/screenshots/functionplot_fy.png differ diff --git a/screenshots/functionplot_fy_small.png b/screenshots/functionplot_fy_small.png index 47eb05df74..eb9a50b349 100644 Binary files a/screenshots/functionplot_fy_small.png and b/screenshots/functionplot_fy_small.png differ diff --git a/screenshots/functionplot_small.png b/screenshots/functionplot_small.png index 3a58058cd9..ef8c3a0443 100644 Binary files a/screenshots/functionplot_small.png and b/screenshots/functionplot_small.png differ diff --git a/screenshots/geometric.png b/screenshots/geometric.png index 91cb247d4e..7c514b268b 100644 Binary files a/screenshots/geometric.png and b/screenshots/geometric.png differ diff --git a/screenshots/geometric_small.png b/screenshots/geometric_small.png index c9b24e1232..8a25435e53 100644 Binary files a/screenshots/geometric_small.png and b/screenshots/geometric_small.png differ diff --git a/screenshots/imageplot.png b/screenshots/imageplot.png index bd002c5c4a..bea2dd7033 100644 Binary files a/screenshots/imageplot.png and b/screenshots/imageplot.png differ diff --git a/screenshots/imageplot_modifier.png b/screenshots/imageplot_modifier.png index e2144e9d61..3f1221e7ea 100644 Binary files a/screenshots/imageplot_modifier.png and b/screenshots/imageplot_modifier.png differ diff --git a/screenshots/imageplot_modifier_small.png b/screenshots/imageplot_modifier_small.png index 6543a32baa..c37d2185f0 100644 Binary files a/screenshots/imageplot_modifier_small.png and b/screenshots/imageplot_modifier_small.png differ diff --git a/screenshots/imageplot_nodatastore.png b/screenshots/imageplot_nodatastore.png index 222aae03aa..25ad665a56 100644 Binary files a/screenshots/imageplot_nodatastore.png and b/screenshots/imageplot_nodatastore.png differ diff --git a/screenshots/imageplot_nodatastore_small.png b/screenshots/imageplot_nodatastore_small.png index 1d4b9a8da1..2c56f3d959 100644 Binary files a/screenshots/imageplot_nodatastore_small.png and b/screenshots/imageplot_nodatastore_small.png differ diff --git a/screenshots/imageplot_small.png b/screenshots/imageplot_small.png index 517b728a18..1c6ad98b9c 100644 Binary files a/screenshots/imageplot_small.png and b/screenshots/imageplot_small.png differ diff --git a/screenshots/imageplot_userpal_program.png b/screenshots/imageplot_userpal_program.png index f3f05a41d6..05829af909 100644 Binary files a/screenshots/imageplot_userpal_program.png and b/screenshots/imageplot_userpal_program.png differ diff --git a/screenshots/imageplot_userpal_program_small.png b/screenshots/imageplot_userpal_program_small.png index 275c7940ab..06f28886be 100644 Binary files a/screenshots/imageplot_userpal_program_small.png and b/screenshots/imageplot_userpal_program_small.png differ diff --git a/screenshots/impulsesplot.png b/screenshots/impulsesplot.png index e6798ccc9c..25748404c2 100644 Binary files a/screenshots/impulsesplot.png and b/screenshots/impulsesplot.png differ diff --git a/screenshots/impulsesplot_small.png b/screenshots/impulsesplot_small.png index 0260b1ceae..5a85422b50 100644 Binary files a/screenshots/impulsesplot_small.png and b/screenshots/impulsesplot_small.png differ diff --git a/screenshots/multiplot.png b/screenshots/multiplot.png index a5a7c7d5a1..bfb90e4a88 100644 Binary files a/screenshots/multiplot.png and b/screenshots/multiplot.png differ diff --git a/screenshots/multiplot_controlwindow.png b/screenshots/multiplot_controlwindow.png index bf548904a3..5fe791c503 100644 Binary files a/screenshots/multiplot_controlwindow.png and b/screenshots/multiplot_controlwindow.png differ diff --git a/screenshots/multiplot_controlwindow_small.png b/screenshots/multiplot_controlwindow_small.png index b755e78628..8e87106b18 100644 Binary files a/screenshots/multiplot_controlwindow_small.png and b/screenshots/multiplot_controlwindow_small.png differ diff --git a/screenshots/multiplot_small.png b/screenshots/multiplot_small.png index fdba0c7470..d726754aff 100644 Binary files a/screenshots/multiplot_small.png and b/screenshots/multiplot_small.png differ diff --git a/screenshots/parametriccurve1.png b/screenshots/parametriccurve1.png index ffb6e71ff8..4fcf027f7d 100644 Binary files a/screenshots/parametriccurve1.png and b/screenshots/parametriccurve1.png differ diff --git a/screenshots/parametriccurve1_small.png b/screenshots/parametriccurve1_small.png index ed06f9d124..af34fce73f 100644 Binary files a/screenshots/parametriccurve1_small.png and b/screenshots/parametriccurve1_small.png differ diff --git a/screenshots/parametriccurve2.png b/screenshots/parametriccurve2.png index fccc64e3d7..71850c95c5 100644 Binary files a/screenshots/parametriccurve2.png and b/screenshots/parametriccurve2.png differ diff --git a/screenshots/parametriccurve2_small.png b/screenshots/parametriccurve2_small.png index 6348f646e7..00ef2ff742 100644 Binary files a/screenshots/parametriccurve2_small.png and b/screenshots/parametriccurve2_small.png differ diff --git a/screenshots/paramscatterplot.png b/screenshots/paramscatterplot.png index dabcc541a5..d78476f44c 100644 Binary files a/screenshots/paramscatterplot.png and b/screenshots/paramscatterplot.png differ diff --git a/screenshots/paramscatterplot_small.png b/screenshots/paramscatterplot_small.png index 50b80c659b..6c8b878d18 100644 Binary files a/screenshots/paramscatterplot_small.png and b/screenshots/paramscatterplot_small.png differ diff --git a/screenshots/parsedfunctionplot.png b/screenshots/parsedfunctionplot.png index 8dad2b8976..cb0d6f73d4 100644 Binary files a/screenshots/parsedfunctionplot.png and b/screenshots/parsedfunctionplot.png differ diff --git a/screenshots/parsedfunctionplot_small.png b/screenshots/parsedfunctionplot_small.png index fa1d15a231..ad444bae21 100644 Binary files a/screenshots/parsedfunctionplot_small.png and b/screenshots/parsedfunctionplot_small.png differ diff --git a/screenshots/rgbimageplot.png b/screenshots/rgbimageplot.png index aeffa05f4b..ff10120130 100644 Binary files a/screenshots/rgbimageplot.png and b/screenshots/rgbimageplot.png differ diff --git a/screenshots/rgbimageplot_small.png b/screenshots/rgbimageplot_small.png index 8f274a0794..f5e88c5df9 100644 Binary files a/screenshots/rgbimageplot_small.png and b/screenshots/rgbimageplot_small.png differ diff --git a/screenshots/scatter.png b/screenshots/scatter.png index 0e2b69fd86..bf54f5d841 100644 Binary files a/screenshots/scatter.png and b/screenshots/scatter.png differ diff --git a/screenshots/scatter_error.png b/screenshots/scatter_error.png index 9bd32b44fc..0925e26973 100644 Binary files a/screenshots/scatter_error.png and b/screenshots/scatter_error.png differ diff --git a/screenshots/scatter_error_small.png b/screenshots/scatter_error_small.png index 01ff2e9551..26256ee05d 100644 Binary files a/screenshots/scatter_error_small.png and b/screenshots/scatter_error_small.png differ diff --git a/screenshots/scatter_small.png b/screenshots/scatter_small.png index fb7f5c47c3..c3d79ce335 100644 Binary files a/screenshots/scatter_small.png and b/screenshots/scatter_small.png differ diff --git a/screenshots/simpletest.png b/screenshots/simpletest.png index 7486018f87..037ad2f0e4 100644 Binary files a/screenshots/simpletest.png and b/screenshots/simpletest.png differ diff --git a/screenshots/simpletest_small.png b/screenshots/simpletest_small.png index 5910487b09..8c4b458f3f 100644 Binary files a/screenshots/simpletest_small.png and b/screenshots/simpletest_small.png differ diff --git a/screenshots/stackedbars.png b/screenshots/stackedbars.png index 6649ff5cb0..f7e0697fb5 100644 Binary files a/screenshots/stackedbars.png and b/screenshots/stackedbars.png differ diff --git a/screenshots/stackedbars_hor.png b/screenshots/stackedbars_hor.png index a7bc57f8b5..421afed634 100644 Binary files a/screenshots/stackedbars_hor.png and b/screenshots/stackedbars_hor.png differ diff --git a/screenshots/stackedbars_hor_small.png b/screenshots/stackedbars_hor_small.png index 45525c1bdc..91b573c0f0 100644 Binary files a/screenshots/stackedbars_hor_small.png and b/screenshots/stackedbars_hor_small.png differ diff --git a/screenshots/stackedbars_small.png b/screenshots/stackedbars_small.png index 54d9fed2c5..b6c960f5d8 100644 Binary files a/screenshots/stackedbars_small.png and b/screenshots/stackedbars_small.png differ diff --git a/screenshots/stepplots.png b/screenshots/stepplots.png index 8e926ee649..e1b466345a 100644 Binary files a/screenshots/stepplots.png and b/screenshots/stepplots.png differ diff --git a/screenshots/stepplots_small.png b/screenshots/stepplots_small.png index 2295c22976..61c4b50e77 100644 Binary files a/screenshots/stepplots_small.png and b/screenshots/stepplots_small.png differ diff --git a/screenshots/symbols_and_errors.png b/screenshots/symbols_and_errors.png index 241aaead92..fdbd9045f0 100644 Binary files a/screenshots/symbols_and_errors.png and b/screenshots/symbols_and_errors.png differ diff --git a/screenshots/symbols_and_errors_small.png b/screenshots/symbols_and_errors_small.png index 0641ea68a9..a6a01efc8e 100644 Binary files a/screenshots/symbols_and_errors_small.png and b/screenshots/symbols_and_errors_small.png differ diff --git a/screenshots/test_distributionplot.png b/screenshots/test_distributionplot.png index 4bf984f15d..bc2197fa89 100644 Binary files a/screenshots/test_distributionplot.png and b/screenshots/test_distributionplot.png differ diff --git a/screenshots/test_distributionplot_small.png b/screenshots/test_distributionplot_small.png index e281917bab..e28a55a352 100644 Binary files a/screenshots/test_distributionplot_small.png and b/screenshots/test_distributionplot_small.png differ diff --git a/screenshots/violinplot_hor.png b/screenshots/violinplot_hor.png index dcaae4c375..7c0447a78f 100644 Binary files a/screenshots/violinplot_hor.png and b/screenshots/violinplot_hor.png differ diff --git a/screenshots/violinplot_hor_small.png b/screenshots/violinplot_hor_small.png index fcf1d5f2f5..3e45970c85 100644 Binary files a/screenshots/violinplot_hor_small.png and b/screenshots/violinplot_hor_small.png differ diff --git a/screenshots/violinplot_vert.png b/screenshots/violinplot_vert.png index aa26bba465..c7c4384adf 100644 Binary files a/screenshots/violinplot_vert.png and b/screenshots/violinplot_vert.png differ diff --git a/screenshots/violinplot_vert_small.png b/screenshots/violinplot_vert_small.png index 199e993f8c..b8adc3fafc 100644 Binary files a/screenshots/violinplot_vert_small.png and b/screenshots/violinplot_vert_small.png differ diff --git a/screenshots/wiggleplot_x.png b/screenshots/wiggleplot_x.png index 15e59e188c..85ae62f4bc 100644 Binary files a/screenshots/wiggleplot_x.png and b/screenshots/wiggleplot_x.png differ diff --git a/screenshots/wiggleplot_x_small.png b/screenshots/wiggleplot_x_small.png index 40ebec91b3..401b4ad830 100644 Binary files a/screenshots/wiggleplot_x_small.png and b/screenshots/wiggleplot_x_small.png differ diff --git a/screenshots/wiggleplot_y.png b/screenshots/wiggleplot_y.png index 25729f6659..f5b7f4d1bc 100644 Binary files a/screenshots/wiggleplot_y.png and b/screenshots/wiggleplot_y.png differ diff --git a/screenshots/wiggleplot_y_small.png b/screenshots/wiggleplot_y_small.png index 9dd38174c7..de4c1e5a62 100644 Binary files a/screenshots/wiggleplot_y_small.png and b/screenshots/wiggleplot_y_small.png differ diff --git a/tools/jkqtmathtext_render/jkqtmathtext_render.cpp b/tools/jkqtmathtext_render/jkqtmathtext_render.cpp index c0133eabc8..42edbdf66d 100644 --- a/tools/jkqtmathtext_render/jkqtmathtext_render.cpp +++ b/tools/jkqtmathtext_render/jkqtmathtext_render.cpp @@ -70,10 +70,14 @@ int main(int argc, char* argv[]) parser.addOption(outputDirectoryOption); QCommandLineOption listsymbolsOption("listsymbols", "list all symbols in the given output file and generate images.", "listsymbols", ""); parser.addOption(listsymbolsOption); + QCommandLineOption listsymbolsfontsOption("listsymbolsfonts", "fonts for listsymbols.", "listsymbolsfonts", "XITS"); + parser.addOption(listsymbolsfontsOption); QCommandLineOption drawBoxesOption(QStringList()<<"drawboxes"<<"showboxes", "draw boxes."); parser.addOption(drawBoxesOption); QCommandLineOption verboseOption("verbose", "verbose output."); parser.addOption(verboseOption); + QCommandLineOption guifontsOption("guifonts", "use GUI fonts."); + parser.addOption(guifontsOption); QCommandLineOption fontOption("font", "font( size)s) to use.", "font", "XITS"); parser.addOption(fontOption); QCommandLineOption fontsizeOption("fontsize", "font size.", "fontsize", "12"); @@ -118,6 +122,7 @@ int main(int argc, char* argv[]) const QString outputFilename_cmdline=outputDir.absoluteFilePath(args.value(1, "output.png")); const QString inputfile=parser.value(inputfileOption); const QString listsymbols=parser.value(listsymbolsOption); + const QStringList listsymbolsfonts=parser.value(listsymbolsfontsOption).split(','); const bool verbose = parser.isSet(verboseOption); QStringList latex, outputFilename; @@ -137,6 +142,12 @@ int main(int argc, char* argv[]) fileList<<"/*!\n" " \\defgroup jkqtmathtext_supportedlatexsymbols Supported LaTeX-Symbols\n" " \\ingroup jkqtmathtext_general_latex\n\n\\tableofcontents\n\n"; + fileList<<" Symbols are shown in these fonts:\n" + "
      \n"; + for (const QString& fnt: listsymbolsfonts) { + fileList<<"
    • "<\n"; + } + fileList<<"
    \n\n\n"; fileList<<" \\section jkqtmathtext_supportedlatexsymbols_greek Greek Letters\n"; fileList<<" The following table lists all greek letters and their variants available in JKQTMathParser. They are defined in the node-class JKQTMathTextSymbolNode:\n"; fileList<<" \n"; @@ -166,13 +177,22 @@ int main(int argc, char* argv[]) if (ch.isUpper()) symbol_lower+=QString(2, ch).toLower(); else symbol_lower+=ch; } - latex.append(code+"\\vphantom{Iq}"); - outputFilename.append("jkqtmathtext_greek_"+symbol_lower+".png"); - cmdoptions.append(QMap()); + for (const QString& fnt: listsymbolsfonts) { + latex.append(code+"\\vphantom{Iq}"); + outputFilename.append("jkqtmathtext_greek_"+symbol_lower+"_"+fnt+".png"); + QMap localoptions; + localoptions["fontmathroman"]=fnt; + cmdoptions.append(localoptions); + } //std::cout<<" - "<"<:\n \n"; //} @@ -202,10 +222,20 @@ int main(int argc, char* argv[]) if (ch.isUpper()) symbol_lower+=QString(2, ch).toLower(); else symbol_lower+=ch; } - latex.append("\\"+symbol+"\\vphantom{Iq}"); - outputFilename.append("jkqtmathtext_symbols_"+symbol_lower+".png"); - cmdoptions.append(QMap()); - fileList<<" \n"; } @@ -232,18 +262,30 @@ int main(int argc, char* argv[]) else symbol_lower+=ch; } static QSet specialSymbols=QSet()<<"lim"<<"liminf"<<"limsup"<<"arg"<<"argmin"<<"argmax"; + QString code=""; if (JKQTMathTextSymbolNode::getSymbolLength(symbol)>1 && !specialSymbols.contains(symbol)) { - latex.append("$\\"+symbol+"(\\cdot)$\\vphantom{Iq}"); + code="$\\"+symbol+"(\\cdot)$"; } else { if (JKQTMathTextSymbolNode::getSymbolLength(symbol)>1) { - latex.append("$\\"+symbol+"\\limits_{x\\rightarrow\\infty}f(x)$\\vphantom{Iq}"); + code="$\\"+symbol+"\\limits_{x\\rightarrow\\infty}f(x)$"; } else { - latex.append("$\\"+symbol+"\\limits_{x=0}^\\infty f(x)$\\vphantom{Iq}"); + code="$\\"+symbol+"\\limits_{x=0}^\\infty f(x)$"; } } - outputFilename.append("jkqtmathtext_symbols_"+symbol_lower+".png"); - cmdoptions.append(QMap()); - fileList<<" \n"; } @@ -269,10 +311,20 @@ int main(int argc, char* argv[]) if (ch.isUpper()) symbol_lower+=QString(2, ch).toLower(); else symbol_lower+=ch; } - latex.append("$\\"+symbol+"(\\cdot)$\\vphantom{Iq}"); - outputFilename.append("jkqtmathtext_symbols_"+symbol_lower+".png"); - cmdoptions.append(QMap()); - fileList<<" \n"; } @@ -301,13 +353,20 @@ int main(int argc, char* argv[]) else symbol_lower+=ch; } const QString code="\\"+symbol+"\\vphantom{Iq}"; - const QString filename="jkqtmathtext_symbols_"+symbol_lower+".png"; - if (!latex.contains(code) || !outputFilename.contains(filename)) { - latex.append(code); - outputFilename.append(filename); - cmdoptions.append(QMap()); + for (const QString& fnt: listsymbolsfonts) { + latex.append(code+"\\vphantom{Iq}"); + outputFilename.append("jkqtmathtext_greek_"+symbol_lower+"_"+fnt+".png"); + QMap localoptions; + localoptions["fontmathroman"]=fnt; + cmdoptions.append(localoptions); + } + fileList<<" \n"; } @@ -434,10 +493,14 @@ int main(int argc, char* argv[]) QString fontFraktur=parser.value(fontFrakturOption); QString fontCaligraphic=parser.value(fontcaligraphicOption); JKQTMathTextBlackboradDrawingMode fontBlackboardMode=String2JKQTMathTextBlackboradDrawingMode(parser.value(fontblackboardmodeOption)); + bool guiFonts=parser.isSet(guifontsOption); if (cmdoptions[i].size()>0) { for (const QString& key: cmdoptions[i].keys()) { if (key=="drawboxes" || key=="showboxes") drawBoxes=true; + else if (key=="nodrawboxes" || key=="noshowboxes") drawBoxes=false; + else if (key=="guifonts") guiFonts=true; + else if (key=="noguifonts") guiFonts=false; else if (key=="fontsize") fontsize=cmdoptions[i].value(key).toDouble(); else if (key=="sizeincrease") sizeincrease=cmdoptions[i].value(key).toInt(); else if (key=="background") backgroundColor=jkqtp_String2QColor(cmdoptions[i].value(key)); @@ -477,12 +540,19 @@ int main(int argc, char* argv[]) else if (mathFont.toUpper() == "STIX_MATHANDTEXT") mathText.useSTIX(false); if (mathFont.toUpper() == "ASANA") mathText.useASANA(true); else if (mathFont.toUpper() == "ASANA_MATHANDTEXT") mathText.useASANA(false); + if (mathFont.toUpper() == "FIRA") mathText.useFiraMath(true); + else if (mathFont.toUpper() == "FIRA_MATHANDTEXT") mathText.useFiraMath(false); if (fontRoman.size()>0) mathText.setFontRoman(fontRoman, MTFEUnicode); if (fontSans.size()>0) mathText.setFontSans(fontSans, MTFEUnicode); if (fontMathRoman.size()>0) { if (fontMathRoman.toUpper()=="XITS") mathText.useXITS(true); else if (fontMathRoman.toUpper()=="STIX") mathText.useSTIX(true); else if (fontMathRoman.toUpper()=="ASANA") mathText.useASANA(true); + else if (fontMathRoman.toUpper()=="FIRA") mathText.useFiraMath(true); + else if (fontMathRoman.toUpper()=="XITS_MATHANDTEXT") mathText.useXITS(false); + else if (fontMathRoman.toUpper()=="STIX_MATHANDTEXT") mathText.useSTIX(false); + else if (fontMathRoman.toUpper()=="ASANA_MATHANDTEXT") mathText.useASANA(false); + else if (fontMathRoman.toUpper()=="FIRA_MATHANDTEXT") mathText.useFiraMath(false); else mathText.setFontMathRoman(fontMathRoman, MTFEUnicode); } if (fontMathSans.size()>0) mathText.setFontMathSans(fontMathSans, MTFEUnicode); @@ -499,6 +569,9 @@ int main(int argc, char* argv[]) mathText.setFontBlackboradMode(fontBlackboardMode); mathText.setFontSize(fontsize); mathText.setFontColor(textColor); + if (guiFonts) { + mathText.useGuiFonts(); + } // 3. now we parse some LaTeX code QElapsedTimer timer;
    \\image html jkqtmathtext/symbols/"<"<:\n "; + for (int i=0; i< listsymbolsfonts.size(); i++) { + if (i>0) fileList<<" "; + + fileList<<"\\image html jkqtmathtext/symbols/"<\n
    \\\\"<:\n \\image html jkqtmathtext/symbols/"< localoptions; + localoptions["fontmathroman"]=fnt; + cmdoptions.append(localoptions); + } + fileList<<" \\\\"<:\n"; + fileList<<" "; + for (int i=0; i< listsymbolsfonts.size(); i++) { + if (i>0) fileList<<" "; + + fileList<<"\\image html jkqtmathtext/symbols/"<\n
    \\\\"<:\n \\image html jkqtmathtext/symbols/"< localoptions; + localoptions["fontmathroman"]=fnt; + cmdoptions.append(localoptions); + } + fileList<<" \\\\"<:\n"; + fileList<<" "; + for (int i=0; i< listsymbolsfonts.size(); i++) { + if (i>0) fileList<<" "; + + fileList<<"\\image html jkqtmathtext/symbols/"<\n
    \\\\"<:\n \\image html jkqtmathtext/symbols/"< localoptions; + localoptions["fontmathroman"]=fnt; + cmdoptions.append(localoptions); + } + fileList<<" \\\\"<:\n"; + fileList<<" "; + for (int i=0; i< listsymbolsfonts.size(); i++) { + if (i>0) fileList<<" "; + + fileList<<"\\image html jkqtmathtext/symbols/"<\n
    \\\\"<:\n"; + fileList<<" "; + for (int i=0; i< listsymbolsfonts.size(); i++) { + if (i>0) fileList<<" "; + + fileList<<"\\image html jkqtmathtext/symbols/"<\\\\"<:\n \\image html jkqtmathtext/symbols/"<\n