@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,756 @@
|
|
|
1
|
+
#include "atom/atom_matrix.h"
|
|
2
|
+
|
|
3
|
+
#include <memory>
|
|
4
|
+
|
|
5
|
+
#include "atom/atom_basic.h"
|
|
6
|
+
#include "atom/atom_row.h"
|
|
7
|
+
#include "core/formula.h"
|
|
8
|
+
#include "core/glue.h"
|
|
9
|
+
#include "env/env.h"
|
|
10
|
+
#include "utils/exceptions.h"
|
|
11
|
+
#include "utils/string_utils.h"
|
|
12
|
+
|
|
13
|
+
using namespace std;
|
|
14
|
+
using namespace microtex;
|
|
15
|
+
|
|
16
|
+
color MatrixAtom::LINE_COLOR = transparent;
|
|
17
|
+
|
|
18
|
+
map<string, string> MatrixAtom::_colspeReplacement;
|
|
19
|
+
|
|
20
|
+
SpaceAtom MatrixAtom::_hsep(UnitType::em, 1.f, 0.f, 0.f);
|
|
21
|
+
SpaceAtom MatrixAtom::_semihsep(UnitType::em, 0.5f, 0.f, 0.f);
|
|
22
|
+
SpaceAtom MatrixAtom::_vsep_in(UnitType::ex, 0.f, 1.f, 0.f);
|
|
23
|
+
SpaceAtom MatrixAtom::_vsep_ext_top(UnitType::ex, 0.f, 0.5f, 0.f);
|
|
24
|
+
SpaceAtom MatrixAtom::_vsep_ext_bot(UnitType::ex, 0.f, 0.5f, 0.f);
|
|
25
|
+
SpaceAtom MatrixAtom::_align(SpaceType::medMuSkip);
|
|
26
|
+
|
|
27
|
+
sptr<Box> MatrixAtom::_nullbox = StrutBox::empty();
|
|
28
|
+
|
|
29
|
+
void MatrixAtom::defineColumnSpecifier(const string& rep, const string& spe) {
|
|
30
|
+
_colspeReplacement[rep] = spe;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
void MatrixAtom::parsePositions(string opt, vector<Alignment>& lpos) {
|
|
34
|
+
int len = opt.length();
|
|
35
|
+
int pos = 0;
|
|
36
|
+
char ch;
|
|
37
|
+
sptr<Formula> tf;
|
|
38
|
+
sptr<Parser> tp;
|
|
39
|
+
// clear first
|
|
40
|
+
lpos.clear();
|
|
41
|
+
while (pos < len) {
|
|
42
|
+
ch = opt[pos];
|
|
43
|
+
switch (ch) {
|
|
44
|
+
case 'l': lpos.push_back(Alignment::left); break;
|
|
45
|
+
case 'r': lpos.push_back(Alignment::right); break;
|
|
46
|
+
case 'c': lpos.push_back(Alignment::center); break;
|
|
47
|
+
case '|': {
|
|
48
|
+
int nb = 1;
|
|
49
|
+
while (++pos < len) {
|
|
50
|
+
ch = opt[pos];
|
|
51
|
+
if (ch != '|') {
|
|
52
|
+
pos--;
|
|
53
|
+
break;
|
|
54
|
+
} else {
|
|
55
|
+
nb++;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
_vlines[lpos.size()] = sptrOf<VlineAtom>(nb);
|
|
59
|
+
} break;
|
|
60
|
+
case '@': {
|
|
61
|
+
pos++;
|
|
62
|
+
tf = sptrOf<Formula>();
|
|
63
|
+
tp = sptrOf<Parser>(_isPartial, opt.substr(pos), tf.get(), false);
|
|
64
|
+
auto atom = tp->getArgument();
|
|
65
|
+
// Keep columns same with the matrix
|
|
66
|
+
if (lpos.size() > _matrix->cols()) {
|
|
67
|
+
lpos.resize(_matrix->cols());
|
|
68
|
+
}
|
|
69
|
+
_matrix->insertAtomIntoCol(lpos.size(), atom);
|
|
70
|
+
|
|
71
|
+
lpos.push_back(Alignment::none);
|
|
72
|
+
pos += tp->getPos();
|
|
73
|
+
pos--;
|
|
74
|
+
} break;
|
|
75
|
+
case '*': {
|
|
76
|
+
pos++;
|
|
77
|
+
tf = sptrOf<Formula>();
|
|
78
|
+
tp = sptrOf<Parser>(_isPartial, opt.substr(pos), tf.get(), false);
|
|
79
|
+
vector<string> args;
|
|
80
|
+
tp->getOptsArgs(2, 0, args);
|
|
81
|
+
pos += tp->getPos();
|
|
82
|
+
int nrep = 0;
|
|
83
|
+
valueOf(args[1], nrep);
|
|
84
|
+
string str;
|
|
85
|
+
for (int j = 0; j < nrep; j++) str += args[2];
|
|
86
|
+
opt.insert(pos, str);
|
|
87
|
+
len = opt.length();
|
|
88
|
+
pos--;
|
|
89
|
+
} break;
|
|
90
|
+
case '>': {
|
|
91
|
+
pos++;
|
|
92
|
+
tf = sptrOf<ArrayFormula>();
|
|
93
|
+
tp = sptrOf<Parser>(_isPartial, opt.substr(pos), &(*tf), false);
|
|
94
|
+
sptr<Atom> cs = tp->getArgument();
|
|
95
|
+
_columnSpecifiers[lpos.size()] = cs;
|
|
96
|
+
pos += tp->getPos();
|
|
97
|
+
pos--;
|
|
98
|
+
} break;
|
|
99
|
+
case ' ':
|
|
100
|
+
case '\t': break;
|
|
101
|
+
default: {
|
|
102
|
+
int spos = len + 1;
|
|
103
|
+
bool hasrep = false;
|
|
104
|
+
while (--spos > pos) {
|
|
105
|
+
auto it = _colspeReplacement.find(opt.substr(pos, spos - pos));
|
|
106
|
+
if (it != _colspeReplacement.end()) {
|
|
107
|
+
hasrep = true;
|
|
108
|
+
opt.insert(spos, it->second);
|
|
109
|
+
len = opt.length();
|
|
110
|
+
pos = spos - 1;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (!hasrep) {
|
|
115
|
+
// Notify an error instead of using a default alignment
|
|
116
|
+
throw ex_parse("Invalid alignment in array environment!");
|
|
117
|
+
}
|
|
118
|
+
} break;
|
|
119
|
+
}
|
|
120
|
+
pos++;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
for (size_t j = lpos.size(); j < _matrix->cols(); j++) {
|
|
124
|
+
lpos.push_back(Alignment::center);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (lpos.empty()) lpos.push_back(Alignment::center);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
float* MatrixAtom::getColumnSep(Env& env, float width) {
|
|
131
|
+
const int cols = _matrix->cols();
|
|
132
|
+
auto* arr = new float[cols + 1]();
|
|
133
|
+
sptr<Box> Align, AlignSep, Hsep;
|
|
134
|
+
float h, w = env.textWidth();
|
|
135
|
+
int i = 0;
|
|
136
|
+
|
|
137
|
+
if (_matType == MatrixType::aligned || _matType == MatrixType::alignedAt) w = POS_INF;
|
|
138
|
+
|
|
139
|
+
switch (_matType) {
|
|
140
|
+
case MatrixType::array: {
|
|
141
|
+
// Array: (hsep_col/2 or 0) elem hsep_col elem hsep_col ... hsep_col elem (hsep_col/2 or 0)
|
|
142
|
+
Hsep = _hsep.createBox(env);
|
|
143
|
+
for (int i = 0; i < cols; i++) {
|
|
144
|
+
if (_position[i] == Alignment::none) {
|
|
145
|
+
arr[i] = arr[i + 1] = 0;
|
|
146
|
+
i++;
|
|
147
|
+
} else {
|
|
148
|
+
arr[i] = Hsep->_width;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (_spaceAround) {
|
|
152
|
+
const auto half = Hsep->_width / 2;
|
|
153
|
+
if (_position.front() != Alignment::none) arr[0] = half;
|
|
154
|
+
if (_position.back() != Alignment::none) arr[cols] = half;
|
|
155
|
+
}
|
|
156
|
+
return arr;
|
|
157
|
+
}
|
|
158
|
+
case MatrixType::matrix:
|
|
159
|
+
case MatrixType::smallMatrix: {
|
|
160
|
+
// Simple matrix: 0 elem hsep_col elem hsep_col ... hsep_col elem 0
|
|
161
|
+
arr[0] = 0;
|
|
162
|
+
arr[cols] = arr[0];
|
|
163
|
+
Hsep = _hsep.createBox(env);
|
|
164
|
+
for (i = 1; i < cols; i++) arr[i] = Hsep->_width;
|
|
165
|
+
return arr;
|
|
166
|
+
}
|
|
167
|
+
case MatrixType::aligned:
|
|
168
|
+
case MatrixType::align: {
|
|
169
|
+
// Align env: hsep = (textwidth - matwidth) / (2n + 1)
|
|
170
|
+
// Spaces: hsep eq_left \medskip eq_right hsep ... hsep elem hsep
|
|
171
|
+
Align = _align.createBox(env);
|
|
172
|
+
if (w != POS_INF) {
|
|
173
|
+
h = max((w - width - cols / 2 * Align->_width) / floor((cols + 3) / 2.f), 0.f);
|
|
174
|
+
AlignSep = sptrOf<StrutBox>(h, 0.f, 0.f, 0.f);
|
|
175
|
+
} else {
|
|
176
|
+
AlignSep = _hsep.createBox(env);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
arr[cols] = AlignSep->_width;
|
|
180
|
+
for (int i = 0; i < cols; i++) {
|
|
181
|
+
if (i % 2 == 0)
|
|
182
|
+
arr[i] = AlignSep->_width;
|
|
183
|
+
else
|
|
184
|
+
arr[i] = Align->_width;
|
|
185
|
+
}
|
|
186
|
+
} break;
|
|
187
|
+
case MatrixType::alignedAt:
|
|
188
|
+
case MatrixType::alignAt: {
|
|
189
|
+
// Aignat env: hsep = (textwidth - matwdith) / 2
|
|
190
|
+
// Spaces: hsep elem ... elem hsep
|
|
191
|
+
if (w != POS_INF)
|
|
192
|
+
h = max((w - width) / 2, 0.f);
|
|
193
|
+
else
|
|
194
|
+
h = 0;
|
|
195
|
+
Align = _align.createBox(env);
|
|
196
|
+
arr[0] = h;
|
|
197
|
+
arr[cols] = arr[0];
|
|
198
|
+
for (int i = 1; i < cols; i++) {
|
|
199
|
+
if (i % 2 == 0)
|
|
200
|
+
arr[i] = 0;
|
|
201
|
+
else
|
|
202
|
+
arr[i] = Align->_width;
|
|
203
|
+
}
|
|
204
|
+
} break;
|
|
205
|
+
case MatrixType::flAlign: {
|
|
206
|
+
// flalgin env : hsep = (textwidth - matwidth) / (2n + 1)
|
|
207
|
+
// Spaces: hsep eq_left \medskip el_right hsep ... hsep elem hsep
|
|
208
|
+
Align = _align.createBox(env);
|
|
209
|
+
if (w != POS_INF) {
|
|
210
|
+
h = max((w - width - (cols / 2) * Align->_width) / floor((cols - 1) / 2.f), 0.f);
|
|
211
|
+
AlignSep = sptrOf<StrutBox>(h, 0.f, 0.f, 0.f);
|
|
212
|
+
} else {
|
|
213
|
+
AlignSep = _hsep.createBox(env);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
arr[0] = 0;
|
|
217
|
+
arr[cols] = arr[0];
|
|
218
|
+
for (int i = 1; i < cols; i++) {
|
|
219
|
+
if (i % 2 == 0)
|
|
220
|
+
arr[i] = AlignSep->_width;
|
|
221
|
+
else
|
|
222
|
+
arr[i] = Align->_width;
|
|
223
|
+
}
|
|
224
|
+
} break;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (w == POS_INF) {
|
|
228
|
+
arr[0] = 0;
|
|
229
|
+
arr[cols] = arr[0];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return arr;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
void MatrixAtom::recalculateLine(
|
|
236
|
+
const int rows,
|
|
237
|
+
sptr<Box>** boxarr,
|
|
238
|
+
vector<sptr<Atom>>& multiRows,
|
|
239
|
+
float* height,
|
|
240
|
+
float* depth,
|
|
241
|
+
float drt,
|
|
242
|
+
float vspace
|
|
243
|
+
) {
|
|
244
|
+
const size_t s = multiRows.size();
|
|
245
|
+
for (size_t i = 0; i < s; i++) {
|
|
246
|
+
auto* m = (MultiRowAtom*)multiRows[i].get();
|
|
247
|
+
const int r = m->_i;
|
|
248
|
+
const int c = m->_j;
|
|
249
|
+
int n = m->_n;
|
|
250
|
+
int skipped = 0;
|
|
251
|
+
float h = 0;
|
|
252
|
+
if (n < 0) {
|
|
253
|
+
// Across from bottom to top
|
|
254
|
+
int j = r;
|
|
255
|
+
for (; j >= 0 && j > r + n; j--) {
|
|
256
|
+
if (boxarr[j][0]->_type == AtomType::hline) {
|
|
257
|
+
if (j == 0) break;
|
|
258
|
+
h += drt;
|
|
259
|
+
n--;
|
|
260
|
+
} else {
|
|
261
|
+
skipped++;
|
|
262
|
+
h += height[j] + depth[j] + vspace;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
m->_i = ++j;
|
|
266
|
+
auto tmp = boxarr[r][c];
|
|
267
|
+
boxarr[r][c] = boxarr[j][c];
|
|
268
|
+
boxarr[j][c] = tmp;
|
|
269
|
+
} else {
|
|
270
|
+
// Across from top to bottom
|
|
271
|
+
for (int j = r; j < r + n && j < rows; j++) {
|
|
272
|
+
if (boxarr[j][0]->_type == AtomType::hline) {
|
|
273
|
+
if (j == rows - 1) break;
|
|
274
|
+
h += drt;
|
|
275
|
+
n++;
|
|
276
|
+
} else {
|
|
277
|
+
skipped++;
|
|
278
|
+
h += height[j] + depth[j] + vspace;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
m->_n = abs(n);
|
|
283
|
+
auto b = boxarr[m->_i][m->_j];
|
|
284
|
+
const float bh = b->_height + b->_depth + vspace;
|
|
285
|
+
if (h > bh) {
|
|
286
|
+
b->_height = (h - bh + vspace) / 2.f;
|
|
287
|
+
} else if (h < bh) {
|
|
288
|
+
const float ex = (bh - h) / skipped / 2.f;
|
|
289
|
+
const int mr = m->_i + m->_n;
|
|
290
|
+
for (int j = m->_i; j < mr; j++) {
|
|
291
|
+
if (boxarr[j][0]->_type != AtomType::hline) {
|
|
292
|
+
height[j] += ex;
|
|
293
|
+
depth[j] += ex;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
b->_height = height[m->_i];
|
|
297
|
+
b->_depth = bh - b->_height - vspace;
|
|
298
|
+
}
|
|
299
|
+
boxarr[m->_i][m->_j]->_type = AtomType::none;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
sptr<Box> MatrixAtom::generateMulticolumn(
|
|
304
|
+
Env& env,
|
|
305
|
+
const sptr<Box>& b,
|
|
306
|
+
const float* hsep,
|
|
307
|
+
const float* colWidth,
|
|
308
|
+
int i,
|
|
309
|
+
int j
|
|
310
|
+
) {
|
|
311
|
+
float w = 0;
|
|
312
|
+
auto* mca = (MulticolumnAtom*)(_matrix->_array[i][j].get());
|
|
313
|
+
int k, n = mca->skipped();
|
|
314
|
+
for (k = j; k < j + n - 1; k++) {
|
|
315
|
+
w += colWidth[k] + hsep[k + 1];
|
|
316
|
+
auto it = _vlines.find(k + 1);
|
|
317
|
+
if (it != _vlines.end()) w += it->second->getWidth(env);
|
|
318
|
+
}
|
|
319
|
+
w += colWidth[k];
|
|
320
|
+
|
|
321
|
+
if (mca->isNeedWidth() && mca->colWidth() <= PREC) {
|
|
322
|
+
mca->setColWidth(w);
|
|
323
|
+
return mca->createBox(env);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (b->_width >= w) return b;
|
|
327
|
+
|
|
328
|
+
return sptrOf<HBox>(b, w, mca->align());
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
MatrixAtom::MatrixAtom(
|
|
332
|
+
bool isPartial,
|
|
333
|
+
const sptr<ArrayFormula>& arr,
|
|
334
|
+
const string& options,
|
|
335
|
+
bool spaceAround
|
|
336
|
+
) {
|
|
337
|
+
_matrix = arr;
|
|
338
|
+
_matType = MatrixType::array;
|
|
339
|
+
_isPartial = isPartial;
|
|
340
|
+
_spaceAround = spaceAround;
|
|
341
|
+
parsePositions(string(options), _position);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
MatrixAtom::MatrixAtom(bool isPartial, const sptr<ArrayFormula>& arr, const string& options) {
|
|
345
|
+
_matrix = arr;
|
|
346
|
+
_matType = MatrixType::array;
|
|
347
|
+
_isPartial = isPartial;
|
|
348
|
+
_spaceAround = false;
|
|
349
|
+
parsePositions(string(options), _position);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
MatrixAtom::MatrixAtom(bool isPartial, const sptr<ArrayFormula>& arr, MatrixType type) {
|
|
353
|
+
_matrix = arr;
|
|
354
|
+
_matType = type;
|
|
355
|
+
_isPartial = isPartial;
|
|
356
|
+
_spaceAround = false;
|
|
357
|
+
|
|
358
|
+
const int cols = arr->cols();
|
|
359
|
+
if (type != MatrixType::matrix && type != MatrixType::smallMatrix) {
|
|
360
|
+
_position.resize(cols);
|
|
361
|
+
for (size_t i = 0; i < cols; i += 2) {
|
|
362
|
+
_position[i] = Alignment::right;
|
|
363
|
+
if (i + 1 < cols) _position[i + 1] = Alignment::left;
|
|
364
|
+
}
|
|
365
|
+
} else {
|
|
366
|
+
_position.resize(cols);
|
|
367
|
+
for (size_t i = 0; i < cols; i++) _position[i] = Alignment::center;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
void MatrixAtom::applyCell(WrapperBox& box, int i, int j) {
|
|
372
|
+
// 1. apply column specifier
|
|
373
|
+
const auto col = _columnSpecifiers.find(j);
|
|
374
|
+
if (col != _columnSpecifiers.end()) {
|
|
375
|
+
auto spe = col->second;
|
|
376
|
+
RowAtom* p = nullptr;
|
|
377
|
+
auto* r = dynamic_cast<RowAtom*>(spe.get());
|
|
378
|
+
while (r != nullptr) {
|
|
379
|
+
spe = r->getFirstAtom();
|
|
380
|
+
p = r;
|
|
381
|
+
r = dynamic_cast<RowAtom*>(spe.get());
|
|
382
|
+
}
|
|
383
|
+
if (p != nullptr) {
|
|
384
|
+
for (size_t k = 0; k < p->size(); k++) {
|
|
385
|
+
CellSpecifier* s = dynamic_cast<CellSpecifier*>(p->get(k).get());
|
|
386
|
+
if (s != nullptr) {
|
|
387
|
+
s->apply(box);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
// 2. apply row specifier
|
|
393
|
+
const auto row = _matrix->_rowSpecifiers.find(i);
|
|
394
|
+
if (row != _matrix->_rowSpecifiers.end()) {
|
|
395
|
+
for (const auto& s : row->second) s->apply(box);
|
|
396
|
+
}
|
|
397
|
+
// 3. apply cell specifier
|
|
398
|
+
const string key = toString(i) + toString(j);
|
|
399
|
+
auto cell = _matrix->_cellSpecifiers.find(key);
|
|
400
|
+
if (cell != _matrix->_cellSpecifiers.end()) {
|
|
401
|
+
for (const auto& s : cell->second) s->apply(box);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
sptr<Box> MatrixAtom::createBoxInner(Env& env) {
|
|
406
|
+
const int rows = _matrix->rows();
|
|
407
|
+
const int cols = _matrix->cols();
|
|
408
|
+
|
|
409
|
+
auto lineDepth = new float[rows]();
|
|
410
|
+
auto lineHeight = new float[rows]();
|
|
411
|
+
auto colWidth = new float[cols]();
|
|
412
|
+
auto boxarr = new sptr<Box>*[rows]();
|
|
413
|
+
for (int i = 0; i < rows; i++) boxarr[i] = new sptr<Box>[cols]();
|
|
414
|
+
|
|
415
|
+
float matW = 0;
|
|
416
|
+
const auto drt = env.ruleThickness();
|
|
417
|
+
|
|
418
|
+
// multi-column & multi-row atoms
|
|
419
|
+
vector<sptr<Atom>> multiCols;
|
|
420
|
+
vector<sptr<Atom>> multiRows;
|
|
421
|
+
for (int i = 0; i < rows; i++) {
|
|
422
|
+
lineDepth[i] = 0;
|
|
423
|
+
lineHeight[i] = 0;
|
|
424
|
+
const int size = _matrix->_array[i].size();
|
|
425
|
+
for (int j = 0; j < cols; j++) {
|
|
426
|
+
if (j >= size) {
|
|
427
|
+
// If current row is not full-filled, fill the row with _nullbox
|
|
428
|
+
for (int k = j; k < cols; k++) boxarr[i][k] = _nullbox;
|
|
429
|
+
break;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
sptr<Atom> atom = _matrix->_array[i][j];
|
|
433
|
+
boxarr[i][j] = (atom == nullptr) ? _nullbox : atom->createBox(env);
|
|
434
|
+
if (atom != nullptr && atom->_type == AtomType::interText) {
|
|
435
|
+
boxarr[i][j]->_type = AtomType::interText;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
if (boxarr[i][j]->_type != AtomType::multiRow) {
|
|
439
|
+
// Find the highest line (row)
|
|
440
|
+
lineDepth[i] = max(boxarr[i][j]->_depth, lineDepth[i]);
|
|
441
|
+
lineHeight[i] = max(boxarr[i][j]->_height, lineHeight[i]);
|
|
442
|
+
} else {
|
|
443
|
+
auto* mra = (MultiRowAtom*)atom.get();
|
|
444
|
+
mra->setRowColumn(i, j);
|
|
445
|
+
multiRows.push_back(atom);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (boxarr[i][j]->_type != AtomType::multiColumn) {
|
|
449
|
+
// Find the widest column
|
|
450
|
+
colWidth[j] = max(boxarr[i][j]->_width, colWidth[j]);
|
|
451
|
+
} else {
|
|
452
|
+
auto* mca = (MulticolumnAtom*)atom.get();
|
|
453
|
+
mca->setRowColumn(i, j);
|
|
454
|
+
multiCols.push_back(atom);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
for (int j = 0; j < cols; j++) matW += colWidth[j];
|
|
460
|
+
|
|
461
|
+
// The horizontal separator's width
|
|
462
|
+
float* Hsep = getColumnSep(env, matW);
|
|
463
|
+
|
|
464
|
+
for (auto& i : multiCols) {
|
|
465
|
+
auto* multi = (MulticolumnAtom*)i.get();
|
|
466
|
+
const int c = multi->col(), r = multi->row(), n = multi->skipped();
|
|
467
|
+
float w = 0;
|
|
468
|
+
int j = 0;
|
|
469
|
+
for (j = c; j < c + n - 1; j++) w += colWidth[j] + Hsep[j + 1];
|
|
470
|
+
w += colWidth[j];
|
|
471
|
+
if (boxarr[r][c]->_width > w) {
|
|
472
|
+
// If the multi-column's width > the total width of the acrossed columns,
|
|
473
|
+
// add an extra-space to each column
|
|
474
|
+
matW += boxarr[r][c]->_width - w;
|
|
475
|
+
const float extraW = (boxarr[r][c]->_width - w) / n;
|
|
476
|
+
for (int k = c; k < c + n; k++) colWidth[k] += extraW;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// Add separator's space to the matrix width
|
|
481
|
+
for (int j = 0; j < cols + 1; j++) {
|
|
482
|
+
matW += Hsep[j];
|
|
483
|
+
auto it = _vlines.find(j);
|
|
484
|
+
if (it != _vlines.end()) matW += it->second->getWidth(env);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
auto Vsep = _vsep_in.createBox(env);
|
|
488
|
+
// Recalculate the height of the row
|
|
489
|
+
recalculateLine(rows, boxarr, multiRows, lineHeight, lineDepth, drt, Vsep->_height);
|
|
490
|
+
|
|
491
|
+
auto* vb = new VBox();
|
|
492
|
+
float totalHeight = 0;
|
|
493
|
+
float Vspace = Vsep->_height / 2;
|
|
494
|
+
|
|
495
|
+
for (int i = 0; i < rows; i++) {
|
|
496
|
+
auto hb = sptrOf<HBox>();
|
|
497
|
+
for (int j = 0; j < cols; j++) {
|
|
498
|
+
switch (boxarr[i][j]->_type) {
|
|
499
|
+
case AtomType::none:
|
|
500
|
+
case AtomType::multiColumn: {
|
|
501
|
+
if (j == 0) {
|
|
502
|
+
auto it = _vlines.find(0);
|
|
503
|
+
if (it != _vlines.end()) {
|
|
504
|
+
auto vat = it->second;
|
|
505
|
+
vat->_height = lineHeight[i] + lineDepth[i] + Vsep->_height;
|
|
506
|
+
vat->_shift = lineDepth[i] + Vspace;
|
|
507
|
+
auto vatBox = vat->createBox(env);
|
|
508
|
+
hb->add(vatBox);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
bool isLastVline = true;
|
|
513
|
+
|
|
514
|
+
WrapperBox* wb = nullptr;
|
|
515
|
+
int tj = j;
|
|
516
|
+
float l = j == 0 ? Hsep[j] : Hsep[j] / 2;
|
|
517
|
+
if (boxarr[i][j]->_type == AtomType::none) {
|
|
518
|
+
wb = new WrapperBox(
|
|
519
|
+
boxarr[i][j],
|
|
520
|
+
colWidth[j],
|
|
521
|
+
lineHeight[i],
|
|
522
|
+
lineDepth[i],
|
|
523
|
+
_position[j] //
|
|
524
|
+
);
|
|
525
|
+
} else {
|
|
526
|
+
auto b = generateMulticolumn(env, boxarr[i][j], Hsep, colWidth, i, j);
|
|
527
|
+
auto* matom = (MulticolumnAtom*)_matrix->_array[i][j].get();
|
|
528
|
+
j += matom->skipped() - 1;
|
|
529
|
+
wb = new WrapperBox(b, b->_width, lineHeight[i], lineDepth[i], Alignment::left);
|
|
530
|
+
isLastVline = matom->hasRightVline();
|
|
531
|
+
}
|
|
532
|
+
float r = j == cols - 1 ? Hsep[j + 1] : Hsep[j + 1] / 2;
|
|
533
|
+
wb->addInsets(l, Vspace, r, Vspace);
|
|
534
|
+
applyCell(*wb, i, j);
|
|
535
|
+
sptr<Box> swb(wb);
|
|
536
|
+
boxarr[i][tj] = swb;
|
|
537
|
+
hb->add(swb);
|
|
538
|
+
|
|
539
|
+
auto it = _vlines.find(j + 1);
|
|
540
|
+
if (isLastVline && it != _vlines.end()) {
|
|
541
|
+
auto vat = it->second;
|
|
542
|
+
vat->_height = lineHeight[i] + lineDepth[i] + Vsep->_height;
|
|
543
|
+
vat->_shift = lineDepth[i] + Vspace;
|
|
544
|
+
auto vatBox = vat->createBox(env);
|
|
545
|
+
hb->add(vatBox);
|
|
546
|
+
}
|
|
547
|
+
} break;
|
|
548
|
+
|
|
549
|
+
case AtomType::interText: {
|
|
550
|
+
float f = env.textWidth();
|
|
551
|
+
f = f == POS_INF ? colWidth[j] : f;
|
|
552
|
+
hb = sptrOf<HBox>(boxarr[i][j], f, Alignment::left);
|
|
553
|
+
j = cols;
|
|
554
|
+
} break;
|
|
555
|
+
|
|
556
|
+
case AtomType::hline: {
|
|
557
|
+
auto* at = (HlineAtom*)_matrix->_array[i][j].get();
|
|
558
|
+
at->setColor(LINE_COLOR);
|
|
559
|
+
at->setWidth(matW);
|
|
560
|
+
if (i >= 1 && dynamic_cast<HlineAtom*>(_matrix->_array[i - 1][j].get()) != nullptr) {
|
|
561
|
+
hb->add(sptrOf<StrutBox>(0.f, 2 * drt, 0.f, 0.f));
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
hb->add(at->createBox(env));
|
|
565
|
+
j = cols;
|
|
566
|
+
} break;
|
|
567
|
+
default: {
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
if (boxarr[i][0]->_type != AtomType::hline) {
|
|
573
|
+
hb->_height = lineHeight[i] + Vspace;
|
|
574
|
+
hb->_depth = lineDepth[i] + Vspace;
|
|
575
|
+
}
|
|
576
|
+
vb->add(hb);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
totalHeight = vb->_height + vb->_depth;
|
|
580
|
+
|
|
581
|
+
const auto axis = env.axisHeight();
|
|
582
|
+
vb->_height = totalHeight / 2 + axis;
|
|
583
|
+
vb->_depth = totalHeight / 2 - axis;
|
|
584
|
+
|
|
585
|
+
delete[] Hsep;
|
|
586
|
+
delete[] lineDepth;
|
|
587
|
+
delete[] lineHeight;
|
|
588
|
+
delete[] colWidth;
|
|
589
|
+
for (int i = 0; i < rows; i++) delete[] boxarr[i];
|
|
590
|
+
delete[] boxarr;
|
|
591
|
+
|
|
592
|
+
return sptr<Box>(vb);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
sptr<Box> MatrixAtom::createBox(Env& env) {
|
|
596
|
+
if (_matType == MatrixType::smallMatrix) {
|
|
597
|
+
return env.withStyle(TexStyle::script, [this](auto& script) { return createBoxInner(script); });
|
|
598
|
+
} /* else if (_matType == MatrixType::matrix) {
|
|
599
|
+
return env.withStyle(
|
|
600
|
+
TexStyle::text,
|
|
601
|
+
[this](auto& text) { return createBoxInner(text); }
|
|
602
|
+
);
|
|
603
|
+
}*/
|
|
604
|
+
return createBoxInner(env);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/*************************************** multicolumn atoms ****************************************/
|
|
608
|
+
|
|
609
|
+
Alignment MulticolumnAtom::parseAlign(const string& str) {
|
|
610
|
+
int pos = 0;
|
|
611
|
+
int len = str.length();
|
|
612
|
+
Alignment align = Alignment::center;
|
|
613
|
+
bool first = true;
|
|
614
|
+
while (pos < len) {
|
|
615
|
+
char c = str[pos];
|
|
616
|
+
switch (c) {
|
|
617
|
+
case 'l': {
|
|
618
|
+
align = Alignment::left;
|
|
619
|
+
first = false;
|
|
620
|
+
} break;
|
|
621
|
+
case 'r': {
|
|
622
|
+
align = Alignment::right;
|
|
623
|
+
first = false;
|
|
624
|
+
} break;
|
|
625
|
+
case 'c': {
|
|
626
|
+
align = Alignment::center;
|
|
627
|
+
first = false;
|
|
628
|
+
} break;
|
|
629
|
+
case '|': {
|
|
630
|
+
if (first) {
|
|
631
|
+
_beforeVlines = 1;
|
|
632
|
+
} else {
|
|
633
|
+
_afterVlines = 1;
|
|
634
|
+
}
|
|
635
|
+
while (++pos < len) {
|
|
636
|
+
c = str[pos];
|
|
637
|
+
if (c != '|') {
|
|
638
|
+
pos--;
|
|
639
|
+
break;
|
|
640
|
+
} else {
|
|
641
|
+
if (first)
|
|
642
|
+
_beforeVlines++;
|
|
643
|
+
else
|
|
644
|
+
_afterVlines++;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
} break;
|
|
648
|
+
}
|
|
649
|
+
pos++;
|
|
650
|
+
}
|
|
651
|
+
return align;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
sptr<Box> MulticolumnAtom::createBox(Env& env) {
|
|
655
|
+
auto atom = _cols == nullptr ? sptrOf<EmptyAtom>() : _cols;
|
|
656
|
+
sptr<Box> b = _width == 0 ? atom->createBox(env)
|
|
657
|
+
: sptrOf<HBox>(atom->createBox(env), _width, _align);
|
|
658
|
+
b->_type = AtomType::multiColumn;
|
|
659
|
+
return b;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
sptr<Box> HdotsforAtom::createBox(float space, const sptr<Box>& b, Env& env) {
|
|
663
|
+
auto sb = sptrOf<StrutBox>(0.f, space, 0.f, 0.f);
|
|
664
|
+
auto vb = sptrOf<VBox>();
|
|
665
|
+
vb->add(sb);
|
|
666
|
+
vb->add(b);
|
|
667
|
+
vb->add(sb);
|
|
668
|
+
vb->_type = AtomType::multiColumn;
|
|
669
|
+
return vb;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
sptr<Box> HdotsforAtom::createBox(Env& env) {
|
|
673
|
+
auto dot = _cols->createBox(env);
|
|
674
|
+
float space = Glue::getSpace(SpaceType::thinMuSkip, env) * _coeff * 2;
|
|
675
|
+
|
|
676
|
+
// If no width specified, create a box with one dot
|
|
677
|
+
if (_width == 0) return createBox(space, dot, env);
|
|
678
|
+
|
|
679
|
+
float x = (_width - dot->_width) / (space + dot->_width);
|
|
680
|
+
int count = (int)floor(x);
|
|
681
|
+
|
|
682
|
+
// Only one dot can be placed in
|
|
683
|
+
if (count == 0) {
|
|
684
|
+
auto b = sptrOf<HBox>(dot, _width, Alignment::center);
|
|
685
|
+
return createBox(space, b, env);
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
// Adjust the space between
|
|
689
|
+
space += (x - count) * space / count;
|
|
690
|
+
auto sb = sptrOf<StrutBox>(space, 0.f, 0.f, 0.f);
|
|
691
|
+
auto b = sptrOf<HBox>();
|
|
692
|
+
for (int i = 0; i < count; i++) {
|
|
693
|
+
b->add(dot);
|
|
694
|
+
b->add(sb);
|
|
695
|
+
}
|
|
696
|
+
b->add(dot);
|
|
697
|
+
|
|
698
|
+
auto hb = sptrOf<HBox>(b, _width, Alignment::center);
|
|
699
|
+
return createBox(space, hb, env);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
float VlineAtom::getWidth(Env& env) const {
|
|
703
|
+
return _n == 0 ? 0 : env.ruleThickness() * (3 * _n - 2);
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
sptr<Box> VlineAtom::createBox(Env& env) {
|
|
707
|
+
if (_n == 0) return StrutBox::empty();
|
|
708
|
+
|
|
709
|
+
const auto drt = env.ruleThickness();
|
|
710
|
+
auto rb = sptrOf<RuleBox>(_height, drt, _shift, MatrixAtom::LINE_COLOR, true);
|
|
711
|
+
auto sep = sptrOf<StrutBox>(2 * drt, 0.f, 0.f, 0.f);
|
|
712
|
+
auto hb = new HBox();
|
|
713
|
+
for (int i = 0; i < _n - 1; i++) {
|
|
714
|
+
hb->add(rb);
|
|
715
|
+
hb->add(sep);
|
|
716
|
+
}
|
|
717
|
+
if (_n > 0) hb->add(rb);
|
|
718
|
+
return sptr<Box>(hb);
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
SpaceAtom MultlineAtom::_vsep_in(UnitType::ex, 0.f, 1.f, 0.f);
|
|
722
|
+
|
|
723
|
+
sptr<Box> MultlineAtom::createBox(Env& env) {
|
|
724
|
+
float tw = env.textWidth();
|
|
725
|
+
if (tw == POS_INF || _lineType == MultiLineType::gathered)
|
|
726
|
+
return MatrixAtom(_isPartial, _column, "").createBox(env);
|
|
727
|
+
|
|
728
|
+
auto* vb = new VBox();
|
|
729
|
+
auto atom = _column->_array[0][0];
|
|
730
|
+
Alignment alignment = _lineType == MultiLineType::gather ? Alignment::center : Alignment::left;
|
|
731
|
+
if (atom->_alignment != Alignment::none) alignment = atom->_alignment;
|
|
732
|
+
|
|
733
|
+
vb->add(sptrOf<HBox>(atom->createBox(env), tw, alignment));
|
|
734
|
+
auto Vsep = _vsep_in.createBox(env);
|
|
735
|
+
for (size_t i = 1; i < _column->rows() - 1; i++) {
|
|
736
|
+
atom = _column->_array[i][0];
|
|
737
|
+
alignment = Alignment::center;
|
|
738
|
+
if (atom->_alignment != Alignment::none) alignment = atom->_alignment;
|
|
739
|
+
vb->add(Vsep);
|
|
740
|
+
vb->add(sptrOf<HBox>(atom->createBox(env), tw, alignment));
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
if (_column->rows() > 1) {
|
|
744
|
+
atom = _column->_array[_column->rows() - 1][0];
|
|
745
|
+
alignment = _lineType == MultiLineType::gather ? Alignment::center : Alignment::right;
|
|
746
|
+
if (atom->_alignment != Alignment::none) alignment = atom->_alignment;
|
|
747
|
+
vb->add(Vsep);
|
|
748
|
+
vb->add(sptrOf<HBox>(atom->createBox(env), tw, alignment));
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
float h = vb->_height + vb->_depth;
|
|
752
|
+
vb->_height = h / 2;
|
|
753
|
+
vb->_depth = h / 2;
|
|
754
|
+
|
|
755
|
+
return sptr<Box>(vb);
|
|
756
|
+
}
|