@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,162 @@
|
|
|
1
|
+
#include "box/box_factory.h"
|
|
2
|
+
|
|
3
|
+
#include <deque>
|
|
4
|
+
|
|
5
|
+
#include "atom/atom_basic.h"
|
|
6
|
+
#include "atom/atom_char.h"
|
|
7
|
+
#include "box/box_group.h"
|
|
8
|
+
#include "core/formula.h"
|
|
9
|
+
#include "env/env.h"
|
|
10
|
+
#include "utils/exceptions.h"
|
|
11
|
+
#include "utils/utils.h"
|
|
12
|
+
|
|
13
|
+
using namespace std;
|
|
14
|
+
|
|
15
|
+
namespace microtex {
|
|
16
|
+
|
|
17
|
+
static constexpr auto ROUND_TOL = 10; // in font design unit
|
|
18
|
+
|
|
19
|
+
sptr<Box> createHDelim(const sptr<SymbolAtom>& sym, Env& env, int size) {
|
|
20
|
+
const auto& chr = sym->getChar(env);
|
|
21
|
+
return sptrOf<CharBox>(chr.hLarger(size));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
sptr<Box> createVDelim(const sptr<SymbolAtom>& sym, Env& env, int size) {
|
|
25
|
+
const auto& chr = sym->getChar(env);
|
|
26
|
+
return sptrOf<CharBox>(chr.vLarger(size));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static sptr<Box> createDelim(
|
|
30
|
+
const std::string& sym,
|
|
31
|
+
Env& env,
|
|
32
|
+
const float len,
|
|
33
|
+
bool isVertical,
|
|
34
|
+
bool round = false
|
|
35
|
+
) {
|
|
36
|
+
sptr<SymbolAtom> atom;
|
|
37
|
+
if (sym.length() == 1) {
|
|
38
|
+
const auto it = Formula::_charToSymbol.find(sym[0]);
|
|
39
|
+
if (it != Formula::_charToSymbol.end()) {
|
|
40
|
+
atom = SymbolAtom::get(it->second);
|
|
41
|
+
} else {
|
|
42
|
+
atom = SymbolAtom::get(sym);
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
atom = SymbolAtom::get(sym);
|
|
46
|
+
}
|
|
47
|
+
if (atom == nullptr) {
|
|
48
|
+
throw ex_parse(sym + " is not a delimiter!");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const auto& chr = atom->getChar(env);
|
|
52
|
+
// 1. try from variants
|
|
53
|
+
const auto variantCount = isVertical ? chr.vLargerCount() : chr.hLargerCount();
|
|
54
|
+
const auto tolerance = ROUND_TOL * env.scale();
|
|
55
|
+
auto wider = false;
|
|
56
|
+
// tail recursion, compiler will optimize this
|
|
57
|
+
std::function<sptr<Box>(int)> v = [&](int i) -> sptr<Box> {
|
|
58
|
+
if (i >= variantCount) return nullptr;
|
|
59
|
+
const auto& n = isVertical ? chr.vLarger(i) : chr.hLarger(i);
|
|
60
|
+
const auto l = isVertical ? n.height() + n.depth() : n.width();
|
|
61
|
+
wider = l >= len || (round && len - l <= tolerance);
|
|
62
|
+
if (i == variantCount - 1 || wider) return sptrOf<CharBox>(n);
|
|
63
|
+
return v(i + 1);
|
|
64
|
+
};
|
|
65
|
+
auto vb = v(0);
|
|
66
|
+
if (vb != nullptr && wider) return vb;
|
|
67
|
+
|
|
68
|
+
// 2. try from assembly
|
|
69
|
+
const auto& assembly = isVertical ? chr.vAssembly() : chr.hAssembly();
|
|
70
|
+
if (assembly.isEmpty()) {
|
|
71
|
+
if (vb != nullptr) return vb;
|
|
72
|
+
return sptrOf<CharBox>(chr);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
deque<pair<int, sptr<Box>>> f;
|
|
76
|
+
vector<sptr<Box>> r;
|
|
77
|
+
auto fl = 0.f, rl = 0.f, max = microtex::F_MAX;
|
|
78
|
+
|
|
79
|
+
auto run = [&](int i) {
|
|
80
|
+
const auto& part = assembly[i];
|
|
81
|
+
const auto b = sptrOf<CharBox>(chr.assemblyPart(part.glyph()));
|
|
82
|
+
const auto l = isVertical ? b->vlen() : b->_width;
|
|
83
|
+
if (part.startConnectorLength() != 0) {
|
|
84
|
+
max = std::min(max, (float)part.startConnectorLength());
|
|
85
|
+
}
|
|
86
|
+
if (part.endConnectorLength() != 0) {
|
|
87
|
+
max = std::min(max, (float)part.endConnectorLength());
|
|
88
|
+
}
|
|
89
|
+
if (!part.isExtender()) {
|
|
90
|
+
f.emplace_back(static_cast<int>(r.size()), b);
|
|
91
|
+
fl += l;
|
|
92
|
+
} else {
|
|
93
|
+
r.push_back(b);
|
|
94
|
+
rl += l;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const auto pcnt = assembly.partCount();
|
|
99
|
+
if (isVertical) {
|
|
100
|
+
for (auto i = pcnt - 1; i >= 0; --i) run(i);
|
|
101
|
+
} else {
|
|
102
|
+
for (auto i = 0; i < pcnt; i++) run(i);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const auto m = env.mathConsts().minConnectorOverlap() * env.scale();
|
|
106
|
+
// must satisfy:
|
|
107
|
+
// len < repeat_cnt * repeat_len + fixed_len
|
|
108
|
+
// - (repeat_part_size * repeat_cnt + fixed_part_size - 1) * min_connector_overlap
|
|
109
|
+
// thus:
|
|
110
|
+
// repeat_cnt > (len - fixed_len + (fixed_part_size - 1) * min_connector_overlap)
|
|
111
|
+
// / (repeat_len - repeat_part_size * min_connector_overlap)
|
|
112
|
+
const auto cnt = (int)std::ceil((len - fl + (f.size() - 1) * m) / (rl - r.size() * m));
|
|
113
|
+
const auto p = r.size() * cnt + f.size() - 1;
|
|
114
|
+
const auto e = (cnt * rl + fl - p * m - len) / p;
|
|
115
|
+
const auto s = std::min(m + e, max);
|
|
116
|
+
const auto space = (isVertical ? sptrOf<StrutBox>(0.f, -s, 0.f, 0.f) : StrutBox::create(-s));
|
|
117
|
+
|
|
118
|
+
sptr<BoxGroup> box;
|
|
119
|
+
if (isVertical)
|
|
120
|
+
box = sptrOf<VBox>();
|
|
121
|
+
else
|
|
122
|
+
box = sptrOf<HBox>();
|
|
123
|
+
|
|
124
|
+
for (size_t i = 0; i < r.size(); i++) {
|
|
125
|
+
while (!f.empty()) {
|
|
126
|
+
const auto& [k, n] = f.front();
|
|
127
|
+
if (k == i) {
|
|
128
|
+
box->add(n);
|
|
129
|
+
box->add(space);
|
|
130
|
+
f.pop_front();
|
|
131
|
+
} else {
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const auto b = r[i];
|
|
136
|
+
for (int j = 0; j < cnt; j++) {
|
|
137
|
+
box->add(b);
|
|
138
|
+
if (i == r.size() - 1 && j == cnt - 1 && f.empty()) break;
|
|
139
|
+
box->add(space);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
while (!f.empty()) {
|
|
144
|
+
const auto& [_, b] = f.front();
|
|
145
|
+
box->add(b);
|
|
146
|
+
f.pop_front();
|
|
147
|
+
if (f.empty()) break;
|
|
148
|
+
box->add(space);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return box;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
sptr<Box> createHDelim(const std::string& sym, Env& env, float width, bool round) {
|
|
155
|
+
return createDelim(sym, env, width, false, round);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
sptr<Box> createVDelim(const std::string& sym, Env& env, float height, bool round) {
|
|
159
|
+
return createDelim(sym, env, height, true, round);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
} // namespace microtex
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#ifndef MICROTEX_BOX_FACTORY_H
|
|
2
|
+
#define MICROTEX_BOX_FACTORY_H
|
|
3
|
+
|
|
4
|
+
#include "atom/atom.h"
|
|
5
|
+
|
|
6
|
+
namespace microtex {
|
|
7
|
+
|
|
8
|
+
class SymbolAtom;
|
|
9
|
+
|
|
10
|
+
/** Create a horizontal delimiter with given symbol and size */
|
|
11
|
+
sptr<Box> createHDelim(const sptr<SymbolAtom>& sym, Env& env, int size);
|
|
12
|
+
|
|
13
|
+
/** Create a vertical delimiter with given symbol and size */
|
|
14
|
+
sptr<Box> createVDelim(const sptr<SymbolAtom>& sym, Env& env, int size);
|
|
15
|
+
|
|
16
|
+
/** Create a horizontal delimiter with given symbol and width */
|
|
17
|
+
sptr<Box> createHDelim(const std::string& sym, Env& env, float width, bool round = false);
|
|
18
|
+
|
|
19
|
+
/** Create a vertical delimiter with given symbol and height */
|
|
20
|
+
sptr<Box> createVDelim(const std::string& sym, Env& env, float height, bool round = false);
|
|
21
|
+
|
|
22
|
+
} // namespace microtex
|
|
23
|
+
|
|
24
|
+
#endif // MICROTEX_BOX_FACTORY_H
|
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
#include "box/box_group.h"
|
|
2
|
+
|
|
3
|
+
#include <utility>
|
|
4
|
+
|
|
5
|
+
#include "box/box_single.h"
|
|
6
|
+
#include "graphic/graphic.h"
|
|
7
|
+
|
|
8
|
+
using namespace std;
|
|
9
|
+
using namespace microtex;
|
|
10
|
+
|
|
11
|
+
/************************************* horizontal box implementation ******************************/
|
|
12
|
+
|
|
13
|
+
HBox::HBox(const sptr<Box>& box, float width, float bias) {
|
|
14
|
+
if (width == POS_INF) {
|
|
15
|
+
add(box);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
float rest = width - box->_width;
|
|
19
|
+
if (rest < 0) {
|
|
20
|
+
add(box);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (std::abs(bias) < PREC) {
|
|
24
|
+
auto space = StrutBox::create(rest / 2);
|
|
25
|
+
add(space);
|
|
26
|
+
add(box);
|
|
27
|
+
add(space);
|
|
28
|
+
} else {
|
|
29
|
+
add(StrutBox::create(rest / 2 + bias));
|
|
30
|
+
add(box);
|
|
31
|
+
add(StrutBox::create(rest / 2 - bias));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
HBox::HBox(const sptr<Box>& box, float width, Alignment alignment) {
|
|
36
|
+
if (width == POS_INF) {
|
|
37
|
+
add(box);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
float rest = width - box->_width;
|
|
41
|
+
if (rest <= 0) {
|
|
42
|
+
add(box);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (alignment == Alignment::center || alignment == Alignment::none) {
|
|
46
|
+
auto space = StrutBox::create(rest / 2);
|
|
47
|
+
add(space);
|
|
48
|
+
add(box);
|
|
49
|
+
add(space);
|
|
50
|
+
} else if (alignment == Alignment::left) {
|
|
51
|
+
add(box);
|
|
52
|
+
auto space = StrutBox::create(rest);
|
|
53
|
+
add(space);
|
|
54
|
+
} else if (alignment == Alignment::right) {
|
|
55
|
+
auto space = StrutBox::create(rest);
|
|
56
|
+
add(space);
|
|
57
|
+
add(box);
|
|
58
|
+
} else {
|
|
59
|
+
add(box);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
HBox::HBox(const sptr<Box>& box) {
|
|
64
|
+
add(box);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
void HBox::recalculate(const Box& box) {
|
|
68
|
+
// \left(\!\!\!\begin{array}{c}n\\\\r\end{array}\!\!\!\right)+123
|
|
69
|
+
// curPos += box._width;
|
|
70
|
+
// width = max(width, curPos);
|
|
71
|
+
_width += box._width;
|
|
72
|
+
const float h = _children.empty() ? NEG_INF : _height;
|
|
73
|
+
_height = max(h, box._height - box._shift);
|
|
74
|
+
const float d = _children.empty() ? NEG_INF : _depth;
|
|
75
|
+
_depth = max(d, box._depth + box._shift);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
sptr<HBox> HBox::cloneBox() {
|
|
79
|
+
auto* b = new HBox();
|
|
80
|
+
b->_shift = _shift;
|
|
81
|
+
return sptr<HBox>(b);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
void HBox::add(const sptr<Box>& box) {
|
|
85
|
+
recalculate(*box);
|
|
86
|
+
BoxGroup::add(box);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
void HBox::add(int pos, const sptr<Box>& box) {
|
|
90
|
+
recalculate(*box);
|
|
91
|
+
BoxGroup::add(pos, box);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
void HBox::replaceFirst(const sptr<Box>& from, const sptr<Box>& to) {
|
|
95
|
+
auto replaced = false;
|
|
96
|
+
for (auto& i : _children) {
|
|
97
|
+
if (i == from) {
|
|
98
|
+
replaced = true;
|
|
99
|
+
i = to;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (!replaced) return;
|
|
104
|
+
_width -= from->_width - to->_width;
|
|
105
|
+
auto mh = 0.f, md = 0.f;
|
|
106
|
+
for (auto& i : _children) {
|
|
107
|
+
mh = std::max(mh, i->_height - i->_shift);
|
|
108
|
+
md = std::max(md, i->_depth + i->_shift);
|
|
109
|
+
}
|
|
110
|
+
_height = mh;
|
|
111
|
+
_depth = md;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
pair<sptr<HBox>, sptr<HBox>> HBox::split(int pos, int shift) {
|
|
115
|
+
auto hb1 = cloneBox();
|
|
116
|
+
auto hb2 = cloneBox();
|
|
117
|
+
for (int i = 0; i <= pos; i++) {
|
|
118
|
+
hb1->add(_children[i]);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
for (size_t i = pos + shift; i < _children.size(); i++) {
|
|
122
|
+
hb2->add(_children[i]);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (!_breakPositions.empty()) {
|
|
126
|
+
for (int _breakPosition : _breakPositions) {
|
|
127
|
+
if (_breakPosition > pos + 1) {
|
|
128
|
+
hb2->addBreakPosition(_breakPosition - pos - 1);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return make_pair(hb1, hb2);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
void HBox::draw(Graphics2D& g2, float x, float y) {
|
|
137
|
+
float xPos = x;
|
|
138
|
+
for (const auto& box : _children) {
|
|
139
|
+
box->draw(g2, xPos, y + box->_shift);
|
|
140
|
+
xPos += box->_width;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/************************************* vertical box implementation ********************************/
|
|
145
|
+
|
|
146
|
+
VBox::VBox(const sptr<Box>& box, float rest, Alignment alignment)
|
|
147
|
+
: _leftMostPos(F_MAX), _rightMostPos(F_MIN) {
|
|
148
|
+
add(box);
|
|
149
|
+
if (alignment == Alignment::center) {
|
|
150
|
+
auto s = sptrOf<StrutBox>(0.f, rest / 2, 0.f, 0.f);
|
|
151
|
+
BoxGroup::add(0, s);
|
|
152
|
+
_height += rest / 2.f;
|
|
153
|
+
_depth += rest / 2.f;
|
|
154
|
+
BoxGroup::add(s);
|
|
155
|
+
} else if (alignment == Alignment::top) {
|
|
156
|
+
_depth += rest;
|
|
157
|
+
auto s = sptrOf<StrutBox>(0.f, rest, 0.f, 0.f);
|
|
158
|
+
BoxGroup::add(s);
|
|
159
|
+
} else if (alignment == Alignment::bottom) {
|
|
160
|
+
_height += rest;
|
|
161
|
+
auto s = sptrOf<StrutBox>(0.f, rest, 0.f, 0.f);
|
|
162
|
+
BoxGroup::add(0, s);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
void VBox::recalculateWidth(const Box& box) {
|
|
167
|
+
_leftMostPos = min(_leftMostPos, box._shift);
|
|
168
|
+
_rightMostPos = max(_rightMostPos, box._shift + (box._width > 0 ? box._width : 0));
|
|
169
|
+
_width = _rightMostPos - _leftMostPos;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
void VBox::add(const sptr<Box>& box) {
|
|
173
|
+
BoxGroup::add(box);
|
|
174
|
+
if (_children.size() == 1) {
|
|
175
|
+
_height = box->_height;
|
|
176
|
+
_depth = box->_depth;
|
|
177
|
+
} else {
|
|
178
|
+
_depth += box->_height + box->_depth;
|
|
179
|
+
}
|
|
180
|
+
recalculateWidth(*box);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
void VBox::add(const sptr<Box>& box, float interline) {
|
|
184
|
+
if (!_children.empty()) {
|
|
185
|
+
auto s = sptrOf<StrutBox>(0.f, interline, 0.f, 0.f);
|
|
186
|
+
add(s);
|
|
187
|
+
}
|
|
188
|
+
add(box);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
void VBox::add(int pos, const sptr<Box>& box) {
|
|
192
|
+
BoxGroup::add(pos, box);
|
|
193
|
+
if (pos == 0) {
|
|
194
|
+
_depth += box->_depth + _height;
|
|
195
|
+
_height = box->_height;
|
|
196
|
+
} else {
|
|
197
|
+
_depth += box->_height + box->_depth;
|
|
198
|
+
}
|
|
199
|
+
recalculateWidth(*box);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
void VBox::draw(Graphics2D& g2, float x, float y) {
|
|
203
|
+
float yPos = y - _height;
|
|
204
|
+
for (const auto& b : _children) {
|
|
205
|
+
yPos += b->_height;
|
|
206
|
+
b->draw(g2, x + b->_shift - _leftMostPos, yPos);
|
|
207
|
+
yPos += b->_depth;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/********************************** color box implementation ********************************/
|
|
212
|
+
|
|
213
|
+
ColorBox::ColorBox(const sptr<Box>& box, color fg, color bg) : DecorBox(box) {
|
|
214
|
+
_foreground = fg;
|
|
215
|
+
_background = bg;
|
|
216
|
+
_type = box->_type;
|
|
217
|
+
copyMetrics(box);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
void ColorBox::draw(Graphics2D& g2, float x, float y) {
|
|
221
|
+
const color prev = g2.getColor();
|
|
222
|
+
if (!isTransparent(_background)) {
|
|
223
|
+
g2.setColor(_background);
|
|
224
|
+
g2.fillRect(x, y - _height, _width, _height + _depth);
|
|
225
|
+
}
|
|
226
|
+
g2.setColor(isTransparent(_foreground) ? prev : _foreground);
|
|
227
|
+
_base->draw(g2, x, y);
|
|
228
|
+
g2.setColor(prev);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/*************************************** scale box implementation *********************************/
|
|
232
|
+
|
|
233
|
+
void ScaleBox::init(const sptr<Box>& b, float sx, float sy) {
|
|
234
|
+
_sx = (isnan(sx) || isinf(sx)) ? 1 : sx;
|
|
235
|
+
_sy = (isnan(sy) || isinf(sy)) ? 1 : sy;
|
|
236
|
+
_width = b->_width * abs(_sx);
|
|
237
|
+
_height = _sy > 0 ? b->_height * _sy : -b->_depth * _sy;
|
|
238
|
+
_depth = _sy > 0 ? b->_depth * _sy : -b->_height * _sy;
|
|
239
|
+
_shift = b->_shift * _sy;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
void ScaleBox::draw(Graphics2D& g2, float x, float y) {
|
|
243
|
+
if (_sx == 0 || _sy == 0) return;
|
|
244
|
+
float dec = _sx < 0 ? _width : 0;
|
|
245
|
+
g2.translate(x + dec, y);
|
|
246
|
+
g2.scale(_sx, _sy);
|
|
247
|
+
_base->draw(g2, 0, 0);
|
|
248
|
+
g2.scale(1.f / _sx, 1.f / _sy);
|
|
249
|
+
g2.translate(-x - dec, -y);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/************************************** reflect box implementation ********************************/
|
|
253
|
+
|
|
254
|
+
ReflectBox::ReflectBox(const sptr<Box>& b) : DecorBox(b) {
|
|
255
|
+
copyMetrics(b);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
void ReflectBox::draw(Graphics2D& g2, float x, float y) {
|
|
259
|
+
g2.translate(x, y);
|
|
260
|
+
g2.scale(-1, 1);
|
|
261
|
+
_base->draw(g2, -_width, 0);
|
|
262
|
+
g2.scale(-1, 1);
|
|
263
|
+
g2.translate(-x, -y);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/************************************** rotate box implementation *********************************/
|
|
267
|
+
|
|
268
|
+
void RotateBox::init(const sptr<Box>& b, float angle, float x, float y) {
|
|
269
|
+
_angle = angle * PI / 180;
|
|
270
|
+
_height = b->_height;
|
|
271
|
+
_depth = b->_depth;
|
|
272
|
+
_width = b->_width;
|
|
273
|
+
float s = sin(_angle);
|
|
274
|
+
float c = cos(_angle);
|
|
275
|
+
_shiftX = x * (1 - c) + y * s;
|
|
276
|
+
_shiftY = y * (1 - c) - x * s;
|
|
277
|
+
|
|
278
|
+
// clang-format off
|
|
279
|
+
_xmax = max(
|
|
280
|
+
-_height * s,
|
|
281
|
+
max(
|
|
282
|
+
_depth * s,
|
|
283
|
+
max(_width * c + _depth * s, _width * c - _height * s)
|
|
284
|
+
)
|
|
285
|
+
) + _shiftX;
|
|
286
|
+
|
|
287
|
+
_xmin = min(
|
|
288
|
+
-_height * s,
|
|
289
|
+
min(
|
|
290
|
+
_depth * s,
|
|
291
|
+
min(_width * c + _depth * s, _width * c - _height * s)
|
|
292
|
+
)
|
|
293
|
+
) + _shiftX;
|
|
294
|
+
|
|
295
|
+
_ymax = max(
|
|
296
|
+
_height * c,
|
|
297
|
+
max(
|
|
298
|
+
-_depth * c,
|
|
299
|
+
max(_width * s - _depth * c, _width * s + _height * c)
|
|
300
|
+
)
|
|
301
|
+
);
|
|
302
|
+
_ymin = min(
|
|
303
|
+
_height * c,
|
|
304
|
+
min(
|
|
305
|
+
-_depth * c,
|
|
306
|
+
min(_width * s - _depth * c, _width * s + _height * c)
|
|
307
|
+
)
|
|
308
|
+
);
|
|
309
|
+
// clang-format on
|
|
310
|
+
|
|
311
|
+
_width = _xmax - _xmin;
|
|
312
|
+
_height = _ymax + _shiftY;
|
|
313
|
+
_depth = -_ymin - _shiftY;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
Point RotateBox::calculateShift(const Box& b, Rotation option) {
|
|
317
|
+
Point p(0, -b._depth);
|
|
318
|
+
switch (option) {
|
|
319
|
+
case Rotation::bl:
|
|
320
|
+
p.x = 0;
|
|
321
|
+
p.y = -b._depth;
|
|
322
|
+
break;
|
|
323
|
+
case Rotation::br:
|
|
324
|
+
p.x = b._width;
|
|
325
|
+
p.y = -b._depth;
|
|
326
|
+
break;
|
|
327
|
+
case Rotation::bc:
|
|
328
|
+
p.x = b._width / 2.f;
|
|
329
|
+
p.y = -b._depth;
|
|
330
|
+
break;
|
|
331
|
+
case Rotation::tl:
|
|
332
|
+
p.x = 0;
|
|
333
|
+
p.y = b._height;
|
|
334
|
+
break;
|
|
335
|
+
case Rotation::tr:
|
|
336
|
+
p.x = b._width;
|
|
337
|
+
p.y = b._height;
|
|
338
|
+
break;
|
|
339
|
+
case Rotation::tc:
|
|
340
|
+
p.x = b._width / 2.f;
|
|
341
|
+
p.y = b._height;
|
|
342
|
+
break;
|
|
343
|
+
case Rotation::Bl:
|
|
344
|
+
p.x = 0;
|
|
345
|
+
p.y = 0;
|
|
346
|
+
break;
|
|
347
|
+
case Rotation::Br:
|
|
348
|
+
p.x = b._width;
|
|
349
|
+
p.y = 0;
|
|
350
|
+
break;
|
|
351
|
+
case Rotation::Bc:
|
|
352
|
+
p.x = b._width / 2.f;
|
|
353
|
+
p.y = 0;
|
|
354
|
+
break;
|
|
355
|
+
case Rotation::cl:
|
|
356
|
+
p.x = 0;
|
|
357
|
+
p.y = (b._height - b._depth) / 2.f;
|
|
358
|
+
break;
|
|
359
|
+
case Rotation::cr:
|
|
360
|
+
p.x = b._width;
|
|
361
|
+
p.y = (b._height - b._depth) / 2.f;
|
|
362
|
+
break;
|
|
363
|
+
case Rotation::cc:
|
|
364
|
+
p.x = b._width / 2.f;
|
|
365
|
+
p.y = (b._height - b._depth) / 2.f;
|
|
366
|
+
break;
|
|
367
|
+
default: break;
|
|
368
|
+
}
|
|
369
|
+
return p;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
Rotation RotateBox::getOrigin(string option) {
|
|
373
|
+
if (option.empty()) return Rotation::Bl;
|
|
374
|
+
if (option.size() == 1) option += "c";
|
|
375
|
+
|
|
376
|
+
if (option == "bl" || option == "lb") return Rotation::bl;
|
|
377
|
+
if (option == "bc" || option == "cb") return Rotation::bc;
|
|
378
|
+
if (option == "br" || option == "rb") return Rotation::br;
|
|
379
|
+
if (option == "cl" || option == "lc") return Rotation::cl;
|
|
380
|
+
if (option == "cc") return Rotation::cc;
|
|
381
|
+
if (option == "cr" || option == "rc") return Rotation::cr;
|
|
382
|
+
if (option == "tl" || option == "lt") return Rotation::tl;
|
|
383
|
+
if (option == "tc" || option == "ct") return Rotation::tc;
|
|
384
|
+
if (option == "tr" || option == "rt") return Rotation::tr;
|
|
385
|
+
if (option == "Bl" || option == "lB") return Rotation::Bl;
|
|
386
|
+
if (option == "Bc" || option == "cB") return Rotation::Bc;
|
|
387
|
+
if (option == "Br" || option == "rB") return Rotation::Br;
|
|
388
|
+
return Rotation::Bl;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
void RotateBox::draw(Graphics2D& g2, float x, float y) {
|
|
392
|
+
y -= _shiftY;
|
|
393
|
+
x += _shiftX - _xmin;
|
|
394
|
+
g2.rotate(-_angle, x, y);
|
|
395
|
+
_base->draw(g2, x, y);
|
|
396
|
+
g2.rotate(_angle, x, y);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/************************************* framed box implementation **********************************/
|
|
400
|
+
|
|
401
|
+
void FramedBox::init(const sptr<Box>& box, float thickness, float space) {
|
|
402
|
+
_line = transparent;
|
|
403
|
+
_bg = transparent;
|
|
404
|
+
const Box& b = *box;
|
|
405
|
+
_width = b._width + 2 * thickness + 2 * space;
|
|
406
|
+
_height = b._height + thickness + space;
|
|
407
|
+
_depth = b._depth + thickness + space;
|
|
408
|
+
_shift = b._shift;
|
|
409
|
+
_thickness = thickness;
|
|
410
|
+
_space = space;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
void FramedBox::draw(Graphics2D& g2, float x, float y) {
|
|
414
|
+
const Stroke& st = g2.getStroke();
|
|
415
|
+
g2.setStroke(Stroke(_thickness, CAP_BUTT, JOIN_MITER));
|
|
416
|
+
float th = _thickness / 2.f;
|
|
417
|
+
if (!isTransparent(_bg)) {
|
|
418
|
+
color prev = g2.getColor();
|
|
419
|
+
g2.setColor(_bg);
|
|
420
|
+
g2.fillRect(x + th, y - _height + th, _width - _thickness, _height + _depth - _thickness);
|
|
421
|
+
g2.setColor(prev);
|
|
422
|
+
}
|
|
423
|
+
if (!isTransparent(_line)) {
|
|
424
|
+
color prev = g2.getColor();
|
|
425
|
+
g2.setColor(_line);
|
|
426
|
+
g2.drawRect(x + th, y - _height + th, _width - _thickness, _height + _depth - _thickness);
|
|
427
|
+
g2.setColor(prev);
|
|
428
|
+
} else {
|
|
429
|
+
g2.drawRect(x + th, y - _height + th, _width - _thickness, _height + _depth - _thickness);
|
|
430
|
+
}
|
|
431
|
+
g2.setStroke(st);
|
|
432
|
+
_base->draw(g2, x + _space + _thickness, y);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
void OvalBox::draw(Graphics2D& g2, float x, float y) {
|
|
436
|
+
const Stroke& st = g2.getStroke();
|
|
437
|
+
g2.setStroke(Stroke(_thickness, CAP_BUTT, JOIN_MITER));
|
|
438
|
+
float th = _thickness / 2.f;
|
|
439
|
+
float r = 0.f;
|
|
440
|
+
if (_diameter != 0) {
|
|
441
|
+
r = _diameter;
|
|
442
|
+
} else {
|
|
443
|
+
r = _multiplier * min(_width - _thickness, _height + _depth - _thickness);
|
|
444
|
+
}
|
|
445
|
+
g2.drawRoundRect(
|
|
446
|
+
x + th,
|
|
447
|
+
y - _height + th,
|
|
448
|
+
_width - _thickness,
|
|
449
|
+
_height + _depth - _thickness,
|
|
450
|
+
r,
|
|
451
|
+
r
|
|
452
|
+
);
|
|
453
|
+
g2.setStroke(st);
|
|
454
|
+
_base->draw(g2, x + _space + _thickness, y);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
void ShadowBox::draw(Graphics2D& g2, float x, float y) {
|
|
458
|
+
const float th = _thickness / 2.f;
|
|
459
|
+
const Stroke& st = g2.getStroke();
|
|
460
|
+
g2.setStroke(Stroke(_thickness, CAP_BUTT, JOIN_MITER));
|
|
461
|
+
g2.drawRect(
|
|
462
|
+
x + th,
|
|
463
|
+
y - _height + th,
|
|
464
|
+
_width - _shadowRule - _thickness,
|
|
465
|
+
_height + _depth - _shadowRule - _thickness
|
|
466
|
+
);
|
|
467
|
+
float penth = abs(1.f / g2.sx());
|
|
468
|
+
g2.setStroke(Stroke(penth, CAP_BUTT, JOIN_MITER));
|
|
469
|
+
g2.fillRect(
|
|
470
|
+
x + _shadowRule - penth,
|
|
471
|
+
y + _depth - _shadowRule - penth,
|
|
472
|
+
_width - _shadowRule,
|
|
473
|
+
_shadowRule
|
|
474
|
+
);
|
|
475
|
+
g2.fillRect(
|
|
476
|
+
x + _width - _shadowRule - penth,
|
|
477
|
+
y - _height + th + _shadowRule,
|
|
478
|
+
_shadowRule,
|
|
479
|
+
_depth + _height - 2 * _shadowRule - th
|
|
480
|
+
);
|
|
481
|
+
g2.setStroke(st);
|
|
482
|
+
_base->draw(g2, x + _space + _thickness, y);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/************************************ wrapper box implementation **********************************/
|
|
486
|
+
|
|
487
|
+
void WrapperBox::addInsets(float l, float t, float r, float b) {
|
|
488
|
+
_l += l;
|
|
489
|
+
_width += l + r;
|
|
490
|
+
_height += t;
|
|
491
|
+
_depth += b;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
void WrapperBox::draw(Graphics2D& g2, float x, float y) {
|
|
495
|
+
const color prev = g2.getColor();
|
|
496
|
+
if (!isTransparent(_bg)) {
|
|
497
|
+
g2.setColor(_bg);
|
|
498
|
+
g2.fillRect(x, y - _height, _width, _height + _depth);
|
|
499
|
+
}
|
|
500
|
+
g2.setColor(isTransparent(_fg) ? prev : _fg);
|
|
501
|
+
_base->draw(g2, x + _l, y + _base->_shift);
|
|
502
|
+
g2.setColor(prev);
|
|
503
|
+
}
|