@simonklee/opentui-tex-native-source 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/LICENSE-PROJECT +21 -0
- package/README.md +7 -0
- package/build.zig +112 -0
- package/build.zig.zon +12 -0
- package/native/lib.zig +280 -0
- package/native/nanosvg.c +4 -0
- package/native/vendor/.bootstrap-v5 +1 -0
- package/native/vendor/LICENSE-NANOSVG +18 -0
- package/native/vendor/microtex/.clang-format +26 -0
- package/native/vendor/microtex/.github/workflows/ubuntu.yml +92 -0
- package/native/vendor/microtex/.github/workflows/windows-gdi.yml +34 -0
- package/native/vendor/microtex/.github/workflows/windows-qt.yml +52 -0
- package/native/vendor/microtex/CMakeLists.txt +110 -0
- package/native/vendor/microtex/LICENSE +21 -0
- package/native/vendor/microtex/MicroTeXInstall.cmake +42 -0
- package/native/vendor/microtex/README.md +600 -0
- package/native/vendor/microtex/build.zig +209 -0
- package/native/vendor/microtex/clatexmath.wrap +6 -0
- package/native/vendor/microtex/doc/meson.build +38 -0
- package/native/vendor/microtex/doc/microtex-doc.toml.in +47 -0
- package/native/vendor/microtex/doc/microtex.svg +39 -0
- package/native/vendor/microtex/doc/urlmap.js +6 -0
- package/native/vendor/microtex/example/gtk/CMakeLists.txt +68 -0
- package/native/vendor/microtex/example/gtk/gtk_main.c +170 -0
- package/native/vendor/microtex/example/gtk/isamples.cpp +21 -0
- package/native/vendor/microtex/example/gtk/isamples.h +15 -0
- package/native/vendor/microtex/example/gtk/meson.build +27 -0
- package/native/vendor/microtex/example/gtk/microtex-gtk.gresource.xml +6 -0
- package/native/vendor/microtex/example/gtk/microtex-gtk.ui +117 -0
- package/native/vendor/microtex/example/gtkmm/CMakeLists.txt +19 -0
- package/native/vendor/microtex/example/gtkmm/gtkmm_main.cpp +531 -0
- package/native/vendor/microtex/example/gtkmm/meson.build +19 -0
- package/native/vendor/microtex/example/memcheck/CMakeLists.txt +12 -0
- package/native/vendor/microtex/example/memcheck/mem_check_main.cpp +154 -0
- package/native/vendor/microtex/example/qt/CMakeLists.txt +37 -0
- package/native/vendor/microtex/example/qt/meson.build +25 -0
- package/native/vendor/microtex/example/qt/qt_main.cpp +70 -0
- package/native/vendor/microtex/example/qt/qt_mainwindow.cpp +107 -0
- package/native/vendor/microtex/example/qt/qt_mainwindow.h +40 -0
- package/native/vendor/microtex/example/qt/qt_skiatexwidget.cpp +149 -0
- package/native/vendor/microtex/example/qt/qt_skiatexwidget.h +48 -0
- package/native/vendor/microtex/example/qt/qt_tex_render.h +15 -0
- package/native/vendor/microtex/example/qt/qt_texqmlitem.cpp +56 -0
- package/native/vendor/microtex/example/qt/qt_texqmlitem.h +31 -0
- package/native/vendor/microtex/example/qt/qt_texwidget.cpp +62 -0
- package/native/vendor/microtex/example/qt/qt_texwidget.h +31 -0
- package/native/vendor/microtex/example/qtpng/CMakeLists.txt +11 -0
- package/native/vendor/microtex/example/qtpng/latex2png.cpp +115 -0
- package/native/vendor/microtex/example/samples/samples.cpp +52 -0
- package/native/vendor/microtex/example/samples/samples.h +32 -0
- package/native/vendor/microtex/example/win32/CMakeLists.txt +15 -0
- package/native/vendor/microtex/example/win32/meson.build +18 -0
- package/native/vendor/microtex/example/win32/win32_main.cpp +375 -0
- package/native/vendor/microtex/githooks/pre-commit +19 -0
- package/native/vendor/microtex/githooks/pre-push +103 -0
- package/native/vendor/microtex/lib/CMakeLists.txt +234 -0
- package/native/vendor/microtex/lib/atom/atom.cpp +14 -0
- package/native/vendor/microtex/lib/atom/atom.h +96 -0
- package/native/vendor/microtex/lib/atom/atom_accent.cpp +115 -0
- package/native/vendor/microtex/lib/atom/atom_accent.h +53 -0
- package/native/vendor/microtex/lib/atom/atom_basic.cpp +146 -0
- package/native/vendor/microtex/lib/atom/atom_basic.h +273 -0
- package/native/vendor/microtex/lib/atom/atom_box.cpp +41 -0
- package/native/vendor/microtex/lib/atom/atom_box.h +70 -0
- package/native/vendor/microtex/lib/atom/atom_char.cpp +99 -0
- package/native/vendor/microtex/lib/atom/atom_char.h +147 -0
- package/native/vendor/microtex/lib/atom/atom_delim.cpp +65 -0
- package/native/vendor/microtex/lib/atom/atom_delim.h +58 -0
- package/native/vendor/microtex/lib/atom/atom_fence.cpp +65 -0
- package/native/vendor/microtex/lib/atom/atom_fence.h +56 -0
- package/native/vendor/microtex/lib/atom/atom_font.cpp +20 -0
- package/native/vendor/microtex/lib/atom/atom_font.h +49 -0
- package/native/vendor/microtex/lib/atom/atom_frac.cpp +101 -0
- package/native/vendor/microtex/lib/atom/atom_frac.h +42 -0
- package/native/vendor/microtex/lib/atom/atom_matrix.cpp +756 -0
- package/native/vendor/microtex/lib/atom/atom_matrix.h +268 -0
- package/native/vendor/microtex/lib/atom/atom_misc.cpp +230 -0
- package/native/vendor/microtex/lib/atom/atom_misc.h +200 -0
- package/native/vendor/microtex/lib/atom/atom_operator.cpp +51 -0
- package/native/vendor/microtex/lib/atom/atom_operator.h +41 -0
- package/native/vendor/microtex/lib/atom/atom_root.cpp +61 -0
- package/native/vendor/microtex/lib/atom/atom_root.h +27 -0
- package/native/vendor/microtex/lib/atom/atom_row.cpp +334 -0
- package/native/vendor/microtex/lib/atom/atom_row.h +176 -0
- package/native/vendor/microtex/lib/atom/atom_scripts.cpp +182 -0
- package/native/vendor/microtex/lib/atom/atom_scripts.h +52 -0
- package/native/vendor/microtex/lib/atom/atom_sideset.cpp +92 -0
- package/native/vendor/microtex/lib/atom/atom_sideset.h +24 -0
- package/native/vendor/microtex/lib/atom/atom_space.cpp +22 -0
- package/native/vendor/microtex/lib/atom/atom_space.h +38 -0
- package/native/vendor/microtex/lib/atom/atom_stack.cpp +117 -0
- package/native/vendor/microtex/lib/atom/atom_stack.h +103 -0
- package/native/vendor/microtex/lib/atom/atom_text.cpp +17 -0
- package/native/vendor/microtex/lib/atom/atom_text.h +33 -0
- package/native/vendor/microtex/lib/atom/atom_vrow.cpp +96 -0
- package/native/vendor/microtex/lib/atom/atom_vrow.h +47 -0
- package/native/vendor/microtex/lib/atom/atom_zstack.cpp +66 -0
- package/native/vendor/microtex/lib/atom/atom_zstack.h +37 -0
- package/native/vendor/microtex/lib/atom/colors_def.cpp +157 -0
- package/native/vendor/microtex/lib/atom/meson.build +50 -0
- package/native/vendor/microtex/lib/box/box.cpp +49 -0
- package/native/vendor/microtex/lib/box/box.h +184 -0
- package/native/vendor/microtex/lib/box/box_factory.cpp +162 -0
- package/native/vendor/microtex/lib/box/box_factory.h +24 -0
- package/native/vendor/microtex/lib/box/box_group.cpp +503 -0
- package/native/vendor/microtex/lib/box/box_group.h +285 -0
- package/native/vendor/microtex/lib/box/box_single.cpp +179 -0
- package/native/vendor/microtex/lib/box/box_single.h +157 -0
- package/native/vendor/microtex/lib/box/meson.build +15 -0
- package/native/vendor/microtex/lib/core/debug_config.cpp +3 -0
- package/native/vendor/microtex/lib/core/debug_config.h +24 -0
- package/native/vendor/microtex/lib/core/formula.cpp +180 -0
- package/native/vendor/microtex/lib/core/formula.h +137 -0
- package/native/vendor/microtex/lib/core/formula_def.cpp +167 -0
- package/native/vendor/microtex/lib/core/glue.cpp +108 -0
- package/native/vendor/microtex/lib/core/glue.h +55 -0
- package/native/vendor/microtex/lib/core/localized_num.cpp +51 -0
- package/native/vendor/microtex/lib/core/meson.build +19 -0
- package/native/vendor/microtex/lib/core/parser.cpp +874 -0
- package/native/vendor/microtex/lib/core/parser.h +306 -0
- package/native/vendor/microtex/lib/core/split.cpp +185 -0
- package/native/vendor/microtex/lib/core/split.h +40 -0
- package/native/vendor/microtex/lib/env/env.cpp +141 -0
- package/native/vendor/microtex/lib/env/env.h +221 -0
- package/native/vendor/microtex/lib/env/meson.build +11 -0
- package/native/vendor/microtex/lib/env/units.cpp +109 -0
- package/native/vendor/microtex/lib/env/units.h +61 -0
- package/native/vendor/microtex/lib/graphic/font_style.cpp +63 -0
- package/native/vendor/microtex/lib/graphic/font_style.h +61 -0
- package/native/vendor/microtex/lib/graphic/graphic.cpp +38 -0
- package/native/vendor/microtex/lib/graphic/graphic.h +314 -0
- package/native/vendor/microtex/lib/graphic/graphic_basic.cpp +44 -0
- package/native/vendor/microtex/lib/graphic/graphic_basic.h +131 -0
- package/native/vendor/microtex/lib/graphic/meson.build +13 -0
- package/native/vendor/microtex/lib/macro/macro.cpp +143 -0
- package/native/vendor/microtex/lib/macro/macro.h +155 -0
- package/native/vendor/microtex/lib/macro/macro_accent.cpp +50 -0
- package/native/vendor/microtex/lib/macro/macro_accent.h +61 -0
- package/native/vendor/microtex/lib/macro/macro_boxes.h +68 -0
- package/native/vendor/microtex/lib/macro/macro_colors.cpp +42 -0
- package/native/vendor/microtex/lib/macro/macro_colors.h +42 -0
- package/native/vendor/microtex/lib/macro/macro_decl.h +16 -0
- package/native/vendor/microtex/lib/macro/macro_def.cpp +418 -0
- package/native/vendor/microtex/lib/macro/macro_delims.cpp +56 -0
- package/native/vendor/microtex/lib/macro/macro_delims.h +73 -0
- package/native/vendor/microtex/lib/macro/macro_env.h +212 -0
- package/native/vendor/microtex/lib/macro/macro_fonts.cpp +53 -0
- package/native/vendor/microtex/lib/macro/macro_fonts.h +78 -0
- package/native/vendor/microtex/lib/macro/macro_frac.cpp +138 -0
- package/native/vendor/microtex/lib/macro/macro_frac.h +50 -0
- package/native/vendor/microtex/lib/macro/macro_misc.cpp +211 -0
- package/native/vendor/microtex/lib/macro/macro_misc.h +217 -0
- package/native/vendor/microtex/lib/macro/macro_scripts.cpp +32 -0
- package/native/vendor/microtex/lib/macro/macro_scripts.h +17 -0
- package/native/vendor/microtex/lib/macro/macro_sizes.h +110 -0
- package/native/vendor/microtex/lib/macro/macro_space.cpp +31 -0
- package/native/vendor/microtex/lib/macro/macro_space.h +17 -0
- package/native/vendor/microtex/lib/macro/macro_styles.cpp +45 -0
- package/native/vendor/microtex/lib/macro/macro_styles.h +22 -0
- package/native/vendor/microtex/lib/macro/macro_types.h +48 -0
- package/native/vendor/microtex/lib/macro/meson.build +33 -0
- package/native/vendor/microtex/lib/meson.build +102 -0
- package/native/vendor/microtex/lib/microtex.cpp +208 -0
- package/native/vendor/microtex/lib/microtex.h +225 -0
- package/native/vendor/microtex/lib/microtexConfig.cmake.in +2 -0
- package/native/vendor/microtex/lib/microtexapi.h +22 -0
- package/native/vendor/microtex/lib/microtexconfig.h.in +7 -0
- package/native/vendor/microtex/lib/microtexexport.h +31 -0
- package/native/vendor/microtex/lib/otf/clm.cpp +405 -0
- package/native/vendor/microtex/lib/otf/clm.h +61 -0
- package/native/vendor/microtex/lib/otf/fontsense.cpp +191 -0
- package/native/vendor/microtex/lib/otf/fontsense.h +20 -0
- package/native/vendor/microtex/lib/otf/glyph.cpp +53 -0
- package/native/vendor/microtex/lib/otf/glyph.h +384 -0
- package/native/vendor/microtex/lib/otf/math_consts.h +154 -0
- package/native/vendor/microtex/lib/otf/meson.build +18 -0
- package/native/vendor/microtex/lib/otf/otf.cpp +84 -0
- package/native/vendor/microtex/lib/otf/otf.h +177 -0
- package/native/vendor/microtex/lib/otf/otfconfig.h +32 -0
- package/native/vendor/microtex/lib/otf/path.cpp +187 -0
- package/native/vendor/microtex/lib/otf/path.h +120 -0
- package/native/vendor/microtex/lib/render/builder.cpp +68 -0
- package/native/vendor/microtex/lib/render/builder.h +73 -0
- package/native/vendor/microtex/lib/render/meson.build +11 -0
- package/native/vendor/microtex/lib/render/render.cpp +136 -0
- package/native/vendor/microtex/lib/render/render.h +59 -0
- package/native/vendor/microtex/lib/unimath/font_meta.h +22 -0
- package/native/vendor/microtex/lib/unimath/font_src.cpp +21 -0
- package/native/vendor/microtex/lib/unimath/font_src.h +61 -0
- package/native/vendor/microtex/lib/unimath/math_type.cpp +318 -0
- package/native/vendor/microtex/lib/unimath/math_type.h +105 -0
- package/native/vendor/microtex/lib/unimath/meson.build +18 -0
- package/native/vendor/microtex/lib/unimath/uni_char.cpp +121 -0
- package/native/vendor/microtex/lib/unimath/uni_char.h +109 -0
- package/native/vendor/microtex/lib/unimath/uni_font.cpp +248 -0
- package/native/vendor/microtex/lib/unimath/uni_font.h +139 -0
- package/native/vendor/microtex/lib/unimath/uni_symbol.cpp +2929 -0
- package/native/vendor/microtex/lib/unimath/uni_symbol.h +31 -0
- package/native/vendor/microtex/lib/utils/dict_tree.h +68 -0
- package/native/vendor/microtex/lib/utils/exceptions.h +61 -0
- package/native/vendor/microtex/lib/utils/log.h +34 -0
- package/native/vendor/microtex/lib/utils/meson.build +18 -0
- package/native/vendor/microtex/lib/utils/nums.h +24 -0
- package/native/vendor/microtex/lib/utils/string_utils.cpp +85 -0
- package/native/vendor/microtex/lib/utils/string_utils.h +130 -0
- package/native/vendor/microtex/lib/utils/types.h +152 -0
- package/native/vendor/microtex/lib/utils/utf.cpp +115 -0
- package/native/vendor/microtex/lib/utils/utf.h +58 -0
- package/native/vendor/microtex/lib/utils/utils.cpp +40 -0
- package/native/vendor/microtex/lib/utils/utils.h +88 -0
- package/native/vendor/microtex/lib/wrapper/byte_seq.cpp +46 -0
- package/native/vendor/microtex/lib/wrapper/byte_seq.h +70 -0
- package/native/vendor/microtex/lib/wrapper/callback.cpp +10 -0
- package/native/vendor/microtex/lib/wrapper/callback.h +72 -0
- package/native/vendor/microtex/lib/wrapper/cwrapper.cpp +206 -0
- package/native/vendor/microtex/lib/wrapper/cwrapper.h +305 -0
- package/native/vendor/microtex/lib/wrapper/graphic_wrapper.cpp +211 -0
- package/native/vendor/microtex/lib/wrapper/graphic_wrapper.h +159 -0
- package/native/vendor/microtex/lib/wrapper/meson.build +22 -0
- package/native/vendor/microtex/meson.build +75 -0
- package/native/vendor/microtex/meson_options.txt +29 -0
- package/native/vendor/microtex/platform/cairo/CMakeLists.txt +36 -0
- package/native/vendor/microtex/platform/cairo/graphic_cairo.cpp +384 -0
- package/native/vendor/microtex/platform/cairo/graphic_cairo.h +119 -0
- package/native/vendor/microtex/platform/cairo/meson.build +47 -0
- package/native/vendor/microtex/platform/cairo/microtex-cairoConfig.cmake.in +11 -0
- package/native/vendor/microtex/platform/flutter/microtex/.metadata +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/CHANGELOG.md +3 -0
- package/native/vendor/microtex/platform/flutter/microtex/LICENSE +1 -0
- package/native/vendor/microtex/platform/flutter/microtex/README.md +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/analysis_options.yaml +4 -0
- package/native/vendor/microtex/platform/flutter/microtex/android/build.gradle +56 -0
- package/native/vendor/microtex/platform/flutter/microtex/android/settings.gradle +1 -0
- package/native/vendor/microtex/platform/flutter/microtex/android/src/main/AndroidManifest.xml +3 -0
- package/native/vendor/microtex/platform/flutter/microtex/android/src/main/kotlin/io/nano/microtex/microtex/MicrotexPlugin.kt +35 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/.metadata +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/README.md +16 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/analysis_options.yaml +31 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/build.gradle +68 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/debug/AndroidManifest.xml +7 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/AndroidManifest.xml +34 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/kotlin/io/nano/microtex/microtex_example/MainActivity.kt +6 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/drawable/launch_background.xml +12 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/drawable-v21/launch_background.xml +12 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/values/styles.xml +18 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/values-night/styles.xml +18 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/profile/AndroidManifest.xml +7 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/build.gradle +31 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/gradle.properties +3 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/settings.gradle +11 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Flutter/AppFrameworkInfo.plist +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Flutter/Debug.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Flutter/Release.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Podfile +41 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Podfile.lock +22 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/AppDelegate.swift +13 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +122 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +5 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Base.lproj/LaunchScreen.storyboard +37 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Base.lproj/Main.storyboard +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Info.plist +49 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Runner-Bridging-Header.h +1 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.pbxproj +549 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +87 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcworkspace/contents.xcworkspacedata +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/main.dart +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/screen/edit_in_one.dart +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/screen/edit_screen.dart +208 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/utils/convert_spans.dart +63 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/utils/string_ext.dart +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/cmp.dart +118 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/draggable.dart +75 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/rich.dart +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/split.dart +72 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/tex_highlight_controller.dart +66 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/tex_input_controller.dart +19 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/CMakeLists.txt +116 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/CMakeLists.txt +87 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/generated_plugin_registrant.cc +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/generated_plugin_registrant.h +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/generated_plugins.cmake +24 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/main.cc +6 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/my_application.cc +104 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/my_application.h +18 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Flutter/Flutter-Debug.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Flutter/Flutter-Release.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Flutter/GeneratedPluginRegistrant.swift +12 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Podfile +40 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Podfile.lock +22 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/AppDelegate.swift +9 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Base.lproj/MainMenu.xib +343 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/AppInfo.xcconfig +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/Debug.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/Release.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/Warnings.xcconfig +13 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/DebugProfile.entitlements +12 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Info.plist +32 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/MainFlutterWindow.swift +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Release.entitlements +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcodeproj/project.pbxproj +633 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +87 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcworkspace/contents.xcworkspacedata +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/pubspec.lock +191 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/pubspec.yaml +56 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/test/widget_test.dart +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/CMakeLists.txt +95 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/CMakeLists.txt +103 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/generated_plugin_registrant.cc +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/generated_plugin_registrant.h +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/generated_plugins.cmake +24 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/CMakeLists.txt +17 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/Runner.rc +121 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/flutter_window.cpp +61 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/flutter_window.h +33 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/main.cpp +43 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/resource.h +16 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/resources/app_icon.ico +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/runner.exe.manifest +20 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/utils.cpp +64 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/utils.h +19 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/win32_window.cpp +245 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/win32_window.h +98 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Assets/.gitkeep +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/MicrotexPlugin.h +4 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/MicrotexPlugin.m +19 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/SwiftMicrotexPlugin.swift +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/dummy.h +4 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/microtex.podspec +27 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/microtex.dart +7 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/bindings.dart +218 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/bounds.dart +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/context.dart +205 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/fontdesc.dart +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/fontmeta.dart +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/pathcache.dart +17 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/render.dart +291 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/texstyle.dart +11 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/textlayout.dart +93 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/widget.dart +163 -0
- package/native/vendor/microtex/platform/flutter/microtex/linux/CMakeLists.txt +33 -0
- package/native/vendor/microtex/platform/flutter/microtex/linux/include/microtex/microtex_plugin.h +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/linux/microtex_plugin.cc +70 -0
- package/native/vendor/microtex/platform/flutter/microtex/macos/Classes/MicrotexPlugin.swift +20 -0
- package/native/vendor/microtex/platform/flutter/microtex/macos/Classes/dummy.h +4 -0
- package/native/vendor/microtex/platform/flutter/microtex/macos/Classes/microtex-Bridging-Header.h +1 -0
- package/native/vendor/microtex/platform/flutter/microtex/macos/microtex.podspec +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/nativelib/CMakeLists.txt +44 -0
- package/native/vendor/microtex/platform/flutter/microtex/nativelib/builddarwin.sh +108 -0
- package/native/vendor/microtex/platform/flutter/microtex/pubspec.yaml +37 -0
- package/native/vendor/microtex/platform/flutter/microtex/test/microtex_test.dart +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/windows/CMakeLists.txt +32 -0
- package/native/vendor/microtex/platform/flutter/microtex/windows/include/microtex/microtex_plugin.h +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/windows/microtex_plugin.cpp +82 -0
- package/native/vendor/microtex/platform/gdi_win/CMakeLists.txt +20 -0
- package/native/vendor/microtex/platform/gdi_win/graphic_win32.cpp +352 -0
- package/native/vendor/microtex/platform/gdi_win/graphic_win32.h +137 -0
- package/native/vendor/microtex/platform/gdi_win/meson.build +39 -0
- package/native/vendor/microtex/platform/gtk/CMakeLists.txt +36 -0
- package/native/vendor/microtex/platform/gtk/meson.build +65 -0
- package/native/vendor/microtex/platform/gtk/microtex-gtkConfig.cmake.in +11 -0
- package/native/vendor/microtex/platform/gtk/microtexequation.cpp +708 -0
- package/native/vendor/microtex/platform/gtk/microtexequation.h +72 -0
- package/native/vendor/microtex/platform/qt/CMakeLists.txt +37 -0
- package/native/vendor/microtex/platform/qt/graphic_qt.cpp +355 -0
- package/native/vendor/microtex/platform/qt/graphic_qt.h +116 -0
- package/native/vendor/microtex/platform/qt/meson.build +38 -0
- package/native/vendor/microtex/platform/qt/microtex-qtConfig.cmake.in +7 -0
- package/native/vendor/microtex/platform/skia/CMakeLists.txt +46 -0
- package/native/vendor/microtex/platform/skia/graphic_skia.cpp +306 -0
- package/native/vendor/microtex/platform/skia/graphic_skia.h +125 -0
- package/native/vendor/microtex/platform/skia/microtex-skiaConfig.cmake.in +6 -0
- package/native/vendor/microtex/platform/wasm/CMakeLists.txt +38 -0
- package/native/vendor/microtex/platform/wasm/emscripten.cross +31 -0
- package/native/vendor/microtex/platform/wasm/main.cpp +15 -0
- package/native/vendor/microtex/platform/wasm/meson.build +8 -0
- package/native/vendor/microtex/platform/wasm/prebuild-example-meson.sh +21 -0
- package/native/vendor/microtex/platform/wasm/prebuild-example.sh +21 -0
- package/native/vendor/microtex/platform/wasm/prebuild-lib-meson.sh +28 -0
- package/native/vendor/microtex/platform/wasm/prebuild-lib.sh +31 -0
- package/native/vendor/microtex/platform/wasm/web/.babelrc +10 -0
- package/native/vendor/microtex/platform/wasm/web/example/examples.js +43 -0
- package/native/vendor/microtex/platform/wasm/web/example/hello.js +31 -0
- package/native/vendor/microtex/platform/wasm/web/example/index.html +55 -0
- package/native/vendor/microtex/platform/wasm/web/example/index.js +243 -0
- package/native/vendor/microtex/platform/wasm/web/example/styles.css +86 -0
- package/native/vendor/microtex/platform/wasm/web/example/utils.js +47 -0
- package/native/vendor/microtex/platform/wasm/web/lib/context.js +271 -0
- package/native/vendor/microtex/platform/wasm/web/lib/index.js +10 -0
- package/native/vendor/microtex/platform/wasm/web/lib/render.js +293 -0
- package/native/vendor/microtex/platform/wasm/web/lib/runtime.js +14 -0
- package/native/vendor/microtex/platform/wasm/web/lib/svg.js +237 -0
- package/native/vendor/microtex/platform/wasm/web/lib/textlayout.js +88 -0
- package/native/vendor/microtex/platform/wasm/web/package-lock.json +5931 -0
- package/native/vendor/microtex/platform/wasm/web/package.json +45 -0
- package/native/vendor/microtex/platform/wasm/web/publish-example.sh +17 -0
- package/native/vendor/microtex/platform/wasm/web/rollup.config.example.js +24 -0
- package/native/vendor/microtex/platform/wasm/web/rollup.config.lib.js +16 -0
- package/native/vendor/microtex/prebuilt/otf2clm.py +807 -0
- package/native/vendor/microtex/prebuilt/otf2clm.sh +9 -0
- package/native/vendor/microtex/prebuilt/preclms.sh +17 -0
- package/native/vendor/microtex/readme/example_bw_false.svg +680 -0
- package/native/vendor/microtex/readme/example_bw_true.svg +680 -0
- package/native/vendor/microtex/readme/example_cjk_trying.svg +54 -0
- package/native/vendor/microtex/readme/example_custom_symbols.svg +92 -0
- package/native/vendor/microtex/readme/example_debug.svg +764 -0
- package/native/vendor/microtex/readme/example_emoji.svg +199 -0
- package/native/vendor/microtex/readme/example_have_log.svg +79 -0
- package/native/vendor/microtex/readme/example_keep_trying.svg +101 -0
- package/native/vendor/microtex/readme/example_logos.svg +50 -0
- package/native/vendor/microtex/readme/example_ubuntu.png +0 -0
- package/native/vendor/microtex/readme/example_windows.png +0 -0
- package/native/vendor/microtex/readme/samples/sample_0.svg +665 -0
- package/native/vendor/microtex/readme/samples/sample_1.svg +1259 -0
- package/native/vendor/microtex/readme/samples/sample_10.svg +333 -0
- package/native/vendor/microtex/readme/samples/sample_11.svg +306 -0
- package/native/vendor/microtex/readme/samples/sample_2.svg +2461 -0
- package/native/vendor/microtex/readme/samples/sample_3.svg +2653 -0
- package/native/vendor/microtex/readme/samples/sample_4.svg +554 -0
- package/native/vendor/microtex/readme/samples/sample_5.svg +247 -0
- package/native/vendor/microtex/readme/samples/sample_6.svg +1082 -0
- package/native/vendor/microtex/readme/samples/sample_7.svg +518 -0
- package/native/vendor/microtex/readme/samples/sample_8.svg +529 -0
- package/native/vendor/microtex/readme/samples/sample_9.svg +1702 -0
- package/native/vendor/microtex/readme/samples.md +301 -0
- package/native/vendor/microtex/readme/tex_logo.svg +19 -0
- package/native/vendor/microtex/res/EXAMPLE.txt +25 -0
- package/native/vendor/microtex/res/SAMPLES.tex +946 -0
- package/native/vendor/microtex/res/firamath/FiraMath-Regular.clm1 +0 -0
- package/native/vendor/microtex/res/firamath/FiraMath-Regular.clm2 +0 -0
- package/native/vendor/microtex/res/firamath/FiraMath-Regular.otf +0 -0
- package/native/vendor/microtex/res/firamath/README.md +42 -0
- package/native/vendor/microtex/res/lm-math/README +92 -0
- package/native/vendor/microtex/res/lm-math/latinmodern-math.clm1 +0 -0
- package/native/vendor/microtex/res/lm-math/latinmodern-math.clm2 +0 -0
- package/native/vendor/microtex/res/lm-math/latinmodern-math.otf +0 -0
- package/native/vendor/microtex/res/tex-gyre/README-TeX-Gyre-DejaVu-Math.txt +82 -0
- package/native/vendor/microtex/res/tex-gyre/texgyredejavu-math.clm1 +0 -0
- package/native/vendor/microtex/res/tex-gyre/texgyredejavu-math.clm2 +0 -0
- package/native/vendor/microtex/res/tex-gyre/texgyredejavu-math.otf +0 -0
- package/native/vendor/microtex/res/xits/FONTLOG.txt +246 -0
- package/native/vendor/microtex/res/xits/OFL.txt +98 -0
- package/native/vendor/microtex/res/xits/README.txt +15 -0
- package/native/vendor/microtex/res/xits/XITS-Bold.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Bold.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Bold.otf +0 -0
- package/native/vendor/microtex/res/xits/XITS-BoldItalic.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITS-BoldItalic.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITS-BoldItalic.otf +0 -0
- package/native/vendor/microtex/res/xits/XITS-Italic.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Italic.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Italic.otf +0 -0
- package/native/vendor/microtex/res/xits/XITS-Regular.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Regular.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Regular.otf +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Bold.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Bold.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Bold.otf +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Regular.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Regular.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Regular.otf +0 -0
- package/native/vendor/microtex/test/clm/meson.build +10 -0
- package/native/vendor/microtex/test/clm/test_clm.cpp +140 -0
- package/native/vendor/microtex/test/env/meson.build +10 -0
- package/native/vendor/microtex/test/env/test_env.cpp +100 -0
- package/native/vendor/microtex/test/fuzzer/afl.native +20 -0
- package/native/vendor/microtex/test/fuzzer/fuzz.sh +135 -0
- package/native/vendor/microtex/test/fuzzer/fuzzer.cpp +61 -0
- package/native/vendor/microtex/test/fuzzer/generateSeed.java +33 -0
- package/native/vendor/microtex/test/fuzzer/meson.build +9 -0
- package/native/vendor/microtex/test/fuzzer/microtex.dict +3708 -0
- package/native/vendor/microtex/test/fuzzer/platform_none.cpp +100 -0
- package/native/vendor/microtex/test/has_filesystem.cpp +8 -0
- package/native/vendor/microtex/test/meson.build +6 -0
- package/native/vendor/nanosvg.h +3278 -0
- package/native/vendor/nanosvgrast.h +1472 -0
- package/native/vendor/zigtex/.github/assets/example.svg +27 -0
- package/native/vendor/zigtex/LICENSE +674 -0
- package/native/vendor/zigtex/README.md +52 -0
- package/native/vendor/zigtex/build.zig +52 -0
- package/native/vendor/zigtex/build.zig.zon +16 -0
- package/native/vendor/zigtex/fonts/latinmodern-math.clm2 +0 -0
- package/native/vendor/zigtex/src/main.zig +22 -0
- package/native/vendor/zigtex/src/root.zig +124 -0
- package/native/vendor/zigtex/src/svg.zig +273 -0
- package/native/vendor/zigtex/src/tex.zig +383 -0
- package/native/zigtex-0.16.patch +35 -0
- package/package.json +27 -0
- package/scripts/bootstrap-native +89 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#include "graphic/graphic.h"
|
|
2
|
+
#include "microtex.h"
|
|
3
|
+
#include "utils/utils.h"
|
|
4
|
+
|
|
5
|
+
namespace microtex {
|
|
6
|
+
|
|
7
|
+
class Font_none : public Font {
|
|
8
|
+
public:
|
|
9
|
+
Font_none() = default;
|
|
10
|
+
|
|
11
|
+
bool operator==(const Font& f) const override { return false; }
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
class TextLayout_none : public TextLayout {
|
|
15
|
+
public:
|
|
16
|
+
TextLayout_none() = default;
|
|
17
|
+
|
|
18
|
+
void getBounds(Rect& bounds) override {}
|
|
19
|
+
|
|
20
|
+
void draw(Graphics2D& g2, float x, float y) override {}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
class PlatformFactory_none : public PlatformFactory {
|
|
24
|
+
public:
|
|
25
|
+
sptr<Font> createFont(const std::string& file) override { return sptrOf<Font_none>(); }
|
|
26
|
+
|
|
27
|
+
sptr<TextLayout> createTextLayout(const std::string& src, FontStyle style, float size) override {
|
|
28
|
+
return sptrOf<TextLayout_none>();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
class Graphics2D_none : public Graphics2D {
|
|
33
|
+
private:
|
|
34
|
+
Stroke _stroke;
|
|
35
|
+
float _fontSize = 100;
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
void setColor(color c) override {}
|
|
39
|
+
|
|
40
|
+
color getColor() const override { return 0; }
|
|
41
|
+
|
|
42
|
+
void setStroke(const Stroke& s) override { _stroke = s; }
|
|
43
|
+
|
|
44
|
+
const Stroke& getStroke() const override { return _stroke; }
|
|
45
|
+
|
|
46
|
+
void setStrokeWidth(float w) override {}
|
|
47
|
+
|
|
48
|
+
void setDash(const std::vector<float>& dash) override {}
|
|
49
|
+
|
|
50
|
+
std::vector<float> getDash() override { return std::vector<float>(); }
|
|
51
|
+
|
|
52
|
+
sptr<Font> getFont() const override { return microtex::sptr<Font_none>(); }
|
|
53
|
+
|
|
54
|
+
void setFont(const sptr<Font>& font) override {}
|
|
55
|
+
|
|
56
|
+
float getFontSize() const override { return _fontSize; }
|
|
57
|
+
|
|
58
|
+
void setFontSize(float size) override { _fontSize = size; }
|
|
59
|
+
|
|
60
|
+
void translate(float dx, float dy) override {}
|
|
61
|
+
|
|
62
|
+
void scale(float sx, float sy) override {}
|
|
63
|
+
|
|
64
|
+
void rotate(float angle) override {}
|
|
65
|
+
|
|
66
|
+
void rotate(float angle, float px, float py) override {}
|
|
67
|
+
|
|
68
|
+
void reset() override {}
|
|
69
|
+
|
|
70
|
+
float sx() const override { return 1; }
|
|
71
|
+
|
|
72
|
+
float sy() const override { return 1; }
|
|
73
|
+
|
|
74
|
+
void drawGlyph(u16 glyph, float x, float y) override {}
|
|
75
|
+
|
|
76
|
+
bool beginPath(i32 id) override { return false; }
|
|
77
|
+
|
|
78
|
+
void moveTo(float x, float y) override {}
|
|
79
|
+
|
|
80
|
+
void lineTo(float x, float y) override {}
|
|
81
|
+
|
|
82
|
+
void cubicTo(float x1, float y1, float x2, float y2, float x3, float y3) override {}
|
|
83
|
+
|
|
84
|
+
void quadTo(float x1, float y1, float x2, float y2) override {}
|
|
85
|
+
|
|
86
|
+
void closePath() override {}
|
|
87
|
+
|
|
88
|
+
void fillPath(i32 id) override {}
|
|
89
|
+
|
|
90
|
+
void drawLine(float x1, float y1, float x2, float y2) override {}
|
|
91
|
+
|
|
92
|
+
void drawRect(float x, float y, float w, float h) override {}
|
|
93
|
+
|
|
94
|
+
void fillRect(float x, float y, float w, float h) override {}
|
|
95
|
+
|
|
96
|
+
void drawRoundRect(float x, float y, float w, float h, float rx, float ry) override {}
|
|
97
|
+
|
|
98
|
+
void fillRoundRect(float x, float y, float w, float h, float rx, float ry) override {}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
} // namespace microtex
|
|
102
|
+
|
|
103
|
+
#include <chrono>
|
|
104
|
+
|
|
105
|
+
#include "samples.h"
|
|
106
|
+
|
|
107
|
+
template <typename F>
|
|
108
|
+
auto countDuration(const F& f) {
|
|
109
|
+
auto start = std::chrono::high_resolution_clock::now();
|
|
110
|
+
auto res = f();
|
|
111
|
+
auto stop = std::chrono::high_resolution_clock::now();
|
|
112
|
+
return std::make_pair(
|
|
113
|
+
std::chrono::duration_cast<std::chrono::microseconds>(stop - start).count(),
|
|
114
|
+
res
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
int main(int argc, char* argv[]) {
|
|
119
|
+
if (argc < 4) {
|
|
120
|
+
fprintf(
|
|
121
|
+
stderr,
|
|
122
|
+
"Required options:\n"
|
|
123
|
+
" <clm data file>\n"
|
|
124
|
+
" <math font file>\n"
|
|
125
|
+
" <samples file>\n"
|
|
126
|
+
);
|
|
127
|
+
return 1;
|
|
128
|
+
}
|
|
129
|
+
const microtex::FontSrcFile math{argv[1], argv[2]};
|
|
130
|
+
microtex::MicroTeX::init(math);
|
|
131
|
+
|
|
132
|
+
microtex::PlatformFactory::registerFactory(
|
|
133
|
+
"none",
|
|
134
|
+
std::make_unique<microtex::PlatformFactory_none>()
|
|
135
|
+
);
|
|
136
|
+
microtex::PlatformFactory::activate("none");
|
|
137
|
+
|
|
138
|
+
long total = 0;
|
|
139
|
+
microtex::Samples samples(argv[3]);
|
|
140
|
+
for (int i = 0; i < samples.count(); i++) {
|
|
141
|
+
auto [d, r] = countDuration([&]() {
|
|
142
|
+
return microtex::MicroTeX::parse(samples.next(), 720, 20, 20 / 3.f, microtex::black);
|
|
143
|
+
});
|
|
144
|
+
total += d;
|
|
145
|
+
printf("time: %ld(us)\n", d);
|
|
146
|
+
microtex::Graphics2D_none g2;
|
|
147
|
+
r->draw(g2, 0, 0);
|
|
148
|
+
delete r;
|
|
149
|
+
}
|
|
150
|
+
printf("total time: %ld(us)\n", total);
|
|
151
|
+
|
|
152
|
+
microtex::MicroTeX::release();
|
|
153
|
+
return 0;
|
|
154
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
add_executable(
|
|
2
|
+
microtex-qt-example
|
|
3
|
+
qt_texwidget.cpp
|
|
4
|
+
qt_mainwindow.cpp
|
|
5
|
+
qt_main.cpp
|
|
6
|
+
../samples/samples.cpp
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
target_include_directories(microtex-qt-example PUBLIC ../samples)
|
|
10
|
+
|
|
11
|
+
find_package(QT NAMES Qt6 Qt5 COMPONENTS Gui Widgets REQUIRED)
|
|
12
|
+
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui Widgets REQUIRED)
|
|
13
|
+
|
|
14
|
+
target_link_libraries(
|
|
15
|
+
microtex-qt-example PRIVATE
|
|
16
|
+
microtex
|
|
17
|
+
microtex-qt
|
|
18
|
+
Qt${QT_VERSION_MAJOR}::Widgets
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
if (SKIA)
|
|
22
|
+
target_compile_definitions(microtex-qt-example PUBLIC BUILD_SKIA)
|
|
23
|
+
if (QT_VERSION_MAJOR GREATER_EQUAL 6)
|
|
24
|
+
find_package(Qt6 COMPONENTS OpenGLWidgets REQUIRED)
|
|
25
|
+
target_link_libraries(
|
|
26
|
+
microtex-qt-example PRIVATE
|
|
27
|
+
Qt${QT_VERSION_MAJOR}::OpenGLWidgets
|
|
28
|
+
)
|
|
29
|
+
endif ()
|
|
30
|
+
target_sources(microtex-qt-example PRIVATE qt_skiatexwidget.cpp)
|
|
31
|
+
target_link_libraries(
|
|
32
|
+
microtex-qt-example PRIVATE
|
|
33
|
+
microtex-skia
|
|
34
|
+
)
|
|
35
|
+
endif ()
|
|
36
|
+
|
|
37
|
+
set_target_properties(microtex-qt-example PROPERTIES AUTOMOC ON)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
example_qt_dep = [
|
|
2
|
+
dependency('qt5', modules: ['Core', 'Gui', 'Widgets']),
|
|
3
|
+
microtex_qt_dep
|
|
4
|
+
]
|
|
5
|
+
|
|
6
|
+
example_qt_inc = ['../samples', inc]
|
|
7
|
+
example_qt_src = [
|
|
8
|
+
qt5.preprocess(moc_headers: [
|
|
9
|
+
'qt_mainwindow.h',
|
|
10
|
+
],
|
|
11
|
+
include_directories: example_qt_inc,
|
|
12
|
+
dependencies: example_qt_dep
|
|
13
|
+
),
|
|
14
|
+
'qt_main.cpp',
|
|
15
|
+
'qt_mainwindow.cpp',
|
|
16
|
+
'qt_texwidget.cpp',
|
|
17
|
+
'../samples/samples.cpp'
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
executable(
|
|
21
|
+
'microtex-qt-example', example_qt_src,
|
|
22
|
+
include_directories: example_qt_inc,
|
|
23
|
+
dependencies: example_qt_dep,
|
|
24
|
+
install: true
|
|
25
|
+
)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#include <QApplication>
|
|
2
|
+
|
|
3
|
+
#include "graphic_qt.h"
|
|
4
|
+
#include "microtex.h"
|
|
5
|
+
#include "qt_mainwindow.h"
|
|
6
|
+
|
|
7
|
+
#ifdef BUILD_SKIA
|
|
8
|
+
#include "graphic_skia.h"
|
|
9
|
+
#include "qt_skiatexwidget.h"
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
void initSkia() {
|
|
13
|
+
#ifdef BUILD_SKIA
|
|
14
|
+
microtex::PlatformFactory::registerFactory(
|
|
15
|
+
"skia",
|
|
16
|
+
std::make_unique<microtex::PlatformFactory_skia>()
|
|
17
|
+
);
|
|
18
|
+
microtex::PlatformFactory::activate("skia");
|
|
19
|
+
initGL();
|
|
20
|
+
#endif
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
void initQt() {
|
|
24
|
+
microtex::PlatformFactory::registerFactory(
|
|
25
|
+
"qt",
|
|
26
|
+
std::make_unique<microtex::PlatformFactory_qt>()
|
|
27
|
+
);
|
|
28
|
+
microtex::PlatformFactory::activate("qt");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
int main(int argc, char** argv) {
|
|
32
|
+
QApplication app(argc, argv);
|
|
33
|
+
|
|
34
|
+
if (argc < 4) {
|
|
35
|
+
fprintf(
|
|
36
|
+
stderr,
|
|
37
|
+
"Required arguments:\n"
|
|
38
|
+
" <clm data file>\n"
|
|
39
|
+
" <math font file>\n"
|
|
40
|
+
" <samples file>\n"
|
|
41
|
+
"Optional arguments:\n"
|
|
42
|
+
" <if render glyph use path: true|false>\n"
|
|
43
|
+
" <if render use skia: true|false>\n"
|
|
44
|
+
);
|
|
45
|
+
return 1;
|
|
46
|
+
}
|
|
47
|
+
const microtex::FontSrcFile math{argv[1], argv[2]};
|
|
48
|
+
microtex::MicroTeX::init(math);
|
|
49
|
+
const std::string samples(argv[3]);
|
|
50
|
+
microtex::MicroTeX::setRenderGlyphUsePath(
|
|
51
|
+
argc > 4 && std::string("true") == std::string(argv[4])
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
bool useSkia = argc > 5 && std::string("true") == std::string(argv[5]);
|
|
55
|
+
#ifdef BUILD_SKIA
|
|
56
|
+
if (useSkia) {
|
|
57
|
+
initSkia();
|
|
58
|
+
} else {
|
|
59
|
+
initQt();
|
|
60
|
+
}
|
|
61
|
+
#else
|
|
62
|
+
initQt();
|
|
63
|
+
#endif
|
|
64
|
+
MainWindow win(nullptr, useSkia, samples);
|
|
65
|
+
win.show();
|
|
66
|
+
int ret = QApplication::exec();
|
|
67
|
+
|
|
68
|
+
microtex::MicroTeX::release();
|
|
69
|
+
return ret;
|
|
70
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#include "qt_mainwindow.h"
|
|
2
|
+
|
|
3
|
+
#include <QHBoxLayout>
|
|
4
|
+
#include <QLabel>
|
|
5
|
+
#include <QPushButton>
|
|
6
|
+
#include <QScrollArea>
|
|
7
|
+
#include <QSplitter>
|
|
8
|
+
#include <QString>
|
|
9
|
+
#include <string>
|
|
10
|
+
// #include "moc_qt_mainwindow.cpp"
|
|
11
|
+
|
|
12
|
+
#include "qt_texwidget.h"
|
|
13
|
+
|
|
14
|
+
#ifdef BUILD_SKIA
|
|
15
|
+
#include "qt_skiatexwidget.h"
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
using namespace std;
|
|
19
|
+
|
|
20
|
+
MainWindow::MainWindow(QWidget* parent, bool useSkia, const std::string& samplesFile)
|
|
21
|
+
: QWidget(parent), _samples(samplesFile) {
|
|
22
|
+
int text_size = 20;
|
|
23
|
+
|
|
24
|
+
// main layout for window
|
|
25
|
+
QHBoxLayout* layout = new QHBoxLayout;
|
|
26
|
+
|
|
27
|
+
// splitter separates left from right
|
|
28
|
+
QSplitter* splitter = new QSplitter;
|
|
29
|
+
layout->addWidget(splitter);
|
|
30
|
+
|
|
31
|
+
// the TeX widget is on the left
|
|
32
|
+
#ifdef BUILD_SKIA
|
|
33
|
+
if (useSkia) {
|
|
34
|
+
_texwidget = new SkiaTeXWidget(nullptr, text_size);
|
|
35
|
+
} else {
|
|
36
|
+
_texwidget = new TeXWidget(nullptr, text_size);
|
|
37
|
+
}
|
|
38
|
+
#else
|
|
39
|
+
_texwidget = new TeXWidget(nullptr, text_size);
|
|
40
|
+
#endif
|
|
41
|
+
_render = dynamic_cast<TeXRender*>(_texwidget);
|
|
42
|
+
_texwidget->setMinimumWidth(400);
|
|
43
|
+
|
|
44
|
+
QScrollArea* scrollArea = new QScrollArea;
|
|
45
|
+
scrollArea->setBackgroundRole(QPalette::Light);
|
|
46
|
+
scrollArea->setWidget(_texwidget);
|
|
47
|
+
|
|
48
|
+
// these are the widgets on the right side
|
|
49
|
+
// want an editor at the top and controls at bottom
|
|
50
|
+
QWidget* right = new QWidget;
|
|
51
|
+
QVBoxLayout* rlayout = new QVBoxLayout;
|
|
52
|
+
rlayout->setContentsMargins(0, 0, 0, 0);
|
|
53
|
+
right->setLayout(rlayout);
|
|
54
|
+
_textedit = new QTextEdit;
|
|
55
|
+
_textedit->setFontFamily("Monaco");
|
|
56
|
+
rlayout->addWidget(_textedit);
|
|
57
|
+
|
|
58
|
+
// these are the controls which go at the bottom right
|
|
59
|
+
QWidget* controls = new QWidget;
|
|
60
|
+
QHBoxLayout* clayout = new QHBoxLayout;
|
|
61
|
+
clayout->setContentsMargins(0, 0, 0, 0);
|
|
62
|
+
controls->setLayout(clayout);
|
|
63
|
+
|
|
64
|
+
QLabel* label1 = new QLabel("Change text size:");
|
|
65
|
+
_sizespin = new QSpinBox;
|
|
66
|
+
_sizespin->setValue(text_size);
|
|
67
|
+
_sizespin->setMinimum(1);
|
|
68
|
+
QPushButton* next = new QPushButton("Next example");
|
|
69
|
+
QPushButton* render = new QPushButton("Rendering");
|
|
70
|
+
QPushButton* save = new QPushButton("Save as SVG");
|
|
71
|
+
clayout->addWidget(label1);
|
|
72
|
+
clayout->addWidget(_sizespin);
|
|
73
|
+
clayout->addWidget(next);
|
|
74
|
+
clayout->addWidget(render);
|
|
75
|
+
clayout->addWidget(save);
|
|
76
|
+
|
|
77
|
+
rlayout->addWidget(controls);
|
|
78
|
+
|
|
79
|
+
splitter->addWidget(scrollArea);
|
|
80
|
+
splitter->addWidget(right);
|
|
81
|
+
|
|
82
|
+
setLayout(layout);
|
|
83
|
+
|
|
84
|
+
QObject::connect(next, &QPushButton::clicked, this, &MainWindow::nextClicked);
|
|
85
|
+
QObject::connect(render, &QPushButton::clicked, this, &MainWindow::renderClicked);
|
|
86
|
+
QObject::connect(save, &QPushButton::clicked, this, &MainWindow::saveClicked);
|
|
87
|
+
QObject::connect(_sizespin, SIGNAL(valueChanged(int)), this, SLOT(fontSizeChanged(int)));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
void MainWindow::fontSizeChanged(int size) {
|
|
91
|
+
_render->setTextSize(size);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
void MainWindow::nextClicked() {
|
|
95
|
+
auto sample = _samples.next();
|
|
96
|
+
_textedit->setText(QString::fromStdString(sample));
|
|
97
|
+
_render->setLaTeX(sample);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
void MainWindow::renderClicked() {
|
|
101
|
+
QString text = _textedit->toPlainText();
|
|
102
|
+
_render->setLaTeX(text.toStdString());
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
void MainWindow::saveClicked() {
|
|
106
|
+
_render->saveSVG("out.svg");
|
|
107
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#ifndef QT_MAINWINDOW_H
|
|
2
|
+
#define QT_MAINWINDOW_H
|
|
3
|
+
|
|
4
|
+
#include <QSpinBox>
|
|
5
|
+
#include <QTextEdit>
|
|
6
|
+
#include <QWidget>
|
|
7
|
+
|
|
8
|
+
#include "qt_tex_render.h"
|
|
9
|
+
#include "samples.h"
|
|
10
|
+
|
|
11
|
+
class MainWindow : public QWidget {
|
|
12
|
+
Q_OBJECT
|
|
13
|
+
|
|
14
|
+
public:
|
|
15
|
+
explicit MainWindow(
|
|
16
|
+
QWidget* parent = nullptr,
|
|
17
|
+
bool useSkia = false,
|
|
18
|
+
const std::string& smaplesFile = ""
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
protected slots:
|
|
22
|
+
|
|
23
|
+
void nextClicked();
|
|
24
|
+
|
|
25
|
+
void renderClicked();
|
|
26
|
+
|
|
27
|
+
void saveClicked();
|
|
28
|
+
|
|
29
|
+
void fontSizeChanged(int size);
|
|
30
|
+
|
|
31
|
+
protected:
|
|
32
|
+
QWidget* _texwidget;
|
|
33
|
+
TeXRender* _render;
|
|
34
|
+
QTextEdit* _textedit;
|
|
35
|
+
QSpinBox* _sizespin;
|
|
36
|
+
|
|
37
|
+
microtex::Samples _samples;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
#endif
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
#include "qt_skiatexwidget.h"
|
|
2
|
+
|
|
3
|
+
#include <include/core/SkCanvas.h>
|
|
4
|
+
#include <include/core/SkColorSpace.h>
|
|
5
|
+
#include <include/core/SkStream.h>
|
|
6
|
+
#include <include/gpu/gl/GrGLAssembleInterface.h>
|
|
7
|
+
#include <include/svg/SkSVGCanvas.h>
|
|
8
|
+
|
|
9
|
+
#include <QApplication>
|
|
10
|
+
#include <QOpenGLContext>
|
|
11
|
+
#include <QOpenGLFunctions>
|
|
12
|
+
|
|
13
|
+
#include "graphic_skia.h"
|
|
14
|
+
|
|
15
|
+
using namespace microtex;
|
|
16
|
+
|
|
17
|
+
static bool AllowEGL;
|
|
18
|
+
|
|
19
|
+
void initGL() {
|
|
20
|
+
QSurfaceFormat fmt;
|
|
21
|
+
fmt.setDepthBufferSize(0);
|
|
22
|
+
fmt.setRedBufferSize(8);
|
|
23
|
+
fmt.setGreenBufferSize(8);
|
|
24
|
+
fmt.setBlueBufferSize(8);
|
|
25
|
+
fmt.setStencilBufferSize(8);
|
|
26
|
+
fmt.setSamples(0);
|
|
27
|
+
|
|
28
|
+
fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
|
|
29
|
+
|
|
30
|
+
if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
|
|
31
|
+
fmt.setVersion(3, 3);
|
|
32
|
+
fmt.setProfile(QSurfaceFormat::CoreProfile);
|
|
33
|
+
} else {
|
|
34
|
+
fmt.setVersion(3, 0);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
QSurfaceFormat::setDefaultFormat(fmt);
|
|
38
|
+
AllowEGL = QApplication::platformName() != "xcb";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static sk_sp<GrDirectContext> makeContext(QOpenGLContext *ctx) {
|
|
42
|
+
auto interface = GrGLMakeAssembledInterface(ctx, [](auto ctx, auto name) {
|
|
43
|
+
return AllowEGL || strncmp(name, "egl", 3)
|
|
44
|
+
? static_cast<QOpenGLContext *>(ctx)->getProcAddress(name)
|
|
45
|
+
: nullptr;
|
|
46
|
+
});
|
|
47
|
+
return GrDirectContext::MakeGL(interface);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static sk_sp<SkSurface> createSurface(GrRecordingContext *ctx, int w, int h, GrGLuint fbo) {
|
|
51
|
+
GrGLFramebufferInfo info;
|
|
52
|
+
info.fFBOID = fbo;
|
|
53
|
+
info.fFormat = GL_RGBA8;
|
|
54
|
+
GrBackendRenderTarget target(w, h, 0, 8, info);
|
|
55
|
+
const SkSurfaceProps props(
|
|
56
|
+
0,
|
|
57
|
+
SkPixelGeometry::kUnknown_SkPixelGeometry
|
|
58
|
+
); // Can customize subpixel layout here
|
|
59
|
+
return SkSurface::MakeFromBackendRenderTarget(
|
|
60
|
+
ctx,
|
|
61
|
+
target,
|
|
62
|
+
kBottomLeft_GrSurfaceOrigin,
|
|
63
|
+
kRGBA_8888_SkColorType,
|
|
64
|
+
nullptr,
|
|
65
|
+
&props,
|
|
66
|
+
nullptr
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
SkiaTeXWidget::SkiaTeXWidget(QWidget *parent, float text_size)
|
|
71
|
+
: QOpenGLWidget(parent), _render(nullptr), _text_size(text_size), _padding(20) {}
|
|
72
|
+
|
|
73
|
+
SkiaTeXWidget::~SkiaTeXWidget() {
|
|
74
|
+
delete _render;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
float SkiaTeXWidget::getTextSize() {
|
|
78
|
+
return _text_size;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
void SkiaTeXWidget::setTextSize(float size) {
|
|
82
|
+
if (size == _text_size) return;
|
|
83
|
+
_text_size = size;
|
|
84
|
+
if (_render != nullptr) {
|
|
85
|
+
_render->setTextSize(_text_size * devicePixelRatio());
|
|
86
|
+
update();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
void SkiaTeXWidget::setLaTeX(const std::string &latex) {
|
|
91
|
+
delete _render;
|
|
92
|
+
const auto size = _text_size * devicePixelRatio();
|
|
93
|
+
auto parent = parentWidget();
|
|
94
|
+
int w = parent == nullptr ? width() : parent->width();
|
|
95
|
+
_render =
|
|
96
|
+
MicroTeX::parse(latex, w * devicePixelRatio() - _padding * 2, size, size / 3.f, 0xff424242);
|
|
97
|
+
resize(getRenderWidth() / devicePixelRatio(), getRenderHeight() / devicePixelRatio());
|
|
98
|
+
update();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
bool SkiaTeXWidget::isRenderDisplayed() {
|
|
102
|
+
return _render != nullptr;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
int SkiaTeXWidget::getRenderWidth() {
|
|
106
|
+
return _render == nullptr ? 0 : _render->getWidth() + _padding * 2;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
int SkiaTeXWidget::getRenderHeight() {
|
|
110
|
+
return _render == nullptr ? 0 : _render->getHeight() + _padding * 2;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
void SkiaTeXWidget::initializeGL() {
|
|
114
|
+
_context = makeContext(context());
|
|
115
|
+
_gl = context()->functions();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
void SkiaTeXWidget::paintGL() {
|
|
119
|
+
auto *canvas = _surface->getCanvas();
|
|
120
|
+
canvas->clear(SK_ColorWHITE);
|
|
121
|
+
SkPaint paint;
|
|
122
|
+
if (_render) {
|
|
123
|
+
Graphics2D_skia g2(canvas);
|
|
124
|
+
_render->draw(g2, _padding, _padding);
|
|
125
|
+
}
|
|
126
|
+
_context->flush();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
void SkiaTeXWidget::resizeGL(int w, int h) {
|
|
130
|
+
_gl->glViewport(0, 0, w, h);
|
|
131
|
+
_context->resetContext();
|
|
132
|
+
auto r = devicePixelRatio();
|
|
133
|
+
_surface = createSurface(_context.get(), w * r, h * r, defaultFramebufferObject());
|
|
134
|
+
update();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
void SkiaTeXWidget::saveSVG(const char *path) {
|
|
138
|
+
// This does not work properly for the more complex examples,
|
|
139
|
+
// which might be due to skia as the SkSVG backend is still experimental.
|
|
140
|
+
// Simples case like $\frac12$ seem to work fine, though.
|
|
141
|
+
SkFILEWStream stream(path);
|
|
142
|
+
SkRect bounds = SkRect::MakeIWH(width(), height());
|
|
143
|
+
std::unique_ptr<SkCanvas> canvas = SkSVGCanvas::Make(bounds, &stream);
|
|
144
|
+
|
|
145
|
+
if (_render) {
|
|
146
|
+
Graphics2D_skia g2(canvas.get());
|
|
147
|
+
_render->draw(g2, _padding, _padding);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#ifndef QT_SKIATEXWIDGET_H
|
|
2
|
+
#define QT_SKIATEXWIDGET_H
|
|
3
|
+
|
|
4
|
+
#include <include/core/SkSurface.h>
|
|
5
|
+
#include <include/gpu/GrDirectContext.h>
|
|
6
|
+
|
|
7
|
+
#include <QOpenGLWidget>
|
|
8
|
+
|
|
9
|
+
#include "microtex.h"
|
|
10
|
+
#include "qt_tex_render.h"
|
|
11
|
+
#include "render/render.h"
|
|
12
|
+
|
|
13
|
+
class QOpenGLFunctions;
|
|
14
|
+
|
|
15
|
+
void initGL();
|
|
16
|
+
|
|
17
|
+
class SkiaTeXWidget : public QOpenGLWidget, public TeXRender {
|
|
18
|
+
public:
|
|
19
|
+
explicit SkiaTeXWidget(QWidget *parent = nullptr, float text_size = 20.f);
|
|
20
|
+
|
|
21
|
+
~SkiaTeXWidget() override;
|
|
22
|
+
|
|
23
|
+
float getTextSize() override;
|
|
24
|
+
void setTextSize(float size) override;
|
|
25
|
+
void setLaTeX(const std::string &latex) override;
|
|
26
|
+
bool isRenderDisplayed() override;
|
|
27
|
+
int getRenderWidth() override;
|
|
28
|
+
int getRenderHeight() override;
|
|
29
|
+
void saveSVG(const char *path) override;
|
|
30
|
+
|
|
31
|
+
protected:
|
|
32
|
+
void initializeGL() override;
|
|
33
|
+
|
|
34
|
+
void paintGL() override;
|
|
35
|
+
|
|
36
|
+
void resizeGL(int w, int h) override;
|
|
37
|
+
|
|
38
|
+
private:
|
|
39
|
+
microtex::Render *_render;
|
|
40
|
+
float _text_size;
|
|
41
|
+
int _padding;
|
|
42
|
+
|
|
43
|
+
sk_sp<GrDirectContext> _context{};
|
|
44
|
+
sk_sp<SkSurface> _surface{};
|
|
45
|
+
QOpenGLFunctions *_gl{};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
#endif
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#ifndef MICROTEX_QT_TEX_RENDER_H
|
|
2
|
+
#define MICROTEX_QT_TEX_RENDER_H
|
|
3
|
+
|
|
4
|
+
class TeXRender {
|
|
5
|
+
public:
|
|
6
|
+
virtual float getTextSize() = 0;
|
|
7
|
+
virtual void setTextSize(float size) = 0;
|
|
8
|
+
virtual void setLaTeX(const std::string& latex) = 0;
|
|
9
|
+
virtual bool isRenderDisplayed() = 0;
|
|
10
|
+
virtual int getRenderWidth() = 0;
|
|
11
|
+
virtual int getRenderHeight() = 0;
|
|
12
|
+
virtual void saveSVG(const char* path) = 0;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
#endif // MICROTEX_QT_TEX_RENDER_H
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#include <QPainter>
|
|
2
|
+
// #include <QDebug>
|
|
3
|
+
|
|
4
|
+
#include "qt_texqmlitem.h"
|
|
5
|
+
|
|
6
|
+
using namespace microtex;
|
|
7
|
+
|
|
8
|
+
TexQmlItem::TexQmlItem(QQuickItem* parent, float text_size)
|
|
9
|
+
: QQuickPaintedItem(parent), _render(nullptr), _text_size(text_size), _padding(0) {
|
|
10
|
+
setImplicitHeight(30);
|
|
11
|
+
setImplicitWidth(100);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
TexQmlItem::~TexQmlItem() {
|
|
15
|
+
delete _render;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
void TexQmlItem::paint(QPainter* painter) {
|
|
19
|
+
if (_render != nullptr) {
|
|
20
|
+
// painter->setRenderHint(QPainter::Antialiasing, true);
|
|
21
|
+
Graphics2D_qt g2(painter);
|
|
22
|
+
_render->draw(g2, _padding, _padding);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
void TexQmlItem::setLatexString(const QString& latex) {
|
|
27
|
+
if (m_latexString == latex) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
m_latexString = latex;
|
|
31
|
+
if (_render != nullptr) {
|
|
32
|
+
delete _render;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
try {
|
|
36
|
+
_render = LaTeX::parse(
|
|
37
|
+
latex.toStdString(),
|
|
38
|
+
width() - _padding * 2,
|
|
39
|
+
_text_size,
|
|
40
|
+
_text_size / 3.f,
|
|
41
|
+
0xff424242
|
|
42
|
+
);
|
|
43
|
+
if (_render) {
|
|
44
|
+
setImplicitHeight(_render->getHeight());
|
|
45
|
+
setImplicitWidth(_render->getWidth());
|
|
46
|
+
}
|
|
47
|
+
} catch (...) {
|
|
48
|
+
_render = nullptr;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
update();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
QString TexQmlItem::latexString() const {
|
|
55
|
+
return m_latexString;
|
|
56
|
+
}
|