@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,180 @@
|
|
|
1
|
+
#include "core/formula.h"
|
|
2
|
+
|
|
3
|
+
#include "atom/atom_basic.h"
|
|
4
|
+
#include "atom/atom_char.h"
|
|
5
|
+
#include "atom/atom_fence.h"
|
|
6
|
+
#include "atom/atom_vrow.h"
|
|
7
|
+
#include "utils/string_utils.h"
|
|
8
|
+
#include "utils/utf.h"
|
|
9
|
+
|
|
10
|
+
using namespace std;
|
|
11
|
+
using namespace microtex;
|
|
12
|
+
|
|
13
|
+
map<string, sptr<Formula>> Formula::_predefFormulas;
|
|
14
|
+
|
|
15
|
+
Formula::Formula() : _parser("", this, false) {}
|
|
16
|
+
|
|
17
|
+
Formula::Formula(const Parser& tp, const string& latex, bool preprocess, bool isMathMode)
|
|
18
|
+
: _parser(tp.isPartial(), latex, this, preprocess, isMathMode) {
|
|
19
|
+
if (tp.isPartial()) {
|
|
20
|
+
try {
|
|
21
|
+
_parser.parse();
|
|
22
|
+
} catch (exception& e) {
|
|
23
|
+
if (_root == nullptr) _root = sptrOf<EmptyAtom>();
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
_parser.parse();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
Formula::Formula(const string& latex, bool preprocess) : _parser(latex, this, preprocess) {
|
|
31
|
+
_parser.parse();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
void Formula::setLaTeX(const string& latex) {
|
|
35
|
+
_parser.reset(latex);
|
|
36
|
+
if (!latex.empty()) _parser.parse();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const std::vector<sptr<MiddleAtom>>& Formula::middle() {
|
|
40
|
+
return _middle;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
Formula* Formula::add(const sptr<Atom>& a) {
|
|
44
|
+
if (a == nullptr) return this;
|
|
45
|
+
auto atom = dynamic_pointer_cast<MiddleAtom>(a);
|
|
46
|
+
if (atom != nullptr) _middle.push_back(atom);
|
|
47
|
+
if (_root == nullptr) {
|
|
48
|
+
_root = a;
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
auto* rm = dynamic_cast<RowAtom*>(_root.get());
|
|
52
|
+
if (rm == nullptr) _root = sptrOf<RowAtom>(_root);
|
|
53
|
+
rm = static_cast<RowAtom*>(_root.get());
|
|
54
|
+
rm->add(a);
|
|
55
|
+
auto* ta = dynamic_cast<TypedAtom*>(a.get());
|
|
56
|
+
if (ta != nullptr) {
|
|
57
|
+
AtomType rt = ta->rightType();
|
|
58
|
+
if (rt == AtomType::binaryOperator || rt == AtomType::relation) {
|
|
59
|
+
rm->add(sptrOf<BreakMarkAtom>());
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
sptr<Box> Formula::createBox(Env& env) {
|
|
66
|
+
if (_root == nullptr) return StrutBox::empty();
|
|
67
|
+
return _root->createBox(env);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
sptr<Formula> Formula::get(const string& name) {
|
|
71
|
+
auto it = _predefFormulas.find(name);
|
|
72
|
+
if (it != _predefFormulas.end()) return it->second;
|
|
73
|
+
|
|
74
|
+
auto i = _predefFormulaStrs.find(name);
|
|
75
|
+
if (i == _predefFormulaStrs.end()) return nullptr;
|
|
76
|
+
|
|
77
|
+
auto tf = sptrOf<Formula>(i->second);
|
|
78
|
+
auto* ra = dynamic_cast<RowAtom*>(tf->_root.get());
|
|
79
|
+
if (ra == nullptr) {
|
|
80
|
+
_predefFormulas[name] = tf;
|
|
81
|
+
}
|
|
82
|
+
return tf;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/*************************************** ArrayFormula implementation ******************************/
|
|
86
|
+
|
|
87
|
+
ArrayFormula::ArrayFormula() : _row(0), _col(0) {
|
|
88
|
+
_array.emplace_back();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
void ArrayFormula::addCol() {
|
|
92
|
+
_array[_row].push_back(_root);
|
|
93
|
+
_root = nullptr;
|
|
94
|
+
_col++;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
void ArrayFormula::addCol(int n) {
|
|
98
|
+
_array[_row].push_back(_root);
|
|
99
|
+
for (int i = 1; i < n - 1; i++) {
|
|
100
|
+
_array[_row].push_back(nullptr);
|
|
101
|
+
}
|
|
102
|
+
_root = nullptr;
|
|
103
|
+
_col += n;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
void ArrayFormula::insertAtomIntoCol(int col, const sptr<Atom>& atom) {
|
|
107
|
+
_col++;
|
|
108
|
+
for (size_t j = 0; j < _row; j++) {
|
|
109
|
+
size_t n_row_columns = _array[j].size();
|
|
110
|
+
if (n_row_columns < col) {
|
|
111
|
+
for (unsigned int i = 0; i < col - n_row_columns; i++)
|
|
112
|
+
_array[j].push_back(sptrOf<EmptyAtom>());
|
|
113
|
+
}
|
|
114
|
+
auto it = _array[j].begin();
|
|
115
|
+
_array[j].insert(it + col, atom);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
void ArrayFormula::addRow() {
|
|
120
|
+
addCol();
|
|
121
|
+
_array.emplace_back();
|
|
122
|
+
_row++;
|
|
123
|
+
_col = 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
void ArrayFormula::addRowSpecifier(const sptr<CellSpecifier>& spe) {
|
|
127
|
+
auto it = _rowSpecifiers.find(_row);
|
|
128
|
+
if (it == _rowSpecifiers.end()) {
|
|
129
|
+
_rowSpecifiers[_row] = vector<sptr<CellSpecifier>>();
|
|
130
|
+
}
|
|
131
|
+
_rowSpecifiers[_row].push_back(spe);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
void ArrayFormula::addCellSpecifier(const sptr<CellSpecifier>& spe) {
|
|
135
|
+
string str = toString(_row) + toString(_col);
|
|
136
|
+
auto it = _cellSpecifiers.find(str);
|
|
137
|
+
if (it == _cellSpecifiers.end()) {
|
|
138
|
+
_cellSpecifiers[str] = vector<sptr<CellSpecifier>>();
|
|
139
|
+
}
|
|
140
|
+
_cellSpecifiers[str].push_back(spe);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
int ArrayFormula::rows() const {
|
|
144
|
+
return _row;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
int ArrayFormula::cols() const {
|
|
148
|
+
return _col;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
sptr<VRowAtom> ArrayFormula::getAsVRow() {
|
|
152
|
+
auto vr = sptrOf<VRowAtom>();
|
|
153
|
+
vr->setAddInterline(true);
|
|
154
|
+
for (auto& c : _array) {
|
|
155
|
+
for (auto& j : c) vr->append(j);
|
|
156
|
+
}
|
|
157
|
+
return vr;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
void ArrayFormula::checkDimensions() {
|
|
161
|
+
if (!_array.back().empty() || _root != nullptr) addRow();
|
|
162
|
+
|
|
163
|
+
_row = _array.size() - 1;
|
|
164
|
+
_col = _array[0].size();
|
|
165
|
+
|
|
166
|
+
// Find the column count of the widest row
|
|
167
|
+
for (size_t i = 1; i < _row; i++) {
|
|
168
|
+
if (_array[i].size() > _col) _col = _array[i].size();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
for (size_t i = 0; i < _row; i++) {
|
|
172
|
+
size_t j = _array[i].size();
|
|
173
|
+
if (j != _col && _array[i][0] != nullptr && _array[i][0]->_type != AtomType::interText) {
|
|
174
|
+
// Fill the row with null atom
|
|
175
|
+
vector<sptr<Atom>>& r = _array[i];
|
|
176
|
+
for (; j < _col; j++) r.push_back(nullptr);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#ifndef MICROTEX_FORMULA_H
|
|
2
|
+
#define MICROTEX_FORMULA_H
|
|
3
|
+
|
|
4
|
+
#include <string>
|
|
5
|
+
#include <utility>
|
|
6
|
+
|
|
7
|
+
#include "core/parser.h"
|
|
8
|
+
|
|
9
|
+
namespace microtex {
|
|
10
|
+
|
|
11
|
+
class MiddleAtom;
|
|
12
|
+
class VRowAtom;
|
|
13
|
+
class CellSpecifier;
|
|
14
|
+
class Parser;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents a logical mathematical formula that will be displayed (by creating
|
|
18
|
+
* a Render from it and painting it) using algorithms that are based
|
|
19
|
+
* on the TeX algorithms.
|
|
20
|
+
*/
|
|
21
|
+
class Formula {
|
|
22
|
+
private:
|
|
23
|
+
// predefined TeX formulas
|
|
24
|
+
static std::map<std::string, sptr<Formula>> _predefFormulas;
|
|
25
|
+
static std::map<std::string, std::string> _predefFormulaStrs;
|
|
26
|
+
|
|
27
|
+
Parser _parser;
|
|
28
|
+
std::vector<sptr<MiddleAtom>> _middle;
|
|
29
|
+
|
|
30
|
+
public:
|
|
31
|
+
// character-to-symbol mappings
|
|
32
|
+
static const std::map<c32, std::string> _charToSymbol;
|
|
33
|
+
|
|
34
|
+
// the root atom of the "atom tree" that represents the formula
|
|
35
|
+
sptr<Atom> _root;
|
|
36
|
+
|
|
37
|
+
/** Create an empty Formula */
|
|
38
|
+
Formula();
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new Formula by parsing the given string (using a primitive
|
|
42
|
+
* TeX parser).
|
|
43
|
+
*
|
|
44
|
+
* @param tp the given TeXParser
|
|
45
|
+
* @param latex the string to be parsed
|
|
46
|
+
* @param preprocess if do preprocessing
|
|
47
|
+
* @param isMathMode if parse in math mode
|
|
48
|
+
*
|
|
49
|
+
* @throw ex_parse if the string could not be parsed correctly
|
|
50
|
+
*/
|
|
51
|
+
Formula(
|
|
52
|
+
const Parser& tp,
|
|
53
|
+
const std::string& latex,
|
|
54
|
+
bool preprocess = true,
|
|
55
|
+
bool isMathMode = true
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new Formula by parsing the given string (using a primitive
|
|
60
|
+
* TeX parser).
|
|
61
|
+
*
|
|
62
|
+
* @param latex the string to be parsed
|
|
63
|
+
* @param preprocess if do preprocessing
|
|
64
|
+
*
|
|
65
|
+
* @throw ex_parse if the string could not be parsed correctly
|
|
66
|
+
*/
|
|
67
|
+
explicit Formula(const std::string& latex, bool preprocess = true);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Change the text of the Formula and regenerate the root atom.
|
|
71
|
+
*
|
|
72
|
+
* @param latex the latex formula
|
|
73
|
+
*/
|
|
74
|
+
void setLaTeX(const std::string& latex);
|
|
75
|
+
|
|
76
|
+
const std::vector<sptr<MiddleAtom>>& middle();
|
|
77
|
+
|
|
78
|
+
/** Inserts an atom at the end of the current formula. */
|
|
79
|
+
Formula* add(const sptr<Atom>& a);
|
|
80
|
+
|
|
81
|
+
/** Convert this Formula into a box, with the given environment. */
|
|
82
|
+
sptr<Box> createBox(Env& env);
|
|
83
|
+
|
|
84
|
+
/** Test if this formula is in array mode. */
|
|
85
|
+
virtual bool isArrayMode() const { return false; }
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Get a predefined Formula.
|
|
89
|
+
*
|
|
90
|
+
* @param name the name of the predefined Formula
|
|
91
|
+
* @return the predefined Formula or nullptr if not found
|
|
92
|
+
*/
|
|
93
|
+
static sptr<Formula> get(const std::string& name);
|
|
94
|
+
|
|
95
|
+
virtual ~Formula() = default;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/** Represents a formula in array mode. */
|
|
99
|
+
class ArrayFormula : public Formula {
|
|
100
|
+
private:
|
|
101
|
+
size_t _row, _col;
|
|
102
|
+
|
|
103
|
+
public:
|
|
104
|
+
std::vector<std::vector<sptr<Atom>>> _array;
|
|
105
|
+
std::map<int, std::vector<sptr<CellSpecifier>>> _rowSpecifiers;
|
|
106
|
+
std::map<std::string, std::vector<sptr<CellSpecifier>>> _cellSpecifiers;
|
|
107
|
+
|
|
108
|
+
ArrayFormula();
|
|
109
|
+
|
|
110
|
+
void addCol();
|
|
111
|
+
|
|
112
|
+
void addCol(int n);
|
|
113
|
+
|
|
114
|
+
void insertAtomIntoCol(int col, const sptr<Atom>& atom);
|
|
115
|
+
|
|
116
|
+
void addRow();
|
|
117
|
+
|
|
118
|
+
void addRowSpecifier(const sptr<CellSpecifier>& spe);
|
|
119
|
+
|
|
120
|
+
void addCellSpecifier(const sptr<CellSpecifier>& spe);
|
|
121
|
+
|
|
122
|
+
int rows() const;
|
|
123
|
+
|
|
124
|
+
int cols() const;
|
|
125
|
+
|
|
126
|
+
sptr<VRowAtom> getAsVRow();
|
|
127
|
+
|
|
128
|
+
void checkDimensions();
|
|
129
|
+
|
|
130
|
+
bool isArrayMode() const override { return true; }
|
|
131
|
+
|
|
132
|
+
~ArrayFormula() override = default;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
} // namespace microtex
|
|
136
|
+
|
|
137
|
+
#endif // MICROTEX_FORMULA_H
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
#include "core/formula.h"
|
|
2
|
+
|
|
3
|
+
using namespace std;
|
|
4
|
+
using namespace microtex;
|
|
5
|
+
|
|
6
|
+
// clang-format off
|
|
7
|
+
const map<c32, string> Formula::_charToSymbol{
|
|
8
|
+
{'+', "plus"},
|
|
9
|
+
{'-', "minus"},
|
|
10
|
+
{'*', "ast"},
|
|
11
|
+
{'/', "slash"},
|
|
12
|
+
{'|', "vert"},
|
|
13
|
+
{'(', "lparen"},
|
|
14
|
+
{')', "rparen"},
|
|
15
|
+
{'[', "lbrack"},
|
|
16
|
+
{']', "rbrack"},
|
|
17
|
+
{'{', "lbrace"},
|
|
18
|
+
{'}', "rbrace"},
|
|
19
|
+
{',', "comma"},
|
|
20
|
+
{';', "semicolon"},
|
|
21
|
+
{'!', "exclam"},
|
|
22
|
+
{'?', "question"},
|
|
23
|
+
{'|', "vert"},
|
|
24
|
+
{':', "colon"},
|
|
25
|
+
{'=', "equal"},
|
|
26
|
+
{'>', "greater"},
|
|
27
|
+
{'<', "less"},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
map<string, string> Formula::_predefFormulaStrs{
|
|
31
|
+
{"qquad", "\\quad\\quad"},
|
|
32
|
+
{" ", "\\nbsp"},
|
|
33
|
+
// region dots
|
|
34
|
+
{"dotsc", "\\ldots"},
|
|
35
|
+
{"dots", "\\ldots"},
|
|
36
|
+
{"dotsb", "\\cdots"},
|
|
37
|
+
{"dotso", "\\ldots"},
|
|
38
|
+
{"dotsi", "\\!\\cdots"},
|
|
39
|
+
{"hdots", "\\ldots"},
|
|
40
|
+
// endregion
|
|
41
|
+
// region math symbols
|
|
42
|
+
{"relbar", "\\mathrel{\\smash-}"},
|
|
43
|
+
{"log", "\\mathop{\\mathrm{log}}\\nolimits"},
|
|
44
|
+
{"lg", "\\mathop{\\mathrm{lg}}\\nolimits"},
|
|
45
|
+
{"ln", "\\mathop{\\mathrm{ln}}\\nolimits"},
|
|
46
|
+
{"ln", "\\mathop{\\mathrm{ln}}\\nolimits"},
|
|
47
|
+
{"lim", "\\mathop{\\mathrm{lim}}"},
|
|
48
|
+
{"limsup", "\\mathop{\\mathrm{lim\\,sup}}"},
|
|
49
|
+
{"liminf", "\\mathop{\\mathrm{lim\\,inf}}"},
|
|
50
|
+
{"injlim", "\\mathop{\\mathrm{inj\\,lim}}"},
|
|
51
|
+
{"projlim", "\\mathop{\\mathrm{proj\\,lim}}"},
|
|
52
|
+
{"varinjlim", "\\mathop{\\underrightarrow{\\mathrm{lim}}}"},
|
|
53
|
+
{"varprojlim", "\\mathop{\\underleftarrow{\\mathrm{lim}}}"},
|
|
54
|
+
{"varliminf", "\\mathop{\\underline{\\mathrm{lim}}}"},
|
|
55
|
+
{"varlimsup", "\\mathop{\\overline{\\mathrm{lim}}}"},
|
|
56
|
+
{"sin", "\\mathop{\\mathrm{sin}}\\nolimits"},
|
|
57
|
+
{"arcsin", "\\mathop{\\mathrm{arcsin}}\\nolimits"},
|
|
58
|
+
{"sinh", "\\mathop{\\mathrm{sinh}}\\nolimits"},
|
|
59
|
+
{"cos", "\\mathop{\\mathrm{cos}}\\nolimits"},
|
|
60
|
+
{"arccos", "\\mathop{\\mathrm{arccos}}\\nolimits"},
|
|
61
|
+
{"cot", "\\mathop{\\mathrm{cot}}\\nolimits"},
|
|
62
|
+
{"arccot", "\\mathop{\\mathrm{arccot}}\\nolimits"},
|
|
63
|
+
{"cosh", "\\mathop{\\mathrm{cosh}}\\nolimits"},
|
|
64
|
+
{"tan", "\\mathop{\\mathrm{tan}}\\nolimits"},
|
|
65
|
+
{"arctan", "\\mathop{\\mathrm{arctan}}\\nolimits"},
|
|
66
|
+
{"tanh", "\\mathop{\\mathrm{tanh}}\\nolimits"},
|
|
67
|
+
{"coth", "\\mathop{\\mathrm{coth}}\\nolimits"},
|
|
68
|
+
{"sec", "\\mathop{\\mathrm{sec}}\\nolimits"},
|
|
69
|
+
{"arcsec", "\\mathop{\\mathrm{arcsec}}\\nolimits"},
|
|
70
|
+
{"arccsc", "\\mathop{\\mathrm{arccsc}}\\nolimits"},
|
|
71
|
+
{"sech", "\\mathop{\\mathrm{sech}}\\nolimits"},
|
|
72
|
+
{"csc", "\\mathop{\\mathrm{csc}}\\nolimits"},
|
|
73
|
+
{"csch", "\\mathop{\\mathrm{csch}}\\nolimits"},
|
|
74
|
+
{"max", "\\mathop{\\mathrm{max}}"},
|
|
75
|
+
{"min", "\\mathop{\\mathrm{min}}"},
|
|
76
|
+
{"sup", "\\mathop{\\mathrm{sup}}"},
|
|
77
|
+
{"inf", "\\mathop{\\mathrm{inf}}"},
|
|
78
|
+
{"arg", "\\mathop{\\mathrm{arg}}\\nolimits"},
|
|
79
|
+
{"ker", "\\mathop{\\mathrm{ker}}\\nolimits"},
|
|
80
|
+
{"dim", "\\mathop{\\mathrm{dim}}\\nolimits"},
|
|
81
|
+
{"hom", "\\mathop{\\mathrm{hom}}\\nolimits"},
|
|
82
|
+
{"det", "\\mathop{\\mathrm{det}}"},
|
|
83
|
+
{"exp", "\\mathop{\\mathrm{exp}}\\nolimits"},
|
|
84
|
+
{"Pr", "\\mathop{\\mathrm{Pr}}"},
|
|
85
|
+
{"gcd", "\\mathop{\\mathrm{gcd}}"},
|
|
86
|
+
{"deg", "\\mathop{\\mathrm{deg}}\\nolimits"},
|
|
87
|
+
{"bmod", "\\:\\mathbin{\\mathrm{mod}}\\:"},
|
|
88
|
+
// endregion
|
|
89
|
+
// region symbol alias
|
|
90
|
+
{"arrowvert", "\\vert"},
|
|
91
|
+
{"Arrowvert", "\\Vert"},
|
|
92
|
+
{"aa", "\\mathring{a}"},
|
|
93
|
+
{"AA", "\\mathring{A}"},
|
|
94
|
+
{"ddag", "\\ddagger"},
|
|
95
|
+
{"dag", "\\dagger"},
|
|
96
|
+
{"Doteq", "\\doteqdot"},
|
|
97
|
+
{"doublecup", "\\Cup"},
|
|
98
|
+
{"doublecap", "\\Cap"},
|
|
99
|
+
{"llless", "\\lll"},
|
|
100
|
+
{"gggtr", "\\ggg"},
|
|
101
|
+
{"copyright", "\\circledR"},
|
|
102
|
+
{"micro", "\\mu"},
|
|
103
|
+
{"rVert", "\\Vert"},
|
|
104
|
+
{"lVert", "\\Vert"},
|
|
105
|
+
{"lvert", "\\vert"},
|
|
106
|
+
{"rvert", "\\vert"},
|
|
107
|
+
// endregion
|
|
108
|
+
// region Greek
|
|
109
|
+
{"Alpha", "Α"},
|
|
110
|
+
{"Beta", "Β"},
|
|
111
|
+
{"Epsilon", "Ε"},
|
|
112
|
+
{"Zeta", "Ζ"},
|
|
113
|
+
{"Eta", "Η"},
|
|
114
|
+
{"Iota", "Ι"},
|
|
115
|
+
{"Kappa", "Κ"},
|
|
116
|
+
{"Mu", "Μ"},
|
|
117
|
+
{"Nu", "Ν"},
|
|
118
|
+
{"Omicron", "Ο"},
|
|
119
|
+
{"Rho", "Ρ"},
|
|
120
|
+
{"Tau", "Τ"},
|
|
121
|
+
{"Chi", "Χ"},
|
|
122
|
+
#if defined(WIN32)
|
|
123
|
+
{"Nabla", u8"\u2207"}, // win32 compat, ugly
|
|
124
|
+
#else
|
|
125
|
+
{"Nabla", "\u2207"},
|
|
126
|
+
#endif
|
|
127
|
+
{"omicron", "ο"},
|
|
128
|
+
// endregion
|
|
129
|
+
// region colons
|
|
130
|
+
{"ratio", "\\mathrel{\\colon}"},
|
|
131
|
+
{"minuscolon", "\\dashcolon"},
|
|
132
|
+
{"minuscoloncolon", "\\mathrel{\\minus\\nokern\\colon\\nokern\\colon}"},
|
|
133
|
+
{"simcolon", "\\mathrel{\\sim\\nokern\\colon}"},
|
|
134
|
+
{"simcoloncolon", "\\mathrel{\\sim\\nokern\\colon\\nokern\\colon}"},
|
|
135
|
+
{"approxcolon", "\\mathrel{\\approx\\nokern\\colon}"},
|
|
136
|
+
{"approxcoloncolon", "\\mathrel{\\approx\\nokern\\colon\\nokern\\colon}"},
|
|
137
|
+
{"coloncolon", "\\Colon"},
|
|
138
|
+
{"equalscolon", "\\eqcolon"},
|
|
139
|
+
{"equalscoloncolon", "\\mathrel{\\equal\\nokern\\colon\\nokern\\colon}"},
|
|
140
|
+
{"colonminus", "\\mathrel{\\reflectbox{\\dashcolon}}"},
|
|
141
|
+
{"coloncolonminus", "\\mathrel{\\colon\\nokern\\colon\\nokern\\minus}"},
|
|
142
|
+
{"colonequals", "\\mathrel{\\reflectbox{\\eqcolon}}"},
|
|
143
|
+
{"coloncolonequals", "\\mathrel{\\colon\\nokern\\colon\\nokern\\equal}"},
|
|
144
|
+
{"colonsim", "\\mathrel{\\colon\\nokern\\sim}"},
|
|
145
|
+
{"coloncolonsim", "\\mathrel{\\colon\\nokern\\colon\\nokern\\sim}"},
|
|
146
|
+
{"colonapprox", "\\mathrel{\\colon\\nokern\\approx}"},
|
|
147
|
+
{"coloncolonapprox", "\\mathrel{\\colon\\nokern\\colon\\nokern\\approx}"},
|
|
148
|
+
// endregion
|
|
149
|
+
{"celsius", "\\mathord{{}^\\circ\\mathrm{C}}"},
|
|
150
|
+
{"marker", "\\kern{0.25ex}\\rule{0.5ex}{1.2ex}\\kern{0.25ex}"},
|
|
151
|
+
{"hybull", "\\rule[0.6ex]{1ex}{0.2ex}"},
|
|
152
|
+
{"block", "\\rule{1ex}{1.2ex}"},
|
|
153
|
+
{"uhblk", "\\rule[0.6ex]{1ex}{0.6ex}"},
|
|
154
|
+
{"lhblk", "\\rule{1ex}{0.6ex}"},
|
|
155
|
+
{"Android", "\\large{🤖️}"},
|
|
156
|
+
{"AndroidTeX", "\\Android\\TeX"},
|
|
157
|
+
{"TeX", "\\mathrm{T\\kern-.15em\\raisebox{-.4ex}{E}\\kern-.15em X}"},
|
|
158
|
+
{"LaTeX", "\\mathrm{L\\kern-0.3em"
|
|
159
|
+
"\\raisebox{.45ex}{\\scalebox{0.7}{A}}"
|
|
160
|
+
"\\kern-.15em T\\kern-.15em"
|
|
161
|
+
"\\raisebox{-.4ex}{E}\\kern-.15em X}"},
|
|
162
|
+
{"IJ", "{I\\kern-0.065em J}"},
|
|
163
|
+
{"ij", "{i\\kern-0.065em j}"},
|
|
164
|
+
{"idotsint", "\\int\\cdots\\int"},
|
|
165
|
+
{"MicroTeX", "\\mathrm{\\mathit{\\mu}\\kern-.1em\\TeX}"},
|
|
166
|
+
};
|
|
167
|
+
// clang-format on
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#include "core/glue.h"
|
|
2
|
+
|
|
3
|
+
#include "box/box_single.h"
|
|
4
|
+
#include "env/env.h"
|
|
5
|
+
#include "env/units.h"
|
|
6
|
+
|
|
7
|
+
using namespace std;
|
|
8
|
+
using namespace microtex;
|
|
9
|
+
|
|
10
|
+
namespace {
|
|
11
|
+
constexpr int TYPE_COUNT = 8;
|
|
12
|
+
constexpr int STYLE_COUNT = 5;
|
|
13
|
+
|
|
14
|
+
// contains the different glue types
|
|
15
|
+
const Glue _glueTypes[4]{
|
|
16
|
+
{0, 0, 0},
|
|
17
|
+
{3, 0, 0},
|
|
18
|
+
{4, 4, 2},
|
|
19
|
+
{5, 0, 5},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
GLUE TABLE
|
|
24
|
+
Page 181 in [The TeXBook]
|
|
25
|
+
-------------------------------------------------------
|
|
26
|
+
ORD OP BIN REL OPEN CLOSE PUNCT INNER
|
|
27
|
+
ORD 0 1 (2) (3) 0 0 0 (1)
|
|
28
|
+
OP 1 1 * (3) 0 0 0 (1)
|
|
29
|
+
BIN (2) (2) * * (2) * * (2)
|
|
30
|
+
REL (3) (3) * 0 (3) 0 0 (3)
|
|
31
|
+
OPEN (0) 0 * 0 0 0 0 0
|
|
32
|
+
CLOSE (0) 1 (2) (3) 0 0 0 (1)
|
|
33
|
+
PUNCT (1) (1) * (1) (1) (1) (1) (1)
|
|
34
|
+
INNER (1) 1 (2) (3) (1) 0 (1) (1)
|
|
35
|
+
|
|
36
|
+
0: no space
|
|
37
|
+
1: thin space
|
|
38
|
+
2: medium space
|
|
39
|
+
3: thick space
|
|
40
|
+
|
|
41
|
+
The table entry is parenthesized if the space is to be inserted only in
|
|
42
|
+
display and text styles, not in script and scriptscript styles.
|
|
43
|
+
|
|
44
|
+
Some of the entries in the table are ‘*’; such cases never arise, because
|
|
45
|
+
Bin atoms must be preceded and followed by atoms compatible with the
|
|
46
|
+
nature of binary operations.
|
|
47
|
+
*/
|
|
48
|
+
const char _table[TYPE_COUNT][TYPE_COUNT][STYLE_COUNT]{
|
|
49
|
+
{"0000", "1111", "2200", "3300", "0000", "0000", "0000", "1100"},
|
|
50
|
+
{"1111", "1111", "0000", "3300", "0000", "0000", "0000", "1100"},
|
|
51
|
+
{"2200", "2200", "0000", "0000", "2200", "0000", "0000", "2200"},
|
|
52
|
+
{"3300", "3300", "0000", "0000", "3300", "0000", "0000", "3300"},
|
|
53
|
+
{"0000", "0000", "0000", "0000", "0000", "0000", "0000", "0000"},
|
|
54
|
+
{"0000", "1111", "2200", "3300", "0000", "0000", "0000", "1100"},
|
|
55
|
+
{"1100", "1100", "0000", "1100", "1100", "1100", "1100", "1100"},
|
|
56
|
+
{"1100", "1111", "2200", "3300", "1100", "0000", "1100", "1100"},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
float getFactor(const Env& env) {
|
|
60
|
+
return Units::fsize(UnitType::mu, 1.f, env);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const Glue& getGlue(SpaceType skipType) {
|
|
64
|
+
const i8 i = static_cast<i8>(skipType);
|
|
65
|
+
return _glueTypes[i < 0 ? -i : i];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
int indexOf(AtomType ltype, AtomType rtype, const Env& env) {
|
|
69
|
+
// types > INNER are considered of type ORD for glue calculations
|
|
70
|
+
AtomType l = (ltype > AtomType::inner ? AtomType::ordinary : ltype);
|
|
71
|
+
AtomType r = (rtype > AtomType::inner ? AtomType::ordinary : rtype);
|
|
72
|
+
const i8 k = static_cast<i8>(env.style()) / 2;
|
|
73
|
+
return _table[static_cast<u8>(l)][static_cast<u8>(r)][k] - '0';
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
} // namespace
|
|
77
|
+
|
|
78
|
+
sptr<GlueBox> Glue::createBox(const Env& env) const {
|
|
79
|
+
float factor = getFactor(env);
|
|
80
|
+
return sptrOf<GlueBox>(_space * factor, _stretch * factor, _shrink * factor);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
sptr<GlueBox> Glue::get(AtomType ltype, AtomType rtype, const Env& env) {
|
|
84
|
+
if (ltype == AtomType::none || rtype == AtomType::none) {
|
|
85
|
+
return sptrOf<GlueBox>(0.f, 0.f, 0.f);
|
|
86
|
+
}
|
|
87
|
+
int i = indexOf(ltype, rtype, env);
|
|
88
|
+
return _glueTypes[i].createBox(env);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
sptr<GlueBox> Glue::get(SpaceType skipType, const Env& env) {
|
|
92
|
+
const Glue& glue = getGlue(skipType);
|
|
93
|
+
auto b = glue.createBox(env);
|
|
94
|
+
if (static_cast<i8>(skipType) < 0) b->negWidth();
|
|
95
|
+
return b;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
float Glue::getSpace(AtomType ltype, AtomType rtype, const Env& env) {
|
|
99
|
+
int i = indexOf(ltype, rtype, env);
|
|
100
|
+
const Glue& glueType = _glueTypes[i];
|
|
101
|
+
return glueType._space * getFactor(env);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
float Glue::getSpace(SpaceType skipType, const Env& env) {
|
|
105
|
+
const Glue& glue = getGlue(skipType);
|
|
106
|
+
const auto v = glue._space * getFactor(env);
|
|
107
|
+
return static_cast<i8>(skipType) < 0 ? -v : v;
|
|
108
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#ifndef MICROTEX_GLUE_H
|
|
2
|
+
#define MICROTEX_GLUE_H
|
|
3
|
+
|
|
4
|
+
#include "utils/utils.h"
|
|
5
|
+
|
|
6
|
+
namespace microtex {
|
|
7
|
+
|
|
8
|
+
class Env;
|
|
9
|
+
|
|
10
|
+
class GlueBox;
|
|
11
|
+
|
|
12
|
+
/** Represents glue by its 3 components. Contains the "glue rules" */
|
|
13
|
+
class Glue {
|
|
14
|
+
private:
|
|
15
|
+
// the glue components, in "mu" unit
|
|
16
|
+
u16 _space, _stretch, _shrink;
|
|
17
|
+
|
|
18
|
+
sptr<GlueBox> createBox(const Env& env) const;
|
|
19
|
+
|
|
20
|
+
public:
|
|
21
|
+
no_copy_assign(Glue);
|
|
22
|
+
|
|
23
|
+
Glue(u16 space, u16 stretch, u16 shrink) noexcept
|
|
24
|
+
: _space(space), _stretch(stretch), _shrink(shrink) {}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates a box representing the glue type according to the "glue rules" based
|
|
28
|
+
* on the atom types between which the glue must be inserted.
|
|
29
|
+
*
|
|
30
|
+
* @param ltype left atom type
|
|
31
|
+
* @param rtype right atom type
|
|
32
|
+
* @param env the Env
|
|
33
|
+
* @return a box containing representing the glue
|
|
34
|
+
*/
|
|
35
|
+
static sptr<GlueBox> get(AtomType ltype, AtomType rtype, const Env& env);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Creates a box representing the glue type according to the "glue rules" based
|
|
39
|
+
* on the skip-type
|
|
40
|
+
*/
|
|
41
|
+
static sptr<GlueBox> get(SpaceType skipType, const Env& env);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Get the space amount from the given left-type and right-type of atoms
|
|
45
|
+
* according to the "glue rules".
|
|
46
|
+
*/
|
|
47
|
+
static float getSpace(AtomType ltype, AtomType rtype, const Env& env);
|
|
48
|
+
|
|
49
|
+
/** Get the space amount from the given skip-type according to the "glue rules" */
|
|
50
|
+
static float getSpace(SpaceType skipType, const Env& env);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace microtex
|
|
54
|
+
|
|
55
|
+
#endif // MICROTEX_GLUE_H
|