@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,115 @@
|
|
|
1
|
+
#include "utf.h"
|
|
2
|
+
|
|
3
|
+
using namespace std;
|
|
4
|
+
using namespace microtex;
|
|
5
|
+
|
|
6
|
+
bool microtex::isVariationSelector(c32 code) {
|
|
7
|
+
if (code <= 0x7ff) return false;
|
|
8
|
+
// variation selectors (Unicode block)
|
|
9
|
+
if (code >= 0xFE00 && code <= 0xFE0F) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
// variation selectors supplement
|
|
13
|
+
if (code >= 0xE0100 && code <= 0xE01EF) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
// Mongolian variation selectors
|
|
17
|
+
if (code >= 0x180B && code <= 0x180D) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
bool microtex::isZWJ(c32 code) {
|
|
24
|
+
return code == 0x200D;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
bool microtex::isZWNJ(c32 code) {
|
|
28
|
+
return code == 0x200C;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
bool microtex::isJoiner(c32 code) {
|
|
32
|
+
return isZWJ(code) || isZWNJ(code);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
void microtex::appendToUtf8(std::string& out, c32 code) {
|
|
36
|
+
if (code <= 0x7f) {
|
|
37
|
+
out.append(1, static_cast<char>(code));
|
|
38
|
+
} else if (code <= 0x7ff) {
|
|
39
|
+
out.append(1, static_cast<char>(0xc0 | ((code >> 6) & 0x1f)));
|
|
40
|
+
out.append(1, static_cast<char>(0x80 | (code & 0x3f)));
|
|
41
|
+
} else if (code <= 0xffff) {
|
|
42
|
+
out.append(1, static_cast<char>(0xe0 | ((code >> 12) & 0x0f)));
|
|
43
|
+
out.append(1, static_cast<char>(0x80 | ((code >> 6) & 0x3f)));
|
|
44
|
+
out.append(1, static_cast<char>(0x80 | (code & 0x3f)));
|
|
45
|
+
} else {
|
|
46
|
+
out.append(1, static_cast<char>(0xf0 | ((code >> 18) & 0x07)));
|
|
47
|
+
out.append(1, static_cast<char>(0x80 | ((code >> 12) & 0x3f)));
|
|
48
|
+
out.append(1, static_cast<char>(0x80 | ((code >> 6) & 0x3f)));
|
|
49
|
+
out.append(1, static_cast<char>(0x80 | (code & 0x3f)));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
c32 microtex::nextUnicode(const std::string& src, int i, int& cnt) {
|
|
54
|
+
const auto l = src.length();
|
|
55
|
+
if (i >= l) {
|
|
56
|
+
cnt = 0;
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
const char* in = src.c_str() + i;
|
|
60
|
+
auto ch = static_cast<unsigned char>(*in);
|
|
61
|
+
// 1 byte
|
|
62
|
+
cnt = 1;
|
|
63
|
+
if (ch <= 0b01111111) {
|
|
64
|
+
return static_cast<c32>(ch);
|
|
65
|
+
}
|
|
66
|
+
// multi-bytes
|
|
67
|
+
c32 code = 0;
|
|
68
|
+
if (ch <= 0b11011111) {
|
|
69
|
+
code = (ch & 0b00011111) << 6;
|
|
70
|
+
cnt = 2;
|
|
71
|
+
} else if (ch <= 0b11101111) {
|
|
72
|
+
code = (ch & 0b00001111) << 12;
|
|
73
|
+
cnt = 3;
|
|
74
|
+
} else if (ch <= 0b11110111) {
|
|
75
|
+
code = (ch & 0b00000111) << 18;
|
|
76
|
+
cnt = 4;
|
|
77
|
+
} else if (ch <= 0b11111011) {
|
|
78
|
+
code = (ch & 0b00000011) << 24;
|
|
79
|
+
cnt = 5;
|
|
80
|
+
} else if (ch <= 0b11111101) {
|
|
81
|
+
code = (ch & 0b00000001) << 30;
|
|
82
|
+
cnt = 6;
|
|
83
|
+
}
|
|
84
|
+
// otherwise, the utf-8 string is malformed
|
|
85
|
+
for (int j = 1; j < cnt; j++) {
|
|
86
|
+
// malformed utf-8 string, we ignore it
|
|
87
|
+
if (i + j >= l) break;
|
|
88
|
+
auto c = static_cast<unsigned char>(*(in + j));
|
|
89
|
+
code |= (c & 0b00111111) << (6 * (cnt - j - 1));
|
|
90
|
+
}
|
|
91
|
+
return code;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
void microtex::scanContinuedUnicodes(
|
|
95
|
+
const std::function<c32()>& next,
|
|
96
|
+
const std::function<void(c32)>& collect
|
|
97
|
+
) {
|
|
98
|
+
const c32 x = next();
|
|
99
|
+
collect(x);
|
|
100
|
+
while (true) {
|
|
101
|
+
const c32 a = next();
|
|
102
|
+
if (microtex::isVariationSelector(a)) {
|
|
103
|
+
collect(a);
|
|
104
|
+
} else if (microtex::isJoiner(a)) {
|
|
105
|
+
collect(a);
|
|
106
|
+
c32 b = 0;
|
|
107
|
+
do {
|
|
108
|
+
b = next();
|
|
109
|
+
collect(b);
|
|
110
|
+
} while (isJoiner(b));
|
|
111
|
+
} else {
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#ifndef UTF_H_INCLUDED
|
|
2
|
+
#define UTF_H_INCLUDED
|
|
3
|
+
|
|
4
|
+
#include <string>
|
|
5
|
+
|
|
6
|
+
#include "utils/utils.h"
|
|
7
|
+
|
|
8
|
+
namespace microtex {
|
|
9
|
+
|
|
10
|
+
/** Append an Unicode code-point to an utf-8 string */
|
|
11
|
+
void appendToUtf8(std::string& out, c32 code);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get the next Unicode code-point from the given utf-8 string
|
|
15
|
+
* start from #i, the bytes count consumed in the byte sequence
|
|
16
|
+
* was given by #cnt after the code-point was decoded.
|
|
17
|
+
*/
|
|
18
|
+
c32 nextUnicode(const std::string& src, int i, int& cnt);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Test if a given Unicode code-point is a variation-selector.
|
|
22
|
+
* See [https://en.m.wikipedia.org/wiki/Variant_form_(Unicode)]
|
|
23
|
+
* for details.
|
|
24
|
+
*/
|
|
25
|
+
bool isVariationSelector(c32 code);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Test if a given Unicode code-point is a zero-width joiner.
|
|
29
|
+
* See [https://en.wikipedia.org/wiki/Zero-width_joiner]
|
|
30
|
+
* for details.
|
|
31
|
+
*/
|
|
32
|
+
bool isZWJ(c32 code);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Test if a given Unicode code-point is a zero-width non-joiner.
|
|
36
|
+
* See [https://en.wikipedia.org/wiki/Zero-width_non-joiner]
|
|
37
|
+
* for details
|
|
38
|
+
*/
|
|
39
|
+
bool isZWNJ(c32 code);
|
|
40
|
+
|
|
41
|
+
/** Test if a given Unicode code-point is a joiner. */
|
|
42
|
+
bool isJoiner(c32 code);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Scan Unicodes that cannot be split from a sequence and collect
|
|
46
|
+
* it into an arbitrary container.
|
|
47
|
+
*
|
|
48
|
+
* @param next function to get the next Unicode code-point, 0 terminated
|
|
49
|
+
* @param collect function to collect the given Unicode-point
|
|
50
|
+
*/
|
|
51
|
+
void scanContinuedUnicodes(
|
|
52
|
+
const std::function<c32()>& next,
|
|
53
|
+
const std::function<void(c32)>& collect
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
} // namespace microtex
|
|
57
|
+
|
|
58
|
+
#endif
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#include "utils/utils.h"
|
|
2
|
+
|
|
3
|
+
const std::locale& microtex::defaultLocale() {
|
|
4
|
+
#if !defined(__WIN32__)
|
|
5
|
+
static const std::locale locale("en_US.UTF-8");
|
|
6
|
+
#else
|
|
7
|
+
static const std::locale locale("C");
|
|
8
|
+
#endif
|
|
9
|
+
return locale;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
bool microtex::isUnicodeLower(c32 code) {
|
|
13
|
+
// the type-cast is necessary, or a std::bad_cast will be thrown,
|
|
14
|
+
// because std::toupper is a template function
|
|
15
|
+
return std::islower((wchar_t)code, defaultLocale());
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
bool microtex::isUnicodeDigit(c32 code) {
|
|
19
|
+
return std::isdigit((wchar_t)code, defaultLocale());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
microtex::c32 microtex::toUnicodeUpper(c32 code) {
|
|
23
|
+
return std::toupper((wchar_t)code, defaultLocale());
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
microtex::c32 microtex::toUnicodeLower(c32 code) {
|
|
27
|
+
return std::tolower((wchar_t)code, defaultLocale());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
int microtex::binIndexOf(int count, const std::function<int(int)>& compare, bool returnClosest) {
|
|
31
|
+
if (count == 0) return -1;
|
|
32
|
+
int l = 0, h = count - 1;
|
|
33
|
+
while (l <= h) {
|
|
34
|
+
const int m = l + ((h - l) >> 1);
|
|
35
|
+
const int cmp = compare(m);
|
|
36
|
+
if (cmp == 0) return m;
|
|
37
|
+
cmp < 0 ? h = m - 1 : l = m + 1;
|
|
38
|
+
}
|
|
39
|
+
return returnClosest ? std::max(0, l - 1) : -1;
|
|
40
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
#ifndef UTILS_INCLUDED
|
|
2
|
+
#define UTILS_INCLUDED
|
|
3
|
+
|
|
4
|
+
#include <algorithm>
|
|
5
|
+
#include <functional>
|
|
6
|
+
#include <locale>
|
|
7
|
+
#include <map>
|
|
8
|
+
#include <vector>
|
|
9
|
+
|
|
10
|
+
#include "types.h"
|
|
11
|
+
|
|
12
|
+
#define no_copy_assign(T) \
|
|
13
|
+
T(const T&) = delete; \
|
|
14
|
+
void operator=(const T&) = delete
|
|
15
|
+
|
|
16
|
+
namespace microtex {
|
|
17
|
+
|
|
18
|
+
template <typename T, typename... Args>
|
|
19
|
+
inline sptr<T> sptrOf(Args&&... args) {
|
|
20
|
+
return std::make_shared<T>(std::forward<Args>(args)...);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
template <typename T, typename... Args>
|
|
24
|
+
inline uptr<T> uptrOf(Args&&... args) {
|
|
25
|
+
return std::make_unique<T>(std::forward<Args>(args)...);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
inline bool isAlpha(char c) {
|
|
29
|
+
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
template <typename K, typename V>
|
|
33
|
+
inline std::vector<K> keys(const std::map<K, V>& map) {
|
|
34
|
+
std::vector<K> v;
|
|
35
|
+
for (auto& it : map) {
|
|
36
|
+
v.push_back(it.first);
|
|
37
|
+
}
|
|
38
|
+
return v;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Template version to find the max value of the given list */
|
|
42
|
+
template <typename T, typename... Args>
|
|
43
|
+
inline T maxOf(Args&&... args) {
|
|
44
|
+
return std::max({args...});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Get number of set bits in binary representation of the given number */
|
|
48
|
+
template <typename T>
|
|
49
|
+
u32 countSetBits(T n) {
|
|
50
|
+
u32 cnt = 0;
|
|
51
|
+
while (n) {
|
|
52
|
+
n &= (n - 1);
|
|
53
|
+
cnt++;
|
|
54
|
+
}
|
|
55
|
+
return cnt;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** The default locale */
|
|
59
|
+
const std::locale& defaultLocale();
|
|
60
|
+
|
|
61
|
+
/** Test if a Unicode code point is lower case */
|
|
62
|
+
bool isUnicodeLower(c32 code);
|
|
63
|
+
|
|
64
|
+
/** Test if a Unicode code point is digit */
|
|
65
|
+
bool isUnicodeDigit(c32 code);
|
|
66
|
+
|
|
67
|
+
/** Convert given Unicode code point to upper case */
|
|
68
|
+
c32 toUnicodeUpper(c32 code);
|
|
69
|
+
|
|
70
|
+
/** Convert given Unicode code point to lower case */
|
|
71
|
+
c32 toUnicodeLower(c32 code);
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Binary-search for the index of the given target in a container. The items in the container must
|
|
75
|
+
* be sorted.
|
|
76
|
+
*
|
|
77
|
+
* @param count total count of elements in the container
|
|
78
|
+
* @param compare function to compare between the target value and the value at the given index
|
|
79
|
+
* @param returnClosest whether return the closest index while not found, default is false
|
|
80
|
+
*
|
|
81
|
+
* @return the index which the target value found at, or the closest index if returnClosest is true,
|
|
82
|
+
* or -1 otherwise
|
|
83
|
+
*/
|
|
84
|
+
int binIndexOf(int count, const std::function<int(int)>& compare, bool returnClosest = false);
|
|
85
|
+
|
|
86
|
+
} // namespace microtex
|
|
87
|
+
|
|
88
|
+
#endif
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#ifdef HAVE_CWRAPPER
|
|
2
|
+
|
|
3
|
+
#include "wrapper/byte_seq.h"
|
|
4
|
+
|
|
5
|
+
#include <cstdlib>
|
|
6
|
+
|
|
7
|
+
#include "utils/log.h"
|
|
8
|
+
|
|
9
|
+
namespace microtex {
|
|
10
|
+
|
|
11
|
+
ByteSeq::ByteSeq() {
|
|
12
|
+
_data = malloc(CHUNK_SIZE);
|
|
13
|
+
// the first 4 bytes is the bytes size used
|
|
14
|
+
_index = 4;
|
|
15
|
+
_capacity = CHUNK_SIZE;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
void ByteSeq::_put(const char* str) {
|
|
19
|
+
auto l = sizeOf(str);
|
|
20
|
+
strcpy((char*)_data + _index, str);
|
|
21
|
+
_index += l;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
void ByteSeq::ensureCapacity(len_t required) {
|
|
25
|
+
if (_index + required < _capacity) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
#ifdef HAVE_LOG
|
|
29
|
+
logv("grow buffer, _capacity: %u, to be add: %u\n", _capacity, required);
|
|
30
|
+
#endif
|
|
31
|
+
_data = realloc(_data, _capacity + CHUNK_SIZE);
|
|
32
|
+
_capacity += CHUNK_SIZE;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
void* ByteSeq::finish() {
|
|
36
|
+
#ifdef HAVE_LOG
|
|
37
|
+
logv("finish drawing commands, bytes: %u\n", _index);
|
|
38
|
+
#endif
|
|
39
|
+
auto ptr = (unsigned int*)_data;
|
|
40
|
+
*ptr = _index;
|
|
41
|
+
return _data;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
} // namespace microtex
|
|
45
|
+
|
|
46
|
+
#endif // HAVE_CWRAPPER
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#ifndef MICROTEX_BYTE_SEQ_H
|
|
2
|
+
#define MICROTEX_BYTE_SEQ_H
|
|
3
|
+
|
|
4
|
+
#ifdef HAVE_CWRAPPER
|
|
5
|
+
|
|
6
|
+
#include <cstring>
|
|
7
|
+
|
|
8
|
+
#include "utils/utils.h"
|
|
9
|
+
|
|
10
|
+
namespace microtex {
|
|
11
|
+
|
|
12
|
+
using len_t = unsigned int;
|
|
13
|
+
|
|
14
|
+
class ByteSeq {
|
|
15
|
+
private:
|
|
16
|
+
static constexpr len_t CHUNK_SIZE = 4 * 1024; // 4KB
|
|
17
|
+
|
|
18
|
+
static inline len_t sizeOf() { return 0; }
|
|
19
|
+
|
|
20
|
+
static inline len_t sizeOf(const char* str) { return strlen(str) + 1; }
|
|
21
|
+
|
|
22
|
+
template <typename T, typename... Ts>
|
|
23
|
+
static len_t sizeOf(const T& t, const Ts&... ts) {
|
|
24
|
+
return sizeof(T) + sizeOf(ts...);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
len_t _index;
|
|
28
|
+
len_t _capacity;
|
|
29
|
+
void* _data;
|
|
30
|
+
|
|
31
|
+
inline void _put() {}
|
|
32
|
+
|
|
33
|
+
void _put(const char* str);
|
|
34
|
+
|
|
35
|
+
template <typename T>
|
|
36
|
+
void _put(T t) {
|
|
37
|
+
auto l = sizeof(T);
|
|
38
|
+
T* ptr = (T*)((char*)_data + _index);
|
|
39
|
+
*ptr = t;
|
|
40
|
+
_index += l;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
template <typename T, typename... Ts>
|
|
44
|
+
void _put(T t, Ts... ts) {
|
|
45
|
+
_put(t);
|
|
46
|
+
_put(ts...);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
void ensureCapacity(len_t required);
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
no_copy_assign(ByteSeq);
|
|
53
|
+
|
|
54
|
+
ByteSeq();
|
|
55
|
+
|
|
56
|
+
template <typename T, typename... Ts>
|
|
57
|
+
void put(T t, Ts... ts) {
|
|
58
|
+
auto l = sizeOf(t, ts...);
|
|
59
|
+
ensureCapacity(l);
|
|
60
|
+
_put(t, ts...);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
void* finish();
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
} // namespace microtex
|
|
67
|
+
|
|
68
|
+
#endif // HAVE_CWRAPPER
|
|
69
|
+
|
|
70
|
+
#endif // MICROTEX_BYTE_SEQ_H
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#ifdef HAVE_CWRAPPER
|
|
2
|
+
|
|
3
|
+
#include "wrapper/callback.h"
|
|
4
|
+
|
|
5
|
+
CBCreateTextLayout microtex_createTextLayout = nullptr;
|
|
6
|
+
CBGetTextLayoutBounds microtex_getTextLayoutBounds = nullptr;
|
|
7
|
+
CBReleaseTextLayout microtex_releaseTextLayout = nullptr;
|
|
8
|
+
CBIsPathExists microtex_isPathExists = nullptr;
|
|
9
|
+
|
|
10
|
+
#endif
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#ifndef MICROTEX_CALLBACK_H
|
|
2
|
+
#define MICROTEX_CALLBACK_H
|
|
3
|
+
|
|
4
|
+
#ifdef HAVE_CWRAPPER
|
|
5
|
+
|
|
6
|
+
#ifdef __cplusplus
|
|
7
|
+
extern "C" {
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
/** Simple struct to represents the bounds of a text layout. */
|
|
11
|
+
typedef struct {
|
|
12
|
+
float width;
|
|
13
|
+
float height;
|
|
14
|
+
float ascent;
|
|
15
|
+
} TextLayoutBounds;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Simple struct to represents the description to create a font to
|
|
19
|
+
* layout and draw a text-layout.
|
|
20
|
+
*
|
|
21
|
+
* Unlike the font the engine using internally, you are free to create
|
|
22
|
+
* the font you want based on the given description, the description
|
|
23
|
+
* is for reference, not a constraint.
|
|
24
|
+
*/
|
|
25
|
+
typedef struct {
|
|
26
|
+
bool isBold;
|
|
27
|
+
bool isItalic;
|
|
28
|
+
bool isSansSerif;
|
|
29
|
+
bool isMonospace;
|
|
30
|
+
float fontSize;
|
|
31
|
+
} FontDesc;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Callback to create a text-layout from given text and font description,
|
|
35
|
+
* it should returns the id of the created text-layout, and then the id
|
|
36
|
+
* will be used to retrieve the bounds and draw.
|
|
37
|
+
*
|
|
38
|
+
* See [lib/wrapper/graphic_wrapper.h: TextLayout_wrapper::draw].
|
|
39
|
+
*/
|
|
40
|
+
typedef unsigned int (*CBCreateTextLayout)(const char* txt, FontDesc* f);
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Callback to retrieve the bounds of the text-layout created by callback
|
|
44
|
+
* [CBCreateTextLayout] before.
|
|
45
|
+
*/
|
|
46
|
+
typedef void (*CBGetTextLayoutBounds)(unsigned int id, TextLayoutBounds* b);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Callback to release the text-layout created by callback [CBCreateTextLayout]
|
|
50
|
+
* before.
|
|
51
|
+
*/
|
|
52
|
+
typedef void (*CBReleaseTextLayout)(unsigned int id);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Callback to check if a (glyph) path given by id is in cache. It will be used
|
|
56
|
+
* by [lib/graphic/graphic.h: Graphic2D::drawPath] to determine if a path is in
|
|
57
|
+
* cache, if it does, the following path drawing command will be ignored.
|
|
58
|
+
*/
|
|
59
|
+
typedef bool (*CBIsPathExists)(unsigned int id);
|
|
60
|
+
|
|
61
|
+
extern CBCreateTextLayout microtex_createTextLayout;
|
|
62
|
+
extern CBGetTextLayoutBounds microtex_getTextLayoutBounds;
|
|
63
|
+
extern CBReleaseTextLayout microtex_releaseTextLayout;
|
|
64
|
+
extern CBIsPathExists microtex_isPathExists;
|
|
65
|
+
|
|
66
|
+
#ifdef __cplusplus
|
|
67
|
+
}
|
|
68
|
+
#endif
|
|
69
|
+
|
|
70
|
+
#endif
|
|
71
|
+
|
|
72
|
+
#endif // MICROTEX_CALLBACK_H
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
#ifdef HAVE_CWRAPPER
|
|
2
|
+
|
|
3
|
+
#include "wrapper/cwrapper.h"
|
|
4
|
+
|
|
5
|
+
#include "microtex.h"
|
|
6
|
+
#include "utils/log.h"
|
|
7
|
+
#include "wrapper/graphic_wrapper.h"
|
|
8
|
+
|
|
9
|
+
using namespace microtex;
|
|
10
|
+
|
|
11
|
+
#ifdef __cplusplus
|
|
12
|
+
extern "C" {
|
|
13
|
+
#endif
|
|
14
|
+
|
|
15
|
+
MICROTEX_CAPI const char* microtex_version() {
|
|
16
|
+
// No need to copy, [MicroTeX::version] returns a static string
|
|
17
|
+
return MicroTeX::version().c_str();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
MICROTEX_CAPI void microtex_registerCallbacks(
|
|
21
|
+
CBCreateTextLayout createTextLayout,
|
|
22
|
+
CBGetTextLayoutBounds getTextLayoutBounds,
|
|
23
|
+
CBReleaseTextLayout releaseTextLayout,
|
|
24
|
+
CBIsPathExists isPathExists
|
|
25
|
+
) {
|
|
26
|
+
microtex_createTextLayout = createTextLayout;
|
|
27
|
+
microtex_getTextLayoutBounds = getTextLayoutBounds;
|
|
28
|
+
microtex_releaseTextLayout = releaseTextLayout;
|
|
29
|
+
microtex_isPathExists = isPathExists;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
MICROTEX_CAPI void
|
|
33
|
+
microtex_setTextLayoutBounds(TextLayoutBounds* b, float width, float height, float ascent) {
|
|
34
|
+
b->width = width;
|
|
35
|
+
b->height = height;
|
|
36
|
+
b->ascent = ascent;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
MICROTEX_CAPI bool microtex_isBold(FontDesc* desc) {
|
|
40
|
+
return desc->isBold;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
MICROTEX_CAPI bool microtex_isItalic(FontDesc* desc) {
|
|
44
|
+
return desc->isItalic;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
MICROTEX_CAPI bool microtex_isSansSerif(FontDesc* desc) {
|
|
48
|
+
return desc->isSansSerif;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
MICROTEX_CAPI bool microtex_isMonospace(FontDesc* desc) {
|
|
52
|
+
return desc->isMonospace;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
MICROTEX_CAPI float microtex_fontSize(FontDesc* desc) {
|
|
56
|
+
return desc->fontSize;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
MICROTEX_CAPI FontMetaPtr microtex_init(unsigned long len, const unsigned char* data) {
|
|
60
|
+
auto factory = std::make_unique<PlatformFactory_wrapper>();
|
|
61
|
+
PlatformFactory::registerFactory("__wrapper__", std::move(factory));
|
|
62
|
+
PlatformFactory::activate("__wrapper__");
|
|
63
|
+
FontSrcData src{len, data};
|
|
64
|
+
auto meta = MicroTeX::init(src);
|
|
65
|
+
return new FontMeta(meta);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
MICROTEX_CAPI void microtex_release() {
|
|
69
|
+
MicroTeX::release();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
MICROTEX_CAPI bool microtex_isInited() {
|
|
73
|
+
return MicroTeX::isInited();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
MICROTEX_CAPI FontMetaPtr microtex_addFont(unsigned long len, const unsigned char* data) {
|
|
77
|
+
FontSrcData src{len, data};
|
|
78
|
+
auto meta = MicroTeX::addFont(src);
|
|
79
|
+
// create a new FontMeta from heap
|
|
80
|
+
// [microtex_releaseFontMeta] must be called after this object has no usages.
|
|
81
|
+
return new FontMeta(meta);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
MICROTEX_CAPI const char* microtex_getFontFamily(FontMetaPtr ptr) {
|
|
85
|
+
auto* meta = (FontMeta*)ptr;
|
|
86
|
+
// no need to copy
|
|
87
|
+
return meta->family.c_str();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
MICROTEX_CAPI const char* microtex_getFontName(FontMetaPtr ptr) {
|
|
91
|
+
auto* meta = (FontMeta*)ptr;
|
|
92
|
+
// no need to copy
|
|
93
|
+
return meta->name.c_str();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
MICROTEX_CAPI bool microtex_isMathFont(FontMetaPtr ptr) {
|
|
97
|
+
auto* meta = (FontMeta*)ptr;
|
|
98
|
+
return meta->isMathFont;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
MICROTEX_CAPI void microtex_releaseFontMeta(FontMetaPtr ptr) {
|
|
102
|
+
auto* meta = (FontMeta*)ptr;
|
|
103
|
+
delete meta;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
MICROTEX_CAPI void microtex_setDefaultMathFont(const char* name) {
|
|
107
|
+
MicroTeX::setDefaultMathFont(name);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
MICROTEX_CAPI void microtex_setDefaultMainFont(const char* name) {
|
|
111
|
+
MicroTeX::setDefaultMainFont(name);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
MICROTEX_CAPI bool microtex_hasGlyphPathRender() {
|
|
115
|
+
return MicroTeX::hasGlyphPathRender();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
MICROTEX_CAPI void microtex_setRenderGlyphUsePath(bool use) {
|
|
119
|
+
return MicroTeX::setRenderGlyphUsePath(use);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
MICROTEX_CAPI bool microtex_isRenderGlyphUsePath() {
|
|
123
|
+
return MicroTeX::isRenderGlyphUsePath();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
MICROTEX_CAPI RenderPtr microtex_parseRender(
|
|
127
|
+
const char* tex,
|
|
128
|
+
int width,
|
|
129
|
+
float textSize,
|
|
130
|
+
float lineSpace,
|
|
131
|
+
unsigned int color,
|
|
132
|
+
bool fillWidth,
|
|
133
|
+
bool enableOverrideTeXStyle,
|
|
134
|
+
unsigned int texStyle
|
|
135
|
+
) {
|
|
136
|
+
#ifdef HAVE_LOG
|
|
137
|
+
logv("parse: %s\n", tex);
|
|
138
|
+
#endif
|
|
139
|
+
auto r = MicroTeX::parse(
|
|
140
|
+
tex,
|
|
141
|
+
width,
|
|
142
|
+
textSize,
|
|
143
|
+
lineSpace,
|
|
144
|
+
color,
|
|
145
|
+
fillWidth,
|
|
146
|
+
{enableOverrideTeXStyle, static_cast<TexStyle>(texStyle)}
|
|
147
|
+
);
|
|
148
|
+
return reinterpret_cast<RenderPtr>(r);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
MICROTEX_CAPI void microtex_deleteRender(RenderPtr render) {
|
|
152
|
+
auto r = reinterpret_cast<Render*>(render);
|
|
153
|
+
delete r;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
MICROTEX_CAPI DrawingData microtex_getDrawingData(RenderPtr render, int x, int y) {
|
|
157
|
+
auto r = reinterpret_cast<Render*>(render);
|
|
158
|
+
Graphics2D_wrapper g2;
|
|
159
|
+
r->draw(g2, x, y);
|
|
160
|
+
return g2.getDrawingData();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
MICROTEX_CAPI void microtex_freeDrawingData(DrawingData data) {
|
|
164
|
+
free(data);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
MICROTEX_CAPI bool microtex_isLittleEndian() {
|
|
168
|
+
int n = 1;
|
|
169
|
+
return *((char*)&n) == 1;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
MICROTEX_CAPI int microtex_getRenderWidth(RenderPtr render) {
|
|
173
|
+
auto r = reinterpret_cast<Render*>(render);
|
|
174
|
+
return r->getWidth();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
MICROTEX_CAPI int microtex_getRenderHeight(RenderPtr render) {
|
|
178
|
+
auto r = reinterpret_cast<Render*>(render);
|
|
179
|
+
return r->getHeight();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
MICROTEX_CAPI int microtex_getRenderDepth(RenderPtr render) {
|
|
183
|
+
auto r = reinterpret_cast<Render*>(render);
|
|
184
|
+
return r->getDepth();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
MICROTEX_CAPI bool microtex_isRenderSplit(RenderPtr render) {
|
|
188
|
+
auto r = reinterpret_cast<Render*>(render);
|
|
189
|
+
return r->isSplit();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
MICROTEX_CAPI void microtex_setRenderTextSize(RenderPtr render, float size) {
|
|
193
|
+
auto r = reinterpret_cast<Render*>(render);
|
|
194
|
+
r->setTextSize(size);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
MICROTEX_CAPI void microtex_setRenderForeground(RenderPtr render, color c) {
|
|
198
|
+
auto r = reinterpret_cast<Render*>(render);
|
|
199
|
+
r->setForeground(c);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
#ifdef __cplusplus
|
|
203
|
+
}
|
|
204
|
+
#endif
|
|
205
|
+
|
|
206
|
+
#endif // HAVE_CWRAPPER
|