@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,306 @@
|
|
|
1
|
+
#ifndef PARSER_H_INCLUDED
|
|
2
|
+
#define PARSER_H_INCLUDED
|
|
3
|
+
|
|
4
|
+
#include "atom/atom.h"
|
|
5
|
+
#include "env/units.h"
|
|
6
|
+
|
|
7
|
+
namespace microtex {
|
|
8
|
+
|
|
9
|
+
using Args = std::vector<std::string>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Convert a character to roman-number if it is a digit localized
|
|
13
|
+
* @param c character to be converted
|
|
14
|
+
*/
|
|
15
|
+
c32 convertToRomanNumber(c32 c);
|
|
16
|
+
|
|
17
|
+
class Formula;
|
|
18
|
+
|
|
19
|
+
class MacroInfo;
|
|
20
|
+
|
|
21
|
+
/** This class implements a parser for latex formulas */
|
|
22
|
+
class Parser {
|
|
23
|
+
private:
|
|
24
|
+
std::string _latex;
|
|
25
|
+
int _pos, _spos, _len;
|
|
26
|
+
int _group;
|
|
27
|
+
int _atIsLetter;
|
|
28
|
+
bool _insertion;
|
|
29
|
+
bool _arrayMode;
|
|
30
|
+
bool _isMathMode;
|
|
31
|
+
bool _isPartial;
|
|
32
|
+
|
|
33
|
+
/** Preprocess parse string */
|
|
34
|
+
void preprocess();
|
|
35
|
+
|
|
36
|
+
sptr<Atom> getScripts(char first);
|
|
37
|
+
|
|
38
|
+
std::string getCmd();
|
|
39
|
+
|
|
40
|
+
sptr<Atom> processEscape();
|
|
41
|
+
|
|
42
|
+
void insert(int beg, int end, const std::string& formula);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Return a string with command, options and arguments.
|
|
46
|
+
*
|
|
47
|
+
* @param cmd name of command
|
|
48
|
+
* @return command with arguments string with format: \cmd[opt][...]{arg}{...}
|
|
49
|
+
*/
|
|
50
|
+
std::string getCmdWithArgs(const std::string& cmd);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Process the given TeX command (by parsing following command
|
|
54
|
+
* arguments in the parse string).
|
|
55
|
+
*/
|
|
56
|
+
sptr<Atom> processCmd(const std::string& cmd, MacroInfo* mac);
|
|
57
|
+
|
|
58
|
+
void preprocess(std::string& cmd, Args& args, int& pos);
|
|
59
|
+
|
|
60
|
+
void preprocessNewCmd(std::string& cmd, Args& args, int& pos);
|
|
61
|
+
|
|
62
|
+
void inflateNewCmd(std::string& cmd, Args& args, int& pos);
|
|
63
|
+
|
|
64
|
+
void inflateEnv(std::string& cmd, Args& args, int& pos);
|
|
65
|
+
|
|
66
|
+
void init(bool isPartial, const std::string& latex, Formula* formula, bool firstPass);
|
|
67
|
+
|
|
68
|
+
sptr<Atom> getCharAtom();
|
|
69
|
+
|
|
70
|
+
public:
|
|
71
|
+
Formula* _formula;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Create a new TeXParser
|
|
75
|
+
* @param latex the string to be parsed
|
|
76
|
+
* @param formula the formula where to put the atoms
|
|
77
|
+
* @throw ex_parse if the string could not be parsed correctly
|
|
78
|
+
*/
|
|
79
|
+
Parser(const std::string& latex, Formula* formula) { init(true, latex, formula, true); }
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Create a new TeXParser
|
|
83
|
+
* @param isPartial if true certain exceptions are not thrown
|
|
84
|
+
* @param latex the string to be parsed
|
|
85
|
+
* @param formula the formula where to put the atoms
|
|
86
|
+
* @throw ex_parse if the string could not be parsed correctly
|
|
87
|
+
*/
|
|
88
|
+
Parser(bool isPartial, const std::string& latex, Formula* formula) {
|
|
89
|
+
init(isPartial, latex, formula, true);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Create a new TeXParser with or without a first pass
|
|
94
|
+
* @param isPartial if true certain exceptions are not thrown
|
|
95
|
+
* @param latex the string to be parsed
|
|
96
|
+
* @param formula the formula where to put the atoms
|
|
97
|
+
* @param preprocess indicate if the parser must replace the user-defined macros by their content
|
|
98
|
+
*
|
|
99
|
+
* @throw ex_parse if the string could not be parsed correctly
|
|
100
|
+
*/
|
|
101
|
+
Parser(bool isPartial, const std::string& latex, Formula* formula, bool preprocess) {
|
|
102
|
+
init(isPartial, latex, formula, preprocess);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Create a new TeXParser with or without a first pass
|
|
107
|
+
* @param latex the string to be parsed
|
|
108
|
+
* @param formula the formula where to put the atoms
|
|
109
|
+
* @param preprocess indicate if the parser must replace the user-defined macros by their content
|
|
110
|
+
*
|
|
111
|
+
* @throw ex_parse if the string could not be parsed correctly
|
|
112
|
+
*/
|
|
113
|
+
Parser(const std::string& latex, Formula* formula, bool preprocess) {
|
|
114
|
+
init(true, latex, formula, preprocess);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Create a new TeXParser which ignores or not the white spaces, it's useful
|
|
119
|
+
* for mbox command
|
|
120
|
+
*
|
|
121
|
+
* @param isPartial if true certain exceptions are not thrown
|
|
122
|
+
* @param latex the string to be parsed
|
|
123
|
+
* @param formula the formula to hold the atoms
|
|
124
|
+
* @param preprocess indicate if the parser must replace the user-defined macros by their content
|
|
125
|
+
* @param isMathMode a boolean to indicate if the parser must ignore or not the white space
|
|
126
|
+
*
|
|
127
|
+
* @throw ex_parse if the string could not be parsed correctly
|
|
128
|
+
*/
|
|
129
|
+
Parser(
|
|
130
|
+
bool isPartial,
|
|
131
|
+
const std::string& latex,
|
|
132
|
+
Formula* formula,
|
|
133
|
+
bool preprocess,
|
|
134
|
+
bool isMathMode
|
|
135
|
+
) {
|
|
136
|
+
init(isPartial, latex, formula, preprocess);
|
|
137
|
+
_isMathMode = isMathMode;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
void skipWhiteSpace(int count = -1);
|
|
141
|
+
|
|
142
|
+
/** Reset the parser with a new latex expression */
|
|
143
|
+
void reset(const std::string& latex);
|
|
144
|
+
|
|
145
|
+
/** Return true if we get a partial formula */
|
|
146
|
+
inline bool isPartial() const { return _isPartial; }
|
|
147
|
+
|
|
148
|
+
/** Get and remove the last atom of the current formula */
|
|
149
|
+
sptr<Atom> popBack() const;
|
|
150
|
+
|
|
151
|
+
/** Get and remove the atom represented by the current formula */
|
|
152
|
+
sptr<Atom> popFormulaAtom() const;
|
|
153
|
+
|
|
154
|
+
/** Put an atom in the current formula */
|
|
155
|
+
void addAtom(const sptr<Atom>& atom) const;
|
|
156
|
+
|
|
157
|
+
/** Make the character @ as letter that can be used in the command's name */
|
|
158
|
+
inline void makeAtLetter() { _atIsLetter++; }
|
|
159
|
+
|
|
160
|
+
/** Make the character @ that can not be used in the command's name */
|
|
161
|
+
inline void makeAtOther() { _atIsLetter--; }
|
|
162
|
+
|
|
163
|
+
/** Test if the character @ is considered as a letter or not */
|
|
164
|
+
inline bool isAtLetter() const { return (_atIsLetter != 0); }
|
|
165
|
+
|
|
166
|
+
/** Test if the parser is used to parse an array or not */
|
|
167
|
+
inline bool isArrayMode() const { return _arrayMode; }
|
|
168
|
+
|
|
169
|
+
/** Test if the parser is in math mode */
|
|
170
|
+
inline bool isMathMode() const { return _isMathMode; }
|
|
171
|
+
|
|
172
|
+
/** Return the current position in the parsed string */
|
|
173
|
+
inline int getPos() const { return _pos; }
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Rewind the current parsed string
|
|
177
|
+
*
|
|
178
|
+
* @param n the number of character to be rewind
|
|
179
|
+
* @return the new position in the parsed string
|
|
180
|
+
*/
|
|
181
|
+
inline int rewind(int n) {
|
|
182
|
+
_pos -= n;
|
|
183
|
+
return _pos;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Finish the parse process */
|
|
187
|
+
inline void finish() { _pos = _latex.size(); }
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Forward from current position to get a balanced group.
|
|
191
|
+
* <li> Forward to the end of the parse string if no group was in process
|
|
192
|
+
* <li> Otherwise get the balanced group embraced by '{' and '}' and forward
|
|
193
|
+
*/
|
|
194
|
+
std::string forwardBalancedGroup();
|
|
195
|
+
|
|
196
|
+
/** Forward parse while the given function #f returns true. */
|
|
197
|
+
std::string forward(std::function<bool(char)>&& f);
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Add a new row when the parser is in array mode
|
|
201
|
+
*
|
|
202
|
+
* @throw ex_parse if the parser is not in array mode
|
|
203
|
+
*/
|
|
204
|
+
void addRow() const;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Parse the input string
|
|
208
|
+
*
|
|
209
|
+
* @throw ex_parse if an error is encountered during parse
|
|
210
|
+
*/
|
|
211
|
+
void parse();
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Get the contents between two delimiters
|
|
215
|
+
*
|
|
216
|
+
* @param openClose the opening and closing character (such as $)
|
|
217
|
+
* @return the enclosed contents
|
|
218
|
+
*
|
|
219
|
+
* @throw ex_parse if the contents are badly enclosed
|
|
220
|
+
*/
|
|
221
|
+
std::string getGroup(char openClose);
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Get the contents between two delimiters
|
|
225
|
+
*
|
|
226
|
+
* @param open the opening character
|
|
227
|
+
* @param close the closing character
|
|
228
|
+
* @return the enclosed contents
|
|
229
|
+
*
|
|
230
|
+
* @throw ex_parse if the contents are badly enclosed
|
|
231
|
+
*/
|
|
232
|
+
std::string getGroup(char open, char close);
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Get the contents between two strings as in \\begin{foo}... \\end{foo}
|
|
236
|
+
*
|
|
237
|
+
* @param open the opening string
|
|
238
|
+
* @param close the closing string
|
|
239
|
+
* @return the enclosed contents
|
|
240
|
+
*
|
|
241
|
+
* @throw ex_parse if the contents are badly enclosed
|
|
242
|
+
*/
|
|
243
|
+
std::string getGroup(const std::string& open, const std::string& close);
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Get the argument of a command in his atomic format
|
|
247
|
+
*
|
|
248
|
+
* @return the corresponding atom
|
|
249
|
+
*
|
|
250
|
+
* @throw ex_parse if the argument is incorrect
|
|
251
|
+
*/
|
|
252
|
+
sptr<Atom> getArgument();
|
|
253
|
+
|
|
254
|
+
/** Get the supscript argument */
|
|
255
|
+
std::string getOverArgument();
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Get the unit and length from given string. The string must be in the format: a digital
|
|
259
|
+
* following with the unit (e.g. 10px, 1cm, 8.2em, ...) or a pair (UnitType::none, 0) will be
|
|
260
|
+
* returned.
|
|
261
|
+
*/
|
|
262
|
+
Dimen getDimen();
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Convert a character in the corresponding atom
|
|
266
|
+
*
|
|
267
|
+
* @param chr the character to be converted
|
|
268
|
+
* @return the corresponding atom
|
|
269
|
+
*/
|
|
270
|
+
sptr<Atom> getCharAtom(c32 chr);
|
|
271
|
+
|
|
272
|
+
/** Get the simple scripts from given character */
|
|
273
|
+
sptr<Atom> getSimpleScripts(bool isPrime);
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Get the arguments and the options of a command
|
|
277
|
+
*
|
|
278
|
+
* @param argc the number of arguments of the command
|
|
279
|
+
* @param opts
|
|
280
|
+
* must be 1 if the options are found before the first argument,
|
|
281
|
+
* and must be 2 if they must be found before the second argument,
|
|
282
|
+
* otherwise there're no options for the command.
|
|
283
|
+
*
|
|
284
|
+
* @param args a vector to put with argument strings
|
|
285
|
+
*/
|
|
286
|
+
void getOptsArgs(int argc, int opts, Args& args);
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Test the validity of the name of a command. It must contains only alpha
|
|
290
|
+
* characters and eventually a @ if makeAtletter activated
|
|
291
|
+
*
|
|
292
|
+
* @param cmd the command's name
|
|
293
|
+
* @return the validity of the name
|
|
294
|
+
*/
|
|
295
|
+
bool isValidCmd(const std::string& cmd) const;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Test the validity of a character in a command. It must contains only
|
|
299
|
+
* alpha characters and eventually a @ if makeAtletter activated
|
|
300
|
+
*/
|
|
301
|
+
bool isValidCharInCmd(char ch) const;
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
} // namespace microtex
|
|
305
|
+
|
|
306
|
+
#endif // PARSER_H_INCLUDED
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#include "core/split.h"
|
|
2
|
+
|
|
3
|
+
#include "box/box_group.h"
|
|
4
|
+
#include "utils/log.h"
|
|
5
|
+
|
|
6
|
+
using namespace std;
|
|
7
|
+
using namespace microtex;
|
|
8
|
+
|
|
9
|
+
#ifdef HAVE_LOG
|
|
10
|
+
|
|
11
|
+
static void printBox(const sptr<Box>& b, int dep, vector<bool>& lines, int max = 0) {
|
|
12
|
+
logv("%-4d", dep);
|
|
13
|
+
if (lines.size() < dep + 1) lines.resize(dep + 1, false);
|
|
14
|
+
|
|
15
|
+
for (int i = 0; i < dep - 1; i++) {
|
|
16
|
+
logv(lines[i] ? " " : " │ ");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (dep > 0) {
|
|
20
|
+
logv(lines[dep - 1] ? " └──" : " ├──");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (b == nullptr) {
|
|
24
|
+
logv(ANSI_COLOR_RED " NULL\n" ANSI_RESET);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const vector<sptr<Box>>& children = b->descendants();
|
|
29
|
+
const auto size = children.size();
|
|
30
|
+
const auto& name = b->name();
|
|
31
|
+
const char* fmt = (size > 0 ? ANSI_COLOR_CYAN " %-*s " ANSI_RESET : " %-*s ");
|
|
32
|
+
logv(fmt, size > 0 ? name.size() : max, name.c_str());
|
|
33
|
+
// show metrics and additional info
|
|
34
|
+
logv(
|
|
35
|
+
"[%g, (%g + %g) = %g, %g] %s\n",
|
|
36
|
+
b->_width,
|
|
37
|
+
b->_height,
|
|
38
|
+
b->_depth,
|
|
39
|
+
b->vlen(),
|
|
40
|
+
b->_shift,
|
|
41
|
+
b->toString().c_str()
|
|
42
|
+
);
|
|
43
|
+
if (size == 0) return;
|
|
44
|
+
|
|
45
|
+
size_t limit = 0;
|
|
46
|
+
for (const auto& x : children) {
|
|
47
|
+
limit = std::max(limit, x->name().size());
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
for (size_t i = 0; i < size; i++) {
|
|
51
|
+
lines[dep] = i == size - 1;
|
|
52
|
+
printBox(children[i], dep + 1, lines, limit);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
void microtex::printBox(const sptr<Box>& box) {
|
|
57
|
+
vector<bool> lines;
|
|
58
|
+
::printBox(box, 0, lines, box->name().size());
|
|
59
|
+
logv("\n");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#endif // HAVE_LOG
|
|
63
|
+
|
|
64
|
+
std::pair<bool, sptr<Box>> BoxSplitter::split(const sptr<Box>& b, float width, float lineSpace) {
|
|
65
|
+
auto h = dynamic_pointer_cast<HBox>(b);
|
|
66
|
+
sptr<Box> box;
|
|
67
|
+
if (h != nullptr) {
|
|
68
|
+
auto [splitted, box] = split(h, width, lineSpace);
|
|
69
|
+
#ifdef HAVE_LOG
|
|
70
|
+
if (box != b) {
|
|
71
|
+
logv("[BEFORE SPLIT]:\n");
|
|
72
|
+
printBox(b);
|
|
73
|
+
logv("[AFTER SPLIT]:\n");
|
|
74
|
+
printBox(box);
|
|
75
|
+
} else {
|
|
76
|
+
logv("[BOX TREE]:\n");
|
|
77
|
+
printBox(box);
|
|
78
|
+
}
|
|
79
|
+
#endif
|
|
80
|
+
return {splitted, box};
|
|
81
|
+
}
|
|
82
|
+
#ifdef HAVE_LOG
|
|
83
|
+
logv("[BOX TREE]:\n");
|
|
84
|
+
printBox(b);
|
|
85
|
+
#endif
|
|
86
|
+
return {false, b};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
std::pair<bool, sptr<Box>> BoxSplitter::split(const sptr<HBox>& hb, float width, float lineSpace) {
|
|
90
|
+
if (width == 0 || hb->_width <= width) return {false, hb};
|
|
91
|
+
|
|
92
|
+
auto* vbox = new VBox();
|
|
93
|
+
sptr<HBox> first, second;
|
|
94
|
+
stack<Position> positions;
|
|
95
|
+
sptr<HBox> hbox = hb;
|
|
96
|
+
bool splitted = false;
|
|
97
|
+
|
|
98
|
+
while (hbox->_width > width && canBreak(positions, hbox, width) != hbox->_width) {
|
|
99
|
+
Position pos = positions.top();
|
|
100
|
+
positions.pop();
|
|
101
|
+
auto hboxes = pos._box->split(pos._index - 1);
|
|
102
|
+
first = hboxes.first;
|
|
103
|
+
second = hboxes.second;
|
|
104
|
+
while (!positions.empty()) {
|
|
105
|
+
pos = positions.top();
|
|
106
|
+
positions.pop();
|
|
107
|
+
hboxes = pos._box->splitRemove(pos._index);
|
|
108
|
+
hboxes.first->add(first);
|
|
109
|
+
hboxes.second->add(0, second);
|
|
110
|
+
first = hboxes.first;
|
|
111
|
+
second = hboxes.second;
|
|
112
|
+
}
|
|
113
|
+
vbox->add(first, lineSpace);
|
|
114
|
+
splitted = true;
|
|
115
|
+
hbox = second;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (second != nullptr) {
|
|
119
|
+
vbox->add(second, lineSpace);
|
|
120
|
+
return {splitted, sptr<Box>(vbox)};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return {splitted, hbox};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
float BoxSplitter::canBreak(stack<Position>& s, const sptr<HBox>& hbox, const float width) {
|
|
127
|
+
const vector<sptr<Box>>& children = hbox->_children;
|
|
128
|
+
const int count = children.size();
|
|
129
|
+
// Cumulative width
|
|
130
|
+
auto* cumWidth = new float[count + 1]();
|
|
131
|
+
cumWidth[0] = 0;
|
|
132
|
+
for (int i = 0; i < count; i++) {
|
|
133
|
+
auto box = children[i];
|
|
134
|
+
cumWidth[i + 1] = cumWidth[i] + box->_width;
|
|
135
|
+
if (cumWidth[i + 1] <= width) continue;
|
|
136
|
+
int pos = getBreakPosition(hbox, i);
|
|
137
|
+
auto h = dynamic_pointer_cast<HBox>(box);
|
|
138
|
+
if (h != nullptr) {
|
|
139
|
+
stack<Position> sub;
|
|
140
|
+
float w = canBreak(sub, h, width - cumWidth[i]);
|
|
141
|
+
if (w != box->_width && (cumWidth[i] + w <= width || pos == -1)) {
|
|
142
|
+
s.push(Position(i - 1, hbox));
|
|
143
|
+
// add to stack
|
|
144
|
+
vector<Position> p;
|
|
145
|
+
while (!sub.empty()) {
|
|
146
|
+
p.push_back(sub.top());
|
|
147
|
+
sub.pop();
|
|
148
|
+
}
|
|
149
|
+
for (auto it = p.rbegin(); it != p.rend(); it++) s.push(*it);
|
|
150
|
+
// release cum-width
|
|
151
|
+
float x = cumWidth[i] + w;
|
|
152
|
+
delete[] cumWidth;
|
|
153
|
+
return x;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (pos != -1) {
|
|
158
|
+
s.push(Position(pos, hbox));
|
|
159
|
+
float x = cumWidth[pos];
|
|
160
|
+
delete[] cumWidth;
|
|
161
|
+
return x;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
delete[] cumWidth;
|
|
166
|
+
return hbox->_width;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
int BoxSplitter::getBreakPosition(const sptr<HBox>& hb, int i) {
|
|
170
|
+
if (hb->_breakPositions.empty()) return -1;
|
|
171
|
+
|
|
172
|
+
if (hb->_breakPositions.size() == 1 && hb->_breakPositions[0] <= i) {
|
|
173
|
+
return hb->_breakPositions[0];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
size_t pos = 0;
|
|
177
|
+
for (; pos < hb->_breakPositions.size(); pos++) {
|
|
178
|
+
if (hb->_breakPositions[pos] > i) {
|
|
179
|
+
if (pos == 0) return -1;
|
|
180
|
+
return hb->_breakPositions[pos - 1];
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return hb->_breakPositions[pos - 1];
|
|
185
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#ifndef MICROTEX_SPLIT_H
|
|
2
|
+
#define MICROTEX_SPLIT_H
|
|
3
|
+
|
|
4
|
+
#include <stack>
|
|
5
|
+
|
|
6
|
+
#include "box/box.h"
|
|
7
|
+
#include "box/box_group.h"
|
|
8
|
+
#include "core/glue.h"
|
|
9
|
+
|
|
10
|
+
namespace microtex {
|
|
11
|
+
|
|
12
|
+
#ifdef HAVE_LOG
|
|
13
|
+
|
|
14
|
+
void printBox(const sptr<Box>& box);
|
|
15
|
+
|
|
16
|
+
#endif // HAVE_LOG
|
|
17
|
+
|
|
18
|
+
class BoxSplitter {
|
|
19
|
+
public:
|
|
20
|
+
struct Position {
|
|
21
|
+
int _index;
|
|
22
|
+
sptr<HBox> _box;
|
|
23
|
+
|
|
24
|
+
Position(int index, const sptr<HBox>& box) : _index(index), _box(box) {}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
private:
|
|
28
|
+
static float canBreak(std::stack<Position>& stack, const sptr<HBox>& hbox, float width);
|
|
29
|
+
|
|
30
|
+
static int getBreakPosition(const sptr<HBox>& hb, int index);
|
|
31
|
+
|
|
32
|
+
static std::pair<bool, sptr<Box>> split(const sptr<HBox>& hb, float width, float lineSpace);
|
|
33
|
+
|
|
34
|
+
public:
|
|
35
|
+
static std::pair<bool, sptr<Box>> split(const sptr<Box>& box, float width, float lineSpace);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
} // namespace microtex
|
|
39
|
+
|
|
40
|
+
#endif // MICROTEX_SPLIT_H
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#include "env/env.h"
|
|
2
|
+
|
|
3
|
+
#include "env/units.h"
|
|
4
|
+
|
|
5
|
+
using namespace std;
|
|
6
|
+
using namespace microtex;
|
|
7
|
+
|
|
8
|
+
float Env::PIXELS_PER_POINT = 1.f;
|
|
9
|
+
|
|
10
|
+
float Env::scale(TexStyle style) const {
|
|
11
|
+
if (style < TexStyle::script) return 1;
|
|
12
|
+
auto math = _fctx->mathFont().otf().mathConsts();
|
|
13
|
+
i16 percent = style < TexStyle::scriptScript ? math->scriptPercentScaleDown()
|
|
14
|
+
: math->scriptScriptPercentScaleDown();
|
|
15
|
+
return percent / 100.f;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
float Env::scale() const {
|
|
19
|
+
return scale(_style);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
Env& Env::setTextWidth(const Dimen& dimen) {
|
|
23
|
+
_textWidth = Units::fsize(dimen, *this);
|
|
24
|
+
return *this;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
Env& Env::setLineSpace(const Dimen& dimen) {
|
|
28
|
+
_lineSpace = Units::fsize(dimen, *this);
|
|
29
|
+
return *this;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const MathConsts& Env::mathConsts() const {
|
|
33
|
+
return *_fctx->mathFont().otf().mathConsts();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
float Env::upem() const {
|
|
37
|
+
return _fctx->mathFont().otf().em();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
float Env::em() const {
|
|
41
|
+
return upem() * scale();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
float Env::ppem() const {
|
|
45
|
+
return PIXELS_PER_POINT * textSize();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
float Env::xHeight() const {
|
|
49
|
+
return _fctx->getFont(lastFontId())->otf().xHeight() * scale();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
float Env::space(bool isMathMode) const {
|
|
53
|
+
if (isMathMode) {
|
|
54
|
+
return _fctx->mathFont().otf().space() * scale();
|
|
55
|
+
}
|
|
56
|
+
return _fctx->mainSpace() * scale();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
float Env::ruleThickness() const {
|
|
60
|
+
return mathConsts().fractionRuleThickness() * scale();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
float Env::axisHeight() const {
|
|
64
|
+
return mathConsts().axisHeight() * scale();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
void Env::addFontStyle(FontStyle style, FontStyle& target) {
|
|
68
|
+
auto dummy = static_cast<u16>(target) | static_cast<u16>(style);
|
|
69
|
+
target = static_cast<FontStyle>(dummy);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
void Env::removeFontStyle(FontStyle style, FontStyle& target) {
|
|
73
|
+
auto dummy = static_cast<u16>(target) & (~static_cast<u16>(style));
|
|
74
|
+
target = static_cast<FontStyle>(dummy);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
void Env::addMathFontStyle(FontStyle style) {
|
|
78
|
+
addFontStyle(style, _mathFontStyle);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
void Env::removeMathFontStyle(FontStyle style) {
|
|
82
|
+
removeFontStyle(style, _mathFontStyle);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
void Env::addTextFontStyle(FontStyle style) {
|
|
86
|
+
addFontStyle(style, _textFontStyle);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
void Env::removeTextFontStyle(FontStyle style) {
|
|
90
|
+
removeFontStyle(style, _textFontStyle);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
void Env::selectMathFont(const std::string& name, MathStyle style) {
|
|
94
|
+
_fctx->selectMathFont(name);
|
|
95
|
+
MathVersion::setMathStyle(style);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
TexStyle Env::crampStyle() const {
|
|
99
|
+
const i8 style = static_cast<i8>(_style);
|
|
100
|
+
return static_cast<TexStyle>(style % 2 == 1 ? style : style + 1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
TexStyle Env::dnomStyle() const {
|
|
104
|
+
const i8 style = static_cast<i8>(_style);
|
|
105
|
+
return static_cast<TexStyle>(2 * (style / 2) + 1 + 2 - 2 * (style / 6));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
TexStyle Env::numStyle() const {
|
|
109
|
+
const i8 style = static_cast<i8>(_style);
|
|
110
|
+
return static_cast<TexStyle>(style + 2 - 2 * (style / 6));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
TexStyle Env::rootStyle() const {
|
|
114
|
+
return TexStyle::scriptScript;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
TexStyle Env::subStyle() const {
|
|
118
|
+
const i8 style = static_cast<i8>(_style);
|
|
119
|
+
return static_cast<TexStyle>(2 * (style / 4) + 4 + 1);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
TexStyle Env::supStyle() const {
|
|
123
|
+
const i8 style = static_cast<i8>(_style);
|
|
124
|
+
return static_cast<TexStyle>(2 * (style / 4) + 4 + (style % 2));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
Char Env::getChar(c32 code, bool isMathMode, FontStyle style) const {
|
|
128
|
+
auto targetStyle = style;
|
|
129
|
+
if (style == FontStyle::invalid) {
|
|
130
|
+
targetStyle = isMathMode ? _mathFontStyle : _textFontStyle;
|
|
131
|
+
}
|
|
132
|
+
auto chr = _fctx->getChar(code, targetStyle, isMathMode);
|
|
133
|
+
chr.scale = scale();
|
|
134
|
+
return chr;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
Char Env::getChar(const Symbol& sym) const {
|
|
138
|
+
auto chr = _fctx->getChar(sym, _mathFontStyle);
|
|
139
|
+
chr.scale = scale();
|
|
140
|
+
return chr;
|
|
141
|
+
}
|