@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,182 @@
|
|
|
1
|
+
#include "atom/atom_scripts.h"
|
|
2
|
+
|
|
3
|
+
#include "atom/atom_accent.h"
|
|
4
|
+
#include "atom/atom_basic.h"
|
|
5
|
+
#include "atom/atom_char.h"
|
|
6
|
+
#include "atom/atom_stack.h"
|
|
7
|
+
|
|
8
|
+
using namespace microtex;
|
|
9
|
+
using namespace std;
|
|
10
|
+
|
|
11
|
+
sptr<Box> ScriptsAtom::createBox(Env& env) {
|
|
12
|
+
// if no base was given, use a phantom 'M' to place scripts
|
|
13
|
+
if (_base == nullptr) {
|
|
14
|
+
auto in = sptrOf<CharAtom>('M', FontStyle::rm, false);
|
|
15
|
+
_base = sptrOf<PhantomAtom>(in, false, true, true);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// no scripts
|
|
19
|
+
if (_sub == nullptr && _sup == nullptr) {
|
|
20
|
+
return _base->createBox(env);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// display as limits
|
|
24
|
+
// clang-format off
|
|
25
|
+
if (_base->_limitsType == LimitsType::limits ||
|
|
26
|
+
(_base->_limitsType == LimitsType::normal && env.style() == TexStyle::display)
|
|
27
|
+
) {
|
|
28
|
+
// clang-format on
|
|
29
|
+
const auto& over = StackArgs::autoSpace(_sup);
|
|
30
|
+
const auto& under = StackArgs::autoSpace(_sub);
|
|
31
|
+
return StackAtom(_base, over, under).createBox(env);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const auto& [base, scripts, space, kern, reduce, italic] = createScripts(env);
|
|
35
|
+
const auto hbox = sptrOf<HBox>();
|
|
36
|
+
if (_onRight) {
|
|
37
|
+
hbox->add(base);
|
|
38
|
+
if (std::abs(reduce + kern) > PREC) hbox->add(StrutBox::create(reduce + kern));
|
|
39
|
+
hbox->add(scripts);
|
|
40
|
+
hbox->add(StrutBox::create(space));
|
|
41
|
+
} else {
|
|
42
|
+
hbox->add(StrutBox::create(space));
|
|
43
|
+
hbox->add(scripts);
|
|
44
|
+
if (std::abs(reduce + kern) > PREC) hbox->add(StrutBox::create(reduce + kern));
|
|
45
|
+
hbox->add(base);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return hbox;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
ScriptResult ScriptsAtom::createScripts(Env& env) {
|
|
52
|
+
// params to place scripts
|
|
53
|
+
sptr<Box> kernel, base;
|
|
54
|
+
float delta = 0.f;
|
|
55
|
+
bool isText = false, isOperator = false;
|
|
56
|
+
const MathKernRecord* kernRecord = nullptr;
|
|
57
|
+
|
|
58
|
+
const auto checkAtom = [&](const sptr<Atom>& atom, Env& targetEnv) {
|
|
59
|
+
if (auto cs = dynamic_cast<CharSymbol*>(atom.get()); cs != nullptr) {
|
|
60
|
+
const auto& chr = cs->getChar(targetEnv);
|
|
61
|
+
kernRecord = &(chr.glyph()->math().kernRecord());
|
|
62
|
+
if (!cs->isText()) delta = chr.italic();
|
|
63
|
+
isText = atom->_type != AtomType::bigOperator;
|
|
64
|
+
isOperator = atom->_type == AtomType::bigOperator;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const auto getMathKern = [&](float height, bool isTop) {
|
|
68
|
+
if (kernRecord == nullptr) return 0.f;
|
|
69
|
+
const auto& mathKern = _onRight ? (isTop ? kernRecord->topRight() : kernRecord->bottomRight())
|
|
70
|
+
: (isTop ? kernRecord->topLeft() : kernRecord->bottomLeft());
|
|
71
|
+
const auto i = mathKern.indexOf(height);
|
|
72
|
+
return mathKern.value(i) * env.scale();
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
if (auto acc = dynamic_cast<AccentedAtom*>(_base.get()); acc != nullptr) {
|
|
76
|
+
// 1. special case: accent
|
|
77
|
+
// the scripts are placed around the accentee
|
|
78
|
+
// clang-format off
|
|
79
|
+
kernel = env.withStyle(
|
|
80
|
+
env.crampStyle(),
|
|
81
|
+
[&](Env& cramp) {
|
|
82
|
+
checkAtom(acc->_base, cramp);
|
|
83
|
+
return (acc->_base == nullptr ? sptrOf<EmptyAtom>() : acc->_base)->createBox(cramp);
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
// clang-format on
|
|
87
|
+
base = _base->createBox(env);
|
|
88
|
+
} else {
|
|
89
|
+
// 2. char symbol or boxed
|
|
90
|
+
checkAtom(_base, env);
|
|
91
|
+
kernel = base = _base->createBox(env);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const auto& math = env.mathConsts();
|
|
95
|
+
|
|
96
|
+
auto u = 0.f, v = 0.f;
|
|
97
|
+
if (!isText) {
|
|
98
|
+
u = kernel->_height - math.superscriptBaselineDropMax() * env.scale();
|
|
99
|
+
v = kernel->_depth + math.subscriptBaselineDropMin() * env.scale();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const auto compose = [&](const sptr<Box>& box, float extra = 0) -> ScriptResult {
|
|
103
|
+
const auto scriptSpace = math.spaceAfterScript() * env.scale();
|
|
104
|
+
const auto kern = kernel->_width - base->_width + extra;
|
|
105
|
+
const auto widthReduce = isOperator && delta > PREC ? -delta : 0.f;
|
|
106
|
+
return {base, box, scriptSpace, kern, widthReduce, delta};
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
if (_sup == nullptr) {
|
|
110
|
+
// case 1. only subscript
|
|
111
|
+
auto x = env.withStyle(env.subStyle(), [&](Env& sub) { return _sub->createBox(sub); });
|
|
112
|
+
x->_shift = maxOf<float>(
|
|
113
|
+
v,
|
|
114
|
+
math.subscriptShiftDown() * env.scale(),
|
|
115
|
+
x->_height - math.subscriptTopMax() * env.scale()
|
|
116
|
+
);
|
|
117
|
+
const auto kern = getMathKern(-x->_shift, false);
|
|
118
|
+
return compose(x, kern);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
auto x = env.withStyle(env.supStyle(), [&](Env& sup) { return _sup->createBox(sup); });
|
|
122
|
+
// clang-format off
|
|
123
|
+
u = maxOf<float>(
|
|
124
|
+
u,
|
|
125
|
+
(float) (
|
|
126
|
+
env.isCrampedStyle()
|
|
127
|
+
? math.superscriptShiftUpCramped()
|
|
128
|
+
: math.superscriptShiftUp()
|
|
129
|
+
) * env.scale(),
|
|
130
|
+
x->_depth + math.superscriptBottomMin() * env.scale()
|
|
131
|
+
);
|
|
132
|
+
// clang-format on
|
|
133
|
+
|
|
134
|
+
if (_sub == nullptr) {
|
|
135
|
+
// case 2. only superscript
|
|
136
|
+
x->_shift = -u;
|
|
137
|
+
const auto kern = getMathKern(-x->_shift, true);
|
|
138
|
+
return compose(x, kern + delta);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// case 3. both super & sub scripts
|
|
142
|
+
auto y = env.withStyle(env.subStyle(), [&](Env& sub) { return _sub->createBox(sub); });
|
|
143
|
+
v = maxOf<float>(v, math.subscriptShiftDown() * env.scale());
|
|
144
|
+
|
|
145
|
+
const auto theta = math.subSuperscriptGapMin() * env.scale();
|
|
146
|
+
auto sigma = (u - x->_depth) - (y->_height - v);
|
|
147
|
+
if (sigma < theta) {
|
|
148
|
+
v = theta + y->_height + x->_depth - u;
|
|
149
|
+
const auto psi = math.superscriptBottomMaxWithSubscript() * env.scale() - (u - x->_depth);
|
|
150
|
+
if (psi > 0 && (v - psi + y->_depth) > kernel->_depth) {
|
|
151
|
+
u += psi;
|
|
152
|
+
v -= psi;
|
|
153
|
+
}
|
|
154
|
+
sigma = theta;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// clang-format off
|
|
158
|
+
const auto topKern =
|
|
159
|
+
(
|
|
160
|
+
_onRight
|
|
161
|
+
? 0
|
|
162
|
+
: std::max(0.f, y->_width - x->_width)
|
|
163
|
+
) + getMathKern(u, true) + delta;
|
|
164
|
+
const auto bottomKern =
|
|
165
|
+
(
|
|
166
|
+
_onRight
|
|
167
|
+
? 0
|
|
168
|
+
: std::max(0.f, x->_width - y->_width)
|
|
169
|
+
) + getMathKern(-v, false);
|
|
170
|
+
// clang-format on
|
|
171
|
+
const auto kern = _onRight ? std::min(topKern, bottomKern) : 0;
|
|
172
|
+
|
|
173
|
+
auto vbox = sptrOf<VBox>();
|
|
174
|
+
x->_shift = topKern - kern;
|
|
175
|
+
vbox->add(x);
|
|
176
|
+
y->_shift = bottomKern - kern;
|
|
177
|
+
vbox->add(y, sigma);
|
|
178
|
+
vbox->_height = x->_height + u;
|
|
179
|
+
vbox->_depth = y->_depth + v;
|
|
180
|
+
|
|
181
|
+
return compose(vbox, kern);
|
|
182
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#ifndef MICROTEX_ATOM_SCRIPTS_H
|
|
2
|
+
#define MICROTEX_ATOM_SCRIPTS_H
|
|
3
|
+
|
|
4
|
+
#include "atom/atom.h"
|
|
5
|
+
#include "atom/atom_space.h"
|
|
6
|
+
#include "box/box_group.h"
|
|
7
|
+
#include "box/box_single.h"
|
|
8
|
+
#include "utils/utils.h"
|
|
9
|
+
|
|
10
|
+
namespace microtex {
|
|
11
|
+
|
|
12
|
+
struct ScriptResult {
|
|
13
|
+
sptr<Box> base = nullptr;
|
|
14
|
+
sptr<Box> scripts = nullptr;
|
|
15
|
+
float space = 0.f;
|
|
16
|
+
float kern = 0.f;
|
|
17
|
+
float widthReduce = 0.f;
|
|
18
|
+
float italic = 0.f;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** An atom representing scripts to be attached to another atom */
|
|
22
|
+
class ScriptsAtom : public Atom {
|
|
23
|
+
public:
|
|
24
|
+
// base atom
|
|
25
|
+
sptr<Atom> _base;
|
|
26
|
+
// subscript and superscript to be attached to the base
|
|
27
|
+
sptr<Atom> _sub;
|
|
28
|
+
sptr<Atom> _sup;
|
|
29
|
+
bool _onRight = true;
|
|
30
|
+
|
|
31
|
+
ScriptsAtom() = delete;
|
|
32
|
+
|
|
33
|
+
ScriptsAtom(
|
|
34
|
+
const sptr<Atom>& base,
|
|
35
|
+
const sptr<Atom>& sub,
|
|
36
|
+
const sptr<Atom>& sup,
|
|
37
|
+
bool onRight = true
|
|
38
|
+
)
|
|
39
|
+
: _base(base), _sub(sub), _sup(sup), _onRight(onRight) {}
|
|
40
|
+
|
|
41
|
+
AtomType leftType() const override { return _base == nullptr ? _type : _base->leftType(); }
|
|
42
|
+
|
|
43
|
+
AtomType rightType() const override { return _base == nullptr ? _type : _base->rightType(); }
|
|
44
|
+
|
|
45
|
+
sptr<Box> createBox(Env& env) override;
|
|
46
|
+
|
|
47
|
+
ScriptResult createScripts(Env& env);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
} // namespace microtex
|
|
51
|
+
|
|
52
|
+
#endif // MICROTEX_ATOM_SCRIPTS_H
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#include "atom/atom_sideset.h"
|
|
2
|
+
|
|
3
|
+
#include "atom/atom_basic.h"
|
|
4
|
+
#include "atom/atom_scripts.h"
|
|
5
|
+
#include "atom/atom_stack.h"
|
|
6
|
+
#include "atom/atom_zstack.h"
|
|
7
|
+
|
|
8
|
+
using namespace microtex;
|
|
9
|
+
|
|
10
|
+
SideSetsAtom::SideSetsAtom(const sptr<Atom>& base, const sptr<Atom>& left, const sptr<Atom>& right) {
|
|
11
|
+
_base = base == nullptr ? sptrOf<EmptyAtom>() : base;
|
|
12
|
+
_left = left == nullptr ? sptrOf<EmptyAtom>() : left;
|
|
13
|
+
_right = right == nullptr ? sptrOf<EmptyAtom>() : right;
|
|
14
|
+
_type = AtomType::bigOperator;
|
|
15
|
+
_limitsType = LimitsType::noLimits;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
sptr<Box> SideSetsAtom::createBox(Env& env) {
|
|
19
|
+
_base->_limitsType = LimitsType::noLimits;
|
|
20
|
+
sptr<Box> l, m, r;
|
|
21
|
+
sptr<PlaceholderAtom> pa;
|
|
22
|
+
auto italic = 0.f;
|
|
23
|
+
|
|
24
|
+
ScriptResult right;
|
|
25
|
+
if (auto sr = dynamic_cast<ScriptsAtom*>(_right.get()); sr != nullptr && sr->_base == nullptr) {
|
|
26
|
+
right = ScriptsAtom(_base, sr->_sub, sr->_sup).createScripts(env);
|
|
27
|
+
m = right.base;
|
|
28
|
+
pa = _base->isChar() ? nullptr
|
|
29
|
+
: sptrOf<PlaceholderAtom>(m->_width, m->_height, m->_depth, right.italic);
|
|
30
|
+
italic = right.italic;
|
|
31
|
+
} else {
|
|
32
|
+
_right = _right == nullptr ? sptrOf<EmptyAtom>() : _right;
|
|
33
|
+
r = _right->createBox(env);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
ScriptResult left;
|
|
37
|
+
if (auto sl = dynamic_cast<ScriptsAtom*>(_left.get()); sl != nullptr && sl->_base == nullptr) {
|
|
38
|
+
const auto base = pa == nullptr ? _base : pa;
|
|
39
|
+
left = ScriptsAtom(base, sl->_sub, sl->_sup, false).createScripts(env);
|
|
40
|
+
if (m == nullptr) m = left.base;
|
|
41
|
+
italic = left.italic;
|
|
42
|
+
} else {
|
|
43
|
+
l = _left->createBox(env);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (m == nullptr) {
|
|
47
|
+
m = _base->createBox(env);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const auto hbox = sptrOf<HBox>();
|
|
51
|
+
if (l != nullptr) {
|
|
52
|
+
hbox->add(l);
|
|
53
|
+
} else {
|
|
54
|
+
const auto& [_1, scripts, space, kern, widthReduce, _2] = left;
|
|
55
|
+
hbox->add(StrutBox::create(space));
|
|
56
|
+
hbox->add(scripts);
|
|
57
|
+
const auto d = kern + widthReduce;
|
|
58
|
+
if (std::abs(d) > PREC) hbox->add(StrutBox::create(d));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const auto ml = hbox->_width;
|
|
62
|
+
hbox->add(m);
|
|
63
|
+
|
|
64
|
+
if (r != nullptr) {
|
|
65
|
+
hbox->add(r);
|
|
66
|
+
} else {
|
|
67
|
+
const auto& [_1, scripts, space, kern, widthReduce, _2] = right;
|
|
68
|
+
const auto d = kern + widthReduce;
|
|
69
|
+
if (std::abs(d) > PREC) hbox->add(StrutBox::create(d));
|
|
70
|
+
hbox->add(scripts);
|
|
71
|
+
hbox->add(StrutBox::create(space));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
sptr<Box> limits;
|
|
75
|
+
float shift = 0.f;
|
|
76
|
+
if (_under != nullptr || _over != nullptr) {
|
|
77
|
+
const auto k = sptrOf<PlaceholderAtom>(m->_width, hbox->_height, hbox->_depth, italic);
|
|
78
|
+
const auto& result =
|
|
79
|
+
StackAtom(k, StackArgs::autoSpace(_over), StackArgs::autoSpace(_under)).createStack(env);
|
|
80
|
+
limits = result.box;
|
|
81
|
+
shift = result.kernelShift;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (limits == nullptr) return hbox;
|
|
85
|
+
|
|
86
|
+
const ZStackArgs hargs{Alignment::left, ml - shift, UnitType::none};
|
|
87
|
+
const ZStackArgs vargs{Alignment::none};
|
|
88
|
+
const auto anchor = sptrOf<PlaceholderAtom>(hbox);
|
|
89
|
+
const auto atom = sptrOf<PlaceholderAtom>(limits);
|
|
90
|
+
|
|
91
|
+
return ZStackAtom(hargs, vargs, atom, anchor).createBox(env);
|
|
92
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#ifndef MICROTEX_ATOM_SIDESET_H
|
|
2
|
+
#define MICROTEX_ATOM_SIDESET_H
|
|
3
|
+
|
|
4
|
+
#include "atom/atom.h"
|
|
5
|
+
|
|
6
|
+
namespace microtex {
|
|
7
|
+
|
|
8
|
+
/** An atom representing scripts around of a base atom */
|
|
9
|
+
class SideSetsAtom : public Atom {
|
|
10
|
+
public:
|
|
11
|
+
// _base is guaranteed to be valid
|
|
12
|
+
sptr<Atom> _left, _right, _base;
|
|
13
|
+
sptr<Atom> _under, _over;
|
|
14
|
+
|
|
15
|
+
SideSetsAtom() = delete;
|
|
16
|
+
|
|
17
|
+
SideSetsAtom(const sptr<Atom>& base, const sptr<Atom>& left, const sptr<Atom>& right);
|
|
18
|
+
|
|
19
|
+
sptr<Box> createBox(Env& env) override;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
} // namespace microtex
|
|
23
|
+
|
|
24
|
+
#endif // MICROTEX_ATOM_SIDESET_H
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#include "atom/atom_space.h"
|
|
2
|
+
|
|
3
|
+
#include "box/box_single.h"
|
|
4
|
+
#include "core/glue.h"
|
|
5
|
+
#include "env/env.h"
|
|
6
|
+
#include "env/units.h"
|
|
7
|
+
|
|
8
|
+
using namespace std;
|
|
9
|
+
using namespace microtex;
|
|
10
|
+
|
|
11
|
+
sptr<Box> SpaceAtom::createBox(Env& env) {
|
|
12
|
+
if (!_blankSpace) {
|
|
13
|
+
float w = Units::fsize(_unit, _width, env);
|
|
14
|
+
float h = Units::fsize(_unit, _height, env);
|
|
15
|
+
float d = Units::fsize(_unit, _depth, env);
|
|
16
|
+
return sptrOf<StrutBox>(w, h, d, 0.f);
|
|
17
|
+
}
|
|
18
|
+
if (_blankType == SpaceType::none) {
|
|
19
|
+
return sptrOf<StrutBox>(env.space(_isMathMode), 0.f, 0.f, 0.f);
|
|
20
|
+
}
|
|
21
|
+
return Glue::get(_blankType, env);
|
|
22
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#ifndef MICROTEX_ATOM_SPACE_H
|
|
2
|
+
#define MICROTEX_ATOM_SPACE_H
|
|
3
|
+
|
|
4
|
+
#include "atom/atom.h"
|
|
5
|
+
#include "utils/utils.h"
|
|
6
|
+
|
|
7
|
+
namespace microtex {
|
|
8
|
+
|
|
9
|
+
/** An atom representing whitespace. */
|
|
10
|
+
class SpaceAtom : public Atom {
|
|
11
|
+
private:
|
|
12
|
+
bool _isMathMode = true;
|
|
13
|
+
// whether a hard space should be represented
|
|
14
|
+
bool _blankSpace = false;
|
|
15
|
+
// thin-mu-skip, med-mu-skip, thick-mu-skip
|
|
16
|
+
SpaceType _blankType{};
|
|
17
|
+
// dimensions
|
|
18
|
+
float _width = 0, _height = 0, _depth = 0;
|
|
19
|
+
// units of the dimensions
|
|
20
|
+
UnitType _unit{};
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
explicit SpaceAtom(bool isMathMode = true) noexcept
|
|
24
|
+
: _blankSpace(true), _isMathMode(isMathMode) {}
|
|
25
|
+
|
|
26
|
+
explicit SpaceAtom(SpaceType type) noexcept : _blankSpace(true), _blankType(type) {}
|
|
27
|
+
|
|
28
|
+
SpaceAtom(UnitType unit, float width, float height, float depth) noexcept
|
|
29
|
+
: _unit(unit), _width(width), _height(height), _depth(depth) {}
|
|
30
|
+
|
|
31
|
+
sptr<Box> createBox(Env& env) override;
|
|
32
|
+
|
|
33
|
+
static sptr<SpaceAtom> empty() { return sptrOf<SpaceAtom>(UnitType::em, 0.f, 0.f, 0.f); }
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
} // namespace microtex
|
|
37
|
+
|
|
38
|
+
#endif // MICROTEX_ATOM_SPACE_H
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
#include "atom/atom_stack.h"
|
|
2
|
+
|
|
3
|
+
#include "atom/atom_basic.h"
|
|
4
|
+
#include "atom/atom_char.h"
|
|
5
|
+
#include "atom/atom_space.h"
|
|
6
|
+
#include "box/box_group.h"
|
|
7
|
+
#include "box/box_single.h"
|
|
8
|
+
|
|
9
|
+
using namespace microtex;
|
|
10
|
+
using namespace std;
|
|
11
|
+
|
|
12
|
+
const std::vector<StackElement> StackAtom::_defaultOrder = {
|
|
13
|
+
StackElement::over,
|
|
14
|
+
StackElement::under,
|
|
15
|
+
StackElement::base,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
sptr<Box> StackAtom::createBox(Env& env) {
|
|
19
|
+
const auto& [box, _] = createStack(env);
|
|
20
|
+
return box;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
StackResult StackAtom::createStack(Env& env) {
|
|
24
|
+
// over and under
|
|
25
|
+
sptr<Box> o, u, b;
|
|
26
|
+
const auto createOverUnder = [&](const StackArgs& args, TexStyle style) -> sptr<Box> {
|
|
27
|
+
if (!args.isPresent()) return nullptr;
|
|
28
|
+
auto x = args.isScript ? env.withStyle(style, [&](Env& e) { return args.atom->createBox(e); })
|
|
29
|
+
: args.atom->createBox(env);
|
|
30
|
+
_maxWidth = std::max(_maxWidth, x->_width);
|
|
31
|
+
return x;
|
|
32
|
+
};
|
|
33
|
+
for (auto elem : _order) {
|
|
34
|
+
switch (elem) {
|
|
35
|
+
case StackElement::over: o = createOverUnder(_over, env.supStyle()); break;
|
|
36
|
+
case StackElement::under: u = createOverUnder(_under, env.subStyle()); break;
|
|
37
|
+
case StackElement::base:
|
|
38
|
+
b = _base == nullptr ? StrutBox::empty() : _base->createBox(env);
|
|
39
|
+
_maxWidth = std::max(_maxWidth, b->_width);
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
auto delta = 0.f;
|
|
45
|
+
if (auto cs = dynamic_cast<CharSymbol*>(_base.get()); cs != nullptr) {
|
|
46
|
+
delta = cs->getChar(env).italic();
|
|
47
|
+
} else if (auto pa = dynamic_cast<PlaceholderAtom*>(_base.get()); pa != nullptr) {
|
|
48
|
+
delta = pa->italic();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const auto wrap = [&](const sptr<Box>& box, float bias) -> sptr<Box> {
|
|
52
|
+
box->_shift = (_maxWidth - box->_width) / 2 + bias;
|
|
53
|
+
return box;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// vertical box
|
|
57
|
+
auto vbox = sptrOf<VBox>();
|
|
58
|
+
|
|
59
|
+
// last font used by base (for mono-space atoms following)
|
|
60
|
+
env.setLastFontId(b->lastFontId());
|
|
61
|
+
|
|
62
|
+
// params to layout limits
|
|
63
|
+
const auto& math = env.mathConsts();
|
|
64
|
+
|
|
65
|
+
// over script + space
|
|
66
|
+
if (o != nullptr && !o->isSpace()) {
|
|
67
|
+
auto ob = wrap(o, delta / 2);
|
|
68
|
+
vbox->add(ob);
|
|
69
|
+
float space = 0.f;
|
|
70
|
+
if (_over.isAutoSpace) {
|
|
71
|
+
const auto gapMin = math.upperLimitGapMin() * env.scale();
|
|
72
|
+
const auto baselineRiseMin = math.upperLimitBaselineRiseMin() * env.scale();
|
|
73
|
+
space = std::max(baselineRiseMin - o->_depth, gapMin);
|
|
74
|
+
} else {
|
|
75
|
+
space = Units::fsize(_over.spaceUnit, _over.space, env);
|
|
76
|
+
}
|
|
77
|
+
const auto kern = sptrOf<StrutBox>(0.f, space, 0.f, 0.f);
|
|
78
|
+
kern->_shift = delta / 2;
|
|
79
|
+
vbox->add(kern);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// base
|
|
83
|
+
auto center = wrap(b, 0.f);
|
|
84
|
+
vbox->add(center);
|
|
85
|
+
|
|
86
|
+
// calculate future height of the vertical box, to make sure that the
|
|
87
|
+
// base stays on the baseline
|
|
88
|
+
const auto h = vbox->_height + vbox->_depth - center->_depth;
|
|
89
|
+
|
|
90
|
+
// under script + space
|
|
91
|
+
if (u != nullptr && !u->isSpace()) {
|
|
92
|
+
float space = 0.f;
|
|
93
|
+
if (_under.isAutoSpace) {
|
|
94
|
+
const auto gapMin = math.lowerLimitGapMin() * env.scale();
|
|
95
|
+
const auto baselineDropMin = math.lowerLimitBaselineDropMin() * env.scale();
|
|
96
|
+
space = std::max(baselineDropMin - u->_height, gapMin);
|
|
97
|
+
} else {
|
|
98
|
+
space = Units::fsize(_under.spaceUnit, _under.space, env);
|
|
99
|
+
}
|
|
100
|
+
const auto kern = sptrOf<StrutBox>(0.f, space, 0.f, 0.f);
|
|
101
|
+
kern->_shift = delta / 2;
|
|
102
|
+
vbox->add(kern);
|
|
103
|
+
auto ub = wrap(u, -delta / 2);
|
|
104
|
+
vbox->add(ub);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// calculate height and depth
|
|
108
|
+
vbox->_depth = vbox->_height + vbox->_depth - h;
|
|
109
|
+
vbox->_height = h;
|
|
110
|
+
|
|
111
|
+
// if is under accent, adjust with kerning
|
|
112
|
+
if (_adjustBottom) {
|
|
113
|
+
vbox->add(sptrOf<StrutBox>(0.f, -env.mathConsts().accentBaseHeight(), 0.f, 0.f));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return {vbox, center->_shift - vbox->leftMostPos()};
|
|
117
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#ifndef MICROTEX_ATOM_STACK_H
|
|
2
|
+
#define MICROTEX_ATOM_STACK_H
|
|
3
|
+
|
|
4
|
+
#include <utility>
|
|
5
|
+
|
|
6
|
+
#include "atom/atom.h"
|
|
7
|
+
#include "env/units.h"
|
|
8
|
+
|
|
9
|
+
namespace microtex {
|
|
10
|
+
|
|
11
|
+
/** Arguments to place stacked atoms */
|
|
12
|
+
struct StackArgs {
|
|
13
|
+
sptr<Atom> atom = nullptr;
|
|
14
|
+
UnitType spaceUnit = UnitType::none;
|
|
15
|
+
float space = 0.f;
|
|
16
|
+
bool isScript = false;
|
|
17
|
+
bool isAutoSpace = false;
|
|
18
|
+
|
|
19
|
+
inline bool isPresent() const { return atom != nullptr; }
|
|
20
|
+
|
|
21
|
+
static inline StackArgs autoSpace(const sptr<Atom>& atom, bool isScript = true) {
|
|
22
|
+
return {atom, UnitType::none, 0.f, isScript, true};
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
struct StackResult {
|
|
27
|
+
sptr<Box> box;
|
|
28
|
+
float kernelShift;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
enum class StackElement { over, under, base };
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* An atom representing another atom with an atom above it (if not null)
|
|
35
|
+
* separated by a kern and in a smaller size depending on "overScriptSize"
|
|
36
|
+
* and/or an atom under it (if not null) separated by a kern and in a smaller
|
|
37
|
+
* size depending on "underScriptSize"
|
|
38
|
+
*/
|
|
39
|
+
class StackAtom : public Atom {
|
|
40
|
+
private:
|
|
41
|
+
sptr<Atom> _base;
|
|
42
|
+
StackArgs _over;
|
|
43
|
+
StackArgs _under;
|
|
44
|
+
float _maxWidth = 0.f;
|
|
45
|
+
bool _adjustBottom = false;
|
|
46
|
+
std::vector<StackElement> _order;
|
|
47
|
+
|
|
48
|
+
static const std::vector<StackElement> _defaultOrder;
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
explicit StackAtom(std::vector<StackElement> order = _defaultOrder) : _order(std::move(order)) {}
|
|
52
|
+
|
|
53
|
+
StackAtom(
|
|
54
|
+
const sptr<Atom>& base,
|
|
55
|
+
const StackArgs& args,
|
|
56
|
+
bool isOver,
|
|
57
|
+
std::vector<StackElement> order = _defaultOrder
|
|
58
|
+
)
|
|
59
|
+
: _base(base), _order(std::move(order)) {
|
|
60
|
+
if (isOver) {
|
|
61
|
+
_over = args;
|
|
62
|
+
} else {
|
|
63
|
+
_under = args;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
StackAtom(
|
|
68
|
+
const sptr<Atom>& base,
|
|
69
|
+
StackArgs overArgs,
|
|
70
|
+
StackArgs underArgs,
|
|
71
|
+
std::vector<StackElement> order = _defaultOrder
|
|
72
|
+
)
|
|
73
|
+
: _base(base),
|
|
74
|
+
_over(std::move(overArgs)),
|
|
75
|
+
_under(std::move(underArgs)),
|
|
76
|
+
_order(std::move(order)) {}
|
|
77
|
+
|
|
78
|
+
inline void setBaseAtom(const sptr<Atom>& base) { _base = base; }
|
|
79
|
+
|
|
80
|
+
inline void setAdjustBottom(bool adjust) { _adjustBottom = adjust; }
|
|
81
|
+
|
|
82
|
+
inline void setOver(StackArgs over) { _over = std::move(over); }
|
|
83
|
+
|
|
84
|
+
inline void setUnder(StackArgs under) { _under = std::move(under); }
|
|
85
|
+
|
|
86
|
+
inline float getMaxWidth() { return _maxWidth; }
|
|
87
|
+
|
|
88
|
+
AtomType leftType() const override {
|
|
89
|
+
return _base == nullptr ? AtomType::ordinary : _base->leftType();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
AtomType rightType() const override {
|
|
93
|
+
return _base == nullptr ? AtomType::ordinary : _base->rightType();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
sptr<Box> createBox(Env& env) override;
|
|
97
|
+
|
|
98
|
+
StackResult createStack(Env& env);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
} // namespace microtex
|
|
102
|
+
|
|
103
|
+
#endif // MICROTEX_ATOM_STACK_H
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#include "atom/atom_text.h"
|
|
2
|
+
|
|
3
|
+
#include "box/box_single.h"
|
|
4
|
+
#include "env/env.h"
|
|
5
|
+
#include "utils/utf.h"
|
|
6
|
+
|
|
7
|
+
using namespace std;
|
|
8
|
+
using namespace microtex;
|
|
9
|
+
|
|
10
|
+
void TextAtom::append(c32 code) {
|
|
11
|
+
appendToUtf8(_txt, code);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
sptr<Box> TextAtom::createBox(Env& env) {
|
|
15
|
+
auto style = (_mathMode ? env.mathFontStyle() : env.textFontStyle());
|
|
16
|
+
return sptrOf<TextBox>(_txt, style, Env::fixedTextSize() * env.scale());
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#ifndef MICROTEX_ATOM_TEXT_H
|
|
2
|
+
#define MICROTEX_ATOM_TEXT_H
|
|
3
|
+
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#include "atom/atom.h"
|
|
7
|
+
|
|
8
|
+
namespace microtex {
|
|
9
|
+
|
|
10
|
+
class TextAtom : public Atom {
|
|
11
|
+
private:
|
|
12
|
+
std::string _txt;
|
|
13
|
+
bool _mathMode;
|
|
14
|
+
|
|
15
|
+
public:
|
|
16
|
+
TextAtom(bool isMathMode) : _mathMode(isMathMode) {}
|
|
17
|
+
|
|
18
|
+
TextAtom(std::string str, bool isMathMode) : _txt(std::move(str)), _mathMode(isMathMode) {}
|
|
19
|
+
|
|
20
|
+
void append(c32 code);
|
|
21
|
+
|
|
22
|
+
inline bool isMathMode() const { return _mathMode; }
|
|
23
|
+
|
|
24
|
+
sptr<Box> createBox(Env& env) override;
|
|
25
|
+
|
|
26
|
+
AtomType leftType() const override { return AtomType::ordinary; }
|
|
27
|
+
|
|
28
|
+
AtomType rightType() const override { return AtomType::ordinary; }
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
} // namespace microtex
|
|
32
|
+
|
|
33
|
+
#endif // MICROTEX_ATOM_TEXT_H
|