@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,177 @@
|
|
|
1
|
+
#ifndef MICROTEX_OTF_H
|
|
2
|
+
#define MICROTEX_OTF_H
|
|
3
|
+
|
|
4
|
+
#include "otf/glyph.h"
|
|
5
|
+
#include "otf/math_consts.h"
|
|
6
|
+
#include "utils/utils.h"
|
|
7
|
+
|
|
8
|
+
namespace microtex {
|
|
9
|
+
|
|
10
|
+
class CLMReader;
|
|
11
|
+
|
|
12
|
+
/** Table represents standard ligatures. */
|
|
13
|
+
using LigaTable = SortedDictTree<u16, i32>;
|
|
14
|
+
|
|
15
|
+
/** Represents classified kerning */
|
|
16
|
+
struct ClassKerning final {
|
|
17
|
+
private:
|
|
18
|
+
u16 _leftCount = 0;
|
|
19
|
+
/** left glyphs, in pair format (glyph, class_index) */
|
|
20
|
+
u16* _lefts = nullptr;
|
|
21
|
+
|
|
22
|
+
u16 _rightCount = 0;
|
|
23
|
+
/** right glyphs, in pair format (glyph, class_index) */
|
|
24
|
+
u16* _rights = nullptr;
|
|
25
|
+
|
|
26
|
+
u16 _rowLength = 0, _columnLength = 0;
|
|
27
|
+
/** kerning value table, size = (_rowLength * _columnLength) */
|
|
28
|
+
i16* _table = nullptr;
|
|
29
|
+
|
|
30
|
+
ClassKerning() = default;
|
|
31
|
+
|
|
32
|
+
public:
|
|
33
|
+
no_copy_assign(ClassKerning);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get the kerning value for the given left and right glyph.
|
|
37
|
+
* Return [false, 0] if not found.
|
|
38
|
+
*/
|
|
39
|
+
std::pair<bool, i16> operator()(u16 left, u16 right) const;
|
|
40
|
+
|
|
41
|
+
~ClassKerning();
|
|
42
|
+
|
|
43
|
+
friend CLMReader;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** Class to represent an otf font */
|
|
47
|
+
class Otf final {
|
|
48
|
+
private:
|
|
49
|
+
std::string _name;
|
|
50
|
+
std::string _family;
|
|
51
|
+
|
|
52
|
+
u16 _style;
|
|
53
|
+
|
|
54
|
+
u16 _unicodeCount = 0;
|
|
55
|
+
u32* _unicodes = nullptr;
|
|
56
|
+
u16* _unicodeGlyphs = nullptr;
|
|
57
|
+
|
|
58
|
+
u16 _em = 0;
|
|
59
|
+
u16 _xHeight = 0;
|
|
60
|
+
u16 _ascent = 0;
|
|
61
|
+
u16 _descent = 0;
|
|
62
|
+
|
|
63
|
+
bool _isMathFont = false;
|
|
64
|
+
MathConsts* _mathConsts = nullptr;
|
|
65
|
+
bool _hasGlyphPath = false;
|
|
66
|
+
|
|
67
|
+
LigaTable* _ligatures = nullptr;
|
|
68
|
+
u16 _classKerningCount = 0;
|
|
69
|
+
ClassKerning** _classKernings = nullptr;
|
|
70
|
+
|
|
71
|
+
u16 _glyphCount = 0;
|
|
72
|
+
Glyph** _glyphs = nullptr;
|
|
73
|
+
|
|
74
|
+
Otf() = default;
|
|
75
|
+
|
|
76
|
+
public:
|
|
77
|
+
no_copy_assign(Otf);
|
|
78
|
+
|
|
79
|
+
/** Undefined value */
|
|
80
|
+
static constexpr auto undefinedMathValue = 0x7FFF;
|
|
81
|
+
|
|
82
|
+
/** Read otf font from file */
|
|
83
|
+
static Otf* fromFile(const char* filePath);
|
|
84
|
+
|
|
85
|
+
/** Read otf font from data */
|
|
86
|
+
static Otf* fromData(size_t len, const u8* data);
|
|
87
|
+
|
|
88
|
+
/** Get the full postscript name of this font */
|
|
89
|
+
inline std::string name() const { return _name; }
|
|
90
|
+
|
|
91
|
+
/** Get the postscript family name of this font */
|
|
92
|
+
inline std::string family() const { return _family; }
|
|
93
|
+
|
|
94
|
+
/** Test if this font is a math font */
|
|
95
|
+
inline bool isMathFont() const { return _isMathFont; }
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Test if this font has glyph's path.
|
|
99
|
+
* Always is false if GLYPH_RENDER_TYPE equals to GLYPH_RENDER_TYPE_TYPEFACE.
|
|
100
|
+
*/
|
|
101
|
+
inline bool hasGlyphPath() const { return _hasGlyphPath; }
|
|
102
|
+
|
|
103
|
+
/** Get the font style in clm (short enum see [lib/graphics/font_style.h: FontStyle]) format **/
|
|
104
|
+
inline u16 style() const { return _style; }
|
|
105
|
+
|
|
106
|
+
/** Get the char count covered by this font */
|
|
107
|
+
inline u16 unicodesCount() const { return _unicodeCount; }
|
|
108
|
+
|
|
109
|
+
/** Get the glyphs count covered by this font */
|
|
110
|
+
inline u16 glyphsCount() const { return _glyphCount; }
|
|
111
|
+
|
|
112
|
+
/** Get the em size of this font. */
|
|
113
|
+
inline u16 em() const { return _em; }
|
|
114
|
+
|
|
115
|
+
/** Get the quad of this font. */
|
|
116
|
+
inline u16 quad() const { return _em; }
|
|
117
|
+
|
|
118
|
+
/** Get the x-height of this font. */
|
|
119
|
+
inline u16 xHeight() const { return _xHeight; }
|
|
120
|
+
|
|
121
|
+
/** Get the ascent of this font. */
|
|
122
|
+
inline u16 ascent() const { return _ascent; }
|
|
123
|
+
|
|
124
|
+
/** Get the descent of this font. */
|
|
125
|
+
inline u16 descent() const { return _descent; }
|
|
126
|
+
|
|
127
|
+
/** Get the math-consts table, return null if absent. */
|
|
128
|
+
inline const MathConsts* mathConsts() const { return _mathConsts; }
|
|
129
|
+
|
|
130
|
+
/** Get the space size of this font. */
|
|
131
|
+
u16 space() const;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get the glyph id from the given Unicode code-point, return -1 if not found.
|
|
135
|
+
*
|
|
136
|
+
* <p>
|
|
137
|
+
* The glyph id actually represents the index of the glyph in font file.
|
|
138
|
+
* <strong>Does not support CID-keyed fonts (either in PS or in CFF format).</strong>
|
|
139
|
+
*
|
|
140
|
+
* <p>
|
|
141
|
+
* See
|
|
142
|
+
* <a href="https://docs.microsoft.com/en-us/typography/opentype/spec/cff">
|
|
143
|
+
* CFF - Compact Font Format Table</a> for details.
|
|
144
|
+
*
|
|
145
|
+
* And
|
|
146
|
+
* <a
|
|
147
|
+
* href="https://freetype-py.readthedocs.io/en/latest/ft_face_flags.html#FT_FACE_FLAG_CID_KEYED">
|
|
148
|
+
* FT_FACE_FLAG_CID_KEYED</a> explains why.
|
|
149
|
+
*/
|
|
150
|
+
i32 glyphId(c32 codepoint) const;
|
|
151
|
+
|
|
152
|
+
/** Get the glyph from the given Unicode code-point, return null if not found. */
|
|
153
|
+
const Glyph* glyphOfUnicode(c32 codepoint) const;
|
|
154
|
+
|
|
155
|
+
/** Get the glyph from the given glyph id, return null if absent. */
|
|
156
|
+
const Glyph* glyph(i32 id) const;
|
|
157
|
+
|
|
158
|
+
/** Get the ligatures of this font, return null if absent. */
|
|
159
|
+
const LigaTable* ligatures() const { return _ligatures; }
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Get the classified-kerning value between left and right glyph.
|
|
163
|
+
*
|
|
164
|
+
* @param left the glyph id of the left character
|
|
165
|
+
* @param right the glyph id of the right character
|
|
166
|
+
* @return the kerning value or 0 if absent
|
|
167
|
+
*/
|
|
168
|
+
i16 classKerning(u16 left, u16 right) const;
|
|
169
|
+
|
|
170
|
+
~Otf();
|
|
171
|
+
|
|
172
|
+
friend CLMReader;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
} // namespace microtex
|
|
176
|
+
|
|
177
|
+
#endif
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#ifndef MICROTEX_OTFCONFIG_H
|
|
2
|
+
#define MICROTEX_OTFCONFIG_H
|
|
3
|
+
|
|
4
|
+
#define GLYPH_RENDER_TYPE_BOTH 0
|
|
5
|
+
#define GLYPH_RENDER_TYPE_PATH 1
|
|
6
|
+
#define GLYPH_RENDER_TYPE_TYPEFACE 2
|
|
7
|
+
|
|
8
|
+
// clang-format off
|
|
9
|
+
// if have glyph render path
|
|
10
|
+
#if GLYPH_RENDER_TYPE == GLYPH_RENDER_TYPE_BOTH || GLYPH_RENDER_TYPE == GLYPH_RENDER_TYPE_PATH
|
|
11
|
+
# define HAVE_GLYPH_RENDER_PATH
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#if GLYPH_RENDER_TYPE == GLYPH_RENDER_TYPE_BOTH || GLYPH_RENDER_TYPE == GLYPH_RENDER_TYPE_TYPEFACE
|
|
15
|
+
# define HAVE_GLYPH_RENDER_TYPEFACE
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
// The clm data major version
|
|
19
|
+
#define CLM_VER_MAJOR 5
|
|
20
|
+
|
|
21
|
+
// The clm data minor version, must be 1 or 2
|
|
22
|
+
#ifdef HAVE_GLYPH_RENDER_PATH
|
|
23
|
+
# define CLM_VER_MINOR 2
|
|
24
|
+
#else
|
|
25
|
+
# define CLM_VER_MINOR 1
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
// If clm supports glyph path
|
|
29
|
+
#define CLM_SUPPORT_GLYPH_PATH(minorVersion) ((minorVersion) == 2)
|
|
30
|
+
// clang-format on
|
|
31
|
+
|
|
32
|
+
#endif // MICROTEX_OTFCONFIG_H
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
#include "otf/path.h"
|
|
2
|
+
|
|
3
|
+
microtex::u16 microtex::pathCmdArgsCount(char cmd) {
|
|
4
|
+
switch (cmd) {
|
|
5
|
+
case 'M':
|
|
6
|
+
case 'm':
|
|
7
|
+
case 'L':
|
|
8
|
+
case 'l':
|
|
9
|
+
case 'T':
|
|
10
|
+
case 't': return 2;
|
|
11
|
+
|
|
12
|
+
case 'H':
|
|
13
|
+
case 'h':
|
|
14
|
+
case 'V':
|
|
15
|
+
case 'v': return 1;
|
|
16
|
+
|
|
17
|
+
case 'Z':
|
|
18
|
+
case 'z': return 0;
|
|
19
|
+
|
|
20
|
+
case 'C':
|
|
21
|
+
case 'c': return 6;
|
|
22
|
+
|
|
23
|
+
case 'S':
|
|
24
|
+
case 's':
|
|
25
|
+
case 'Q':
|
|
26
|
+
case 'q': return 4;
|
|
27
|
+
|
|
28
|
+
default: return 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#ifdef HAVE_GLYPH_RENDER_PATH
|
|
33
|
+
|
|
34
|
+
#include "graphic/graphic.h"
|
|
35
|
+
#include "utils/string_utils.h"
|
|
36
|
+
|
|
37
|
+
namespace microtex {
|
|
38
|
+
|
|
39
|
+
PathCmd::PathCmd(char cmd, const i16* args) noexcept : cmd(cmd), args(args) {}
|
|
40
|
+
|
|
41
|
+
std::string PathCmd::toString() const {
|
|
42
|
+
std::string str;
|
|
43
|
+
str.append(1, cmd).append(1, ' ');
|
|
44
|
+
for (int i = 0; i < pathCmdArgsCount(cmd); i++) {
|
|
45
|
+
str.append(microtex::toString(args[i])).append(1, ' ');
|
|
46
|
+
}
|
|
47
|
+
str.append(1, '\n');
|
|
48
|
+
return str;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
PathCmd::~PathCmd() {
|
|
52
|
+
delete[] args;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
Path Path::empty(-1, 0, nullptr);
|
|
56
|
+
|
|
57
|
+
Path::Path(i32 id, u16 cmdCnt, PathCmd** cmds) noexcept : _id(id), _cmdCnt(cmdCnt), _cmds(cmds) {}
|
|
58
|
+
|
|
59
|
+
void Path::draw(Graphics2D& g2) const {
|
|
60
|
+
if (isEmpty()) return;
|
|
61
|
+
const auto cached = g2.beginPath(_id);
|
|
62
|
+
if (cached) {
|
|
63
|
+
g2.fillPath(_id);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
int mx = 0, my = 0; // the first point to move to
|
|
67
|
+
int px = 0, py = 0; // the current point
|
|
68
|
+
int cx = 0, cy = 0; // the last control point
|
|
69
|
+
for (u16 i = 0; i < _cmdCnt; i++) {
|
|
70
|
+
const auto& cmd = *_cmds[i];
|
|
71
|
+
if (!cmd.isValid()) continue;
|
|
72
|
+
switch (cmd.cmd) {
|
|
73
|
+
case 'M':
|
|
74
|
+
mx = px = cmd[0];
|
|
75
|
+
my = py = cmd[1];
|
|
76
|
+
g2.moveTo(px, py);
|
|
77
|
+
break;
|
|
78
|
+
case 'm':
|
|
79
|
+
mx = px = cmd[0] + px;
|
|
80
|
+
my = py = cmd[1] + py;
|
|
81
|
+
g2.moveTo(px, py);
|
|
82
|
+
break;
|
|
83
|
+
case 'L':
|
|
84
|
+
px = cmd[0];
|
|
85
|
+
py = cmd[1];
|
|
86
|
+
g2.lineTo(px, py);
|
|
87
|
+
break;
|
|
88
|
+
case 'l':
|
|
89
|
+
px += cmd[0];
|
|
90
|
+
py += cmd[1];
|
|
91
|
+
g2.lineTo(px, py);
|
|
92
|
+
break;
|
|
93
|
+
case 'H':
|
|
94
|
+
px = cmd[0];
|
|
95
|
+
g2.lineTo(px, py);
|
|
96
|
+
break;
|
|
97
|
+
case 'h':
|
|
98
|
+
px += cmd[0];
|
|
99
|
+
g2.lineTo(px, py);
|
|
100
|
+
break;
|
|
101
|
+
case 'V':
|
|
102
|
+
py = cmd[0];
|
|
103
|
+
g2.lineTo(px, py);
|
|
104
|
+
break;
|
|
105
|
+
case 'v':
|
|
106
|
+
py += cmd[0];
|
|
107
|
+
g2.lineTo(px, py);
|
|
108
|
+
break;
|
|
109
|
+
case 'C':
|
|
110
|
+
cx = cmd[2];
|
|
111
|
+
cy = cmd[3];
|
|
112
|
+
px = cmd[4];
|
|
113
|
+
py = cmd[5];
|
|
114
|
+
g2.cubicTo(cmd[0], cmd[1], cx, cy, px, py);
|
|
115
|
+
break;
|
|
116
|
+
case 'c':
|
|
117
|
+
g2.cubicTo(px + cmd[0], py + cmd[1], px + cmd[2], py + cmd[3], px + cmd[4], py + cmd[5]);
|
|
118
|
+
cx = px + cmd[2];
|
|
119
|
+
cy = py + cmd[3];
|
|
120
|
+
px += cmd[4];
|
|
121
|
+
py += cmd[5];
|
|
122
|
+
break;
|
|
123
|
+
case 'S':
|
|
124
|
+
g2.cubicTo(px + px - cx, py + py - cy, cmd[0], cmd[1], cmd[2], cmd[3]);
|
|
125
|
+
cx = cmd[0];
|
|
126
|
+
cy = cmd[1];
|
|
127
|
+
px = cmd[2];
|
|
128
|
+
py = cmd[3];
|
|
129
|
+
break;
|
|
130
|
+
case 's':
|
|
131
|
+
g2.cubicTo(px + px - cx, py + py - cy, px + cmd[0], py + cmd[1], px + cmd[2], py + cmd[3]);
|
|
132
|
+
cx = cmd[0] + px;
|
|
133
|
+
cy = cmd[1] + py;
|
|
134
|
+
px += cmd[2];
|
|
135
|
+
py += cmd[3];
|
|
136
|
+
break;
|
|
137
|
+
case 'Q':
|
|
138
|
+
cx = cmd[0];
|
|
139
|
+
cy = cmd[1];
|
|
140
|
+
px = cmd[2];
|
|
141
|
+
py = cmd[3];
|
|
142
|
+
g2.quadTo(cx, cy, px, py);
|
|
143
|
+
break;
|
|
144
|
+
case 'q':
|
|
145
|
+
cx = cmd[0] + px;
|
|
146
|
+
cy = cmd[1] + py;
|
|
147
|
+
px += cmd[2];
|
|
148
|
+
py += cmd[3];
|
|
149
|
+
g2.quadTo(cx, cy, px, py);
|
|
150
|
+
break;
|
|
151
|
+
case 'T':
|
|
152
|
+
cx = px + px - cx;
|
|
153
|
+
cy = py + py - cy;
|
|
154
|
+
px = cmd[0];
|
|
155
|
+
py = cmd[1];
|
|
156
|
+
g2.quadTo(cx, cy, px, py);
|
|
157
|
+
break;
|
|
158
|
+
case 't':
|
|
159
|
+
cx = px + px - cx;
|
|
160
|
+
cy = py + py - cy;
|
|
161
|
+
px += cmd[0];
|
|
162
|
+
py += cmd[1];
|
|
163
|
+
g2.quadTo(cx, cy, px, py);
|
|
164
|
+
break;
|
|
165
|
+
case 'Z':
|
|
166
|
+
case 'z': g2.closePath(); break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
g2.fillPath(_id);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
std::string Path::toString() const {
|
|
173
|
+
std::string str;
|
|
174
|
+
for (int i = 0; i < _cmdCnt; i++) {
|
|
175
|
+
str.append(_cmds[i]->toString());
|
|
176
|
+
}
|
|
177
|
+
return str;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
Path::~Path() {
|
|
181
|
+
for (u16 i = 0; i < _cmdCnt; i++) delete _cmds[i];
|
|
182
|
+
delete[] _cmds;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
} // namespace microtex
|
|
186
|
+
|
|
187
|
+
#endif // HAVE_GLYPH_RENDER_PATH
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#ifndef MICROTEX_PATH_H
|
|
2
|
+
#define MICROTEX_PATH_H
|
|
3
|
+
|
|
4
|
+
#include "otf/otfconfig.h"
|
|
5
|
+
#include "utils/utils.h"
|
|
6
|
+
|
|
7
|
+
namespace microtex {
|
|
8
|
+
|
|
9
|
+
/** Get the arguments count of the given path command. */
|
|
10
|
+
u16 pathCmdArgsCount(char cmd);
|
|
11
|
+
|
|
12
|
+
} // namespace microtex
|
|
13
|
+
|
|
14
|
+
#ifdef HAVE_GLYPH_RENDER_PATH
|
|
15
|
+
|
|
16
|
+
#include <string>
|
|
17
|
+
|
|
18
|
+
namespace microtex {
|
|
19
|
+
|
|
20
|
+
class Graphics2D;
|
|
21
|
+
|
|
22
|
+
/** Abstract graphical path command, with its drawing command and points. */
|
|
23
|
+
struct PathCmd {
|
|
24
|
+
/**
|
|
25
|
+
* Path drawing command, one of the following:
|
|
26
|
+
* @code
|
|
27
|
+
* cmd args desc
|
|
28
|
+
* M x, y Move to point (x, y).
|
|
29
|
+
*
|
|
30
|
+
* m dx, dy Given a current point (x0, y0), move to (x0 + dx, y0 + dy).
|
|
31
|
+
*
|
|
32
|
+
* L x, y Line to (x, y).
|
|
33
|
+
*
|
|
34
|
+
* l dx, dy Given a current point (x0, y0), line to (x0 + dx, y0 + dy).
|
|
35
|
+
*
|
|
36
|
+
* H x Given a current point (x0, y0), line to (x, y0).
|
|
37
|
+
*
|
|
38
|
+
* h dx Given a current point (x0, y0), line to (x0 + dx, y0).
|
|
39
|
+
*
|
|
40
|
+
* V y Given a current point (x0, y0), line to (x0, y).
|
|
41
|
+
*
|
|
42
|
+
* v dy Given a current point (x0, y0), line to (x0, y0 + dy).
|
|
43
|
+
*
|
|
44
|
+
* C cx1, cy1, Adds a cubic Bezier spline to path from current point to position
|
|
45
|
+
* cx2, cy2, (x, y), using (cx1, cy1) and (cx2, cy2) as the control points, the
|
|
46
|
+
* x, y current point will be (x, y).
|
|
47
|
+
*
|
|
48
|
+
* c dx1, dy1, Given a current point (x0, y0), c(dx1, dy1, dx2, dy2, dx, dy) is
|
|
49
|
+
* dx2, dy2, logically equivalent to
|
|
50
|
+
* dx, dy C(x0 + dx1, y0 + dy1, x0 + dx2, y0 + dy2, x0 + dx, y0 + dy).
|
|
51
|
+
*
|
|
52
|
+
* S cx, cy, Produces the same type of curve as 'C', but if it follows another
|
|
53
|
+
* x, y 'S' command or a 'C' command, the first control point is assumed to
|
|
54
|
+
* be a reflection of the one used previously.
|
|
55
|
+
*
|
|
56
|
+
* s cx, cy, Given a current point (x0, y0), s(cx, cy, dx, dy) is logically
|
|
57
|
+
* dx, dy equivalent to S(x0 + cx, y0 + cy, x0 + dx, y0 + dy).
|
|
58
|
+
*
|
|
59
|
+
* Q cx, cy Simpler curve than the cubic one. With its control point (cx, cy)
|
|
60
|
+
* x, y and final point (x, y).
|
|
61
|
+
*
|
|
62
|
+
* q cx, cy Given a current point (x0, y0), q(cx, cy, dx, dy) is logically
|
|
63
|
+
* dx, dy equivalent to Q(x0 + cx, y0 + cy, x0 + dx, y0 + dy).
|
|
64
|
+
*
|
|
65
|
+
* T x, y Like the command 'S', if 'T' follows another curve command, the first
|
|
66
|
+
* control point is assumed to be a reflection of the one used previously.
|
|
67
|
+
*
|
|
68
|
+
* t dx, dy Same as 'T', but the params are given by the offset of the final point.
|
|
69
|
+
*
|
|
70
|
+
* Z N/A Close the path.
|
|
71
|
+
*
|
|
72
|
+
* z N/A Close the path.
|
|
73
|
+
* @endcode
|
|
74
|
+
*
|
|
75
|
+
* See <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths">this
|
|
76
|
+
* tutorial</a> for details.
|
|
77
|
+
*/
|
|
78
|
+
const char cmd;
|
|
79
|
+
const i16* const args;
|
|
80
|
+
|
|
81
|
+
PathCmd(char cmd, const i16* args) noexcept;
|
|
82
|
+
|
|
83
|
+
no_copy_assign(PathCmd);
|
|
84
|
+
|
|
85
|
+
inline bool isValid() const { return cmd != ' '; }
|
|
86
|
+
|
|
87
|
+
inline i16 operator[](int i) const { return args[i]; }
|
|
88
|
+
|
|
89
|
+
std::string toString() const;
|
|
90
|
+
|
|
91
|
+
~PathCmd();
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/** A group of PathCmd */
|
|
95
|
+
struct Path {
|
|
96
|
+
private:
|
|
97
|
+
const i32 _id;
|
|
98
|
+
const u16 _cmdCnt;
|
|
99
|
+
PathCmd** _cmds;
|
|
100
|
+
|
|
101
|
+
public:
|
|
102
|
+
no_copy_assign(Path);
|
|
103
|
+
|
|
104
|
+
Path(i32 id, u16 cmdCnt, PathCmd** cmds) noexcept;
|
|
105
|
+
|
|
106
|
+
inline bool isEmpty() const { return _cmdCnt <= 0; }
|
|
107
|
+
|
|
108
|
+
void draw(Graphics2D& g2) const;
|
|
109
|
+
|
|
110
|
+
std::string toString() const;
|
|
111
|
+
|
|
112
|
+
~Path();
|
|
113
|
+
|
|
114
|
+
static Path empty;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
} // namespace microtex
|
|
118
|
+
|
|
119
|
+
#endif // HAVE_GLYPH_RENDER_PATH
|
|
120
|
+
#endif // MICROTEX_PATH_H
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#include "builder.h"
|
|
2
|
+
|
|
3
|
+
#include "atom/atom_basic.h"
|
|
4
|
+
#include "box/box_group.h"
|
|
5
|
+
#include "box/box_single.h"
|
|
6
|
+
#include "core/formula.h"
|
|
7
|
+
#include "core/split.h"
|
|
8
|
+
#include "utils/exceptions.h"
|
|
9
|
+
|
|
10
|
+
using namespace microtex;
|
|
11
|
+
|
|
12
|
+
RenderBuilder& RenderBuilder::setLineSpace(const Dimen& dimen) {
|
|
13
|
+
if (!dimen.isValid()) {
|
|
14
|
+
throw ex_invalid_state("Cannot set line space without having specified a width!");
|
|
15
|
+
}
|
|
16
|
+
_lineSpace = dimen;
|
|
17
|
+
return *this;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
Render* RenderBuilder::build(Formula& f) {
|
|
21
|
+
return build(f._root);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Render* RenderBuilder::build(const sptr<Atom>& fc) {
|
|
25
|
+
sptr<Atom> f = fc;
|
|
26
|
+
if (f == nullptr) f = sptrOf<EmptyAtom>();
|
|
27
|
+
if (_textSize == -1) {
|
|
28
|
+
throw ex_invalid_state("A text size is required, call function setTextSize before build.");
|
|
29
|
+
}
|
|
30
|
+
if (_mathFontName.empty()) {
|
|
31
|
+
throw ex_invalid_state("A math font is required, call function setMathFontName before build.");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
auto fctx = sptrOf<FontContext>();
|
|
35
|
+
fctx->selectMathFont(_mathFontName);
|
|
36
|
+
fctx->selectMainFont(_mainFontName);
|
|
37
|
+
|
|
38
|
+
const auto style = _style;
|
|
39
|
+
Env env(style, fctx, _textSize);
|
|
40
|
+
const auto isLimitedWidth = !_textWidth.isEmpty();
|
|
41
|
+
if (isLimitedWidth) {
|
|
42
|
+
env.setTextWidth(_textWidth);
|
|
43
|
+
}
|
|
44
|
+
if (_lineSpace.isValid()) {
|
|
45
|
+
env.setLineSpace(_lineSpace);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
Render* render;
|
|
49
|
+
auto box = f->createBox(env);
|
|
50
|
+
if (isLimitedWidth) {
|
|
51
|
+
HBox* hb;
|
|
52
|
+
bool isBoxSplit = false;
|
|
53
|
+
if (!_lineSpace.isEmpty()) {
|
|
54
|
+
auto space = Units::fsize(_lineSpace, env);
|
|
55
|
+
auto [isSplit, split] = BoxSplitter::split(box, env.textWidth(), space);
|
|
56
|
+
isBoxSplit = isSplit;
|
|
57
|
+
hb = new HBox(split, _fillWidth ? env.textWidth() : split->_width, _align);
|
|
58
|
+
} else {
|
|
59
|
+
hb = new HBox(box, _fillWidth ? env.textWidth() : box->_width, _align);
|
|
60
|
+
}
|
|
61
|
+
render = new Render(sptr<Box>(hb), _textSize, isBoxSplit);
|
|
62
|
+
} else {
|
|
63
|
+
render = new Render(box, _textSize);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!isTransparent(_fg)) render->setForeground(_fg);
|
|
67
|
+
return render;
|
|
68
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#ifndef MICROTEX_BUILDER_H
|
|
2
|
+
#define MICROTEX_BUILDER_H
|
|
3
|
+
|
|
4
|
+
#include "env/units.h"
|
|
5
|
+
#include "render.h"
|
|
6
|
+
|
|
7
|
+
namespace microtex {
|
|
8
|
+
|
|
9
|
+
class Formula;
|
|
10
|
+
|
|
11
|
+
class Atom;
|
|
12
|
+
|
|
13
|
+
class RenderBuilder {
|
|
14
|
+
private:
|
|
15
|
+
TexStyle _style = TexStyle::display;
|
|
16
|
+
Dimen _textWidth;
|
|
17
|
+
Dimen _lineSpace;
|
|
18
|
+
float _textSize = 0;
|
|
19
|
+
bool _fillWidth = false;
|
|
20
|
+
color _fg = black;
|
|
21
|
+
Alignment _align = Alignment::none;
|
|
22
|
+
std::string _mathFontName;
|
|
23
|
+
std::string _mainFontName;
|
|
24
|
+
|
|
25
|
+
public:
|
|
26
|
+
RenderBuilder() = default;
|
|
27
|
+
|
|
28
|
+
inline RenderBuilder& setStyle(TexStyle style) {
|
|
29
|
+
_style = style;
|
|
30
|
+
return *this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
inline RenderBuilder& setTextSize(float textSize) {
|
|
34
|
+
_textSize = textSize;
|
|
35
|
+
return *this;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
inline RenderBuilder& setForeground(color c) {
|
|
39
|
+
_fg = c;
|
|
40
|
+
return *this;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
inline RenderBuilder& setWidth(const Dimen& dimen, Alignment align) {
|
|
44
|
+
_textWidth = dimen;
|
|
45
|
+
_align = align;
|
|
46
|
+
return *this;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
inline RenderBuilder& setMathFontName(const std::string& name) {
|
|
50
|
+
_mathFontName = name;
|
|
51
|
+
return *this;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
inline RenderBuilder& setMainFontName(const std::string& name) {
|
|
55
|
+
_mainFontName = name;
|
|
56
|
+
return *this;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
inline RenderBuilder& setFillWidth(bool i) {
|
|
60
|
+
_fillWidth = i;
|
|
61
|
+
return *this;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
RenderBuilder& setLineSpace(const Dimen& dimen);
|
|
65
|
+
|
|
66
|
+
Render* build(const sptr<Atom>& f);
|
|
67
|
+
|
|
68
|
+
Render* build(Formula& f);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
} // namespace microtex
|
|
72
|
+
|
|
73
|
+
#endif // MICROTEX_BUILDER_H
|