@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,136 @@
|
|
|
1
|
+
#include "render.h"
|
|
2
|
+
|
|
3
|
+
#include <functional>
|
|
4
|
+
|
|
5
|
+
#include "atom/atom.h"
|
|
6
|
+
#include "box/box_single.h"
|
|
7
|
+
#include "core/debug_config.h"
|
|
8
|
+
#include "core/split.h"
|
|
9
|
+
#include "env/env.h"
|
|
10
|
+
|
|
11
|
+
using namespace std;
|
|
12
|
+
using namespace microtex;
|
|
13
|
+
|
|
14
|
+
namespace microtex {
|
|
15
|
+
|
|
16
|
+
using BoxFilter = std::function<bool(const sptr<Box>&)>;
|
|
17
|
+
|
|
18
|
+
struct RenderData {
|
|
19
|
+
sptr<Box> root;
|
|
20
|
+
float textSize;
|
|
21
|
+
float fixedScale;
|
|
22
|
+
color fg;
|
|
23
|
+
bool isSplit;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
static sptr<BoxGroup> wrap(const sptr<Box>& box) {
|
|
27
|
+
sptr<BoxGroup> parent;
|
|
28
|
+
if (auto group = dynamic_pointer_cast<BoxGroup>(box); group != nullptr) {
|
|
29
|
+
parent = group;
|
|
30
|
+
} else {
|
|
31
|
+
parent = sptrOf<HBox>(box);
|
|
32
|
+
}
|
|
33
|
+
return parent;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static void
|
|
37
|
+
buildDebug(const sptr<BoxGroup>& parent, const sptr<Box>& box, const BoxFilter& filter) {
|
|
38
|
+
if (parent != nullptr) {
|
|
39
|
+
if (box->isSpace()) {
|
|
40
|
+
parent->addOnly(box);
|
|
41
|
+
} else if (filter(box)) {
|
|
42
|
+
parent->addOnly(sptrOf<DebugBox>(box));
|
|
43
|
+
} else {
|
|
44
|
+
// placeholder to consume the space of the current box
|
|
45
|
+
parent->addOnly(sptrOf<StrutBox>(box));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (auto group = dynamic_pointer_cast<BoxGroup>(box); group != nullptr) {
|
|
49
|
+
const auto kern =
|
|
50
|
+
sptrOf<StrutBox>(-group->_width, -group->_height, -group->_depth, -group->_shift);
|
|
51
|
+
// snapshot of current children
|
|
52
|
+
const auto children = group->descendants();
|
|
53
|
+
group->addOnly(kern);
|
|
54
|
+
for (const auto& child : children) {
|
|
55
|
+
buildDebug(group, child, filter);
|
|
56
|
+
}
|
|
57
|
+
} else if (auto decor = dynamic_pointer_cast<DecorBox>(box); decor != nullptr) {
|
|
58
|
+
const auto g = wrap(decor->_base);
|
|
59
|
+
decor->_base = g;
|
|
60
|
+
buildDebug(nullptr, g, filter);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
} // namespace microtex
|
|
65
|
+
|
|
66
|
+
Render::Render(const sptr<Box>& box, float textSize, bool isSplit) {
|
|
67
|
+
_data = new RenderData{box, textSize, textSize / Env::fixedTextSize(), black, isSplit};
|
|
68
|
+
const auto& debugConfig = DebugConfig::INSTANCE;
|
|
69
|
+
if (debugConfig.enable) {
|
|
70
|
+
const auto group = microtex::wrap(box);
|
|
71
|
+
_data->root = group;
|
|
72
|
+
BoxFilter filter = [&](const sptr<Box>& b) {
|
|
73
|
+
return (
|
|
74
|
+
debugConfig.showOnlyChar ? dynamic_cast<CharBox*>(b.get()) != nullptr : !b->isSpace()
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
microtex::buildDebug(nullptr, group, filter);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
Render::~Render() {
|
|
82
|
+
delete _data;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
float Render::getTextSize() const {
|
|
86
|
+
return _data->textSize;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
int Render::getHeight() const {
|
|
90
|
+
auto box = _data->root;
|
|
91
|
+
return (int)(box->vlen() * _data->fixedScale);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
int Render::getDepth() const {
|
|
95
|
+
return (int)(_data->root->_depth * _data->fixedScale);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
int Render::getWidth() const {
|
|
99
|
+
return (int)(_data->root->_width * _data->fixedScale);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
float Render::getBaseline() const {
|
|
103
|
+
auto box = _data->root;
|
|
104
|
+
return box->_height / box->vlen();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
bool Render::isSplit() const {
|
|
108
|
+
return _data->isSplit;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
void Render::setTextSize(float textSize) {
|
|
112
|
+
_data->textSize = textSize;
|
|
113
|
+
_data->fixedScale = textSize / Env::fixedTextSize();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
void Render::setForeground(color fg) {
|
|
117
|
+
_data->fg = fg;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
void Render::draw(Graphics2D& g2, int x, int y) {
|
|
121
|
+
color old = g2.getColor();
|
|
122
|
+
auto fixedScale = _data->fixedScale;
|
|
123
|
+
auto box = _data->root;
|
|
124
|
+
|
|
125
|
+
g2.setColor(isTransparent(_data->fg) ? black : _data->fg);
|
|
126
|
+
g2.translate(x, y);
|
|
127
|
+
g2.scale(fixedScale, fixedScale);
|
|
128
|
+
|
|
129
|
+
// draw formula box
|
|
130
|
+
box->draw(g2, 0, box->_height);
|
|
131
|
+
|
|
132
|
+
// restore
|
|
133
|
+
g2.scale(1.f / fixedScale, 1.f / fixedScale);
|
|
134
|
+
g2.translate(-x, -y);
|
|
135
|
+
g2.setColor(old);
|
|
136
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#ifndef MICROTEX_RENDER_H
|
|
2
|
+
#define MICROTEX_RENDER_H
|
|
3
|
+
|
|
4
|
+
#include "graphic/graphic.h"
|
|
5
|
+
#include "microtexexport.h"
|
|
6
|
+
|
|
7
|
+
namespace microtex {
|
|
8
|
+
|
|
9
|
+
class Box;
|
|
10
|
+
|
|
11
|
+
struct RenderData;
|
|
12
|
+
|
|
13
|
+
/** Object to paint formula, is baseline aligned. */
|
|
14
|
+
class MICROTEX_EXPORT Render {
|
|
15
|
+
private:
|
|
16
|
+
RenderData* _data;
|
|
17
|
+
|
|
18
|
+
public:
|
|
19
|
+
Render(const sptr<Box>& box, float textSize, bool isSplit = false);
|
|
20
|
+
|
|
21
|
+
~Render();
|
|
22
|
+
|
|
23
|
+
/** Get the text size of this render */
|
|
24
|
+
float getTextSize() const;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get the total height of this render, equals to
|
|
28
|
+
* ascent + descent (or namely "depth", distance below the baseline).
|
|
29
|
+
*/
|
|
30
|
+
int getHeight() const;
|
|
31
|
+
|
|
32
|
+
/** Get the distance below the baseline, in positive. */
|
|
33
|
+
int getDepth() const;
|
|
34
|
+
|
|
35
|
+
/** Get the width of this render. */
|
|
36
|
+
int getWidth() const;
|
|
37
|
+
|
|
38
|
+
/** Get the ratio of ascent to total height. */
|
|
39
|
+
float getBaseline() const;
|
|
40
|
+
|
|
41
|
+
/** Test if is split to multi-lines. */
|
|
42
|
+
bool isSplit() const;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Set text size to draw. The dimension (width, height, depth) will be
|
|
46
|
+
* changed following the text size change.
|
|
47
|
+
*/
|
|
48
|
+
void setTextSize(float textSize);
|
|
49
|
+
|
|
50
|
+
/** Set the foreground color to draw. */
|
|
51
|
+
void setForeground(color fg);
|
|
52
|
+
|
|
53
|
+
/** Draw the formula */
|
|
54
|
+
void draw(Graphics2D& g2, int x, int y);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace microtex
|
|
58
|
+
|
|
59
|
+
#endif // MICROTEX_RENDER_H
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#ifndef MICROTEX_FONT_META_H
|
|
2
|
+
#define MICROTEX_FONT_META_H
|
|
3
|
+
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#include "graphic/font_style.h"
|
|
7
|
+
#include "microtexexport.h"
|
|
8
|
+
|
|
9
|
+
namespace microtex {
|
|
10
|
+
|
|
11
|
+
struct MICROTEX_EXPORT FontMeta {
|
|
12
|
+
std::string family;
|
|
13
|
+
std::string name;
|
|
14
|
+
FontStyle style;
|
|
15
|
+
bool isMathFont;
|
|
16
|
+
|
|
17
|
+
inline bool isValid() const { return !family.empty() && !name.empty(); }
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
} // namespace microtex
|
|
21
|
+
|
|
22
|
+
#endif // MICROTEX_FONT_META_H
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#include "unimath/font_src.h"
|
|
2
|
+
|
|
3
|
+
#include "otf/otf.h"
|
|
4
|
+
|
|
5
|
+
using namespace microtex;
|
|
6
|
+
|
|
7
|
+
FontSrc::FontSrc(std::string fontFile) : fontFile(std::move(fontFile)) {}
|
|
8
|
+
|
|
9
|
+
FontSrcFile::FontSrcFile(std::string clmFile, std::string fontFile)
|
|
10
|
+
: FontSrc(std::move(fontFile)), clmFile(std::move(clmFile)) {}
|
|
11
|
+
|
|
12
|
+
sptr<Otf> FontSrcFile::loadOtf() const {
|
|
13
|
+
return sptr<Otf>(Otf::fromFile(clmFile.c_str()));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
FontSrcData::FontSrcData(size_t len, const u8* data, std::string fontFile)
|
|
17
|
+
: FontSrc(std::move(fontFile)), len(len), data(data) {}
|
|
18
|
+
|
|
19
|
+
sptr<Otf> FontSrcData::loadOtf() const {
|
|
20
|
+
return sptr<Otf>(Otf::fromData(len, data));
|
|
21
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#ifndef MICROTEX_FONT_SRC_H
|
|
2
|
+
#define MICROTEX_FONT_SRC_H
|
|
3
|
+
|
|
4
|
+
#include <string>
|
|
5
|
+
#include <vector>
|
|
6
|
+
|
|
7
|
+
#include "microtexexport.h"
|
|
8
|
+
#include "utils/types.h"
|
|
9
|
+
|
|
10
|
+
namespace microtex {
|
|
11
|
+
|
|
12
|
+
class Otf;
|
|
13
|
+
|
|
14
|
+
/** Source to load font. */
|
|
15
|
+
class MICROTEX_EXPORT FontSrc {
|
|
16
|
+
public:
|
|
17
|
+
/**
|
|
18
|
+
* The font file (descriptor), may be empty if glyphs are drawn by graphical-paths.
|
|
19
|
+
*
|
|
20
|
+
* NOTICE: the 'fontFile' doesn't have to be a real font file, it could be a font id,
|
|
21
|
+
* a font name, or something like that, because all font loading will be done on the
|
|
22
|
+
* user side (you can preload the font resources and gives its id, name or something
|
|
23
|
+
* can distinguish various fonts).
|
|
24
|
+
*
|
|
25
|
+
* If no file was given, the engine will use the font family name as its identifier,
|
|
26
|
+
* thus when load font the font family name will be used as its 'font file' instead
|
|
27
|
+
* of a real font file.
|
|
28
|
+
*/
|
|
29
|
+
const std::string fontFile;
|
|
30
|
+
|
|
31
|
+
explicit FontSrc(std::string fontFile);
|
|
32
|
+
|
|
33
|
+
virtual sptr<Otf> loadOtf() const = 0;
|
|
34
|
+
|
|
35
|
+
virtual ~FontSrc() = default;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** Font source from file. */
|
|
39
|
+
class MICROTEX_EXPORT FontSrcFile : public FontSrc {
|
|
40
|
+
public:
|
|
41
|
+
const std::string clmFile;
|
|
42
|
+
|
|
43
|
+
explicit FontSrcFile(std::string clmFile, std::string fontFile = "");
|
|
44
|
+
|
|
45
|
+
sptr<Otf> loadOtf() const override;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** Font source from data. */
|
|
49
|
+
class MICROTEX_EXPORT FontSrcData : public FontSrc {
|
|
50
|
+
public:
|
|
51
|
+
const size_t len;
|
|
52
|
+
const u8* data;
|
|
53
|
+
|
|
54
|
+
FontSrcData(size_t len, const u8* data, std::string fontFile = "");
|
|
55
|
+
|
|
56
|
+
sptr<Otf> loadOtf() const override;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
} // namespace microtex
|
|
60
|
+
|
|
61
|
+
#endif // MICROTEX_FONT_SRC_H
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
#include "unimath/math_type.h"
|
|
2
|
+
|
|
3
|
+
#include "utils/utils.h"
|
|
4
|
+
|
|
5
|
+
using namespace std;
|
|
6
|
+
using namespace microtex;
|
|
7
|
+
|
|
8
|
+
namespace {
|
|
9
|
+
|
|
10
|
+
/** The reserved code map, thanks to the Unicode Consortium */
|
|
11
|
+
// IMPORTANT: sorted by the reserved code, you must sort this after add item
|
|
12
|
+
const pair<c32, c32> _reserved[]{
|
|
13
|
+
// small serif italic
|
|
14
|
+
{0x1d455, 0x210e},
|
|
15
|
+
// capital calligraphy normal
|
|
16
|
+
{0x1d49d, 0x212c},
|
|
17
|
+
{0x1d4a0, 0x2130},
|
|
18
|
+
{0x1d4a1, 0x2131},
|
|
19
|
+
{0x1d4a3, 0x210b},
|
|
20
|
+
{0x1d4a4, 0x2110},
|
|
21
|
+
{0x1d4a7, 0x2112},
|
|
22
|
+
{0x1d4a8, 0x2133},
|
|
23
|
+
{0x1d4ad, 0x211b},
|
|
24
|
+
// small script normal
|
|
25
|
+
{0x1d4ba, 0x212f},
|
|
26
|
+
{0x1d4bc, 0x210a},
|
|
27
|
+
{0x1d4c4, 0x2134},
|
|
28
|
+
// capital fraktur normal
|
|
29
|
+
{0x1d506, 0x212d},
|
|
30
|
+
{0x1d50b, 0x210c},
|
|
31
|
+
{0x1d50c, 0x2111},
|
|
32
|
+
{0x1d515, 0x211c},
|
|
33
|
+
{0x1d51d, 0x2128},
|
|
34
|
+
// capital double-struck bold
|
|
35
|
+
{0x1d53a, 0x2102},
|
|
36
|
+
{0x1d53f, 0x210d},
|
|
37
|
+
{0x1d545, 0x2115},
|
|
38
|
+
{0x1d547, 0x2119},
|
|
39
|
+
{0x1d548, 0x211a},
|
|
40
|
+
{0x1d549, 0x211d},
|
|
41
|
+
{0x1d551, 0x2124},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const int _reservedCount = sizeof(_reserved) / sizeof(pair<c32, c32>);
|
|
45
|
+
|
|
46
|
+
struct Orphan {
|
|
47
|
+
LetterType type;
|
|
48
|
+
c32 code;
|
|
49
|
+
std::map<FontStyle, c32> styles;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// clang-format off
|
|
53
|
+
const Orphan _orphans[]{
|
|
54
|
+
// latin small letter dotless i
|
|
55
|
+
{
|
|
56
|
+
LetterType::latinSmall, 0x131,
|
|
57
|
+
{
|
|
58
|
+
{FontStyle::rm, 0x131},
|
|
59
|
+
{FontStyle::it, 0x1d6a4},
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
// latin small letter dotless j
|
|
63
|
+
{
|
|
64
|
+
LetterType::latinSmall, 0x237,
|
|
65
|
+
{
|
|
66
|
+
{FontStyle::rm, 0x237},
|
|
67
|
+
{FontStyle::it, 0x1d6a5},
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
// greek theta symbol
|
|
71
|
+
{
|
|
72
|
+
LetterType::greekSmall, 0x3d1,
|
|
73
|
+
{
|
|
74
|
+
{FontStyle::rm, 0x3d1},
|
|
75
|
+
{FontStyle::bf, 0x1d6dd},
|
|
76
|
+
{FontStyle::it, 0x1d717},
|
|
77
|
+
{FontStyle::bfit, 0x1d751},
|
|
78
|
+
{FontStyle::sfbf, 0x1d78b},
|
|
79
|
+
{FontStyle::sfbfit, 0x1d7c5},
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
// greek phi symbol
|
|
83
|
+
{
|
|
84
|
+
LetterType::greekSmall, 0x3d5,
|
|
85
|
+
{
|
|
86
|
+
{FontStyle::rm, 0x3d5},
|
|
87
|
+
{FontStyle::bf, 0x1d6df},
|
|
88
|
+
{FontStyle::it, 0x1d719},
|
|
89
|
+
{FontStyle::bfit, 0x1d753},
|
|
90
|
+
{FontStyle::sfbf, 0x1d78d},
|
|
91
|
+
{FontStyle::sfbfit, 0x1d7c7},
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
// greek pi symbol
|
|
95
|
+
{
|
|
96
|
+
LetterType::greekSmall, 0x3d6,
|
|
97
|
+
{
|
|
98
|
+
{FontStyle::rm, 0x3d6},
|
|
99
|
+
{FontStyle::bf, 0x1d6e1},
|
|
100
|
+
{FontStyle::it, 0x1d71b},
|
|
101
|
+
{FontStyle::bfit, 0x1d755},
|
|
102
|
+
{FontStyle::sfbf, 0x1d78f},
|
|
103
|
+
{FontStyle::sfbfit, 0x1d7c9},
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
// greek capital letter digamma
|
|
107
|
+
{
|
|
108
|
+
LetterType::greekCapital, 0x3dc,
|
|
109
|
+
{
|
|
110
|
+
{FontStyle::rm, 0x3dc},
|
|
111
|
+
{FontStyle::bf, 0x1d7ca},
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
// greek small letter digamma
|
|
115
|
+
{
|
|
116
|
+
LetterType::greekSmall, 0x3dd,
|
|
117
|
+
{
|
|
118
|
+
{FontStyle::rm, 0x3dd},
|
|
119
|
+
{FontStyle::bf, 0x1d7cb},
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
// greek kappa symbol
|
|
123
|
+
{
|
|
124
|
+
LetterType::greekSmall, 0x3f0,
|
|
125
|
+
{
|
|
126
|
+
{FontStyle::rm, 0x3f0},
|
|
127
|
+
{FontStyle::bf, 0x1d6de},
|
|
128
|
+
{FontStyle::it, 0x1d718},
|
|
129
|
+
{FontStyle::bfit, 0x1d752},
|
|
130
|
+
{FontStyle::sfbf, 0x1d78c},
|
|
131
|
+
{FontStyle::sfbfit, 0x1d7c6},
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
// greek rho symbol
|
|
135
|
+
{
|
|
136
|
+
LetterType::greekSmall, 0x3f1,
|
|
137
|
+
{
|
|
138
|
+
{FontStyle::rm, 0x3f1},
|
|
139
|
+
{FontStyle::bf, 0x1d6e0},
|
|
140
|
+
{FontStyle::it, 0x1d71a},
|
|
141
|
+
{FontStyle::bfit, 0x1d754},
|
|
142
|
+
{FontStyle::sfbf, 0x1d783},
|
|
143
|
+
{FontStyle::sfbfit, 0x1d7c8},
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
// greek capital theta symbol
|
|
147
|
+
{
|
|
148
|
+
LetterType::greekCapital, 0x3f4,
|
|
149
|
+
{
|
|
150
|
+
{FontStyle::rm, 0x3f4},
|
|
151
|
+
{FontStyle::bf, 0x1d6b9},
|
|
152
|
+
{FontStyle::it, 0x1d6f3},
|
|
153
|
+
{FontStyle::bfit, 0x1d72d},
|
|
154
|
+
{FontStyle::sfbf, 0x1d767},
|
|
155
|
+
{FontStyle::sfbfit, 0x1d7a1},
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
// greek lunate epsilon symbol
|
|
159
|
+
{
|
|
160
|
+
LetterType::greekSmall, 0x3f5,
|
|
161
|
+
{
|
|
162
|
+
{FontStyle::rm, 0x3f5},
|
|
163
|
+
{FontStyle::bf, 0x1d6dc},
|
|
164
|
+
{FontStyle::it, 0x1d716},
|
|
165
|
+
{FontStyle::bfit, 0x1d750},
|
|
166
|
+
{FontStyle::sfbf, 0x1d78a},
|
|
167
|
+
{FontStyle::sfbfit, 0x1d7c4},
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
// partial differential
|
|
171
|
+
{
|
|
172
|
+
LetterType::greekSmall, 0x2202,
|
|
173
|
+
{
|
|
174
|
+
{FontStyle::rm, 0x2202},
|
|
175
|
+
{FontStyle::bf, 0x1d6db},
|
|
176
|
+
{FontStyle::it, 0x1d715},
|
|
177
|
+
{FontStyle::bfit, 0x1d74f},
|
|
178
|
+
{FontStyle::sfbf, 0x1d789},
|
|
179
|
+
{FontStyle::sfbfit, 0x1d7c3},
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
// nabla
|
|
183
|
+
{
|
|
184
|
+
LetterType::greekCapital, 0x2207,
|
|
185
|
+
{
|
|
186
|
+
{FontStyle::rm, 0x2207},
|
|
187
|
+
{FontStyle::bf, 0x1d6c1},
|
|
188
|
+
{FontStyle::it, 0x1d6fb},
|
|
189
|
+
{FontStyle::bfit, 0x1d735},
|
|
190
|
+
{FontStyle::sfbf, 0x1d76f},
|
|
191
|
+
{FontStyle::sfbfit, 0x1d7a9},
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
// clang-format on
|
|
196
|
+
|
|
197
|
+
const int _orphansCount = sizeof(_orphans) / sizeof(Orphan);
|
|
198
|
+
|
|
199
|
+
#define style(digit, latinSmall, latinCapital, greekSmall, greekCapital) \
|
|
200
|
+
sptrOf<const MathVersion>(digit, latinSmall, latinCapital, greekSmall, greekCapital)
|
|
201
|
+
|
|
202
|
+
/** style to version map */
|
|
203
|
+
sptr<const MathVersion> _mathStyles[4]{
|
|
204
|
+
style('0', 0x1D44E, 0x1D434, 0x1D6FC, 0x0391),
|
|
205
|
+
style('0', 0x1D44E, 0x1D434, 0x1D6FC, 0x1D6E2),
|
|
206
|
+
style('0', 0x1D44E, 'A', 0x03B1, 0x0391),
|
|
207
|
+
style('0', 'a', 'A', 0x03B1, 0x0391),
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
#define version(style, digit, latinSmall, latinCapital, greekSmall, greekCapital) \
|
|
211
|
+
{ \
|
|
212
|
+
style, \
|
|
213
|
+
sptrOf<const MathVersion>(digit, latinSmall, latinCapital, greekSmall, greekCapital, style) \
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** font style to version map */
|
|
217
|
+
map<FontStyle, sptr<const MathVersion>> _mathVersions{
|
|
218
|
+
// default TeX style
|
|
219
|
+
{FontStyle::none, _mathStyles[0]},
|
|
220
|
+
version(FontStyle::rm, '0', 'a', 'A', 0x03B1, 0x0391),
|
|
221
|
+
version(FontStyle::bf, 0x1D7CE, 0x1D41A, 0x1D400, 0x1D6C2, 0x1D6A8),
|
|
222
|
+
version(FontStyle::it, '0', 0x1D44E, 0x1D434, 0x1D6FC, 0x1D6E2),
|
|
223
|
+
version(FontStyle::cal, '0', 0x1D4B6, 0x1D49C, 0x03B1, 0x0391),
|
|
224
|
+
version(FontStyle::frak, '0', 0x1D51E, 0x1D504, 0x03B1, 0x0391),
|
|
225
|
+
version(FontStyle::bb, 0x1D7D8, 0x1D552, 0x1D538, 0x03B1, 0x0391),
|
|
226
|
+
version(FontStyle::sf, 0x1D7E2, 0x1D5BA, 0x1D5A0, 0x03B1, 0x0391),
|
|
227
|
+
version(FontStyle::tt, 0x1D7F6, 0x1D68A, 0x1D670, 0x03B1, 0x0391),
|
|
228
|
+
// composed styles
|
|
229
|
+
version(FontStyle::bfit, '0', 0x1D482, 0x1D468, 0x1D736, 0x1D71C),
|
|
230
|
+
version(FontStyle::bfcal, '0', 0x1D4EA, 0x1D4D0, 0x03B1, 0x0391),
|
|
231
|
+
version(FontStyle::bffrak, '0', 0x1D586, 0x1D56C, 0x03B1, 0x0391),
|
|
232
|
+
version(FontStyle::sfbf, 0x1D7EC, 0x1D5EE, 0x1D5D4, 0x1D770, 0x1D756),
|
|
233
|
+
version(FontStyle::sfit, '0', 0x1D622, 0x1D608, 0x03B1, 0x0391),
|
|
234
|
+
version(FontStyle::sfbfit, '0', 0x1D656, 0x1D63C, 0x1D7AA, 0x1D790),
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/** current math style */
|
|
238
|
+
MathStyle _mathStyle = MathStyle::TeX;
|
|
239
|
+
|
|
240
|
+
/** Get the MathType and the version-specific offset of the given codepoint. */
|
|
241
|
+
pair<LetterType, c32> ofChar(c32 codepoint) {
|
|
242
|
+
if (codepoint >= '0' && codepoint <= '9') return {LetterType::digit, codepoint - '0'};
|
|
243
|
+
if (codepoint >= 'a' && codepoint <= 'z') return {LetterType::latinSmall, codepoint - 'a'};
|
|
244
|
+
if (codepoint >= 'A' && codepoint <= 'Z') return {LetterType::latinCapital, codepoint - 'A'};
|
|
245
|
+
// greek small letters: α - ω
|
|
246
|
+
if (codepoint >= 0x03B1 && codepoint <= 0x03C9) {
|
|
247
|
+
return {LetterType::greekSmall, codepoint - 0x03B1};
|
|
248
|
+
}
|
|
249
|
+
// greek capital letters: Α - Ω
|
|
250
|
+
if (codepoint >= 0x0391 && codepoint <= 0x03A9) {
|
|
251
|
+
return {LetterType::greekCapital, codepoint - 0x0391};
|
|
252
|
+
}
|
|
253
|
+
// otherwise no mapping was found
|
|
254
|
+
return {LetterType::none, codepoint};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
FontStyle fontStyleOfOrphan(const MathStyle mathStyle, const LetterType type) {
|
|
258
|
+
switch (type) {
|
|
259
|
+
case LetterType::latinSmall:
|
|
260
|
+
return (mathStyle == MathStyle::upright ? FontStyle::rm : FontStyle::it);
|
|
261
|
+
case LetterType::latinCapital:
|
|
262
|
+
case LetterType::greekSmall:
|
|
263
|
+
return mathStyle == MathStyle::French || mathStyle == MathStyle::upright ? FontStyle::rm
|
|
264
|
+
: FontStyle::it;
|
|
265
|
+
case LetterType::greekCapital:
|
|
266
|
+
default: return mathStyle == MathStyle::ISO ? FontStyle::it : FontStyle::rm;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
} // namespace
|
|
271
|
+
|
|
272
|
+
MathVersion::MathVersion(
|
|
273
|
+
c32 digit,
|
|
274
|
+
c32 latinSmall,
|
|
275
|
+
c32 latinCapital,
|
|
276
|
+
c32 greekSmall,
|
|
277
|
+
c32 greekCapital,
|
|
278
|
+
FontStyle fontStyle
|
|
279
|
+
) noexcept
|
|
280
|
+
: _codepoints{0, digit, latinSmall, latinCapital, greekSmall, greekCapital},
|
|
281
|
+
_fontStyle(fontStyle) {}
|
|
282
|
+
|
|
283
|
+
c32 MathVersion::map(const c32 codepoint) const {
|
|
284
|
+
auto [type, offset] = ofChar(codepoint);
|
|
285
|
+
const c32 mapped = _codepoints[static_cast<u8>(type)] + offset;
|
|
286
|
+
// try find from orphans
|
|
287
|
+
if (type == LetterType::none) {
|
|
288
|
+
const int j = binIndexOf(_orphansCount, [&](int j) { return mapped - _orphans[j].code; });
|
|
289
|
+
if (j >= 0) {
|
|
290
|
+
const auto& orphan = _orphans[j];
|
|
291
|
+
FontStyle fontStyle = _fontStyle;
|
|
292
|
+
if (fontStyle == FontStyle::none) {
|
|
293
|
+
fontStyle = fontStyleOfOrphan(_mathStyle, orphan.type);
|
|
294
|
+
}
|
|
295
|
+
const auto it = orphan.styles.find(fontStyle);
|
|
296
|
+
if (it == orphan.styles.end()) {
|
|
297
|
+
return mapped;
|
|
298
|
+
}
|
|
299
|
+
return it->second;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
// try find from reserved
|
|
303
|
+
const int i = binIndexOf(_reservedCount, [&](int i) { return mapped - _reserved[i].first; });
|
|
304
|
+
if (i >= 0) return _reserved[i].second;
|
|
305
|
+
return mapped;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
void MathVersion::setMathStyle(const MathStyle style) {
|
|
309
|
+
auto v = _mathStyles[static_cast<u8>(style)];
|
|
310
|
+
_mathVersions[FontStyle::none] = v;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
c32 MathVersion::map(FontStyle style, c32 code) {
|
|
314
|
+
const auto it = _mathVersions.find(style);
|
|
315
|
+
const MathVersion& version = it == _mathVersions.end() ? *_mathVersions[findClosestStyle(style)]
|
|
316
|
+
: *it->second;
|
|
317
|
+
return version.map(code);
|
|
318
|
+
}
|