@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,291 @@
|
|
|
1
|
+
import 'dart:convert';
|
|
2
|
+
import 'dart:ffi';
|
|
3
|
+
import 'dart:typed_data';
|
|
4
|
+
import 'dart:ui';
|
|
5
|
+
|
|
6
|
+
import 'package:flutter/rendering.dart';
|
|
7
|
+
import 'package:microtex/microtex.dart';
|
|
8
|
+
import 'package:microtex/src/bindings.dart';
|
|
9
|
+
import 'package:microtex/src/pathcache.dart';
|
|
10
|
+
import 'package:microtex/src/textlayout.dart';
|
|
11
|
+
|
|
12
|
+
class Render {
|
|
13
|
+
final NativeBindings _bindings;
|
|
14
|
+
final Pointer _nativeInstance;
|
|
15
|
+
final Endian _endian;
|
|
16
|
+
|
|
17
|
+
/// If filter is enabled, using a bluring to simulate the 'grid fitting' on glyhs
|
|
18
|
+
/// drawing to get a much clear rendering, but it is expensive, especially for
|
|
19
|
+
/// complex formulas.
|
|
20
|
+
/// See [https://github.com/flutter/flutter/issues/104017].
|
|
21
|
+
Blur? blur;
|
|
22
|
+
|
|
23
|
+
Render(this._bindings, this._nativeInstance, bool isLittleEndian)
|
|
24
|
+
: _endian = isLittleEndian ? Endian.little : Endian.big;
|
|
25
|
+
|
|
26
|
+
/// The width of this render.
|
|
27
|
+
int get width => _bindings.getRenderWidth(_nativeInstance);
|
|
28
|
+
|
|
29
|
+
/// The height of this render, equals to ascent + descent (or namely [depth],
|
|
30
|
+
/// distance below the baseline).
|
|
31
|
+
int get height => _bindings.getRenderHeight(_nativeInstance);
|
|
32
|
+
|
|
33
|
+
/// The distance below the baseline, in positive.
|
|
34
|
+
int get depth => _bindings.getRenderDepth(_nativeInstance);
|
|
35
|
+
|
|
36
|
+
/// Test if this render is split to multi-lines.
|
|
37
|
+
bool get isSplit => _bindings.isRenderSplit(_nativeInstance);
|
|
38
|
+
|
|
39
|
+
void release() {
|
|
40
|
+
_bindings.deleteRender(_nativeInstance);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/// Set the text size to draw. The dimension ([width], [height], [depth]) will be
|
|
44
|
+
/// changed following the text size change.
|
|
45
|
+
void setTextSize(double textSize) {
|
|
46
|
+
_bindings.setRenderTextSize(_nativeInstance, textSize);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/// Set the foreground color to draw.
|
|
50
|
+
void setColor(int color) {
|
|
51
|
+
_bindings.setRenderForground(_nativeInstance, color);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// If this render is use path to render glyphs.
|
|
55
|
+
///
|
|
56
|
+
/// Unlike the [MicroTeX.isRenderGlyphUsePath], this is for every particular renders.
|
|
57
|
+
bool isRenderGlyphUsePath = false;
|
|
58
|
+
|
|
59
|
+
static const _caps = [StrokeCap.butt, StrokeCap.round, StrokeCap.square];
|
|
60
|
+
static const _joins = [StrokeJoin.bevel, StrokeJoin.round, StrokeJoin.miter];
|
|
61
|
+
|
|
62
|
+
final _paint = Paint()..isAntiAlias = true;
|
|
63
|
+
final _argBuf = Float32List(8);
|
|
64
|
+
|
|
65
|
+
void draw(Canvas canvas) {
|
|
66
|
+
print("Render.draw");
|
|
67
|
+
// it is OK to change the value of the property [MicroTeX.isRenderGlyphUsePath] when
|
|
68
|
+
// drawing every renders, since draw runs in UI thread.
|
|
69
|
+
final prevIsRenderGlyphUsePath = MicroTeX().isRenderGlyphUsePath();
|
|
70
|
+
MicroTeX().setRenderGlyphUsePath(isRenderGlyphUsePath);
|
|
71
|
+
// get the drawing commands from native render
|
|
72
|
+
final drawingData = _bindings.getDrawingData(_nativeInstance, 0, 0);
|
|
73
|
+
// the first 4 bytes is the total count of byte used
|
|
74
|
+
final n = drawingData.asTypedList(4);
|
|
75
|
+
final len = n.buffer.asByteData().getUint32(0, _endian);
|
|
76
|
+
|
|
77
|
+
// make a view to iterate over the drawing commands
|
|
78
|
+
final v = drawingData.asTypedList(len).buffer.asByteData();
|
|
79
|
+
var offset = 0;
|
|
80
|
+
|
|
81
|
+
int getU8() {
|
|
82
|
+
final x = v.getUint8(offset);
|
|
83
|
+
offset += 1;
|
|
84
|
+
return x;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
T getNum<T>(int size, T Function(int offset) f) {
|
|
88
|
+
final x = f(offset);
|
|
89
|
+
offset += size;
|
|
90
|
+
return x;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
String getString() {
|
|
94
|
+
final utf8 = <int>[];
|
|
95
|
+
var byte = getU8();
|
|
96
|
+
while (byte != 0) {
|
|
97
|
+
utf8.add(byte);
|
|
98
|
+
byte = getU8();
|
|
99
|
+
}
|
|
100
|
+
return const Utf8Decoder().convert(utf8);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
int getU16() => getNum(2, (offset) => v.getUint16(offset, _endian));
|
|
104
|
+
int getI32() => getNum(4, (offset) => v.getInt32(offset, _endian));
|
|
105
|
+
int getU32() => getNum(4, (offset) => v.getUint32(offset, _endian));
|
|
106
|
+
double getF32() => getNum(4, (offset) => v.getFloat32(offset, _endian));
|
|
107
|
+
|
|
108
|
+
Float32List getF32s(int cnt) {
|
|
109
|
+
for (var i = 0; i < cnt; i++) {
|
|
110
|
+
_argBuf[i] = v.getFloat32(offset, _endian);
|
|
111
|
+
offset += 4;
|
|
112
|
+
}
|
|
113
|
+
return _argBuf;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// consume the first 4 bytes
|
|
117
|
+
getU32();
|
|
118
|
+
var sx = 1.0, sy = 1.0;
|
|
119
|
+
var path = Path();
|
|
120
|
+
|
|
121
|
+
var fontFamily = "";
|
|
122
|
+
var fontSize = 0.0;
|
|
123
|
+
|
|
124
|
+
while (offset < len) {
|
|
125
|
+
final cmd = getU8();
|
|
126
|
+
switch (cmd) {
|
|
127
|
+
case 0: // setColor
|
|
128
|
+
final color = getU32();
|
|
129
|
+
_paint.color = Color(color);
|
|
130
|
+
break;
|
|
131
|
+
case 1: // setStroke
|
|
132
|
+
final lineWidth = getF32();
|
|
133
|
+
final miterLimit = getF32();
|
|
134
|
+
final cap = getU32();
|
|
135
|
+
final join = getU32();
|
|
136
|
+
_paint
|
|
137
|
+
..strokeWidth = lineWidth
|
|
138
|
+
..strokeMiterLimit = miterLimit
|
|
139
|
+
..strokeCap = _caps[cap]
|
|
140
|
+
..strokeJoin = _joins[join];
|
|
141
|
+
break;
|
|
142
|
+
case 2: // setDash
|
|
143
|
+
final hasDash = getU8() == 1;
|
|
144
|
+
final dash = hasDash ? [5 / sx, 5 / sx] : [];
|
|
145
|
+
// FIXME
|
|
146
|
+
// Flutter does not support dashing lines
|
|
147
|
+
break;
|
|
148
|
+
case 3: // setFont
|
|
149
|
+
// TODO
|
|
150
|
+
final family = getString();
|
|
151
|
+
fontFamily = family;
|
|
152
|
+
break;
|
|
153
|
+
case 4: // setFontSize
|
|
154
|
+
// TODO
|
|
155
|
+
final size = getF32();
|
|
156
|
+
fontSize = size;
|
|
157
|
+
break;
|
|
158
|
+
case 5: // translate
|
|
159
|
+
final t = getF32s(2);
|
|
160
|
+
canvas.translate(t[0], t[1]);
|
|
161
|
+
break;
|
|
162
|
+
case 6: // scale
|
|
163
|
+
final s = getF32s(2);
|
|
164
|
+
sx *= s[0];
|
|
165
|
+
sy *= s[1];
|
|
166
|
+
canvas.scale(s[0], s[1]);
|
|
167
|
+
break;
|
|
168
|
+
case 7: // rotate
|
|
169
|
+
final r = getF32s(3);
|
|
170
|
+
canvas.translate(r[1], r[2]);
|
|
171
|
+
canvas.rotate(r[0]);
|
|
172
|
+
canvas.translate(-r[1], -r[2]);
|
|
173
|
+
break;
|
|
174
|
+
case 8: // reset
|
|
175
|
+
canvas.transform(Matrix4.identity().storage);
|
|
176
|
+
break;
|
|
177
|
+
case 9: // drawGlyph
|
|
178
|
+
// TODO
|
|
179
|
+
final glyph = getU16();
|
|
180
|
+
final xy = getF32s(2);
|
|
181
|
+
final run = GlyphRun(
|
|
182
|
+
glyphs: Uint16List.fromList([glyph]),
|
|
183
|
+
positions: [Offset(xy[0], xy[1])],
|
|
184
|
+
fontFamily: fontFamily,
|
|
185
|
+
fontSize: fontSize,
|
|
186
|
+
);
|
|
187
|
+
canvas.drawGlyphRun(run, const Offset(0, 0), _paint);
|
|
188
|
+
break;
|
|
189
|
+
case 10: // beginPath
|
|
190
|
+
final pid = getI32();
|
|
191
|
+
final p = PathCache()[pid];
|
|
192
|
+
path = p ?? Path();
|
|
193
|
+
break;
|
|
194
|
+
case 11: // moveTo
|
|
195
|
+
final m = getF32s(2);
|
|
196
|
+
path.moveTo(m[0], m[1]);
|
|
197
|
+
break;
|
|
198
|
+
case 12: // lineTo
|
|
199
|
+
final l = getF32s(2);
|
|
200
|
+
path.lineTo(l[0], l[1]);
|
|
201
|
+
break;
|
|
202
|
+
case 13: // cubicTo
|
|
203
|
+
final c = getF32s(6);
|
|
204
|
+
path.cubicTo(c[0], c[1], c[2], c[3], c[4], c[5]);
|
|
205
|
+
break;
|
|
206
|
+
case 14: // quadTo
|
|
207
|
+
final q = getF32s(4);
|
|
208
|
+
path.quadraticBezierTo(q[0], q[1], q[2], q[3]);
|
|
209
|
+
break;
|
|
210
|
+
case 15: // closePath
|
|
211
|
+
path.close();
|
|
212
|
+
break;
|
|
213
|
+
case 16: // fillPath
|
|
214
|
+
final pid = getI32();
|
|
215
|
+
_paint.style = PaintingStyle.fill;
|
|
216
|
+
final b = blur;
|
|
217
|
+
final p = b == null ? _paint : (_paint.copy()..maskFilter = MaskFilter.blur(b.style, b.sigma / sx));
|
|
218
|
+
PathCache()[pid] = path;
|
|
219
|
+
canvas.drawPath(path, p);
|
|
220
|
+
break;
|
|
221
|
+
case 17: // drawLine
|
|
222
|
+
final dl = getF32s(4);
|
|
223
|
+
canvas.drawLine(Offset(dl[0], dl[1]), Offset(dl[2], dl[3]), _paint);
|
|
224
|
+
break;
|
|
225
|
+
case 18: // drawRect
|
|
226
|
+
final dr = getF32s(4);
|
|
227
|
+
_paint.style = PaintingStyle.stroke;
|
|
228
|
+
canvas.drawRect(Rect.fromLTWH(dr[0], dr[1], dr[2], dr[3]), _paint);
|
|
229
|
+
break;
|
|
230
|
+
case 19: // fillRect
|
|
231
|
+
final fr = getF32s(4);
|
|
232
|
+
_paint.style = PaintingStyle.fill;
|
|
233
|
+
canvas.drawRect(Rect.fromLTWH(fr[0], fr[1], fr[2], fr[3]), _paint);
|
|
234
|
+
break;
|
|
235
|
+
case 20: // drawRoundRect
|
|
236
|
+
final rr = getF32s(6);
|
|
237
|
+
_paint.style = PaintingStyle.stroke;
|
|
238
|
+
canvas.drawRRect(
|
|
239
|
+
RRect.fromRectXY(Rect.fromLTWH(rr[0], rr[1], rr[2], rr[3]), rr[4], rr[5]),
|
|
240
|
+
_paint,
|
|
241
|
+
);
|
|
242
|
+
break;
|
|
243
|
+
case 21: // fillRoundRect
|
|
244
|
+
final rf = getF32s(6);
|
|
245
|
+
_paint.style = PaintingStyle.fill;
|
|
246
|
+
canvas.drawRRect(
|
|
247
|
+
RRect.fromRectXY(Rect.fromLTWH(rf[0], rf[1], rf[2], rf[3]), rf[4], rf[5]),
|
|
248
|
+
_paint,
|
|
249
|
+
);
|
|
250
|
+
break;
|
|
251
|
+
case 22: // drawTextLayout
|
|
252
|
+
final id = getU32();
|
|
253
|
+
final xy = getF32s(2);
|
|
254
|
+
TextLayout.draw(id, canvas, xy[0], xy[1], _paint.color);
|
|
255
|
+
break;
|
|
256
|
+
default:
|
|
257
|
+
// invalid drawing command
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
// delete the drawing data
|
|
262
|
+
_bindings.deleteDrawingData(drawingData);
|
|
263
|
+
// reset the property
|
|
264
|
+
MicroTeX().setRenderGlyphUsePath(prevIsRenderGlyphUsePath);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
@override
|
|
268
|
+
String toString() {
|
|
269
|
+
return "Render{$width, $height, $depth}";
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
extension _PaintExt on Paint {
|
|
274
|
+
Paint copy() {
|
|
275
|
+
return Paint()
|
|
276
|
+
..isAntiAlias = isAntiAlias
|
|
277
|
+
..color = color
|
|
278
|
+
..blendMode = blendMode
|
|
279
|
+
..style = style
|
|
280
|
+
..strokeWidth = strokeWidth
|
|
281
|
+
..strokeCap = strokeCap
|
|
282
|
+
..strokeJoin = strokeJoin
|
|
283
|
+
..strokeMiterLimit = strokeMiterLimit
|
|
284
|
+
..maskFilter = maskFilter
|
|
285
|
+
..filterQuality = filterQuality
|
|
286
|
+
..shader = shader
|
|
287
|
+
..colorFilter = colorFilter
|
|
288
|
+
..imageFilter = imageFilter
|
|
289
|
+
..invertColors = invertColors;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import 'package:flutter/material.dart';
|
|
2
|
+
import 'package:flutter/painting.dart';
|
|
3
|
+
import 'package:microtex/src/context.dart';
|
|
4
|
+
import 'package:microtex/src/fontdesc.dart';
|
|
5
|
+
|
|
6
|
+
class TextLayout {
|
|
7
|
+
TextLayout._();
|
|
8
|
+
|
|
9
|
+
static String _serif = "";
|
|
10
|
+
static String _sansSerif = "";
|
|
11
|
+
static String _monospace = "";
|
|
12
|
+
|
|
13
|
+
static int _id = 0;
|
|
14
|
+
static final _texts = <int, Txt>{};
|
|
15
|
+
|
|
16
|
+
static void setFontFamily(String serif, String sansSerif, String monospace) {
|
|
17
|
+
_serif = serif;
|
|
18
|
+
_sansSerif = sansSerif;
|
|
19
|
+
_monospace = monospace;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static int create(String text, FontDesc font) {
|
|
23
|
+
_id++;
|
|
24
|
+
_texts[_id] = Txt(text, font);
|
|
25
|
+
return _id;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/// FIXME
|
|
29
|
+
/// Because TextStyle cannot be modified, we need to create 2 painters in
|
|
30
|
+
/// method [getBounds] to retrieve the metrics and method [draw] to
|
|
31
|
+
/// change the color to draw
|
|
32
|
+
static TextPainter _createPainter(Txt t, [Color? color]) {
|
|
33
|
+
return TextPainter(
|
|
34
|
+
text: TextSpan(
|
|
35
|
+
text: t.txt,
|
|
36
|
+
style: TextStyle(
|
|
37
|
+
fontSize: t.fontSize,
|
|
38
|
+
fontWeight: t.fontWeight,
|
|
39
|
+
fontStyle: t.fontStyle,
|
|
40
|
+
fontFamily: t.fontFamily,
|
|
41
|
+
color: color,
|
|
42
|
+
),
|
|
43
|
+
),
|
|
44
|
+
textDirection: TextDirection.ltr,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static List<double> getBounds(int id) {
|
|
49
|
+
final t = _texts[id];
|
|
50
|
+
if (t == null) return [0, 0, 0];
|
|
51
|
+
final painter = _createPainter(t)..layout();
|
|
52
|
+
final m = painter.computeLineMetrics().first;
|
|
53
|
+
t.ascent = m.ascent;
|
|
54
|
+
return [m.width, m.ascent + m.descent, -m.ascent];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static void draw(int id, Canvas canvas, double x, double y, Color color) {
|
|
58
|
+
final t = _texts[id];
|
|
59
|
+
if (t == null) return;
|
|
60
|
+
_createPainter(t, color)
|
|
61
|
+
..layout()
|
|
62
|
+
..paint(canvas, Offset(x, y - t.ascent));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
static void release(int id) {
|
|
66
|
+
if (debugMicroTeX) {
|
|
67
|
+
print('TextLayout.relase($id)');
|
|
68
|
+
}
|
|
69
|
+
_texts.remove(id);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
class Txt {
|
|
74
|
+
final String txt;
|
|
75
|
+
final double fontSize;
|
|
76
|
+
late final FontWeight fontWeight;
|
|
77
|
+
late final FontStyle fontStyle;
|
|
78
|
+
late final String fontFamily;
|
|
79
|
+
|
|
80
|
+
double ascent = 0;
|
|
81
|
+
|
|
82
|
+
Txt(this.txt, FontDesc font) : fontSize = font.fontSize {
|
|
83
|
+
if (font.isSansSerif) {
|
|
84
|
+
fontFamily = TextLayout._sansSerif;
|
|
85
|
+
} else if (font.isMonospace) {
|
|
86
|
+
fontFamily = TextLayout._monospace;
|
|
87
|
+
} else {
|
|
88
|
+
fontFamily = TextLayout._serif;
|
|
89
|
+
}
|
|
90
|
+
fontWeight = font.isBold ? FontWeight.bold : FontWeight.normal;
|
|
91
|
+
fontStyle = font.isItalic ? FontStyle.italic : FontStyle.normal;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import 'package:flutter/material.dart';
|
|
2
|
+
import 'package:microtex/microtex.dart';
|
|
3
|
+
|
|
4
|
+
class Blur {
|
|
5
|
+
final BlurStyle style;
|
|
6
|
+
final double sigma;
|
|
7
|
+
|
|
8
|
+
const Blur(this.style, this.sigma);
|
|
9
|
+
|
|
10
|
+
@override
|
|
11
|
+
bool operator ==(Object other) {
|
|
12
|
+
return other is Blur && style == other.style && sigma == other.sigma;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@override
|
|
16
|
+
int get hashCode => hashValues(style, sigma);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
class LaTeX extends LeafRenderObjectWidget {
|
|
20
|
+
final String latex;
|
|
21
|
+
final double textSize;
|
|
22
|
+
final Color color;
|
|
23
|
+
final bool isRenderGlyphUsePath;
|
|
24
|
+
final TeXStyle? style;
|
|
25
|
+
final Blur? blur;
|
|
26
|
+
|
|
27
|
+
const LaTeX({
|
|
28
|
+
Key? key,
|
|
29
|
+
required this.latex,
|
|
30
|
+
this.textSize = 20,
|
|
31
|
+
this.color = const Color(0xFF424242),
|
|
32
|
+
this.style,
|
|
33
|
+
this.blur,
|
|
34
|
+
this.isRenderGlyphUsePath = false,
|
|
35
|
+
}) : super(key: key);
|
|
36
|
+
|
|
37
|
+
@override
|
|
38
|
+
RenderObject createRenderObject(BuildContext context) {
|
|
39
|
+
return RenderLaTeX(latex, textSize, color, style, blur, isRenderGlyphUsePath);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@override
|
|
43
|
+
void updateRenderObject(BuildContext context, covariant RenderLaTeX renderObject) {
|
|
44
|
+
renderObject.update(latex, textSize, color, style, blur, isRenderGlyphUsePath);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
class RenderLaTeX extends RenderBox {
|
|
49
|
+
String _latex;
|
|
50
|
+
double _textSize;
|
|
51
|
+
Color _color;
|
|
52
|
+
bool _isRenderGlyphUsePath;
|
|
53
|
+
TeXStyle? _style;
|
|
54
|
+
Blur? _blur;
|
|
55
|
+
|
|
56
|
+
double _lastMaxWidth = 0;
|
|
57
|
+
Render? _render;
|
|
58
|
+
|
|
59
|
+
RenderLaTeX(this._latex, this._textSize, this._color, this._style, this._blur, this._isRenderGlyphUsePath);
|
|
60
|
+
|
|
61
|
+
void update(String latex, double textSize, Color color, TeXStyle? style, Blur? blur, bool isRenderUsePath) {
|
|
62
|
+
var needParse = false;
|
|
63
|
+
if (_latex != latex || _style != style) {
|
|
64
|
+
_latex = latex;
|
|
65
|
+
_style = style;
|
|
66
|
+
needParse = true;
|
|
67
|
+
}
|
|
68
|
+
var needLayout = false;
|
|
69
|
+
if (_textSize != textSize) {
|
|
70
|
+
_textSize = textSize;
|
|
71
|
+
_render?.setTextSize(textSize);
|
|
72
|
+
needLayout = true;
|
|
73
|
+
}
|
|
74
|
+
var needPaint = false;
|
|
75
|
+
if (_color != color || _blur != blur || _isRenderGlyphUsePath != isRenderUsePath) {
|
|
76
|
+
_color = color;
|
|
77
|
+
_blur = blur;
|
|
78
|
+
_isRenderGlyphUsePath = isRenderUsePath;
|
|
79
|
+
_render
|
|
80
|
+
?..setColor(color.value)
|
|
81
|
+
..blur = blur
|
|
82
|
+
..isRenderGlyphUsePath = isRenderUsePath;
|
|
83
|
+
needPaint = true;
|
|
84
|
+
}
|
|
85
|
+
if (debugMicroTeX) {
|
|
86
|
+
print(
|
|
87
|
+
'RenderLaTeX.update'
|
|
88
|
+
'{parse: $needParse, layout: $needLayout, paint: $needPaint}',
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
if (needParse) {
|
|
92
|
+
_render?.release();
|
|
93
|
+
_render = null;
|
|
94
|
+
markNeedsLayout();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (needLayout) {
|
|
98
|
+
markNeedsLayout();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (needPaint) markNeedsPaint();
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@override
|
|
105
|
+
bool get isRepaintBoundary => true;
|
|
106
|
+
|
|
107
|
+
@override
|
|
108
|
+
void dispose() {
|
|
109
|
+
super.dispose();
|
|
110
|
+
_render?.release();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@override
|
|
114
|
+
void performLayout() {
|
|
115
|
+
var r = _render;
|
|
116
|
+
var reparse = false;
|
|
117
|
+
final maxWidth = constraints.maxWidth;
|
|
118
|
+
if (r != null && _lastMaxWidth != maxWidth) {
|
|
119
|
+
// If max width changed, it might need to re-parse
|
|
120
|
+
reparse = r.isSplit;
|
|
121
|
+
}
|
|
122
|
+
_lastMaxWidth = maxWidth;
|
|
123
|
+
if (r == null || reparse) {
|
|
124
|
+
if (debugMicroTeX) {
|
|
125
|
+
print(
|
|
126
|
+
'RenderLaTeX.performLayout'
|
|
127
|
+
'{render: $r, reparse: $reparse}',
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
r = MicroTeX().parse(
|
|
131
|
+
tex: _latex,
|
|
132
|
+
width: _lastMaxWidth == double.infinity ? 0 : _lastMaxWidth.toInt(),
|
|
133
|
+
textSize: _textSize,
|
|
134
|
+
lineSpace: _textSize / 3,
|
|
135
|
+
color: _color,
|
|
136
|
+
// never fill the width, if you want to, wrap a Container or something like that
|
|
137
|
+
fillWidth: false,
|
|
138
|
+
overrideTeXStyle: _style != null,
|
|
139
|
+
style: _style ?? TeXStyle.text,
|
|
140
|
+
);
|
|
141
|
+
r.blur = _blur;
|
|
142
|
+
r.isRenderGlyphUsePath = _isRenderGlyphUsePath;
|
|
143
|
+
_render = r;
|
|
144
|
+
}
|
|
145
|
+
size = Size(r.width.toDouble(), r.height.toDouble());
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@override
|
|
149
|
+
double? computeDistanceToActualBaseline(TextBaseline baseline) {
|
|
150
|
+
final r = _render;
|
|
151
|
+
if (r == null) return null;
|
|
152
|
+
return (r.height - r.depth).toDouble();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@override
|
|
156
|
+
void paint(PaintingContext context, Offset offset) {
|
|
157
|
+
final r = _render;
|
|
158
|
+
if (r == null) return;
|
|
159
|
+
context.canvas.translate(offset.dx, offset.dy);
|
|
160
|
+
r.draw(context.canvas);
|
|
161
|
+
context.canvas.translate(-offset.dx, -offset.dy);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.10)
|
|
2
|
+
set(PROJECT_NAME "microtex")
|
|
3
|
+
project(${PROJECT_NAME} LANGUAGES CXX)
|
|
4
|
+
|
|
5
|
+
# This value is used when generating builds using this plugin, so it must
|
|
6
|
+
# not be changed
|
|
7
|
+
set(PLUGIN_NAME "microtex_plugin")
|
|
8
|
+
|
|
9
|
+
add_library(
|
|
10
|
+
${PLUGIN_NAME} SHARED
|
|
11
|
+
"microtex_plugin.cc"
|
|
12
|
+
)
|
|
13
|
+
apply_standard_settings(${PLUGIN_NAME})
|
|
14
|
+
set_target_properties(
|
|
15
|
+
${PLUGIN_NAME} PROPERTIES
|
|
16
|
+
CXX_VISIBILITY_PRESET hidden
|
|
17
|
+
)
|
|
18
|
+
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
|
|
19
|
+
target_include_directories(
|
|
20
|
+
${PLUGIN_NAME} INTERFACE
|
|
21
|
+
"${CMAKE_CURRENT_SOURCE_DIR}/include"
|
|
22
|
+
)
|
|
23
|
+
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter)
|
|
24
|
+
target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK)
|
|
25
|
+
|
|
26
|
+
add_subdirectory(nativelib)
|
|
27
|
+
|
|
28
|
+
# List of absolute paths to libraries that should be bundled with the plugin
|
|
29
|
+
set(
|
|
30
|
+
microtex_bundled_libraries
|
|
31
|
+
"${CMAKE_CURRENT_BINARY_DIR}/nativelib/lib/libmicrotex.so"
|
|
32
|
+
PARENT_SCOPE
|
|
33
|
+
)
|
package/native/vendor/microtex/platform/flutter/microtex/linux/include/microtex/microtex_plugin.h
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#ifndef FLUTTER_PLUGIN_MICROTEX_PLUGIN_H_
|
|
2
|
+
#define FLUTTER_PLUGIN_MICROTEX_PLUGIN_H_
|
|
3
|
+
|
|
4
|
+
#include <flutter_linux/flutter_linux.h>
|
|
5
|
+
|
|
6
|
+
G_BEGIN_DECLS
|
|
7
|
+
|
|
8
|
+
#ifdef FLUTTER_PLUGIN_IMPL
|
|
9
|
+
#define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default")))
|
|
10
|
+
#else
|
|
11
|
+
#define FLUTTER_PLUGIN_EXPORT
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
typedef struct _MicrotexPlugin MicrotexPlugin;
|
|
15
|
+
typedef struct {
|
|
16
|
+
GObjectClass parent_class;
|
|
17
|
+
} MicrotexPluginClass;
|
|
18
|
+
|
|
19
|
+
FLUTTER_PLUGIN_EXPORT GType microtex_plugin_get_type();
|
|
20
|
+
|
|
21
|
+
FLUTTER_PLUGIN_EXPORT void microtex_plugin_register_with_registrar(
|
|
22
|
+
FlPluginRegistrar* registrar);
|
|
23
|
+
|
|
24
|
+
G_END_DECLS
|
|
25
|
+
|
|
26
|
+
#endif // FLUTTER_PLUGIN_MICROTEX_PLUGIN_H_
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#include "include/microtex/microtex_plugin.h"
|
|
2
|
+
|
|
3
|
+
#include <flutter_linux/flutter_linux.h>
|
|
4
|
+
#include <gtk/gtk.h>
|
|
5
|
+
#include <sys/utsname.h>
|
|
6
|
+
|
|
7
|
+
#include <cstring>
|
|
8
|
+
|
|
9
|
+
#define MICROTEX_PLUGIN(obj) \
|
|
10
|
+
(G_TYPE_CHECK_INSTANCE_CAST((obj), microtex_plugin_get_type(), \
|
|
11
|
+
MicrotexPlugin))
|
|
12
|
+
|
|
13
|
+
struct _MicrotexPlugin {
|
|
14
|
+
GObject parent_instance;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
G_DEFINE_TYPE(MicrotexPlugin, microtex_plugin, g_object_get_type())
|
|
18
|
+
|
|
19
|
+
// Called when a method call is received from Flutter.
|
|
20
|
+
static void microtex_plugin_handle_method_call(
|
|
21
|
+
MicrotexPlugin* self,
|
|
22
|
+
FlMethodCall* method_call) {
|
|
23
|
+
g_autoptr(FlMethodResponse) response = nullptr;
|
|
24
|
+
|
|
25
|
+
const gchar* method = fl_method_call_get_name(method_call);
|
|
26
|
+
|
|
27
|
+
if (strcmp(method, "getPlatformVersion") == 0) {
|
|
28
|
+
struct utsname uname_data = {};
|
|
29
|
+
uname(&uname_data);
|
|
30
|
+
g_autofree gchar *version = g_strdup_printf("Linux %s", uname_data.version);
|
|
31
|
+
g_autoptr(FlValue) result = fl_value_new_string(version);
|
|
32
|
+
response = FL_METHOD_RESPONSE(fl_method_success_response_new(result));
|
|
33
|
+
} else {
|
|
34
|
+
response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new());
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
fl_method_call_respond(method_call, response, nullptr);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static void microtex_plugin_dispose(GObject* object) {
|
|
41
|
+
G_OBJECT_CLASS(microtex_plugin_parent_class)->dispose(object);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static void microtex_plugin_class_init(MicrotexPluginClass* klass) {
|
|
45
|
+
G_OBJECT_CLASS(klass)->dispose = microtex_plugin_dispose;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static void microtex_plugin_init(MicrotexPlugin* self) {}
|
|
49
|
+
|
|
50
|
+
static void method_call_cb(FlMethodChannel* channel, FlMethodCall* method_call,
|
|
51
|
+
gpointer user_data) {
|
|
52
|
+
MicrotexPlugin* plugin = MICROTEX_PLUGIN(user_data);
|
|
53
|
+
microtex_plugin_handle_method_call(plugin, method_call);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
void microtex_plugin_register_with_registrar(FlPluginRegistrar* registrar) {
|
|
57
|
+
MicrotexPlugin* plugin = MICROTEX_PLUGIN(
|
|
58
|
+
g_object_new(microtex_plugin_get_type(), nullptr));
|
|
59
|
+
|
|
60
|
+
g_autoptr(FlStandardMethodCodec) codec = fl_standard_method_codec_new();
|
|
61
|
+
g_autoptr(FlMethodChannel) channel =
|
|
62
|
+
fl_method_channel_new(fl_plugin_registrar_get_messenger(registrar),
|
|
63
|
+
"microtex",
|
|
64
|
+
FL_METHOD_CODEC(codec));
|
|
65
|
+
fl_method_channel_set_method_call_handler(channel, method_call_cb,
|
|
66
|
+
g_object_ref(plugin),
|
|
67
|
+
g_object_unref);
|
|
68
|
+
|
|
69
|
+
g_object_unref(plugin);
|
|
70
|
+
}
|