@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,72 @@
|
|
|
1
|
+
#ifndef __MICROTEXEQUATION_H__
|
|
2
|
+
#define __MICROTEXEQUATION_H__
|
|
3
|
+
|
|
4
|
+
#include <glib-object.h>
|
|
5
|
+
#include <gtk/gtk.h>
|
|
6
|
+
|
|
7
|
+
#ifdef _MSC_VER
|
|
8
|
+
#include "vcruntime.h"
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
G_BEGIN_DECLS
|
|
12
|
+
|
|
13
|
+
// msvc
|
|
14
|
+
#ifdef _MSC_VER
|
|
15
|
+
#if defined(MICROTEX_LIBRARY)
|
|
16
|
+
#define MICROTEX_EXPORT __declspec(dllexport)
|
|
17
|
+
#else
|
|
18
|
+
#define MICROTEX_EXPORT __declspec(dllimport)
|
|
19
|
+
#endif
|
|
20
|
+
// gnuc and clang
|
|
21
|
+
#elif defined(__GNUC__) || defined(__GNUG__) || defined(__clang__)
|
|
22
|
+
#define MICROTEX_EXPORT __attribute((visibility("default")))
|
|
23
|
+
// otherwise...
|
|
24
|
+
#else
|
|
25
|
+
#define MICROTEX_EXPORT
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#define MICROTEX_TYPE_EQUATION (microtex_equation_get_type())
|
|
29
|
+
MICROTEX_EXPORT
|
|
30
|
+
G_DECLARE_DERIVABLE_TYPE(MicroTexEquation, microtex_equation, MICROTEX, EQUATION, GtkWidget)
|
|
31
|
+
|
|
32
|
+
struct _MicroTexEquationClass {
|
|
33
|
+
GtkWidgetClass parent_class;
|
|
34
|
+
|
|
35
|
+
gpointer padding[12];
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
MICROTEX_EXPORT
|
|
39
|
+
GtkWidget* microtex_equation_new();
|
|
40
|
+
|
|
41
|
+
MICROTEX_EXPORT
|
|
42
|
+
const gchar* microtex_equation_get_equation(MicroTexEquation* self);
|
|
43
|
+
MICROTEX_EXPORT
|
|
44
|
+
void microtex_equation_set_equation(MicroTexEquation* self, const gchar* equation);
|
|
45
|
+
|
|
46
|
+
MICROTEX_EXPORT
|
|
47
|
+
gfloat microtex_equation_get_width(MicroTexEquation* self);
|
|
48
|
+
MICROTEX_EXPORT
|
|
49
|
+
void microtex_equation_set_width(MicroTexEquation* self, gfloat width);
|
|
50
|
+
|
|
51
|
+
MICROTEX_EXPORT
|
|
52
|
+
gfloat microtex_equation_get_text_size(MicroTexEquation* self);
|
|
53
|
+
MICROTEX_EXPORT
|
|
54
|
+
void microtex_equation_set_text_size(MicroTexEquation* self, gfloat text_size);
|
|
55
|
+
|
|
56
|
+
MICROTEX_EXPORT
|
|
57
|
+
guint32 microtex_equation_get_color(MicroTexEquation* self);
|
|
58
|
+
MICROTEX_EXPORT
|
|
59
|
+
void microtex_equation_set_color(MicroTexEquation* self, guint32 color);
|
|
60
|
+
|
|
61
|
+
MICROTEX_EXPORT
|
|
62
|
+
gint64 microtex_equation_get_baseline(MicroTexEquation* self);
|
|
63
|
+
|
|
64
|
+
MICROTEX_EXPORT
|
|
65
|
+
GBytes* microtex_equation_to_svg(MicroTexEquation* self, gboolean* success);
|
|
66
|
+
|
|
67
|
+
MICROTEX_EXPORT
|
|
68
|
+
gboolean microtex_equation_init_tex();
|
|
69
|
+
|
|
70
|
+
G_END_DECLS
|
|
71
|
+
|
|
72
|
+
#endif // __MICROTEXEQUATION_H__
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
message(STATUS "Cross-building using Qt")
|
|
2
|
+
|
|
3
|
+
set(MICROTEX_QT_sources "graphic_qt.cpp")
|
|
4
|
+
if (DEFINED _BUILD_STATIC AND _BUILD_STATIC)
|
|
5
|
+
add_library(microtex-qt STATIC "${MICROTEX_QT_sources}")
|
|
6
|
+
else ()
|
|
7
|
+
add_library(microtex-qt SHARED "${MICROTEX_QT_sources}")
|
|
8
|
+
endif ()
|
|
9
|
+
|
|
10
|
+
#add_library(microtex-qt SHARED graphic_qt.cpp)
|
|
11
|
+
|
|
12
|
+
set_target_properties(
|
|
13
|
+
microtex-qt PROPERTIES
|
|
14
|
+
VERSION ${PROJECT_VERSION}
|
|
15
|
+
SOVERSION ${MICROTEX_API_VERSION}
|
|
16
|
+
CXX_VISIBILITY_PRESET hidden
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
find_package(QT NAMES Qt6 Qt5 COMPONENTS Gui Widgets REQUIRED)
|
|
20
|
+
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Gui Widgets REQUIRED)
|
|
21
|
+
|
|
22
|
+
target_include_directories(
|
|
23
|
+
microtex-qt PUBLIC
|
|
24
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
|
25
|
+
$<INSTALL_INTERFACE:include/microtex-qt>
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# we need to export the library on Windows
|
|
29
|
+
target_compile_definitions(microtex-qt PRIVATE -DMICROTEX_LIBRARY)
|
|
30
|
+
target_link_libraries(
|
|
31
|
+
microtex-qt PRIVATE
|
|
32
|
+
microtex
|
|
33
|
+
Qt${QT_VERSION_MAJOR}::Gui
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
microtex_install_target(microtex-qt)
|
|
37
|
+
microtex_install_headers(microtex-qt HEADERS graphic_qt.h)
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
#include "graphic_qt.h"
|
|
2
|
+
|
|
3
|
+
#include <QBrush>
|
|
4
|
+
#include <QColor>
|
|
5
|
+
#include <QDebug>
|
|
6
|
+
#include <QFile>
|
|
7
|
+
#include <QFont>
|
|
8
|
+
#include <QFontDatabase>
|
|
9
|
+
#include <QGlyphRun>
|
|
10
|
+
#include <QPainter>
|
|
11
|
+
#include <QPen>
|
|
12
|
+
#include <QPointF>
|
|
13
|
+
#include <QRectF>
|
|
14
|
+
#include <QString>
|
|
15
|
+
#include <QTransform>
|
|
16
|
+
#include <QtGlobal>
|
|
17
|
+
#include <QtMath>
|
|
18
|
+
|
|
19
|
+
#include "utils/log.h"
|
|
20
|
+
#include "utils/utils.h"
|
|
21
|
+
|
|
22
|
+
using namespace microtex;
|
|
23
|
+
using namespace std;
|
|
24
|
+
|
|
25
|
+
namespace {
|
|
26
|
+
QMap<QString, QString> _qtFamilies;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
void Font_qt::loadFont(const std::string& file) {
|
|
30
|
+
QString filename(QString::fromStdString(file));
|
|
31
|
+
if (!QFile::exists(filename)) {
|
|
32
|
+
filename.prepend(":/");
|
|
33
|
+
}
|
|
34
|
+
// find from cache first
|
|
35
|
+
if (_qtFamilies.contains(filename)) {
|
|
36
|
+
_font.setFamily(_qtFamilies.value(filename));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
// load to font database
|
|
40
|
+
int id = QFontDatabase::addApplicationFont(filename);
|
|
41
|
+
if (id == -1) {
|
|
42
|
+
#ifdef HAVE_LOG
|
|
43
|
+
logv("failed to load font: %s\n", file.c_str());
|
|
44
|
+
#endif
|
|
45
|
+
} else {
|
|
46
|
+
auto families = QFontDatabase::applicationFontFamilies(id);
|
|
47
|
+
if (families.size() >= 0) {
|
|
48
|
+
auto first = families.first();
|
|
49
|
+
_qtFamilies[filename] = first;
|
|
50
|
+
_font.setFamily(families.first());
|
|
51
|
+
} else {
|
|
52
|
+
#ifdef HAVE_LOG
|
|
53
|
+
logv("no font families found: %s\n", file.c_str());
|
|
54
|
+
#endif
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
Font_qt::Font_qt(const std::string& file) {
|
|
60
|
+
loadFont(file);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
QFont Font_qt::getQFont() const {
|
|
64
|
+
return _font;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
bool Font_qt::operator==(const Font& f) const {
|
|
68
|
+
const auto& cast = static_cast<const Font_qt&>(f);
|
|
69
|
+
return _font == cast._font;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**************************************************************************************************/
|
|
73
|
+
|
|
74
|
+
namespace {
|
|
75
|
+
std::string _fallbackFontFamily;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
void TextLayout_qt::setFallbackFontFamily(const std::string& family) {
|
|
79
|
+
_fallbackFontFamily = family;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
TextLayout_qt::TextLayout_qt(const std::string& src, FontStyle style, float size) {
|
|
83
|
+
_text = QString::fromStdString(src);
|
|
84
|
+
_font.setPixelSize(size);
|
|
85
|
+
#define QT_BEFORE_513 (QT_VERSION < QT_VERSION_CHECK(5, 13, 0))
|
|
86
|
+
#if QT_BEFORE_513
|
|
87
|
+
// setFamilies was introduce in Qt 5.13.0
|
|
88
|
+
// https://doc.qt.io/qt-6/qfont.html#setFamily
|
|
89
|
+
QString family;
|
|
90
|
+
#else
|
|
91
|
+
QStringList families;
|
|
92
|
+
#endif
|
|
93
|
+
if (microtex::isSansSerif(style)) {
|
|
94
|
+
#if QT_BEFORE_513
|
|
95
|
+
family = "sans-serif";
|
|
96
|
+
#else
|
|
97
|
+
families.append("sans-serif");
|
|
98
|
+
#endif
|
|
99
|
+
} else {
|
|
100
|
+
#if QT_BEFORE_513
|
|
101
|
+
family = "serif";
|
|
102
|
+
#else
|
|
103
|
+
families.append("serif");
|
|
104
|
+
#endif
|
|
105
|
+
}
|
|
106
|
+
if (microtex::isMono(style)) {
|
|
107
|
+
#if QT_BEFORE_513
|
|
108
|
+
family = "monospace";
|
|
109
|
+
#else
|
|
110
|
+
families.append("monospace");
|
|
111
|
+
#endif
|
|
112
|
+
}
|
|
113
|
+
#if !QT_BEFORE_513
|
|
114
|
+
if (!_fallbackFontFamily.empty()) {
|
|
115
|
+
families.append(QString::fromStdString(_fallbackFontFamily));
|
|
116
|
+
}
|
|
117
|
+
#endif
|
|
118
|
+
#if QT_BEFORE_513
|
|
119
|
+
_font.setFamily(family);
|
|
120
|
+
#else
|
|
121
|
+
_font.setFamilies(families);
|
|
122
|
+
#endif
|
|
123
|
+
_font.setBold(microtex::isBold(style));
|
|
124
|
+
_font.setItalic(microtex::isItalic(style));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
void TextLayout_qt::getBounds(Rect& r) {
|
|
128
|
+
QFontMetricsF fm(_font);
|
|
129
|
+
QRectF br(fm.boundingRect(_text));
|
|
130
|
+
r.x = br.left();
|
|
131
|
+
r.y = br.top();
|
|
132
|
+
r.w = br.width();
|
|
133
|
+
r.h = br.height();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
void TextLayout_qt::draw(Graphics2D& g2, float x, float y) {
|
|
137
|
+
auto& g = static_cast<Graphics2D_qt&>(g2);
|
|
138
|
+
g.getQPainter()->setFont(_font);
|
|
139
|
+
g.getQPainter()->drawText(QPointF(x, y), _text);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**************************************************************************************************/
|
|
143
|
+
|
|
144
|
+
sptr<Font> PlatformFactory_qt::createFont(const std::string& file) {
|
|
145
|
+
return sptrOf<Font_qt>(file);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
sptr<TextLayout>
|
|
149
|
+
PlatformFactory_qt::createTextLayout(const std::string& src, FontStyle style, float size) {
|
|
150
|
+
return sptrOf<TextLayout_qt>(src, style, size);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**************************************************************************************************/
|
|
154
|
+
|
|
155
|
+
Graphics2D_qt::Graphics2D_qt(QPainter* painter) : _painter(painter) {
|
|
156
|
+
_sx = _sy = 1.f;
|
|
157
|
+
_fontSize = 1.f;
|
|
158
|
+
setColor(BLACK);
|
|
159
|
+
setStroke(Stroke());
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
QPainter* Graphics2D_qt::getQPainter() const {
|
|
163
|
+
return _painter;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
QBrush Graphics2D_qt::getQBrush() const {
|
|
167
|
+
return QBrush(QColor(color_r(_color), color_g(_color), color_b(_color), color_a(_color)));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
void Graphics2D_qt::setColor(color c) {
|
|
171
|
+
_color = c;
|
|
172
|
+
_pen.setBrush(getQBrush());
|
|
173
|
+
_painter->setPen(_pen);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
color Graphics2D_qt::getColor() const {
|
|
177
|
+
return _color;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
void Graphics2D_qt::setStroke(const Stroke& s) {
|
|
181
|
+
_stroke = s;
|
|
182
|
+
Qt::PenCapStyle cap;
|
|
183
|
+
switch (_stroke.cap) {
|
|
184
|
+
case CAP_ROUND: cap = Qt::RoundCap; break;
|
|
185
|
+
case CAP_SQUARE: cap = Qt::SquareCap; break;
|
|
186
|
+
case CAP_BUTT:
|
|
187
|
+
default: cap = Qt::FlatCap; break;
|
|
188
|
+
}
|
|
189
|
+
Qt::PenJoinStyle join;
|
|
190
|
+
switch (_stroke.join) {
|
|
191
|
+
case JOIN_BEVEL: join = Qt::BevelJoin; break;
|
|
192
|
+
case JOIN_ROUND: join = Qt::RoundJoin; break;
|
|
193
|
+
case JOIN_MITER:
|
|
194
|
+
default: join = Qt::MiterJoin; break;
|
|
195
|
+
}
|
|
196
|
+
_pen.setStyle(Qt::SolidLine);
|
|
197
|
+
_pen.setCapStyle(cap);
|
|
198
|
+
_pen.setJoinStyle(join);
|
|
199
|
+
_pen.setWidthF(s.lineWidth);
|
|
200
|
+
_pen.setMiterLimit(s.miterLimit);
|
|
201
|
+
_painter->setPen(_pen);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const Stroke& Graphics2D_qt::getStroke() const {
|
|
205
|
+
return _stroke;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
void Graphics2D_qt::setStrokeWidth(float w) {
|
|
209
|
+
_stroke.lineWidth = w;
|
|
210
|
+
_pen.setWidthF(w);
|
|
211
|
+
_painter->setPen(_pen);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
void Graphics2D_qt::setDash(const std::vector<float>& dash) {
|
|
215
|
+
if (dash.empty()) {
|
|
216
|
+
_pen.setStyle(Qt::SolidLine);
|
|
217
|
+
_pen.setDashPattern({});
|
|
218
|
+
} else {
|
|
219
|
+
_pen.setStyle(Qt::DashLine);
|
|
220
|
+
#if QT_VERSION_MAJOR < 6
|
|
221
|
+
QVector<qreal> list;
|
|
222
|
+
#else
|
|
223
|
+
QList<qreal> list;
|
|
224
|
+
#endif
|
|
225
|
+
list.reserve(dash.size());
|
|
226
|
+
std::transform(dash.begin(), dash.end(), list.begin(), [this](float v) { return v * sx(); });
|
|
227
|
+
_pen.setDashPattern(list);
|
|
228
|
+
}
|
|
229
|
+
_painter->setPen(_pen);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
std::vector<float> Graphics2D_qt::getDash() {
|
|
233
|
+
const auto& list = _pen.dashPattern();
|
|
234
|
+
std::vector<float> dash;
|
|
235
|
+
dash.reserve(list.size());
|
|
236
|
+
std::transform(list.begin(), list.end(), dash.begin(), [this](double v) { return v / sx(); });
|
|
237
|
+
return dash;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
sptr<Font> Graphics2D_qt::getFont() const {
|
|
241
|
+
return _font;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
void Graphics2D_qt::setFont(const sptr<Font>& font) {
|
|
245
|
+
_font = static_pointer_cast<Font_qt>(font);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
float Graphics2D_qt::getFontSize() const {
|
|
249
|
+
return _fontSize;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
void Graphics2D_qt::setFontSize(float size) {
|
|
253
|
+
_fontSize = size;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
void Graphics2D_qt::translate(float dx, float dy) {
|
|
257
|
+
_painter->translate(dx, dy);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
void Graphics2D_qt::scale(float sx, float sy) {
|
|
261
|
+
_sx *= sx;
|
|
262
|
+
_sy *= sy;
|
|
263
|
+
_painter->scale(sx, sy);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
void Graphics2D_qt::rotate(float angle) {
|
|
267
|
+
_painter->rotate(qRadiansToDegrees(angle));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
void Graphics2D_qt::rotate(float angle, float px, float py) {
|
|
271
|
+
_painter->translate(px, py);
|
|
272
|
+
_painter->rotate(qRadiansToDegrees(angle));
|
|
273
|
+
_painter->translate(-px, -py);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
void Graphics2D_qt::reset() {
|
|
277
|
+
_painter->setTransform(QTransform());
|
|
278
|
+
_sx = _sy = 1.f;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
float Graphics2D_qt::sx() const {
|
|
282
|
+
return _sx;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
float Graphics2D_qt::sy() const {
|
|
286
|
+
return _sy;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
void Graphics2D_qt::drawGlyph(u16 glyph, float x, float y) {
|
|
290
|
+
auto f = _font->getQFont();
|
|
291
|
+
// f.setPointSizeF(_fontSize);
|
|
292
|
+
f.setPixelSize(_fontSize);
|
|
293
|
+
auto rf = QRawFont::fromFont(f);
|
|
294
|
+
QGlyphRun g;
|
|
295
|
+
g.setRawFont(rf);
|
|
296
|
+
g.setGlyphIndexes({glyph});
|
|
297
|
+
g.setPositions({
|
|
298
|
+
{0, 0}
|
|
299
|
+
});
|
|
300
|
+
_painter->drawGlyphRun({x, y}, g);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
bool Graphics2D_qt::beginPath(i32 id) {
|
|
304
|
+
_path = QPainterPath();
|
|
305
|
+
return false;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
void Graphics2D_qt::moveTo(float x, float y) {
|
|
309
|
+
_path.moveTo(x, y);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
void Graphics2D_qt::lineTo(float x, float y) {
|
|
313
|
+
_path.lineTo(x, y);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
void Graphics2D_qt::cubicTo(float x1, float y1, float x2, float y2, float x3, float y3) {
|
|
317
|
+
_path.cubicTo(x1, y1, x2, y2, x3, y3);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
void Graphics2D_qt::quadTo(float x1, float y1, float x2, float y2) {
|
|
321
|
+
_path.quadTo(x1, y1, x2, y2);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
void Graphics2D_qt::closePath() {
|
|
325
|
+
_path.closeSubpath();
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
void Graphics2D_qt::fillPath(i32 id) {
|
|
329
|
+
_painter->fillPath(_path, getQBrush());
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
void Graphics2D_qt::drawLine(float x1, float y1, float x2, float y2) {
|
|
333
|
+
_painter->drawLine(QPointF(x1, y1), QPointF(x2, y2));
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
void Graphics2D_qt::drawRect(float x, float y, float w, float h) {
|
|
337
|
+
_painter->drawRect(QRectF(x, y, w, h));
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
void Graphics2D_qt::fillRect(float x, float y, float w, float h) {
|
|
341
|
+
_painter->fillRect(QRectF(x, y, w, h), getQBrush());
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
void Graphics2D_qt::drawRoundRect(float x, float y, float w, float h, float rx, float ry) {
|
|
345
|
+
_painter->drawRoundedRect(QRectF(x, y, w, h), rx, ry);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
void Graphics2D_qt::fillRoundRect(float x, float y, float w, float h, float rx, float ry) {
|
|
349
|
+
_painter->setPen(QPen(Qt::NoPen));
|
|
350
|
+
_painter->setBrush(getQBrush());
|
|
351
|
+
|
|
352
|
+
_painter->drawRoundedRect(QRectF(x, y, w, h), rx, ry);
|
|
353
|
+
|
|
354
|
+
_painter->setPen(_pen);
|
|
355
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#ifndef GRAPHIC_QT_H_INCLUDED
|
|
2
|
+
#define GRAPHIC_QT_H_INCLUDED
|
|
3
|
+
|
|
4
|
+
#include <QBrush>
|
|
5
|
+
#include <QFont>
|
|
6
|
+
#include <QMap>
|
|
7
|
+
#include <QPainter>
|
|
8
|
+
#include <QPainterPath>
|
|
9
|
+
#include <QString>
|
|
10
|
+
#include <QTextLayout>
|
|
11
|
+
#include <string>
|
|
12
|
+
|
|
13
|
+
#include "graphic/graphic.h"
|
|
14
|
+
#include "microtexexport.h"
|
|
15
|
+
|
|
16
|
+
namespace microtex {
|
|
17
|
+
|
|
18
|
+
class MICROTEX_EXPORT Font_qt : public Font {
|
|
19
|
+
private:
|
|
20
|
+
QFont _font;
|
|
21
|
+
|
|
22
|
+
void loadFont(const std::string& file);
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
explicit Font_qt(const std::string& file);
|
|
26
|
+
|
|
27
|
+
QFont getQFont() const;
|
|
28
|
+
|
|
29
|
+
bool operator==(const Font& f) const override;
|
|
30
|
+
|
|
31
|
+
~Font_qt() override = default;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**************************************************************************************************/
|
|
35
|
+
|
|
36
|
+
class MICROTEX_EXPORT TextLayout_qt : public TextLayout {
|
|
37
|
+
private:
|
|
38
|
+
QFont _font;
|
|
39
|
+
QString _text;
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
TextLayout_qt(const std::string& src, FontStyle style, float size);
|
|
43
|
+
|
|
44
|
+
static void setFallbackFontFamily(const std::string& family);
|
|
45
|
+
|
|
46
|
+
void getBounds(Rect& r) override;
|
|
47
|
+
|
|
48
|
+
void draw(Graphics2D& g2, float x, float y) override;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**************************************************************************************************/
|
|
52
|
+
|
|
53
|
+
class MICROTEX_EXPORT PlatformFactory_qt : public PlatformFactory {
|
|
54
|
+
public:
|
|
55
|
+
sptr<Font> createFont(const std::string& file) override;
|
|
56
|
+
|
|
57
|
+
sptr<TextLayout> createTextLayout(const std::string& src, FontStyle style, float size) override;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**************************************************************************************************/
|
|
61
|
+
|
|
62
|
+
class MICROTEX_EXPORT Graphics2D_qt : public Graphics2D {
|
|
63
|
+
private:
|
|
64
|
+
QPainterPath _path;
|
|
65
|
+
QPen _pen;
|
|
66
|
+
QPainter* _painter;
|
|
67
|
+
|
|
68
|
+
color _color;
|
|
69
|
+
Stroke _stroke;
|
|
70
|
+
sptr<Font_qt> _font;
|
|
71
|
+
float _fontSize;
|
|
72
|
+
float _sx, _sy;
|
|
73
|
+
|
|
74
|
+
QBrush getQBrush() const;
|
|
75
|
+
|
|
76
|
+
public:
|
|
77
|
+
explicit Graphics2D_qt(QPainter* painter);
|
|
78
|
+
|
|
79
|
+
QPainter* getQPainter() const;
|
|
80
|
+
|
|
81
|
+
void setColor(color c) override;
|
|
82
|
+
color getColor() const override;
|
|
83
|
+
void setStroke(const Stroke& s) override;
|
|
84
|
+
const Stroke& getStroke() const override;
|
|
85
|
+
void setStrokeWidth(float w) override;
|
|
86
|
+
void setDash(const std::vector<float>& dash) override;
|
|
87
|
+
std::vector<float> getDash() override;
|
|
88
|
+
sptr<Font> getFont() const override;
|
|
89
|
+
void setFont(const sptr<Font>& font) override;
|
|
90
|
+
float getFontSize() const override;
|
|
91
|
+
void setFontSize(float size) override;
|
|
92
|
+
void translate(float dx, float dy) override;
|
|
93
|
+
void scale(float sx, float sy) override;
|
|
94
|
+
void rotate(float angle) override;
|
|
95
|
+
void rotate(float angle, float px, float py) override;
|
|
96
|
+
void reset() override;
|
|
97
|
+
float sx() const override;
|
|
98
|
+
float sy() const override;
|
|
99
|
+
void drawGlyph(u16 glyph, float x, float y) override;
|
|
100
|
+
bool beginPath(i32 id) override;
|
|
101
|
+
void moveTo(float x, float y) override;
|
|
102
|
+
void lineTo(float x, float y) override;
|
|
103
|
+
void cubicTo(float x1, float y1, float x2, float y2, float x3, float y3) override;
|
|
104
|
+
void quadTo(float x1, float y1, float x2, float y2) override;
|
|
105
|
+
void closePath() override;
|
|
106
|
+
void fillPath(i32 id) override;
|
|
107
|
+
void drawLine(float x, float y1, float x2, float y2) override;
|
|
108
|
+
void drawRect(float x, float y, float w, float h) override;
|
|
109
|
+
void fillRect(float x, float y, float w, float h) override;
|
|
110
|
+
void drawRoundRect(float x, float y, float w, float h, float rx, float ry) override;
|
|
111
|
+
void fillRoundRect(float x, float y, float w, float h, float rx, float ry) override;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
} // namespace microtex
|
|
115
|
+
|
|
116
|
+
#endif // GRAPHIC_QT_H_INCLUDED
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
qt5 = import('qt5')
|
|
2
|
+
qt_dep = dependency('qt5', modules: ['Gui'])
|
|
3
|
+
qt_src = [
|
|
4
|
+
qt5.preprocess(moc_headers: 'graphic_qt.h', include_directories: inc, dependencies: qt_dep),
|
|
5
|
+
'graphic_qt.cpp'
|
|
6
|
+
]
|
|
7
|
+
|
|
8
|
+
microtex_qt_lib = library('microtex-qt', qt_src,
|
|
9
|
+
link_with: microtex_lib,
|
|
10
|
+
include_directories: inc,
|
|
11
|
+
dependencies: qt_dep,
|
|
12
|
+
version: meson.project_version(),
|
|
13
|
+
soversion: microtex_api_version,
|
|
14
|
+
install: true
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
microtex_qt_dep = declare_dependency(
|
|
18
|
+
link_with: [microtex_lib, microtex_qt_lib],
|
|
19
|
+
include_directories: ['.', inc],
|
|
20
|
+
version: meson.project_version()
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
if get_option('TARGET_DEVEL')
|
|
24
|
+
pkgconfig.generate(microtex_qt_lib,
|
|
25
|
+
libraries: microtex_lib,
|
|
26
|
+
version: meson.project_version(),
|
|
27
|
+
name: 'microtex-qt',
|
|
28
|
+
filebase: 'microtex-qt',
|
|
29
|
+
subdirs: ['microtex/platform/qt'],
|
|
30
|
+
description: 'qt5 backend to microtex'
|
|
31
|
+
)
|
|
32
|
+
endif
|
|
33
|
+
|
|
34
|
+
if install_headerfiles
|
|
35
|
+
install_headers([
|
|
36
|
+
'graphic_qt.h'
|
|
37
|
+
], subdir: 'microtex/platform/qt')
|
|
38
|
+
endif
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
include(CMakeFindDependencyMacro)
|
|
2
|
+
|
|
3
|
+
find_dependency(microtex REQUIRED)
|
|
4
|
+
find_dependency(QT NAMES Qt6 Qt5 COMPONENTS Gui Widgets REQUIRED)
|
|
5
|
+
find_dependency(Qt${QT_VERSION_MAJOR} COMPONENTS Gui Widgets REQUIRED)
|
|
6
|
+
|
|
7
|
+
include("${CMAKE_CURRENT_LIST_DIR}/microtex-qtTargets.cmake")
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
message(STATUS "Cross-building using Skia")
|
|
2
|
+
|
|
3
|
+
add_library(microtex-skia SHARED graphic_skia.cpp)
|
|
4
|
+
|
|
5
|
+
set_target_properties(
|
|
6
|
+
microtex-skia PROPERTIES
|
|
7
|
+
VERSION ${PROJECT_VERSION}
|
|
8
|
+
SOVERSION ${MICROTEX_API_VERSION}
|
|
9
|
+
CXX_VISIBILITY_PRESET hidden
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
# try find skia via cmake module
|
|
13
|
+
find_package(skia QUIET)
|
|
14
|
+
if (skia_FOUND)
|
|
15
|
+
target_link_libraries(microtex-skia PRIVATE skia skia::skia)
|
|
16
|
+
else ()
|
|
17
|
+
message(WARNING "cmake module Skia not found, try user defined configs")
|
|
18
|
+
message(STATUS "You must has skia built with flag -DSK_SL and export the skparagraph module")
|
|
19
|
+
if (NOT DEFINED SKIA_INCLUDE_DIRECTORY)
|
|
20
|
+
message(FATAL_ERROR "Skia include directory not found, try give it by -DSKIA_INCLUDE_DIRECTORY.")
|
|
21
|
+
endif ()
|
|
22
|
+
message(STATUS "SKIA_INCLUDE_DIRECTORY: ${SKIA_INCLUDE_DIRECTORY}")
|
|
23
|
+
if (NOT DEFINED SKIA_LINK_DIRECTORY)
|
|
24
|
+
message(FATAL_ERROR "Skia link directory not found, try give it by -DSKIA_LINK_DIRECTORY.")
|
|
25
|
+
endif ()
|
|
26
|
+
message(STATUS "SKIA_LINK_DIRECTORY: ${SKIA_LINK_DIRECTORY}")
|
|
27
|
+
target_compile_definitions(microtex-skia PUBLIC -DSK_GL)
|
|
28
|
+
target_include_directories(microtex-skia PUBLIC ${SKIA_INCLUDE_DIRECTORY})
|
|
29
|
+
target_link_directories(microtex-skia PUBLIC ${SKIA_LINK_DIRECTORY})
|
|
30
|
+
target_link_libraries(microtex-skia PUBLIC skparagraph skia)
|
|
31
|
+
endif ()
|
|
32
|
+
|
|
33
|
+
target_include_directories(
|
|
34
|
+
microtex-skia PUBLIC
|
|
35
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
|
36
|
+
$<INSTALL_INTERFACE:include/microtex-skia>
|
|
37
|
+
)
|
|
38
|
+
# we need to export the library on Windows
|
|
39
|
+
target_compile_definitions(microtex-skia PRIVATE -DMICROTEX_LIBRARY)
|
|
40
|
+
target_link_libraries(
|
|
41
|
+
microtex-skia PRIVATE
|
|
42
|
+
microtex
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
microtex_install_target(microtex-skia)
|
|
46
|
+
microtex_install_headers(microtex-skia HEADERS graphic_skia.h)
|