@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,51 @@
|
|
|
1
|
+
#include "atom/atom_operator.h"
|
|
2
|
+
|
|
3
|
+
#include "atom/atom_basic.h"
|
|
4
|
+
#include "atom/atom_row.h"
|
|
5
|
+
#include "atom/atom_scripts.h"
|
|
6
|
+
#include "atom/atom_sideset.h"
|
|
7
|
+
#include "atom/atom_stack.h"
|
|
8
|
+
#include "env/env.h"
|
|
9
|
+
|
|
10
|
+
using namespace microtex;
|
|
11
|
+
|
|
12
|
+
sptr<Box> OperatorAtom::createBox(Env& env) {
|
|
13
|
+
// case 1: side sets
|
|
14
|
+
if (auto ss = dynamic_cast<SideSetsAtom*>(_base.get()); ss != nullptr) {
|
|
15
|
+
ss->_under = _under;
|
|
16
|
+
ss->_over = _over;
|
|
17
|
+
return ss->createBox(env);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// case 2: limits are shown as scripts
|
|
21
|
+
// clang-format off
|
|
22
|
+
if ((_limitsType == LimitsType::noLimits)
|
|
23
|
+
|| (_limitsType == LimitsType::normal && env.style() >= TexStyle::text)
|
|
24
|
+
) {
|
|
25
|
+
// clang-format on
|
|
26
|
+
RowAtom* row = nullptr;
|
|
27
|
+
auto base = _base;
|
|
28
|
+
// special case: the base atom is a row that composed by other atoms
|
|
29
|
+
// we should take out the last atom in the row to place scripts
|
|
30
|
+
if (auto typed = dynamic_cast<TypedAtom*>(_base.get()); typed != nullptr) {
|
|
31
|
+
const auto& atom = typed->base();
|
|
32
|
+
const auto ra = dynamic_cast<RowAtom*>(atom.get());
|
|
33
|
+
if (ra != nullptr && ra->_lookAtLastAtom) {
|
|
34
|
+
base = ra->popBack();
|
|
35
|
+
row = ra;
|
|
36
|
+
} else {
|
|
37
|
+
base = atom;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (row != nullptr) {
|
|
41
|
+
row->add(sptrOf<ScriptsAtom>(base, _under, _over));
|
|
42
|
+
return row->createBox(env);
|
|
43
|
+
}
|
|
44
|
+
return ScriptsAtom(base, _under, _over).createBox(env);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// case 3: limits are put over/under the base
|
|
48
|
+
const StackArgs& over = StackArgs::autoSpace(_over);
|
|
49
|
+
const StackArgs& under = StackArgs::autoSpace(_under);
|
|
50
|
+
return StackAtom(_base, over, under).createBox(env);
|
|
51
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#ifndef MICROTEX_ATOM_OPERATOR_H
|
|
2
|
+
#define MICROTEX_ATOM_OPERATOR_H
|
|
3
|
+
|
|
4
|
+
#include "atom/atom.h"
|
|
5
|
+
|
|
6
|
+
namespace microtex {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* An atom representing a "big operator" (or an atom that acts as one) together
|
|
10
|
+
* with its limits
|
|
11
|
+
*/
|
|
12
|
+
class OperatorAtom : public Atom {
|
|
13
|
+
private:
|
|
14
|
+
sptr<Atom> _base, _under, _over;
|
|
15
|
+
|
|
16
|
+
public:
|
|
17
|
+
OperatorAtom() = delete;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new OperatorAtom from the given atoms. The default rules the
|
|
21
|
+
* positioning of the limits will be applied.
|
|
22
|
+
*
|
|
23
|
+
* @param base atom representing the big operator
|
|
24
|
+
* @param under atom representing the under limit
|
|
25
|
+
* @param over atom representing the over limit
|
|
26
|
+
*/
|
|
27
|
+
OperatorAtom(const sptr<Atom>& base, const sptr<Atom>& under, const sptr<Atom>& over)
|
|
28
|
+
: _base(base), _under(under), _over(over) {
|
|
29
|
+
_limitsType = _base->_limitsType;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
sptr<Box> createBox(Env& env) override;
|
|
33
|
+
|
|
34
|
+
AtomType leftType() const override { return _base->leftType(); }
|
|
35
|
+
|
|
36
|
+
AtomType rightType() const override { return _base->rightType(); }
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
} // namespace microtex
|
|
40
|
+
|
|
41
|
+
#endif // MICROTEX_ATOM_OPERATOR_H
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#include "atom/atom_root.h"
|
|
2
|
+
|
|
3
|
+
#include "box/box_factory.h"
|
|
4
|
+
#include "box/box_group.h"
|
|
5
|
+
#include "env/env.h"
|
|
6
|
+
|
|
7
|
+
using namespace microtex;
|
|
8
|
+
|
|
9
|
+
sptr<Box> NthRoot::createBox(Env& env) {
|
|
10
|
+
// clang-format off
|
|
11
|
+
const auto base = (
|
|
12
|
+
_base == nullptr
|
|
13
|
+
? StrutBox::empty()
|
|
14
|
+
: env.withStyle(env.crampStyle(), [&](Env& cramp) { return _base->createBox(cramp); })
|
|
15
|
+
);
|
|
16
|
+
// clang-format on
|
|
17
|
+
|
|
18
|
+
const auto& math = env.mathConsts();
|
|
19
|
+
const auto gap = env.style() <= TexStyle::display1 ? math.radicalDisplayStyleVerticalGap()
|
|
20
|
+
: math.radicalVerticalGap();
|
|
21
|
+
const auto theta = math.radicalRuleThickness() * env.scale();
|
|
22
|
+
auto radical = microtex::createVDelim("sqrt", env, base->vlen() + gap + theta);
|
|
23
|
+
|
|
24
|
+
const auto delta = (radical->vlen() - (base->vlen() + gap + theta)) / 2.f;
|
|
25
|
+
const auto rule = sptrOf<RuleBox>(theta, base->_width, 0.f);
|
|
26
|
+
|
|
27
|
+
auto vbox = sptrOf<VBox>();
|
|
28
|
+
const auto asc = math.radicalExtraAscender() * env.scale();
|
|
29
|
+
vbox->add(sptrOf<StrutBox>(0.f, asc, 0.f, 0.f));
|
|
30
|
+
vbox->add(rule);
|
|
31
|
+
vbox->add(sptrOf<StrutBox>(0.f, gap + delta, 0.f, 0.f));
|
|
32
|
+
vbox->add(base);
|
|
33
|
+
const auto h = vbox->vlen();
|
|
34
|
+
vbox->_height = h - base->_depth;
|
|
35
|
+
vbox->_depth = base->_depth;
|
|
36
|
+
|
|
37
|
+
auto hbox = sptrOf<HBox>();
|
|
38
|
+
radical->_shift = radical->_height - vbox->_height + asc;
|
|
39
|
+
hbox->add(radical);
|
|
40
|
+
hbox->add(vbox);
|
|
41
|
+
|
|
42
|
+
// degree
|
|
43
|
+
if (_root == nullptr) {
|
|
44
|
+
return hbox;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const auto degree =
|
|
48
|
+
env.withStyle(env.rootStyle(), [&](Env& root) { return _root->createBox(root); });
|
|
49
|
+
const auto hd = sptrOf<HBox>();
|
|
50
|
+
const auto bk = math.radicalKernBeforeDegree() * env.scale();
|
|
51
|
+
hd->add(StrutBox::create(bk));
|
|
52
|
+
hd->add(degree);
|
|
53
|
+
const auto br = math.radicalDegreeBottomRaisePercent() / 100.f * hbox->vlen();
|
|
54
|
+
hd->_shift = hbox->_depth - hd->_depth - br + asc + theta;
|
|
55
|
+
|
|
56
|
+
hbox->add(0, hd);
|
|
57
|
+
const auto ak = math.radicalKernAfterDegree() * env.scale();
|
|
58
|
+
hbox->add(1, StrutBox::create(ak));
|
|
59
|
+
|
|
60
|
+
return hbox;
|
|
61
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#ifndef MICROTEX_ATOM_ROOT_H
|
|
2
|
+
#define MICROTEX_ATOM_ROOT_H
|
|
3
|
+
|
|
4
|
+
#include "atom/atom.h"
|
|
5
|
+
#include "atom/atom_basic.h"
|
|
6
|
+
|
|
7
|
+
namespace microtex {
|
|
8
|
+
|
|
9
|
+
/** An atom representing an nth-root construction */
|
|
10
|
+
class NthRoot : public Atom {
|
|
11
|
+
private:
|
|
12
|
+
// base atom to be put under the root sign
|
|
13
|
+
sptr<Atom> _base;
|
|
14
|
+
// root atom to be put in the upper left corner above the root sign
|
|
15
|
+
sptr<Atom> _root;
|
|
16
|
+
|
|
17
|
+
public:
|
|
18
|
+
NthRoot() = delete;
|
|
19
|
+
|
|
20
|
+
NthRoot(const sptr<Atom>& base, const sptr<Atom>& root) : _base(base), _root(root) {}
|
|
21
|
+
|
|
22
|
+
sptr<Box> createBox(Env& env) override;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
} // namespace microtex
|
|
26
|
+
|
|
27
|
+
#endif // MICROTEX_ATOM_ROOT_H
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
#include "atom/atom_row.h"
|
|
2
|
+
|
|
3
|
+
#include "atom/atom_basic.h"
|
|
4
|
+
#include "atom/atom_char.h"
|
|
5
|
+
#include "atom/atom_space.h"
|
|
6
|
+
#include "atom/atom_text.h"
|
|
7
|
+
#include "box/box_group.h"
|
|
8
|
+
#include "box/box_single.h"
|
|
9
|
+
#include "core/glue.h"
|
|
10
|
+
#include "env/env.h"
|
|
11
|
+
#include "utils/utf.h"
|
|
12
|
+
|
|
13
|
+
using namespace std;
|
|
14
|
+
using namespace microtex;
|
|
15
|
+
|
|
16
|
+
bool AtomDecor::isChar() const {
|
|
17
|
+
return _atom->isChar();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
bool AtomDecor::isMathMode() const {
|
|
21
|
+
if (!isChar()) return false;
|
|
22
|
+
return static_cast<CharSymbol*>(_atom.get())->isMathMode();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Char AtomDecor::getChar(Env& env) const {
|
|
26
|
+
if (!isChar()) return {};
|
|
27
|
+
return ((CharSymbol*)_atom.get())->getChar(env);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
void AtomDecor::changeAtom(const sptr<FixedCharAtom>& atom) {
|
|
31
|
+
_textSymbol = false;
|
|
32
|
+
_atom = atom;
|
|
33
|
+
_type = AtomType::none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
sptr<Box> AtomDecor::createBox(Env& env) {
|
|
37
|
+
if (_textSymbol) ((CharSymbol*)_atom.get())->markAsText();
|
|
38
|
+
auto box = _atom->createBox(env);
|
|
39
|
+
if (_textSymbol) ((CharSymbol*)_atom.get())->removeMark();
|
|
40
|
+
return box;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
bool AtomDecor::isKern() const {
|
|
44
|
+
auto* x = dynamic_cast<SpaceAtom*>(_atom.get());
|
|
45
|
+
return (x != nullptr);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
void AtomDecor::setPreviousAtom(const sptr<AtomDecor>& prev) {
|
|
49
|
+
auto* row = dynamic_cast<Row*>(_atom.get());
|
|
50
|
+
if (row != nullptr) row->setPreviousAtom(prev);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
bool RowAtom::_breakEverywhere = false;
|
|
54
|
+
|
|
55
|
+
// clang-format off
|
|
56
|
+
bitset<16> RowAtom::_binSet = bitset<16>()
|
|
57
|
+
.set(static_cast<i8>(AtomType::binaryOperator))
|
|
58
|
+
.set(static_cast<i8>(AtomType::bigOperator))
|
|
59
|
+
.set(static_cast<i8>(AtomType::relation))
|
|
60
|
+
.set(static_cast<i8>(AtomType::opening))
|
|
61
|
+
.set(static_cast<i8>(AtomType::punctuation));
|
|
62
|
+
|
|
63
|
+
bitset<16> RowAtom::_ligKernSet = bitset<16>()
|
|
64
|
+
.set(static_cast<i8>(AtomType::ordinary))
|
|
65
|
+
.set(static_cast<i8>(AtomType::bigOperator))
|
|
66
|
+
.set(static_cast<i8>(AtomType::binaryOperator))
|
|
67
|
+
.set(static_cast<i8>(AtomType::relation))
|
|
68
|
+
.set(static_cast<i8>(AtomType::opening))
|
|
69
|
+
.set(static_cast<i8>(AtomType::closing))
|
|
70
|
+
.set(static_cast<i8>(AtomType::punctuation));
|
|
71
|
+
// clang-format on
|
|
72
|
+
|
|
73
|
+
RowAtom::RowAtom(const sptr<Atom>& atom)
|
|
74
|
+
: _lookAtLastAtom(false), _previousAtom(nullptr), _breakable(true) {
|
|
75
|
+
if (atom != nullptr) {
|
|
76
|
+
auto* x = dynamic_cast<RowAtom*>(atom.get());
|
|
77
|
+
if (x != nullptr) {
|
|
78
|
+
// no need to make a row, the only element of a row
|
|
79
|
+
_elements.insert(_elements.end(), x->_elements.begin(), x->_elements.end());
|
|
80
|
+
} else {
|
|
81
|
+
_elements.push_back(atom);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
sptr<Atom> RowAtom::getFirstAtom() {
|
|
87
|
+
if (!_elements.empty()) return _elements.front();
|
|
88
|
+
return nullptr;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
sptr<Atom> RowAtom::popBack() {
|
|
92
|
+
if (!_elements.empty()) {
|
|
93
|
+
sptr<Atom> x = _elements.back();
|
|
94
|
+
_elements.pop_back();
|
|
95
|
+
return x;
|
|
96
|
+
}
|
|
97
|
+
return SpaceAtom::empty();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
sptr<Atom> RowAtom::get(size_t pos) {
|
|
101
|
+
if (pos >= _elements.size()) return SpaceAtom::empty();
|
|
102
|
+
return _elements[pos];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
void RowAtom::add(const sptr<Atom>& atom) {
|
|
106
|
+
if (atom != nullptr) _elements.push_back(atom);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
void RowAtom::changeToOrd(AtomDecor* cur, AtomDecor* prev, Atom* next) {
|
|
110
|
+
AtomType type = cur->leftType();
|
|
111
|
+
// clang-format off
|
|
112
|
+
if ((type == AtomType::binaryOperator)
|
|
113
|
+
&& ((prev == nullptr || _binSet[static_cast<i8>(prev->rightType())]) || next == nullptr)
|
|
114
|
+
) {
|
|
115
|
+
// clang-format on
|
|
116
|
+
cur->_type = AtomType::ordinary;
|
|
117
|
+
} else if (next != nullptr && cur->rightType() == AtomType::binaryOperator) {
|
|
118
|
+
AtomType nextType = next->leftType();
|
|
119
|
+
// clang-format off
|
|
120
|
+
if (nextType == AtomType::relation
|
|
121
|
+
|| nextType == AtomType::closing
|
|
122
|
+
|| nextType == AtomType::punctuation
|
|
123
|
+
) {
|
|
124
|
+
// clang-format on
|
|
125
|
+
cur->_type = AtomType::ordinary;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
AtomType RowAtom::leftType() const {
|
|
131
|
+
if (_elements.empty()) return AtomType::ordinary;
|
|
132
|
+
return _elements.front()->leftType();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
AtomType RowAtom::rightType() const {
|
|
136
|
+
if (_elements.empty()) return AtomType::ordinary;
|
|
137
|
+
return _elements.back()->rightType();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
sptr<CharSymbol> RowAtom::currentChar(int i) {
|
|
141
|
+
if (i >= _elements.size()) return nullptr;
|
|
142
|
+
const auto a = _elements[i];
|
|
143
|
+
if (!a->isChar()) return nullptr;
|
|
144
|
+
return static_pointer_cast<CharSymbol>(a);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
int RowAtom::processInvalid(const sptr<TextAtom>& txt, bool isMathMode, int i, Env& env) {
|
|
148
|
+
const auto a = currentChar(i);
|
|
149
|
+
if (a == nullptr || a->isMathMode() != isMathMode) return i;
|
|
150
|
+
const auto& chr = a->getChar(env);
|
|
151
|
+
if (chr.isValid()) return i;
|
|
152
|
+
txt->append(chr.mappedCode);
|
|
153
|
+
return processInvalid(txt, isMathMode, i + 1, env);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
sptr<TextAtom> RowAtom::processContinues(int& i, bool isMathMode) {
|
|
157
|
+
if (i >= _elements.size()) return nullptr;
|
|
158
|
+
int cnt = 0;
|
|
159
|
+
auto txt = sptrOf<TextAtom>(isMathMode);
|
|
160
|
+
const auto next = [&]() {
|
|
161
|
+
auto a = currentChar(i + cnt);
|
|
162
|
+
return a == nullptr || a->isMathMode() != isMathMode ? 0 : a->unicode();
|
|
163
|
+
};
|
|
164
|
+
const auto collect = [&](c32 code) {
|
|
165
|
+
txt->append(code);
|
|
166
|
+
++cnt;
|
|
167
|
+
};
|
|
168
|
+
microtex::scanContinuedUnicodes(next, collect);
|
|
169
|
+
if (cnt <= 1) return nullptr;
|
|
170
|
+
i += cnt - 1;
|
|
171
|
+
return txt;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
sptr<Box> RowAtom::createBox(Env& env) {
|
|
175
|
+
auto hbox = new HBox();
|
|
176
|
+
// convert atoms to boxes and add to the horizontal box
|
|
177
|
+
const int end = _elements.size() - 1;
|
|
178
|
+
for (int i = -1; i < end;) {
|
|
179
|
+
auto raw = _elements[++i];
|
|
180
|
+
|
|
181
|
+
// 1. Skip break marks
|
|
182
|
+
bool hasBreak = false;
|
|
183
|
+
auto ba = dynamic_cast<BreakMarkAtom*>(raw.get());
|
|
184
|
+
while (ba != nullptr) {
|
|
185
|
+
hasBreak = true;
|
|
186
|
+
if (i < end) {
|
|
187
|
+
raw = _elements[++i];
|
|
188
|
+
ba = dynamic_cast<BreakMarkAtom*>(raw.get());
|
|
189
|
+
} else {
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
auto curr = sptrOf<AtomDecor>(raw);
|
|
195
|
+
auto tmp = curr;
|
|
196
|
+
|
|
197
|
+
// 2. process continued and invalid chars
|
|
198
|
+
auto t = processContinues(i, curr->isMathMode());
|
|
199
|
+
if (t != nullptr) {
|
|
200
|
+
curr = sptrOf<AtomDecor>(t);
|
|
201
|
+
tmp = i < end ? sptrOf<AtomDecor>(_elements[i + 1]) : sptrOf<AtomDecor>(EmptyAtom::create());
|
|
202
|
+
}
|
|
203
|
+
Char c = tmp->getChar(env);
|
|
204
|
+
if (tmp->isChar() && !c.isValid()) {
|
|
205
|
+
const auto isMathMode = tmp->isMathMode();
|
|
206
|
+
if (t == nullptr)
|
|
207
|
+
t = sptrOf<TextAtom>(isMathMode);
|
|
208
|
+
else
|
|
209
|
+
++i;
|
|
210
|
+
t->append(c.mappedCode);
|
|
211
|
+
i = processInvalid(t, isMathMode, i + 1, env) - 1;
|
|
212
|
+
curr = sptrOf<AtomDecor>(t);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// 3. Change atom type
|
|
216
|
+
// if necessary, change BIN to ORD
|
|
217
|
+
// i.e. for formula: $+ e - f$, the plus sign should be treated as an ordinary atom
|
|
218
|
+
sptr<Atom> nextAtom = nullptr;
|
|
219
|
+
if (i < end) nextAtom = _elements[i + 1];
|
|
220
|
+
changeToOrd(curr.get(), _previousAtom.get(), nextAtom.get());
|
|
221
|
+
|
|
222
|
+
// 4. Check for ligatures and kerning
|
|
223
|
+
float kern = 0.f;
|
|
224
|
+
if (nextAtom != nullptr && curr->rightType() == AtomType::ordinary && curr->isChar()) {
|
|
225
|
+
curr->markAsTextSymbol();
|
|
226
|
+
// initialize
|
|
227
|
+
const auto& chr = c;
|
|
228
|
+
const auto font = chr.fontId;
|
|
229
|
+
auto ligs = FontContext::getFont(font)->otf().ligatures();
|
|
230
|
+
auto lig = ligs == nullptr ? nullptr : (*ligs)[chr.glyphId];
|
|
231
|
+
// find target from the ligatures table
|
|
232
|
+
int index = i;
|
|
233
|
+
const LigaTable* target = nullptr;
|
|
234
|
+
i32 nextGlyph = -1;
|
|
235
|
+
while (i < end && lig != nullptr) {
|
|
236
|
+
auto next = _elements[++i];
|
|
237
|
+
if (!next->isChar() || !_ligKernSet[static_cast<i8>(next->leftType())]) {
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
// is safe to cast the atom to CharSymbol since it is a char
|
|
241
|
+
auto nextChar = static_cast<CharSymbol*>(next.get());
|
|
242
|
+
auto c = nextChar->getChar(env);
|
|
243
|
+
// not in same font, break the iteration
|
|
244
|
+
if (c.fontId != font) {
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
// record the first following glyph
|
|
248
|
+
if (nextGlyph == -1) nextGlyph = c.glyphId;
|
|
249
|
+
// is ligature found?
|
|
250
|
+
lig = (*lig)[c.glyphId];
|
|
251
|
+
if (lig != nullptr && lig->value() > 0) {
|
|
252
|
+
target = lig;
|
|
253
|
+
index = i;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
// reset the current index
|
|
257
|
+
i = index;
|
|
258
|
+
auto rawKern = [](const Char& p, i32 q) {
|
|
259
|
+
// The glyph is guaranteed to be valid
|
|
260
|
+
auto kern = FontContext::getFont(p.fontId)->otf().glyph(p.glyphId)->kernRecord()[q];
|
|
261
|
+
if (kern == 0) {
|
|
262
|
+
// Try find from class-kerning
|
|
263
|
+
kern = FontContext::getFont(p.fontId)->otf().classKerning(p.glyphId, q);
|
|
264
|
+
}
|
|
265
|
+
return kern;
|
|
266
|
+
};
|
|
267
|
+
if (target != nullptr) {
|
|
268
|
+
// We found it! Replace with ligature char
|
|
269
|
+
const auto& fixed = Char::onlyGlyph(chr.fontId, target->value(), chr.scale);
|
|
270
|
+
curr->changeAtom(sptrOf<FixedCharAtom>(fixed));
|
|
271
|
+
// TODO record the original code-points?
|
|
272
|
+
} else if (nextGlyph != -1) {
|
|
273
|
+
kern = rawKern(chr, nextGlyph) * chr.scale;
|
|
274
|
+
} else if (nextAtom->isChar() && _ligKernSet[static_cast<i8>(nextAtom->leftType())]) {
|
|
275
|
+
auto nextChar = static_cast<CharSymbol*>(nextAtom.get());
|
|
276
|
+
kern = rawKern(chr, nextChar->getChar(env).glyphId) * chr.scale;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// 5. Insert glue, unless it's the first element of the row
|
|
281
|
+
// or the previous element or the current is a kerning
|
|
282
|
+
if (i != 0 && _previousAtom != nullptr && !_previousAtom->isKern() && !curr->isKern()) {
|
|
283
|
+
const auto glue = Glue::get(_previousAtom->rightType(), curr->leftType(), env);
|
|
284
|
+
if (std::abs(glue->_width) > PREC) {
|
|
285
|
+
hbox->add(glue);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// 6. Add break mark to box
|
|
290
|
+
if (_breakable) {
|
|
291
|
+
if (_breakEverywhere) {
|
|
292
|
+
hbox->addBreakPosition(hbox->size());
|
|
293
|
+
} else {
|
|
294
|
+
if (hasBreak) {
|
|
295
|
+
hbox->addBreakPosition(hbox->size());
|
|
296
|
+
} else {
|
|
297
|
+
auto charAtom = dynamic_cast<CharAtom*>(raw.get());
|
|
298
|
+
if (charAtom != nullptr && isUnicodeDigit(charAtom->unicode())) {
|
|
299
|
+
hbox->addBreakPosition(hbox->size());
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// 7. Add italic
|
|
306
|
+
curr->setPreviousAtom(_previousAtom);
|
|
307
|
+
auto box = curr->createBox(env);
|
|
308
|
+
/* FIXME
|
|
309
|
+
* In most cases we don't care the italic corrections
|
|
310
|
+
* on math environment, although it is looks crappy
|
|
311
|
+
if (auto cb = dynamic_cast<CharBox*>(box.get());
|
|
312
|
+
cb != nullptr
|
|
313
|
+
&& curr->isMathMode()
|
|
314
|
+
&& nextAtom != nullptr
|
|
315
|
+
&& nextAtom->isChar()) {
|
|
316
|
+
kern += cb->italic();
|
|
317
|
+
}*/
|
|
318
|
+
|
|
319
|
+
// 8. Append atom's box and kerning to horizontal box
|
|
320
|
+
hbox->add(box);
|
|
321
|
+
if (std::abs(kern) > PREC) hbox->add(StrutBox::create(kern));
|
|
322
|
+
|
|
323
|
+
env.setLastFontId(box->lastFontId());
|
|
324
|
+
// kerning do not interfere with the normal glue-rules without kerning
|
|
325
|
+
if (!curr->isKern()) _previousAtom = curr;
|
|
326
|
+
}
|
|
327
|
+
// reset previous atom
|
|
328
|
+
_previousAtom = nullptr;
|
|
329
|
+
return sptr<Box>(hbox);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
void RowAtom::setPreviousAtom(const sptr<AtomDecor>& prev) {
|
|
333
|
+
_previousAtom = prev;
|
|
334
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
#ifndef MICROTEX_ATOM_ROW_H
|
|
2
|
+
#define MICROTEX_ATOM_ROW_H
|
|
3
|
+
|
|
4
|
+
#include <bitset>
|
|
5
|
+
|
|
6
|
+
#include "atom/atom.h"
|
|
7
|
+
#include "atom/atom_text.h"
|
|
8
|
+
#include "box/box.h"
|
|
9
|
+
#include "unimath/uni_char.h"
|
|
10
|
+
#include "utils/utils.h"
|
|
11
|
+
|
|
12
|
+
namespace microtex {
|
|
13
|
+
|
|
14
|
+
class AtomDecor;
|
|
15
|
+
|
|
16
|
+
class FixedCharAtom;
|
|
17
|
+
|
|
18
|
+
class CharSymbol;
|
|
19
|
+
|
|
20
|
+
class Env;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A "composed atom": An atom that consists of child atoms that will be
|
|
24
|
+
* displayed next to each other horizontally with glue between them.
|
|
25
|
+
*/
|
|
26
|
+
class Row {
|
|
27
|
+
public:
|
|
28
|
+
/**
|
|
29
|
+
* Sets the given "decor" containing the atom that comes just before the first
|
|
30
|
+
* child atom of this "composed atom". This method will always be called by
|
|
31
|
+
* another composed atom, so this composed atom will be a child of it
|
|
32
|
+
* (nested). This is necessary to determine the glue to insert between the
|
|
33
|
+
* first child atom of this nested composed atom and the atom that the "decor"
|
|
34
|
+
* contains.
|
|
35
|
+
*
|
|
36
|
+
* @param decor
|
|
37
|
+
* the atom that comes just before this "composed atom"
|
|
38
|
+
*/
|
|
39
|
+
virtual void setPreviousAtom(const sptr<AtomDecor>& decor) = 0;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Used by RowAtom. The "textSymbol"-property and the type of an atom can changed
|
|
44
|
+
* (according to the TeX-algorithms used). Or this atom can be replaced by a
|
|
45
|
+
* ligature, (if it was a CharAtom). But atoms cannot be changed, otherwise
|
|
46
|
+
* different boxes could be made from the same formula, and that is not
|
|
47
|
+
* desired! This "atom decor" makes sure that changes to an atom (during the
|
|
48
|
+
* createBox-method of a RowAtom) will be reset.
|
|
49
|
+
*/
|
|
50
|
+
class AtomDecor {
|
|
51
|
+
private:
|
|
52
|
+
sptr<Atom> _atom;
|
|
53
|
+
bool _textSymbol = false;
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
AtomType _type = AtomType::none;
|
|
57
|
+
|
|
58
|
+
AtomDecor() = delete;
|
|
59
|
+
|
|
60
|
+
explicit AtomDecor(const sptr<Atom>& atom) {
|
|
61
|
+
_textSymbol = false;
|
|
62
|
+
_atom = atom;
|
|
63
|
+
_type = AtomType::none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** @return the changed type, or the old left type if it has not been changed */
|
|
67
|
+
inline AtomType leftType() const { return (_type != AtomType::none ? _type : _atom->leftType()); }
|
|
68
|
+
|
|
69
|
+
/** @return the changed type, or the old right type if it has not been changed */
|
|
70
|
+
inline AtomType rightType() const {
|
|
71
|
+
return (_type != AtomType::none ? _type : _atom->rightType());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Test if this atom is a char-symbol. */
|
|
75
|
+
bool isChar() const;
|
|
76
|
+
|
|
77
|
+
/** Test if this char is in math mode. */
|
|
78
|
+
bool isMathMode() const;
|
|
79
|
+
|
|
80
|
+
/** This method will only be called if #isChar returns true. */
|
|
81
|
+
Char getChar(Env& env) const;
|
|
82
|
+
|
|
83
|
+
/** Changes this atom into the given "ligature atom". */
|
|
84
|
+
void changeAtom(const sptr<FixedCharAtom>& atom);
|
|
85
|
+
|
|
86
|
+
sptr<Box> createBox(Env& env);
|
|
87
|
+
|
|
88
|
+
inline void markAsTextSymbol() { _textSymbol = true; }
|
|
89
|
+
|
|
90
|
+
/** Test if this atom is a kern. */
|
|
91
|
+
bool isKern() const;
|
|
92
|
+
|
|
93
|
+
/** Only for row-elements, for nested rows */
|
|
94
|
+
void setPreviousAtom(const sptr<AtomDecor>& prev);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* An atom representing a horizontal row of other atoms, to be separated by
|
|
99
|
+
* glue. It's also responsible for inserting kerns and ligature.
|
|
100
|
+
*/
|
|
101
|
+
class RowAtom : public Atom, public Row {
|
|
102
|
+
private:
|
|
103
|
+
// set of atom types that make a previous bin atom change to ord
|
|
104
|
+
static std::bitset<16> _binSet;
|
|
105
|
+
// set of atom types that can possibly need a kern or, together
|
|
106
|
+
// with the previous atom, be replaced by a ligature
|
|
107
|
+
static std::bitset<16> _ligKernSet;
|
|
108
|
+
|
|
109
|
+
// whether the box generated can be broken
|
|
110
|
+
bool _breakable;
|
|
111
|
+
// atoms to be displayed horizontally next to each-other
|
|
112
|
+
std::vector<sptr<Atom>> _elements;
|
|
113
|
+
// previous atom (for nested Row atoms)
|
|
114
|
+
sptr<AtomDecor> _previousAtom;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Change the atom-type to ORD if necessary
|
|
118
|
+
* <p>
|
|
119
|
+
* i.e. for formula: `$+ e - f$`, the plus sign should be treat as
|
|
120
|
+
* an ordinary type
|
|
121
|
+
*/
|
|
122
|
+
static void changeToOrd(AtomDecor* cur, AtomDecor* prev, Atom* next);
|
|
123
|
+
|
|
124
|
+
sptr<CharSymbol> currentChar(int i);
|
|
125
|
+
|
|
126
|
+
int processInvalid(const sptr<TextAtom>& txt, bool isMathMode, int i, Env& env);
|
|
127
|
+
|
|
128
|
+
sptr<TextAtom> processContinues(int& i, bool isMathMode);
|
|
129
|
+
|
|
130
|
+
public:
|
|
131
|
+
static bool _breakEverywhere;
|
|
132
|
+
|
|
133
|
+
bool _lookAtLastAtom;
|
|
134
|
+
|
|
135
|
+
RowAtom() : _lookAtLastAtom(false), _breakable(true) {}
|
|
136
|
+
|
|
137
|
+
explicit RowAtom(const sptr<Atom>& atom);
|
|
138
|
+
|
|
139
|
+
/** Get the atom at the front in the elements */
|
|
140
|
+
sptr<Atom> getFirstAtom();
|
|
141
|
+
|
|
142
|
+
/** Get and remove the atom at the tail in the elements */
|
|
143
|
+
sptr<Atom> popBack();
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Get the atom at position
|
|
147
|
+
*
|
|
148
|
+
* @param pos the position of the atom to retrieve
|
|
149
|
+
*/
|
|
150
|
+
sptr<Atom> get(size_t pos);
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Indicate the box generated by this atom can be broken or not
|
|
154
|
+
*
|
|
155
|
+
* @param breakable indicate whether the box can be broken
|
|
156
|
+
*/
|
|
157
|
+
inline void setBreakable(bool breakable) { _breakable = breakable; }
|
|
158
|
+
|
|
159
|
+
/** Get the size of the elements */
|
|
160
|
+
inline size_t size() const { return _elements.size(); }
|
|
161
|
+
|
|
162
|
+
/** Push an atom to back */
|
|
163
|
+
void add(const sptr<Atom>& atom);
|
|
164
|
+
|
|
165
|
+
sptr<Box> createBox(Env& env) override;
|
|
166
|
+
|
|
167
|
+
void setPreviousAtom(const sptr<AtomDecor>& prev) override;
|
|
168
|
+
|
|
169
|
+
AtomType leftType() const override;
|
|
170
|
+
|
|
171
|
+
AtomType rightType() const override;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
} // namespace microtex
|
|
175
|
+
|
|
176
|
+
#endif // MICROTEX_ATOM_ROW_H
|