@simonklee/opentui-tex-native-source 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/LICENSE-PROJECT +21 -0
- package/README.md +7 -0
- package/build.zig +112 -0
- package/build.zig.zon +12 -0
- package/native/lib.zig +280 -0
- package/native/nanosvg.c +4 -0
- package/native/vendor/.bootstrap-v5 +1 -0
- package/native/vendor/LICENSE-NANOSVG +18 -0
- package/native/vendor/microtex/.clang-format +26 -0
- package/native/vendor/microtex/.github/workflows/ubuntu.yml +92 -0
- package/native/vendor/microtex/.github/workflows/windows-gdi.yml +34 -0
- package/native/vendor/microtex/.github/workflows/windows-qt.yml +52 -0
- package/native/vendor/microtex/CMakeLists.txt +110 -0
- package/native/vendor/microtex/LICENSE +21 -0
- package/native/vendor/microtex/MicroTeXInstall.cmake +42 -0
- package/native/vendor/microtex/README.md +600 -0
- package/native/vendor/microtex/build.zig +209 -0
- package/native/vendor/microtex/clatexmath.wrap +6 -0
- package/native/vendor/microtex/doc/meson.build +38 -0
- package/native/vendor/microtex/doc/microtex-doc.toml.in +47 -0
- package/native/vendor/microtex/doc/microtex.svg +39 -0
- package/native/vendor/microtex/doc/urlmap.js +6 -0
- package/native/vendor/microtex/example/gtk/CMakeLists.txt +68 -0
- package/native/vendor/microtex/example/gtk/gtk_main.c +170 -0
- package/native/vendor/microtex/example/gtk/isamples.cpp +21 -0
- package/native/vendor/microtex/example/gtk/isamples.h +15 -0
- package/native/vendor/microtex/example/gtk/meson.build +27 -0
- package/native/vendor/microtex/example/gtk/microtex-gtk.gresource.xml +6 -0
- package/native/vendor/microtex/example/gtk/microtex-gtk.ui +117 -0
- package/native/vendor/microtex/example/gtkmm/CMakeLists.txt +19 -0
- package/native/vendor/microtex/example/gtkmm/gtkmm_main.cpp +531 -0
- package/native/vendor/microtex/example/gtkmm/meson.build +19 -0
- package/native/vendor/microtex/example/memcheck/CMakeLists.txt +12 -0
- package/native/vendor/microtex/example/memcheck/mem_check_main.cpp +154 -0
- package/native/vendor/microtex/example/qt/CMakeLists.txt +37 -0
- package/native/vendor/microtex/example/qt/meson.build +25 -0
- package/native/vendor/microtex/example/qt/qt_main.cpp +70 -0
- package/native/vendor/microtex/example/qt/qt_mainwindow.cpp +107 -0
- package/native/vendor/microtex/example/qt/qt_mainwindow.h +40 -0
- package/native/vendor/microtex/example/qt/qt_skiatexwidget.cpp +149 -0
- package/native/vendor/microtex/example/qt/qt_skiatexwidget.h +48 -0
- package/native/vendor/microtex/example/qt/qt_tex_render.h +15 -0
- package/native/vendor/microtex/example/qt/qt_texqmlitem.cpp +56 -0
- package/native/vendor/microtex/example/qt/qt_texqmlitem.h +31 -0
- package/native/vendor/microtex/example/qt/qt_texwidget.cpp +62 -0
- package/native/vendor/microtex/example/qt/qt_texwidget.h +31 -0
- package/native/vendor/microtex/example/qtpng/CMakeLists.txt +11 -0
- package/native/vendor/microtex/example/qtpng/latex2png.cpp +115 -0
- package/native/vendor/microtex/example/samples/samples.cpp +52 -0
- package/native/vendor/microtex/example/samples/samples.h +32 -0
- package/native/vendor/microtex/example/win32/CMakeLists.txt +15 -0
- package/native/vendor/microtex/example/win32/meson.build +18 -0
- package/native/vendor/microtex/example/win32/win32_main.cpp +375 -0
- package/native/vendor/microtex/githooks/pre-commit +19 -0
- package/native/vendor/microtex/githooks/pre-push +103 -0
- package/native/vendor/microtex/lib/CMakeLists.txt +234 -0
- package/native/vendor/microtex/lib/atom/atom.cpp +14 -0
- package/native/vendor/microtex/lib/atom/atom.h +96 -0
- package/native/vendor/microtex/lib/atom/atom_accent.cpp +115 -0
- package/native/vendor/microtex/lib/atom/atom_accent.h +53 -0
- package/native/vendor/microtex/lib/atom/atom_basic.cpp +146 -0
- package/native/vendor/microtex/lib/atom/atom_basic.h +273 -0
- package/native/vendor/microtex/lib/atom/atom_box.cpp +41 -0
- package/native/vendor/microtex/lib/atom/atom_box.h +70 -0
- package/native/vendor/microtex/lib/atom/atom_char.cpp +99 -0
- package/native/vendor/microtex/lib/atom/atom_char.h +147 -0
- package/native/vendor/microtex/lib/atom/atom_delim.cpp +65 -0
- package/native/vendor/microtex/lib/atom/atom_delim.h +58 -0
- package/native/vendor/microtex/lib/atom/atom_fence.cpp +65 -0
- package/native/vendor/microtex/lib/atom/atom_fence.h +56 -0
- package/native/vendor/microtex/lib/atom/atom_font.cpp +20 -0
- package/native/vendor/microtex/lib/atom/atom_font.h +49 -0
- package/native/vendor/microtex/lib/atom/atom_frac.cpp +101 -0
- package/native/vendor/microtex/lib/atom/atom_frac.h +42 -0
- package/native/vendor/microtex/lib/atom/atom_matrix.cpp +756 -0
- package/native/vendor/microtex/lib/atom/atom_matrix.h +268 -0
- package/native/vendor/microtex/lib/atom/atom_misc.cpp +230 -0
- package/native/vendor/microtex/lib/atom/atom_misc.h +200 -0
- package/native/vendor/microtex/lib/atom/atom_operator.cpp +51 -0
- package/native/vendor/microtex/lib/atom/atom_operator.h +41 -0
- package/native/vendor/microtex/lib/atom/atom_root.cpp +61 -0
- package/native/vendor/microtex/lib/atom/atom_root.h +27 -0
- package/native/vendor/microtex/lib/atom/atom_row.cpp +334 -0
- package/native/vendor/microtex/lib/atom/atom_row.h +176 -0
- package/native/vendor/microtex/lib/atom/atom_scripts.cpp +182 -0
- package/native/vendor/microtex/lib/atom/atom_scripts.h +52 -0
- package/native/vendor/microtex/lib/atom/atom_sideset.cpp +92 -0
- package/native/vendor/microtex/lib/atom/atom_sideset.h +24 -0
- package/native/vendor/microtex/lib/atom/atom_space.cpp +22 -0
- package/native/vendor/microtex/lib/atom/atom_space.h +38 -0
- package/native/vendor/microtex/lib/atom/atom_stack.cpp +117 -0
- package/native/vendor/microtex/lib/atom/atom_stack.h +103 -0
- package/native/vendor/microtex/lib/atom/atom_text.cpp +17 -0
- package/native/vendor/microtex/lib/atom/atom_text.h +33 -0
- package/native/vendor/microtex/lib/atom/atom_vrow.cpp +96 -0
- package/native/vendor/microtex/lib/atom/atom_vrow.h +47 -0
- package/native/vendor/microtex/lib/atom/atom_zstack.cpp +66 -0
- package/native/vendor/microtex/lib/atom/atom_zstack.h +37 -0
- package/native/vendor/microtex/lib/atom/colors_def.cpp +157 -0
- package/native/vendor/microtex/lib/atom/meson.build +50 -0
- package/native/vendor/microtex/lib/box/box.cpp +49 -0
- package/native/vendor/microtex/lib/box/box.h +184 -0
- package/native/vendor/microtex/lib/box/box_factory.cpp +162 -0
- package/native/vendor/microtex/lib/box/box_factory.h +24 -0
- package/native/vendor/microtex/lib/box/box_group.cpp +503 -0
- package/native/vendor/microtex/lib/box/box_group.h +285 -0
- package/native/vendor/microtex/lib/box/box_single.cpp +179 -0
- package/native/vendor/microtex/lib/box/box_single.h +157 -0
- package/native/vendor/microtex/lib/box/meson.build +15 -0
- package/native/vendor/microtex/lib/core/debug_config.cpp +3 -0
- package/native/vendor/microtex/lib/core/debug_config.h +24 -0
- package/native/vendor/microtex/lib/core/formula.cpp +180 -0
- package/native/vendor/microtex/lib/core/formula.h +137 -0
- package/native/vendor/microtex/lib/core/formula_def.cpp +167 -0
- package/native/vendor/microtex/lib/core/glue.cpp +108 -0
- package/native/vendor/microtex/lib/core/glue.h +55 -0
- package/native/vendor/microtex/lib/core/localized_num.cpp +51 -0
- package/native/vendor/microtex/lib/core/meson.build +19 -0
- package/native/vendor/microtex/lib/core/parser.cpp +874 -0
- package/native/vendor/microtex/lib/core/parser.h +306 -0
- package/native/vendor/microtex/lib/core/split.cpp +185 -0
- package/native/vendor/microtex/lib/core/split.h +40 -0
- package/native/vendor/microtex/lib/env/env.cpp +141 -0
- package/native/vendor/microtex/lib/env/env.h +221 -0
- package/native/vendor/microtex/lib/env/meson.build +11 -0
- package/native/vendor/microtex/lib/env/units.cpp +109 -0
- package/native/vendor/microtex/lib/env/units.h +61 -0
- package/native/vendor/microtex/lib/graphic/font_style.cpp +63 -0
- package/native/vendor/microtex/lib/graphic/font_style.h +61 -0
- package/native/vendor/microtex/lib/graphic/graphic.cpp +38 -0
- package/native/vendor/microtex/lib/graphic/graphic.h +314 -0
- package/native/vendor/microtex/lib/graphic/graphic_basic.cpp +44 -0
- package/native/vendor/microtex/lib/graphic/graphic_basic.h +131 -0
- package/native/vendor/microtex/lib/graphic/meson.build +13 -0
- package/native/vendor/microtex/lib/macro/macro.cpp +143 -0
- package/native/vendor/microtex/lib/macro/macro.h +155 -0
- package/native/vendor/microtex/lib/macro/macro_accent.cpp +50 -0
- package/native/vendor/microtex/lib/macro/macro_accent.h +61 -0
- package/native/vendor/microtex/lib/macro/macro_boxes.h +68 -0
- package/native/vendor/microtex/lib/macro/macro_colors.cpp +42 -0
- package/native/vendor/microtex/lib/macro/macro_colors.h +42 -0
- package/native/vendor/microtex/lib/macro/macro_decl.h +16 -0
- package/native/vendor/microtex/lib/macro/macro_def.cpp +418 -0
- package/native/vendor/microtex/lib/macro/macro_delims.cpp +56 -0
- package/native/vendor/microtex/lib/macro/macro_delims.h +73 -0
- package/native/vendor/microtex/lib/macro/macro_env.h +212 -0
- package/native/vendor/microtex/lib/macro/macro_fonts.cpp +53 -0
- package/native/vendor/microtex/lib/macro/macro_fonts.h +78 -0
- package/native/vendor/microtex/lib/macro/macro_frac.cpp +138 -0
- package/native/vendor/microtex/lib/macro/macro_frac.h +50 -0
- package/native/vendor/microtex/lib/macro/macro_misc.cpp +211 -0
- package/native/vendor/microtex/lib/macro/macro_misc.h +217 -0
- package/native/vendor/microtex/lib/macro/macro_scripts.cpp +32 -0
- package/native/vendor/microtex/lib/macro/macro_scripts.h +17 -0
- package/native/vendor/microtex/lib/macro/macro_sizes.h +110 -0
- package/native/vendor/microtex/lib/macro/macro_space.cpp +31 -0
- package/native/vendor/microtex/lib/macro/macro_space.h +17 -0
- package/native/vendor/microtex/lib/macro/macro_styles.cpp +45 -0
- package/native/vendor/microtex/lib/macro/macro_styles.h +22 -0
- package/native/vendor/microtex/lib/macro/macro_types.h +48 -0
- package/native/vendor/microtex/lib/macro/meson.build +33 -0
- package/native/vendor/microtex/lib/meson.build +102 -0
- package/native/vendor/microtex/lib/microtex.cpp +208 -0
- package/native/vendor/microtex/lib/microtex.h +225 -0
- package/native/vendor/microtex/lib/microtexConfig.cmake.in +2 -0
- package/native/vendor/microtex/lib/microtexapi.h +22 -0
- package/native/vendor/microtex/lib/microtexconfig.h.in +7 -0
- package/native/vendor/microtex/lib/microtexexport.h +31 -0
- package/native/vendor/microtex/lib/otf/clm.cpp +405 -0
- package/native/vendor/microtex/lib/otf/clm.h +61 -0
- package/native/vendor/microtex/lib/otf/fontsense.cpp +191 -0
- package/native/vendor/microtex/lib/otf/fontsense.h +20 -0
- package/native/vendor/microtex/lib/otf/glyph.cpp +53 -0
- package/native/vendor/microtex/lib/otf/glyph.h +384 -0
- package/native/vendor/microtex/lib/otf/math_consts.h +154 -0
- package/native/vendor/microtex/lib/otf/meson.build +18 -0
- package/native/vendor/microtex/lib/otf/otf.cpp +84 -0
- package/native/vendor/microtex/lib/otf/otf.h +177 -0
- package/native/vendor/microtex/lib/otf/otfconfig.h +32 -0
- package/native/vendor/microtex/lib/otf/path.cpp +187 -0
- package/native/vendor/microtex/lib/otf/path.h +120 -0
- package/native/vendor/microtex/lib/render/builder.cpp +68 -0
- package/native/vendor/microtex/lib/render/builder.h +73 -0
- package/native/vendor/microtex/lib/render/meson.build +11 -0
- package/native/vendor/microtex/lib/render/render.cpp +136 -0
- package/native/vendor/microtex/lib/render/render.h +59 -0
- package/native/vendor/microtex/lib/unimath/font_meta.h +22 -0
- package/native/vendor/microtex/lib/unimath/font_src.cpp +21 -0
- package/native/vendor/microtex/lib/unimath/font_src.h +61 -0
- package/native/vendor/microtex/lib/unimath/math_type.cpp +318 -0
- package/native/vendor/microtex/lib/unimath/math_type.h +105 -0
- package/native/vendor/microtex/lib/unimath/meson.build +18 -0
- package/native/vendor/microtex/lib/unimath/uni_char.cpp +121 -0
- package/native/vendor/microtex/lib/unimath/uni_char.h +109 -0
- package/native/vendor/microtex/lib/unimath/uni_font.cpp +248 -0
- package/native/vendor/microtex/lib/unimath/uni_font.h +139 -0
- package/native/vendor/microtex/lib/unimath/uni_symbol.cpp +2929 -0
- package/native/vendor/microtex/lib/unimath/uni_symbol.h +31 -0
- package/native/vendor/microtex/lib/utils/dict_tree.h +68 -0
- package/native/vendor/microtex/lib/utils/exceptions.h +61 -0
- package/native/vendor/microtex/lib/utils/log.h +34 -0
- package/native/vendor/microtex/lib/utils/meson.build +18 -0
- package/native/vendor/microtex/lib/utils/nums.h +24 -0
- package/native/vendor/microtex/lib/utils/string_utils.cpp +85 -0
- package/native/vendor/microtex/lib/utils/string_utils.h +130 -0
- package/native/vendor/microtex/lib/utils/types.h +152 -0
- package/native/vendor/microtex/lib/utils/utf.cpp +115 -0
- package/native/vendor/microtex/lib/utils/utf.h +58 -0
- package/native/vendor/microtex/lib/utils/utils.cpp +40 -0
- package/native/vendor/microtex/lib/utils/utils.h +88 -0
- package/native/vendor/microtex/lib/wrapper/byte_seq.cpp +46 -0
- package/native/vendor/microtex/lib/wrapper/byte_seq.h +70 -0
- package/native/vendor/microtex/lib/wrapper/callback.cpp +10 -0
- package/native/vendor/microtex/lib/wrapper/callback.h +72 -0
- package/native/vendor/microtex/lib/wrapper/cwrapper.cpp +206 -0
- package/native/vendor/microtex/lib/wrapper/cwrapper.h +305 -0
- package/native/vendor/microtex/lib/wrapper/graphic_wrapper.cpp +211 -0
- package/native/vendor/microtex/lib/wrapper/graphic_wrapper.h +159 -0
- package/native/vendor/microtex/lib/wrapper/meson.build +22 -0
- package/native/vendor/microtex/meson.build +75 -0
- package/native/vendor/microtex/meson_options.txt +29 -0
- package/native/vendor/microtex/platform/cairo/CMakeLists.txt +36 -0
- package/native/vendor/microtex/platform/cairo/graphic_cairo.cpp +384 -0
- package/native/vendor/microtex/platform/cairo/graphic_cairo.h +119 -0
- package/native/vendor/microtex/platform/cairo/meson.build +47 -0
- package/native/vendor/microtex/platform/cairo/microtex-cairoConfig.cmake.in +11 -0
- package/native/vendor/microtex/platform/flutter/microtex/.metadata +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/CHANGELOG.md +3 -0
- package/native/vendor/microtex/platform/flutter/microtex/LICENSE +1 -0
- package/native/vendor/microtex/platform/flutter/microtex/README.md +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/analysis_options.yaml +4 -0
- package/native/vendor/microtex/platform/flutter/microtex/android/build.gradle +56 -0
- package/native/vendor/microtex/platform/flutter/microtex/android/settings.gradle +1 -0
- package/native/vendor/microtex/platform/flutter/microtex/android/src/main/AndroidManifest.xml +3 -0
- package/native/vendor/microtex/platform/flutter/microtex/android/src/main/kotlin/io/nano/microtex/microtex/MicrotexPlugin.kt +35 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/.metadata +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/README.md +16 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/analysis_options.yaml +31 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/build.gradle +68 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/debug/AndroidManifest.xml +7 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/AndroidManifest.xml +34 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/kotlin/io/nano/microtex/microtex_example/MainActivity.kt +6 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/drawable/launch_background.xml +12 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/drawable-v21/launch_background.xml +12 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/values/styles.xml +18 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/values-night/styles.xml +18 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/profile/AndroidManifest.xml +7 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/build.gradle +31 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/gradle.properties +3 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/android/settings.gradle +11 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Flutter/AppFrameworkInfo.plist +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Flutter/Debug.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Flutter/Release.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Podfile +41 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Podfile.lock +22 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/AppDelegate.swift +13 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +122 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +5 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Base.lproj/LaunchScreen.storyboard +37 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Base.lproj/Main.storyboard +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Info.plist +49 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Runner-Bridging-Header.h +1 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.pbxproj +549 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +87 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcworkspace/contents.xcworkspacedata +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/main.dart +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/screen/edit_in_one.dart +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/screen/edit_screen.dart +208 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/utils/convert_spans.dart +63 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/utils/string_ext.dart +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/cmp.dart +118 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/draggable.dart +75 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/rich.dart +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/split.dart +72 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/tex_highlight_controller.dart +66 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/tex_input_controller.dart +19 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/CMakeLists.txt +116 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/CMakeLists.txt +87 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/generated_plugin_registrant.cc +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/generated_plugin_registrant.h +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/generated_plugins.cmake +24 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/main.cc +6 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/my_application.cc +104 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/linux/my_application.h +18 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Flutter/Flutter-Debug.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Flutter/Flutter-Release.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Flutter/GeneratedPluginRegistrant.swift +12 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Podfile +40 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Podfile.lock +22 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/AppDelegate.swift +9 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Base.lproj/MainMenu.xib +343 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/AppInfo.xcconfig +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/Debug.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/Release.xcconfig +2 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/Warnings.xcconfig +13 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/DebugProfile.entitlements +12 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Info.plist +32 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/MainFlutterWindow.swift +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Release.entitlements +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcodeproj/project.pbxproj +633 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +87 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcworkspace/contents.xcworkspacedata +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/pubspec.lock +191 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/pubspec.yaml +56 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/test/widget_test.dart +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/CMakeLists.txt +95 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/CMakeLists.txt +103 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/generated_plugin_registrant.cc +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/generated_plugin_registrant.h +15 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/generated_plugins.cmake +24 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/CMakeLists.txt +17 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/Runner.rc +121 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/flutter_window.cpp +61 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/flutter_window.h +33 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/main.cpp +43 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/resource.h +16 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/resources/app_icon.ico +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/runner.exe.manifest +20 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/utils.cpp +64 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/utils.h +19 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/win32_window.cpp +245 -0
- package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/win32_window.h +98 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Assets/.gitkeep +0 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/MicrotexPlugin.h +4 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/MicrotexPlugin.m +19 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/SwiftMicrotexPlugin.swift +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/dummy.h +4 -0
- package/native/vendor/microtex/platform/flutter/microtex/ios/microtex.podspec +27 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/microtex.dart +7 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/bindings.dart +218 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/bounds.dart +10 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/context.dart +205 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/fontdesc.dart +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/fontmeta.dart +14 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/pathcache.dart +17 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/render.dart +291 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/texstyle.dart +11 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/textlayout.dart +93 -0
- package/native/vendor/microtex/platform/flutter/microtex/lib/src/widget.dart +163 -0
- package/native/vendor/microtex/platform/flutter/microtex/linux/CMakeLists.txt +33 -0
- package/native/vendor/microtex/platform/flutter/microtex/linux/include/microtex/microtex_plugin.h +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/linux/microtex_plugin.cc +70 -0
- package/native/vendor/microtex/platform/flutter/microtex/macos/Classes/MicrotexPlugin.swift +20 -0
- package/native/vendor/microtex/platform/flutter/microtex/macos/Classes/dummy.h +4 -0
- package/native/vendor/microtex/platform/flutter/microtex/macos/Classes/microtex-Bridging-Header.h +1 -0
- package/native/vendor/microtex/platform/flutter/microtex/macos/microtex.podspec +26 -0
- package/native/vendor/microtex/platform/flutter/microtex/nativelib/CMakeLists.txt +44 -0
- package/native/vendor/microtex/platform/flutter/microtex/nativelib/builddarwin.sh +108 -0
- package/native/vendor/microtex/platform/flutter/microtex/pubspec.yaml +37 -0
- package/native/vendor/microtex/platform/flutter/microtex/test/microtex_test.dart +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/windows/CMakeLists.txt +32 -0
- package/native/vendor/microtex/platform/flutter/microtex/windows/include/microtex/microtex_plugin.h +23 -0
- package/native/vendor/microtex/platform/flutter/microtex/windows/microtex_plugin.cpp +82 -0
- package/native/vendor/microtex/platform/gdi_win/CMakeLists.txt +20 -0
- package/native/vendor/microtex/platform/gdi_win/graphic_win32.cpp +352 -0
- package/native/vendor/microtex/platform/gdi_win/graphic_win32.h +137 -0
- package/native/vendor/microtex/platform/gdi_win/meson.build +39 -0
- package/native/vendor/microtex/platform/gtk/CMakeLists.txt +36 -0
- package/native/vendor/microtex/platform/gtk/meson.build +65 -0
- package/native/vendor/microtex/platform/gtk/microtex-gtkConfig.cmake.in +11 -0
- package/native/vendor/microtex/platform/gtk/microtexequation.cpp +708 -0
- package/native/vendor/microtex/platform/gtk/microtexequation.h +72 -0
- package/native/vendor/microtex/platform/qt/CMakeLists.txt +37 -0
- package/native/vendor/microtex/platform/qt/graphic_qt.cpp +355 -0
- package/native/vendor/microtex/platform/qt/graphic_qt.h +116 -0
- package/native/vendor/microtex/platform/qt/meson.build +38 -0
- package/native/vendor/microtex/platform/qt/microtex-qtConfig.cmake.in +7 -0
- package/native/vendor/microtex/platform/skia/CMakeLists.txt +46 -0
- package/native/vendor/microtex/platform/skia/graphic_skia.cpp +306 -0
- package/native/vendor/microtex/platform/skia/graphic_skia.h +125 -0
- package/native/vendor/microtex/platform/skia/microtex-skiaConfig.cmake.in +6 -0
- package/native/vendor/microtex/platform/wasm/CMakeLists.txt +38 -0
- package/native/vendor/microtex/platform/wasm/emscripten.cross +31 -0
- package/native/vendor/microtex/platform/wasm/main.cpp +15 -0
- package/native/vendor/microtex/platform/wasm/meson.build +8 -0
- package/native/vendor/microtex/platform/wasm/prebuild-example-meson.sh +21 -0
- package/native/vendor/microtex/platform/wasm/prebuild-example.sh +21 -0
- package/native/vendor/microtex/platform/wasm/prebuild-lib-meson.sh +28 -0
- package/native/vendor/microtex/platform/wasm/prebuild-lib.sh +31 -0
- package/native/vendor/microtex/platform/wasm/web/.babelrc +10 -0
- package/native/vendor/microtex/platform/wasm/web/example/examples.js +43 -0
- package/native/vendor/microtex/platform/wasm/web/example/hello.js +31 -0
- package/native/vendor/microtex/platform/wasm/web/example/index.html +55 -0
- package/native/vendor/microtex/platform/wasm/web/example/index.js +243 -0
- package/native/vendor/microtex/platform/wasm/web/example/styles.css +86 -0
- package/native/vendor/microtex/platform/wasm/web/example/utils.js +47 -0
- package/native/vendor/microtex/platform/wasm/web/lib/context.js +271 -0
- package/native/vendor/microtex/platform/wasm/web/lib/index.js +10 -0
- package/native/vendor/microtex/platform/wasm/web/lib/render.js +293 -0
- package/native/vendor/microtex/platform/wasm/web/lib/runtime.js +14 -0
- package/native/vendor/microtex/platform/wasm/web/lib/svg.js +237 -0
- package/native/vendor/microtex/platform/wasm/web/lib/textlayout.js +88 -0
- package/native/vendor/microtex/platform/wasm/web/package-lock.json +5931 -0
- package/native/vendor/microtex/platform/wasm/web/package.json +45 -0
- package/native/vendor/microtex/platform/wasm/web/publish-example.sh +17 -0
- package/native/vendor/microtex/platform/wasm/web/rollup.config.example.js +24 -0
- package/native/vendor/microtex/platform/wasm/web/rollup.config.lib.js +16 -0
- package/native/vendor/microtex/prebuilt/otf2clm.py +807 -0
- package/native/vendor/microtex/prebuilt/otf2clm.sh +9 -0
- package/native/vendor/microtex/prebuilt/preclms.sh +17 -0
- package/native/vendor/microtex/readme/example_bw_false.svg +680 -0
- package/native/vendor/microtex/readme/example_bw_true.svg +680 -0
- package/native/vendor/microtex/readme/example_cjk_trying.svg +54 -0
- package/native/vendor/microtex/readme/example_custom_symbols.svg +92 -0
- package/native/vendor/microtex/readme/example_debug.svg +764 -0
- package/native/vendor/microtex/readme/example_emoji.svg +199 -0
- package/native/vendor/microtex/readme/example_have_log.svg +79 -0
- package/native/vendor/microtex/readme/example_keep_trying.svg +101 -0
- package/native/vendor/microtex/readme/example_logos.svg +50 -0
- package/native/vendor/microtex/readme/example_ubuntu.png +0 -0
- package/native/vendor/microtex/readme/example_windows.png +0 -0
- package/native/vendor/microtex/readme/samples/sample_0.svg +665 -0
- package/native/vendor/microtex/readme/samples/sample_1.svg +1259 -0
- package/native/vendor/microtex/readme/samples/sample_10.svg +333 -0
- package/native/vendor/microtex/readme/samples/sample_11.svg +306 -0
- package/native/vendor/microtex/readme/samples/sample_2.svg +2461 -0
- package/native/vendor/microtex/readme/samples/sample_3.svg +2653 -0
- package/native/vendor/microtex/readme/samples/sample_4.svg +554 -0
- package/native/vendor/microtex/readme/samples/sample_5.svg +247 -0
- package/native/vendor/microtex/readme/samples/sample_6.svg +1082 -0
- package/native/vendor/microtex/readme/samples/sample_7.svg +518 -0
- package/native/vendor/microtex/readme/samples/sample_8.svg +529 -0
- package/native/vendor/microtex/readme/samples/sample_9.svg +1702 -0
- package/native/vendor/microtex/readme/samples.md +301 -0
- package/native/vendor/microtex/readme/tex_logo.svg +19 -0
- package/native/vendor/microtex/res/EXAMPLE.txt +25 -0
- package/native/vendor/microtex/res/SAMPLES.tex +946 -0
- package/native/vendor/microtex/res/firamath/FiraMath-Regular.clm1 +0 -0
- package/native/vendor/microtex/res/firamath/FiraMath-Regular.clm2 +0 -0
- package/native/vendor/microtex/res/firamath/FiraMath-Regular.otf +0 -0
- package/native/vendor/microtex/res/firamath/README.md +42 -0
- package/native/vendor/microtex/res/lm-math/README +92 -0
- package/native/vendor/microtex/res/lm-math/latinmodern-math.clm1 +0 -0
- package/native/vendor/microtex/res/lm-math/latinmodern-math.clm2 +0 -0
- package/native/vendor/microtex/res/lm-math/latinmodern-math.otf +0 -0
- package/native/vendor/microtex/res/tex-gyre/README-TeX-Gyre-DejaVu-Math.txt +82 -0
- package/native/vendor/microtex/res/tex-gyre/texgyredejavu-math.clm1 +0 -0
- package/native/vendor/microtex/res/tex-gyre/texgyredejavu-math.clm2 +0 -0
- package/native/vendor/microtex/res/tex-gyre/texgyredejavu-math.otf +0 -0
- package/native/vendor/microtex/res/xits/FONTLOG.txt +246 -0
- package/native/vendor/microtex/res/xits/OFL.txt +98 -0
- package/native/vendor/microtex/res/xits/README.txt +15 -0
- package/native/vendor/microtex/res/xits/XITS-Bold.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Bold.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Bold.otf +0 -0
- package/native/vendor/microtex/res/xits/XITS-BoldItalic.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITS-BoldItalic.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITS-BoldItalic.otf +0 -0
- package/native/vendor/microtex/res/xits/XITS-Italic.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Italic.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Italic.otf +0 -0
- package/native/vendor/microtex/res/xits/XITS-Regular.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Regular.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITS-Regular.otf +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Bold.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Bold.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Bold.otf +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Regular.clm1 +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Regular.clm2 +0 -0
- package/native/vendor/microtex/res/xits/XITSMath-Regular.otf +0 -0
- package/native/vendor/microtex/test/clm/meson.build +10 -0
- package/native/vendor/microtex/test/clm/test_clm.cpp +140 -0
- package/native/vendor/microtex/test/env/meson.build +10 -0
- package/native/vendor/microtex/test/env/test_env.cpp +100 -0
- package/native/vendor/microtex/test/fuzzer/afl.native +20 -0
- package/native/vendor/microtex/test/fuzzer/fuzz.sh +135 -0
- package/native/vendor/microtex/test/fuzzer/fuzzer.cpp +61 -0
- package/native/vendor/microtex/test/fuzzer/generateSeed.java +33 -0
- package/native/vendor/microtex/test/fuzzer/meson.build +9 -0
- package/native/vendor/microtex/test/fuzzer/microtex.dict +3708 -0
- package/native/vendor/microtex/test/fuzzer/platform_none.cpp +100 -0
- package/native/vendor/microtex/test/has_filesystem.cpp +8 -0
- package/native/vendor/microtex/test/meson.build +6 -0
- package/native/vendor/nanosvg.h +3278 -0
- package/native/vendor/nanosvgrast.h +1472 -0
- package/native/vendor/zigtex/.github/assets/example.svg +27 -0
- package/native/vendor/zigtex/LICENSE +674 -0
- package/native/vendor/zigtex/README.md +52 -0
- package/native/vendor/zigtex/build.zig +52 -0
- package/native/vendor/zigtex/build.zig.zon +16 -0
- package/native/vendor/zigtex/fonts/latinmodern-math.clm2 +0 -0
- package/native/vendor/zigtex/src/main.zig +22 -0
- package/native/vendor/zigtex/src/root.zig +124 -0
- package/native/vendor/zigtex/src/svg.zig +273 -0
- package/native/vendor/zigtex/src/tex.zig +383 -0
- package/native/zigtex-0.16.patch +35 -0
- package/package.json +27 -0
- package/scripts/bootstrap-native +89 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
#include "graphic_skia.h"
|
|
2
|
+
|
|
3
|
+
#include <include/effects/SkDashPathEffect.h>
|
|
4
|
+
#include <modules/skparagraph/include/FontCollection.h>
|
|
5
|
+
#include <modules/skparagraph/include/Paragraph.h>
|
|
6
|
+
#include <modules/skparagraph/include/ParagraphBuilder.h>
|
|
7
|
+
|
|
8
|
+
#include "utils/log.h"
|
|
9
|
+
#include "utils/nums.h"
|
|
10
|
+
#include "utils/types.h"
|
|
11
|
+
#include "utils/utils.h"
|
|
12
|
+
|
|
13
|
+
using namespace microtex;
|
|
14
|
+
using namespace std;
|
|
15
|
+
|
|
16
|
+
std::map<std::string, sk_sp<SkTypeface>> Font_skia::_typefaces;
|
|
17
|
+
|
|
18
|
+
Font_skia::Font_skia(const std::string &file) {
|
|
19
|
+
loadFont(file);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
void Font_skia::loadFont(const std::string &file) {
|
|
23
|
+
if (auto it = _typefaces.find(file); it != _typefaces.end()) {
|
|
24
|
+
_typeface = it->second;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
auto typeface = SkTypeface::MakeFromFile(file.c_str());
|
|
28
|
+
if (!typeface) {
|
|
29
|
+
#ifdef HAVE_LOG
|
|
30
|
+
logv("failed to load font '%s'\n", file.c_str());
|
|
31
|
+
#endif
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
_typefaces[file] = typeface;
|
|
35
|
+
_typeface = typeface;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
bool Font_skia::operator==(const Font &f) const {
|
|
39
|
+
return static_cast<const Font_skia &>(f)._typeface == _typeface;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
sk_sp<SkTypeface> Font_skia::getSkTypeface() const {
|
|
43
|
+
return _typeface;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**************************************************************************************************/
|
|
47
|
+
|
|
48
|
+
namespace {
|
|
49
|
+
|
|
50
|
+
SkFontStyle getSkFontStyle(microtex::FontStyle style) {
|
|
51
|
+
auto weight = microtex::isBold(style) ? SkFontStyle::kBold_Weight : SkFontStyle::kNormal_Weight;
|
|
52
|
+
auto slant = microtex::isItalic(style) ? SkFontStyle::kItalic_Slant : SkFontStyle::kUpright_Slant;
|
|
53
|
+
return {weight, SkFontStyle::kNormal_Width, slant};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
sk_sp<skia::textlayout::FontCollection> getSkFontCollection() {
|
|
57
|
+
static sk_sp<skia::textlayout::FontCollection> fontCollection;
|
|
58
|
+
if (fontCollection == nullptr) {
|
|
59
|
+
fontCollection = sk_make_sp<skia::textlayout::FontCollection>();
|
|
60
|
+
fontCollection->enableFontFallback();
|
|
61
|
+
fontCollection->setDefaultFontManager(SkFontMgr::RefDefault());
|
|
62
|
+
}
|
|
63
|
+
return fontCollection;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
} // namespace
|
|
67
|
+
|
|
68
|
+
TextLayout_skia::TextLayout_skia(const std::string &src, microtex::FontStyle style, float size) {
|
|
69
|
+
_textLen = src.length();
|
|
70
|
+
skia::textlayout::TextStyle textStyle;
|
|
71
|
+
textStyle.setFontSize(size);
|
|
72
|
+
textStyle.setFontStyle(getSkFontStyle(style));
|
|
73
|
+
std::vector<SkString> families;
|
|
74
|
+
if (microtex::isSansSerif(style)) {
|
|
75
|
+
families.emplace_back("sans-serif");
|
|
76
|
+
} else {
|
|
77
|
+
families.emplace_back("serif");
|
|
78
|
+
}
|
|
79
|
+
if (microtex::isMono(style)) {
|
|
80
|
+
families.emplace_back("monospace");
|
|
81
|
+
}
|
|
82
|
+
textStyle.setFontFamilies(families);
|
|
83
|
+
skia::textlayout::ParagraphStyle paragraphStyle;
|
|
84
|
+
paragraphStyle.setTextStyle(textStyle);
|
|
85
|
+
auto builder = skia::textlayout::ParagraphBuilder::make(paragraphStyle, getSkFontCollection());
|
|
86
|
+
builder->addText(src.c_str());
|
|
87
|
+
_paragraph = builder->Build();
|
|
88
|
+
// FIXME unlimited text width?
|
|
89
|
+
_paragraph->layout(microtex::F_MAX);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
void TextLayout_skia::getBounds(microtex::Rect &bounds) {
|
|
93
|
+
bounds.x = 0;
|
|
94
|
+
bounds.y = -_paragraph->getAlphabeticBaseline();
|
|
95
|
+
bounds.w = _paragraph->getMaxIntrinsicWidth();
|
|
96
|
+
bounds.h = _paragraph->getHeight();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
void TextLayout_skia::draw(microtex::Graphics2D &g2, float x, float y) {
|
|
100
|
+
auto &g = static_cast<Graphics2D_skia &>(g2);
|
|
101
|
+
SkPaint paint;
|
|
102
|
+
paint.setColor(g2.getColor());
|
|
103
|
+
_paragraph->updateForegroundPaint(0, _textLen, paint);
|
|
104
|
+
_paragraph->paint(g.getSkCanvas(), x, y - _paragraph->getAlphabeticBaseline());
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**************************************************************************************************/
|
|
108
|
+
|
|
109
|
+
sptr<Font> PlatformFactory_skia::createFont(const std::string &file) {
|
|
110
|
+
return sptrOf<Font_skia>(file);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
sptr<TextLayout> PlatformFactory_skia::createTextLayout(
|
|
114
|
+
const std::string &src,
|
|
115
|
+
microtex::FontStyle style,
|
|
116
|
+
float size
|
|
117
|
+
) {
|
|
118
|
+
return sptrOf<TextLayout_skia>(src, style, size);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**************************************************************************************************/
|
|
122
|
+
|
|
123
|
+
Graphics2D_skia::Graphics2D_skia(SkCanvas *canvas) : _canvas(canvas) {
|
|
124
|
+
_sx = _sy = 1;
|
|
125
|
+
_paint.setAntiAlias(true);
|
|
126
|
+
setColor(BLACK);
|
|
127
|
+
setSkFontSettings({true, SkFont::Edging::kAntiAlias, SkFontHinting::kNone});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
SkCanvas *Graphics2D_skia::getSkCanvas() const {
|
|
131
|
+
return _canvas;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const SkPaint &Graphics2D_skia::getSkPaint() const {
|
|
135
|
+
return _paint;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
void Graphics2D_skia::setSkFontSettings(const microtex::SkiaFontSettings &settings) {
|
|
139
|
+
_fontSettings = settings;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
void Graphics2D_skia::setColor(microtex::color c) {
|
|
143
|
+
_color = c;
|
|
144
|
+
_paint.setColor(c);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
color Graphics2D_skia::getColor() const {
|
|
148
|
+
return _color;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
void Graphics2D_skia::setStroke(const microtex::Stroke &s) {
|
|
152
|
+
_stroke = s;
|
|
153
|
+
SkPaint::Cap cap = SkPaint::Cap::kButt_Cap;
|
|
154
|
+
switch (_stroke.cap) {
|
|
155
|
+
case CAP_BUTT: cap = SkPaint::Cap::kButt_Cap; break;
|
|
156
|
+
case CAP_ROUND: cap = SkPaint::Cap::kRound_Cap; break;
|
|
157
|
+
case CAP_SQUARE: cap = SkPaint::Cap::kSquare_Cap; break;
|
|
158
|
+
}
|
|
159
|
+
_paint.setStrokeCap(cap);
|
|
160
|
+
|
|
161
|
+
_paint.setStrokeWidth(s.lineWidth);
|
|
162
|
+
_paint.setStrokeMiter(s.miterLimit);
|
|
163
|
+
|
|
164
|
+
SkPaint::Join join = SkPaint::Join::kMiter_Join;
|
|
165
|
+
switch (_stroke.join) {
|
|
166
|
+
case JOIN_BEVEL: join = SkPaint::Join::kBevel_Join; break;
|
|
167
|
+
case JOIN_ROUND: join = SkPaint::Join::kRound_Join; break;
|
|
168
|
+
case JOIN_MITER: join = SkPaint::Join::kMiter_Join; break;
|
|
169
|
+
}
|
|
170
|
+
_paint.setStrokeJoin(join);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const Stroke &Graphics2D_skia::getStroke() const {
|
|
174
|
+
return _stroke;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
void Graphics2D_skia::setStrokeWidth(float w) {
|
|
178
|
+
_stroke.lineWidth = w;
|
|
179
|
+
_paint.setStrokeWidth(w);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
void Graphics2D_skia::setDash(const std::vector<float> &dash) {
|
|
183
|
+
_paint.setPathEffect(SkDashPathEffect::Make(dash.data(), dash.size(), 0));
|
|
184
|
+
_dash = dash;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
std::vector<float> Graphics2D_skia::getDash() {
|
|
188
|
+
return _dash;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
sptr<Font> Graphics2D_skia::getFont() const {
|
|
192
|
+
return _font;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
void Graphics2D_skia::setFont(const sptr<microtex::Font> &font) {
|
|
196
|
+
_font = static_pointer_cast<Font_skia>(font);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
void Graphics2D_skia::setFontSize(float size) {
|
|
200
|
+
_fontSize = size;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
float Graphics2D_skia::getFontSize() const {
|
|
204
|
+
return _fontSize;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
void Graphics2D_skia::translate(float dx, float dy) {
|
|
208
|
+
_canvas->translate(dx, dy);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
void Graphics2D_skia::scale(float sx, float sy) {
|
|
212
|
+
_sx *= sx;
|
|
213
|
+
_sy *= sy;
|
|
214
|
+
_canvas->scale(sx, sy);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
static inline float radiansToDegrees(float angle) {
|
|
218
|
+
return angle * 180.f / M_PI;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
void Graphics2D_skia::rotate(float angle) {
|
|
222
|
+
_canvas->rotate(radiansToDegrees(angle));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
void Graphics2D_skia::rotate(float angle, float px, float py) {
|
|
226
|
+
_canvas->rotate(radiansToDegrees(angle), px, py);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
void Graphics2D_skia::reset() {
|
|
230
|
+
_canvas->resetMatrix();
|
|
231
|
+
_sx = _sy = 1;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
float Graphics2D_skia::sx() const {
|
|
235
|
+
return _sx;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
float Graphics2D_skia::sy() const {
|
|
239
|
+
return _sy;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
void Graphics2D_skia::drawGlyph(microtex::u16 glyph, float x, float y) {
|
|
243
|
+
_paint.setStyle(SkPaint::Style::kFill_Style);
|
|
244
|
+
SkFont font(_font->getSkTypeface(), _fontSize);
|
|
245
|
+
font.setSubpixel(_fontSettings.subpixel);
|
|
246
|
+
font.setEdging(_fontSettings.edging);
|
|
247
|
+
font.setHinting(_fontSettings.hinting);
|
|
248
|
+
SkPoint position{x, y};
|
|
249
|
+
_canvas->drawGlyphs(1, &glyph, &position, {0, 0}, font, _paint);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
bool Graphics2D_skia::beginPath(microtex::i32 id) {
|
|
253
|
+
// TODO: cache
|
|
254
|
+
_path.reset();
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
void Graphics2D_skia::moveTo(float x, float y) {
|
|
259
|
+
_path.moveTo(x, y);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
void Graphics2D_skia::lineTo(float x, float y) {
|
|
263
|
+
_path.lineTo(x, y);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
void Graphics2D_skia::cubicTo(float x1, float y1, float x2, float y2, float x3, float y3) {
|
|
267
|
+
_path.cubicTo(x1, y1, x2, y2, x3, y3);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
void Graphics2D_skia::quadTo(float x1, float y1, float x2, float y2) {
|
|
271
|
+
_path.quadTo(x1, y1, x2, y2);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
void Graphics2D_skia::closePath() {
|
|
275
|
+
_path.close();
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
void Graphics2D_skia::fillPath(microtex::i32 id) {
|
|
279
|
+
_paint.setStyle(SkPaint::Style::kFill_Style);
|
|
280
|
+
_canvas->drawPath(_path, _paint);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
void Graphics2D_skia::drawLine(float x1, float y1, float x2, float y2) {
|
|
284
|
+
_paint.setStyle(SkPaint::Style::kStroke_Style);
|
|
285
|
+
_canvas->drawLine(x1, y1, x2, y2, _paint);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
void Graphics2D_skia::drawRect(float x, float y, float w, float h) {
|
|
289
|
+
_paint.setStyle(SkPaint::Style::kStroke_Style);
|
|
290
|
+
_canvas->drawRect(SkRect::MakeXYWH(x, y, w, h), _paint);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
void Graphics2D_skia::fillRect(float x, float y, float w, float h) {
|
|
294
|
+
_paint.setStyle(SkPaint::Style::kFill_Style);
|
|
295
|
+
_canvas->drawRect(SkRect::MakeXYWH(x, y, w, h), _paint);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
void Graphics2D_skia::drawRoundRect(float x, float y, float w, float h, float rx, float ry) {
|
|
299
|
+
_paint.setStyle(SkPaint::Style::kStroke_Style);
|
|
300
|
+
_canvas->drawRoundRect(SkRect::MakeXYWH(x, y, w, h), rx, ry, _paint);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
void Graphics2D_skia::fillRoundRect(float x, float y, float w, float h, float rx, float ry) {
|
|
304
|
+
_paint.setStyle(SkPaint::Style::kFill_Style);
|
|
305
|
+
_canvas->drawRoundRect(SkRect::MakeXYWH(x, y, w, h), rx, ry, _paint);
|
|
306
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#ifndef MICROTEX_GRAPHIC_SKIA_H
|
|
2
|
+
#define MICROTEX_GRAPHIC_SKIA_H
|
|
3
|
+
|
|
4
|
+
#include <include/core/SkCanvas.h>
|
|
5
|
+
#include <include/core/SkFont.h>
|
|
6
|
+
#include <include/core/SkPath.h>
|
|
7
|
+
#include <include/core/SkTypeface.h>
|
|
8
|
+
|
|
9
|
+
#include <map>
|
|
10
|
+
#include <string>
|
|
11
|
+
|
|
12
|
+
#include "graphic/graphic.h"
|
|
13
|
+
#include "microtexexport.h"
|
|
14
|
+
|
|
15
|
+
namespace skia {
|
|
16
|
+
namespace textlayout {
|
|
17
|
+
class Paragraph;
|
|
18
|
+
} // namespace textlayout
|
|
19
|
+
} // namespace skia
|
|
20
|
+
|
|
21
|
+
namespace microtex {
|
|
22
|
+
|
|
23
|
+
struct SkiaFontSettings {
|
|
24
|
+
bool subpixel;
|
|
25
|
+
SkFont::Edging edging;
|
|
26
|
+
SkFontHinting hinting;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
class MICROTEX_EXPORT Font_skia : public Font {
|
|
30
|
+
private:
|
|
31
|
+
static std::map<std::string, sk_sp<SkTypeface>> _typefaces;
|
|
32
|
+
sk_sp<SkTypeface> _typeface;
|
|
33
|
+
|
|
34
|
+
void loadFont(const std::string &file);
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
explicit Font_skia(const std::string &file);
|
|
38
|
+
|
|
39
|
+
bool operator==(const Font &f) const override;
|
|
40
|
+
|
|
41
|
+
sk_sp<SkTypeface> getSkTypeface() const;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**************************************************************************************************/
|
|
45
|
+
|
|
46
|
+
class MICROTEX_EXPORT TextLayout_skia : public TextLayout {
|
|
47
|
+
private:
|
|
48
|
+
std::unique_ptr<skia::textlayout::Paragraph> _paragraph;
|
|
49
|
+
std::size_t _textLen;
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
TextLayout_skia(const std::string &src, FontStyle style, float size);
|
|
53
|
+
|
|
54
|
+
void getBounds(Rect &bounds) override;
|
|
55
|
+
|
|
56
|
+
void draw(Graphics2D &g2, float x, float y) override;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**************************************************************************************************/
|
|
60
|
+
|
|
61
|
+
class MICROTEX_EXPORT PlatformFactory_skia : public PlatformFactory {
|
|
62
|
+
public:
|
|
63
|
+
sptr<Font> createFont(const std::string &file) override;
|
|
64
|
+
|
|
65
|
+
sptr<TextLayout> createTextLayout(const std::string &src, FontStyle style, float size) override;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**************************************************************************************************/
|
|
69
|
+
|
|
70
|
+
class MICROTEX_EXPORT Graphics2D_skia : public Graphics2D {
|
|
71
|
+
private:
|
|
72
|
+
SkCanvas *_canvas;
|
|
73
|
+
SkPaint _paint;
|
|
74
|
+
color _color;
|
|
75
|
+
Stroke _stroke;
|
|
76
|
+
sptr<Font_skia> _font;
|
|
77
|
+
float _fontSize;
|
|
78
|
+
float _sx, _sy;
|
|
79
|
+
SkPath _path;
|
|
80
|
+
SkiaFontSettings _fontSettings;
|
|
81
|
+
std::vector<float> _dash;
|
|
82
|
+
|
|
83
|
+
public:
|
|
84
|
+
explicit Graphics2D_skia(SkCanvas *canvas);
|
|
85
|
+
|
|
86
|
+
SkCanvas *getSkCanvas() const;
|
|
87
|
+
const SkPaint &getSkPaint() const;
|
|
88
|
+
void setSkFontSettings(const SkiaFontSettings &settings);
|
|
89
|
+
|
|
90
|
+
void setColor(color c) override;
|
|
91
|
+
color getColor() const override;
|
|
92
|
+
void setStroke(const Stroke &s) override;
|
|
93
|
+
const Stroke &getStroke() const override;
|
|
94
|
+
void setStrokeWidth(float w) override;
|
|
95
|
+
void setDash(const std::vector<float> &dash) override;
|
|
96
|
+
std::vector<float> getDash() override;
|
|
97
|
+
sptr<Font> getFont() const override;
|
|
98
|
+
void setFont(const sptr<Font> &font) override;
|
|
99
|
+
float getFontSize() const override;
|
|
100
|
+
void setFontSize(float size) override;
|
|
101
|
+
void translate(float dx, float dy) override;
|
|
102
|
+
void scale(float sx, float sy) override;
|
|
103
|
+
void rotate(float angle) override;
|
|
104
|
+
void rotate(float angle, float px, float py) override;
|
|
105
|
+
void reset() override;
|
|
106
|
+
float sx() const override;
|
|
107
|
+
float sy() const override;
|
|
108
|
+
void drawGlyph(u16 glyph, float x, float y) override;
|
|
109
|
+
bool beginPath(i32 id) override;
|
|
110
|
+
void moveTo(float x, float y) override;
|
|
111
|
+
void lineTo(float x, float y) override;
|
|
112
|
+
void cubicTo(float x1, float y1, float x2, float y2, float x3, float y3) override;
|
|
113
|
+
void quadTo(float x1, float y1, float x2, float y2) override;
|
|
114
|
+
void closePath() override;
|
|
115
|
+
void fillPath(i32 id) override;
|
|
116
|
+
void drawLine(float x1, float y1, float x2, float y2) override;
|
|
117
|
+
void drawRect(float x, float y, float w, float h) override;
|
|
118
|
+
void fillRect(float x, float y, float w, float h) override;
|
|
119
|
+
void drawRoundRect(float x, float y, float w, float h, float rx, float ry) override;
|
|
120
|
+
void fillRoundRect(float x, float y, float w, float h, float rx, float ry) override;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
} // namespace microtex
|
|
124
|
+
|
|
125
|
+
#endif // MICROTEX_GRAPHIC_SKIA_H
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.16)
|
|
2
|
+
|
|
3
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
4
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
5
|
+
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
6
|
+
|
|
7
|
+
project(
|
|
8
|
+
microtex
|
|
9
|
+
VERSION 1.0.0
|
|
10
|
+
DESCRIPTION "MicroTeX for wasm"
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
# the API (and ABI) is compatible when MICROTEX_API_VERSION is the same
|
|
14
|
+
set(MICROTEX_API_VERSION 1)
|
|
15
|
+
|
|
16
|
+
message(STATUS "Building for wasm")
|
|
17
|
+
|
|
18
|
+
set(_BUILD_STATIC TRUE)
|
|
19
|
+
set(_DISABLE_ALIAS TRUE)
|
|
20
|
+
set(_HAVE_AUTO_FONT_FIND FALSE)
|
|
21
|
+
set(_GLYPH_RENDER_TYPE 1)
|
|
22
|
+
set(HAVE_CWRAPPER TRUE)
|
|
23
|
+
|
|
24
|
+
add_subdirectory(lib)
|
|
25
|
+
|
|
26
|
+
add_executable(microtex-wasm main.cpp)
|
|
27
|
+
target_link_libraries(microtex-wasm PRIVATE microtex)
|
|
28
|
+
|
|
29
|
+
set_target_properties(
|
|
30
|
+
microtex-wasm PROPERTIES
|
|
31
|
+
CXX_VISIBILITY_PRESET hidden
|
|
32
|
+
LINK_FLAGS
|
|
33
|
+
"-fexceptions -s MODULARIZE=1 -s EXPORT_ES6=1\
|
|
34
|
+
-s WASM=1 -s EXPORTED_RUNTIME_METHODS=allocateUTF8,UTF8ToString,addFunction\
|
|
35
|
+
-s EXPORTED_FUNCTIONS=_malloc,_free\
|
|
36
|
+
-s IMPORTED_MEMORY -s ALLOW_MEMORY_GROWTH=1\
|
|
37
|
+
-s RESERVED_FUNCTION_POINTERS=4"
|
|
38
|
+
)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
; Taken from https://github.com/videolan/dav1d/blob/master/package/crossfiles/wasm64.meson
|
|
2
|
+
[binaries]
|
|
3
|
+
c = 'emcc'
|
|
4
|
+
cpp = 'em++'
|
|
5
|
+
ar = 'emar'
|
|
6
|
+
strip = 'emstrip'
|
|
7
|
+
exe_wrapper = 'node'
|
|
8
|
+
|
|
9
|
+
[built-in options]
|
|
10
|
+
default_library = 'static'
|
|
11
|
+
cpp_args = '-fexceptions -sNO_DISABLE_EXCEPTION_CATCHING'
|
|
12
|
+
cpp_link_args = '-fexceptions -sNO_DISABLE_EXCEPTION_CATCHING'
|
|
13
|
+
|
|
14
|
+
[project options]
|
|
15
|
+
CAIRO = false
|
|
16
|
+
EXAMPLE_GTKMM = false
|
|
17
|
+
|
|
18
|
+
GTK = false
|
|
19
|
+
EXAMPLE_GTK = false
|
|
20
|
+
|
|
21
|
+
QT = false
|
|
22
|
+
EXAMPLE_QT = false
|
|
23
|
+
|
|
24
|
+
GDI = 'disabled'
|
|
25
|
+
EXAMPLE_WIN32 = false
|
|
26
|
+
|
|
27
|
+
[host_machine]
|
|
28
|
+
system = 'emscripten'
|
|
29
|
+
cpu_family = 'wasm64'
|
|
30
|
+
cpu = 'wasm64'
|
|
31
|
+
endian = 'little'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#include "wrapper/cwrapper.h"
|
|
2
|
+
|
|
3
|
+
#ifdef __cplusplus
|
|
4
|
+
extern "C" {
|
|
5
|
+
#endif
|
|
6
|
+
|
|
7
|
+
int main(int argc, char** argv) {
|
|
8
|
+
// dummy function call to avoid link optimization
|
|
9
|
+
microtex_isLittleEndian();
|
|
10
|
+
return 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
#ifdef __cplusplus
|
|
14
|
+
}
|
|
15
|
+
#endif
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
subdir('lib/wrapper')
|
|
2
|
+
|
|
3
|
+
executable('microtex-wasm', 'main.cpp',
|
|
4
|
+
dependencies: [microtex_dep, microtex_cwrapper_dep],
|
|
5
|
+
link_args: ['-sMODULARIZE=1', '-sEXPORT_ES6=1', '-sWASM=1', '-sEXPORTED_RUNTIME_METHODS=allocateUTF8,UTF8ToString,addFunction',
|
|
6
|
+
'-sEXPORTED_FUNCTIONS=_malloc,_free', '-sIMPORTED_MEMORY', '-sALLOW_MEMORY_GROWTH=1', '-sRESERVED_FUNCTION_POINTERS=4'
|
|
7
|
+
]
|
|
8
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
web_dir="$(pwd)"
|
|
6
|
+
|
|
7
|
+
cd .. || return
|
|
8
|
+
build_dir="$(pwd)/_build"
|
|
9
|
+
|
|
10
|
+
# go to project root dir
|
|
11
|
+
cd ../../
|
|
12
|
+
project_dir=$(pwd)
|
|
13
|
+
|
|
14
|
+
rm -rf "${web_dir}/example-dist"
|
|
15
|
+
mkdir "${web_dir}/example-dist"
|
|
16
|
+
|
|
17
|
+
# copy to example
|
|
18
|
+
cp -r "${project_dir}/res" "${web_dir}/example-dist"
|
|
19
|
+
cp "${build_dir}/platform/wasm/microtex-wasm.wasm" "${web_dir}/example-dist"
|
|
20
|
+
cp "${web_dir}/example/index.html" "${web_dir}/example-dist"
|
|
21
|
+
cp "${web_dir}/example/styles.css" "${web_dir}/example-dist"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
web_dir="$(pwd)"
|
|
6
|
+
|
|
7
|
+
cd .. || return
|
|
8
|
+
build_dir="$(pwd)/build"
|
|
9
|
+
|
|
10
|
+
# go to project root dir
|
|
11
|
+
cd ../../
|
|
12
|
+
project_dir=$(pwd)
|
|
13
|
+
|
|
14
|
+
rm -rf "${web_dir}/example-dist"
|
|
15
|
+
mkdir "${web_dir}/example-dist"
|
|
16
|
+
|
|
17
|
+
# copy to example
|
|
18
|
+
cp -r "${project_dir}/res" "${web_dir}/example-dist"
|
|
19
|
+
cp "${build_dir}/microtex-wasm.wasm" "${web_dir}/example-dist"
|
|
20
|
+
cp "${web_dir}/example/index.html" "${web_dir}/example-dist"
|
|
21
|
+
cp "${web_dir}/example/styles.css" "${web_dir}/example-dist"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/sh
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
web_dir="$(pwd)"
|
|
6
|
+
|
|
7
|
+
cd .. || return
|
|
8
|
+
build_dir="$(pwd)/_build"
|
|
9
|
+
|
|
10
|
+
if [ -d "${build_dir}" ]; then
|
|
11
|
+
/bin/rm -r "${build_dir}"
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
meson setup --buildtype=release --cross-file emscripten.cross "${build_dir}" ../../
|
|
15
|
+
ninja -C "${build_dir}"
|
|
16
|
+
|
|
17
|
+
rm -rf "${web_dir}/dist"
|
|
18
|
+
rm -rf "${web_dir}/gen"
|
|
19
|
+
|
|
20
|
+
mkdir "${web_dir}/gen"
|
|
21
|
+
mkdir "${web_dir}/dist"
|
|
22
|
+
|
|
23
|
+
# copy to gen
|
|
24
|
+
cp "${build_dir}/platform/wasm/microtex-wasm.wasm" "${web_dir}/gen"
|
|
25
|
+
cp "${build_dir}/platform/wasm/microtex-wasm.js" "${web_dir}/gen"
|
|
26
|
+
|
|
27
|
+
# copy to dist
|
|
28
|
+
cp "${build_dir}/platform/wasm/microtex-wasm.wasm" "${web_dir}/dist"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
web_dir="$(pwd)"
|
|
6
|
+
|
|
7
|
+
cd .. || return
|
|
8
|
+
build_dir="$(pwd)/build"
|
|
9
|
+
|
|
10
|
+
# build the wasm target
|
|
11
|
+
if [ ! -d "${build_dir}" ]; then
|
|
12
|
+
mkdir "${build_dir}"
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
cd "${build_dir}" || return
|
|
16
|
+
|
|
17
|
+
emcmake cmake -DCMAKE_BUILD_TYPE=Release -DHAVE_LOG=OFF -DWASM=ON -DHAVE_CWRAPPER=ON ..
|
|
18
|
+
emmake make -j8
|
|
19
|
+
|
|
20
|
+
rm -rf "${web_dir}/dist"
|
|
21
|
+
rm -rf "${web_dir}/gen"
|
|
22
|
+
|
|
23
|
+
mkdir "${web_dir}/gen"
|
|
24
|
+
mkdir "${web_dir}/dist"
|
|
25
|
+
|
|
26
|
+
# copy to gen
|
|
27
|
+
cp "${build_dir}/microtex-wasm.wasm" "${web_dir}/gen"
|
|
28
|
+
cp "${build_dir}/microtex-wasm.js" "${web_dir}/gen"
|
|
29
|
+
|
|
30
|
+
# copy to dist
|
|
31
|
+
cp "${build_dir}/microtex-wasm.wasm" "${web_dir}/dist"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
function Examples(examplesUrl) {
|
|
4
|
+
let isInited = false;
|
|
5
|
+
|
|
6
|
+
this.isInited = function () {
|
|
7
|
+
return isInited;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
fetch(examplesUrl)
|
|
11
|
+
.then(res => res.text())
|
|
12
|
+
.then(txt => readExamples(txt));
|
|
13
|
+
|
|
14
|
+
let samples = [];
|
|
15
|
+
let i = -1;
|
|
16
|
+
|
|
17
|
+
function readExamples(txt) {
|
|
18
|
+
const lines = txt.split(/\r?\n/);
|
|
19
|
+
let str = "";
|
|
20
|
+
lines.forEach(v => {
|
|
21
|
+
if (/^%+$/.test(v)) {
|
|
22
|
+
samples.push(str);
|
|
23
|
+
str = "";
|
|
24
|
+
} else {
|
|
25
|
+
str += v + "\n";
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
isInited = true;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
this.count = function () {
|
|
32
|
+
return samples.length;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
this.next = function () {
|
|
36
|
+
i = (i + 1) % this.count();
|
|
37
|
+
return samples[i];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const examples = new Examples('./res/SAMPLES.tex');
|
|
42
|
+
|
|
43
|
+
export {examples};
|