@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,105 @@
|
|
|
1
|
+
#ifndef MICROTEX_MATH_TYPE_H
|
|
2
|
+
#define MICROTEX_MATH_TYPE_H
|
|
3
|
+
|
|
4
|
+
#include <map>
|
|
5
|
+
|
|
6
|
+
#include "graphic/font_style.h"
|
|
7
|
+
#include "utils/utils.h"
|
|
8
|
+
|
|
9
|
+
namespace microtex {
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* The math styles. The math glyphs are painted in following styles:
|
|
13
|
+
*
|
|
14
|
+
* style latin Latin greek Greek
|
|
15
|
+
* -----------------------------------
|
|
16
|
+
* TeX it it it up
|
|
17
|
+
* ISO it it it it
|
|
18
|
+
* French it up up up
|
|
19
|
+
* upright up up up up
|
|
20
|
+
*/
|
|
21
|
+
enum class MathStyle : u8 {
|
|
22
|
+
TeX,
|
|
23
|
+
ISO,
|
|
24
|
+
French,
|
|
25
|
+
upright,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
enum class LetterType : u8 {
|
|
29
|
+
none,
|
|
30
|
+
digit,
|
|
31
|
+
latinSmall,
|
|
32
|
+
latinCapital,
|
|
33
|
+
greekSmall,
|
|
34
|
+
greekCapital,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Represents math-version for digit, Latin and Greek alphabets.
|
|
39
|
+
*
|
|
40
|
+
* <p>
|
|
41
|
+
* This for maps a given Unicode character to the mathematical alphanumeric in various
|
|
42
|
+
* math versions.
|
|
43
|
+
*
|
|
44
|
+
* Mathematical Alphanumeric Symbols is a Unicode block comprising styled forms of
|
|
45
|
+
* Latin and Greek letters and decimal digits that enable mathematicians to denote
|
|
46
|
+
* different notions with different letter styles.
|
|
47
|
+
*
|
|
48
|
+
* <p>
|
|
49
|
+
* Unicode includes many such symbols (in the range U+1D400–U+1D7FF). But notice that
|
|
50
|
+
* there are several code-point come up as <Reserved> at Unicode, this handler will
|
|
51
|
+
* replace these <Reserved> code-points with the code-point that has the same "glyph"
|
|
52
|
+
* representation.
|
|
53
|
+
*
|
|
54
|
+
* <p>
|
|
55
|
+
* For example, the math-italic version of the character 'h' has the code-point
|
|
56
|
+
* "U+1D455" that is reserved in Unicode, and it will be replaced by "U+210E" that has
|
|
57
|
+
* the meaning of "PLANCK CONSTANT".
|
|
58
|
+
*
|
|
59
|
+
* <p>
|
|
60
|
+
* See
|
|
61
|
+
* <a href="https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols">
|
|
62
|
+
* Mathematical Alphanumeric Symbols
|
|
63
|
+
* </a>
|
|
64
|
+
* for details.
|
|
65
|
+
*/
|
|
66
|
+
class MathVersion {
|
|
67
|
+
private:
|
|
68
|
+
c32 _codepoints[6];
|
|
69
|
+
FontStyle _fontStyle;
|
|
70
|
+
|
|
71
|
+
public:
|
|
72
|
+
no_copy_assign(MathVersion);
|
|
73
|
+
|
|
74
|
+
MathVersion(
|
|
75
|
+
c32 digit,
|
|
76
|
+
c32 latinSmall,
|
|
77
|
+
c32 latinCapital,
|
|
78
|
+
c32 greekSmall,
|
|
79
|
+
c32 greekCapital,
|
|
80
|
+
FontStyle fontStyle = FontStyle::none
|
|
81
|
+
) noexcept;
|
|
82
|
+
|
|
83
|
+
/** Map an Unicode char to version-specific Unicode char. */
|
|
84
|
+
c32 map(c32 codepoint) const;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Set math style to display formulas.
|
|
88
|
+
*
|
|
89
|
+
* @param style one of the TeX, ISO, French, and upright
|
|
90
|
+
*/
|
|
91
|
+
static void setMathStyle(MathStyle style);
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Map an Unicode char to version-specific Unicode char.
|
|
95
|
+
*
|
|
96
|
+
* @param style the font style
|
|
97
|
+
* @param code the given code
|
|
98
|
+
* @return the mapped version-specific Unicode code-point
|
|
99
|
+
*/
|
|
100
|
+
static c32 map(FontStyle style, c32 code);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
} // namespace microtex
|
|
104
|
+
|
|
105
|
+
#endif // MICROTEX_MATH_TYPE_H
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
unimath_src = [
|
|
2
|
+
'unimath/font_src.cpp',
|
|
3
|
+
'unimath/math_type.cpp',
|
|
4
|
+
'unimath/uni_char.cpp',
|
|
5
|
+
'unimath/uni_font.cpp',
|
|
6
|
+
'unimath/uni_symbol.cpp'
|
|
7
|
+
]
|
|
8
|
+
|
|
9
|
+
if install_headerfiles
|
|
10
|
+
install_headers([
|
|
11
|
+
'font_src.h',
|
|
12
|
+
'font_meta.h',
|
|
13
|
+
'math_type.h',
|
|
14
|
+
'uni_char.h',
|
|
15
|
+
'uni_font.h',
|
|
16
|
+
'uni_symbol.h'
|
|
17
|
+
], subdir: 'microtex/unimath')
|
|
18
|
+
endif
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#include "unimath/uni_char.h"
|
|
2
|
+
|
|
3
|
+
#include "unimath/uni_font.h"
|
|
4
|
+
#include "utils/log.h"
|
|
5
|
+
|
|
6
|
+
using namespace microtex;
|
|
7
|
+
|
|
8
|
+
Char::Char(c32 c, c32 mc, i32 fid, i32 gid, float s)
|
|
9
|
+
: code(c), mappedCode(mc), fontId(fid), glyphId(gid), scale(s) {}
|
|
10
|
+
|
|
11
|
+
Char::Char(const Char& c)
|
|
12
|
+
: code(c.code),
|
|
13
|
+
mappedCode(c.mappedCode),
|
|
14
|
+
fontId(c.fontId),
|
|
15
|
+
glyphId(c.glyphId),
|
|
16
|
+
scale(c.scale) {}
|
|
17
|
+
|
|
18
|
+
sptr<const OtfFont> Char::otfFont() const {
|
|
19
|
+
return FontContext::getFont(fontId);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const Glyph* Char::glyph() const {
|
|
23
|
+
auto font = FontContext::getFont(fontId);
|
|
24
|
+
if (font == nullptr) {
|
|
25
|
+
#ifdef HAVE_LOG
|
|
26
|
+
logv("There's no font was found with id = %d, use '?' instead.\n", fontId);
|
|
27
|
+
#endif
|
|
28
|
+
return FontContext::getFont(0)->otf().glyphOfUnicode('?');
|
|
29
|
+
}
|
|
30
|
+
auto g = font->otf().glyph(glyphId);
|
|
31
|
+
if (g == nullptr) {
|
|
32
|
+
#ifdef HAVE_LOG
|
|
33
|
+
logv(
|
|
34
|
+
"There's no glyph was found with (unicode = %u, id = %d), use '?' instead.\n",
|
|
35
|
+
static_cast<std::uint32_t>(mappedCode),
|
|
36
|
+
glyphId
|
|
37
|
+
);
|
|
38
|
+
#endif
|
|
39
|
+
return font->otf().glyphOfUnicode('?');
|
|
40
|
+
}
|
|
41
|
+
return g;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
i32 Char::fallbackGlyphId() const {
|
|
45
|
+
if (isValid()) return glyphId;
|
|
46
|
+
auto font = FontContext::getFont(fontId);
|
|
47
|
+
if (font == nullptr) {
|
|
48
|
+
return FontContext::getFont(0)->otf().glyphId('?');
|
|
49
|
+
}
|
|
50
|
+
return font->otf().glyphId('?');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
float Char::width() const {
|
|
54
|
+
return glyph()->metrics().width() * scale;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
float Char::height() const {
|
|
58
|
+
return glyph()->metrics().height() * scale;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
float Char::depth() const {
|
|
62
|
+
return glyph()->metrics().depth() * scale;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
float Char::italic() const {
|
|
66
|
+
auto italic = glyph()->math().italicsCorrection();
|
|
67
|
+
return italic == Otf::undefinedMathValue ? 0.f : italic * scale;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
float Char::topAccentAttachment() const {
|
|
71
|
+
auto t = glyph()->math().topAccentAttachment();
|
|
72
|
+
return t == Otf::undefinedMathValue ? width() / 2.f : t * scale;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static Char
|
|
76
|
+
variant(const Char& chr, u32 index, const std::function<const Variants&(const Glyph*)>& f) {
|
|
77
|
+
auto g = chr.glyph();
|
|
78
|
+
const auto& v = f(g);
|
|
79
|
+
if (v.isEmpty()) return chr;
|
|
80
|
+
index = std::min<int>(index, v.count() - 1);
|
|
81
|
+
// only changes the glyph version, other fields remain unchanged
|
|
82
|
+
return {chr.code, chr.mappedCode, chr.fontId, v[index], chr.scale};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
u16 Char::vLargerCount() const {
|
|
86
|
+
return glyph()->math().verticalVariants().count();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
Char Char::vLarger(u32 index) const {
|
|
90
|
+
return variant(*this, index, [](const Glyph* g) -> const Variants& {
|
|
91
|
+
return g->math().verticalVariants();
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
u16 Char::hLargerCount() const {
|
|
96
|
+
return glyph()->math().horizontalVariants().count();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
Char Char::hLarger(u32 index) const {
|
|
100
|
+
return variant(*this, index, [](const Glyph* g) -> const Variants& {
|
|
101
|
+
return g->math().horizontalVariants();
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
Char Char::script(u32 index) const {
|
|
106
|
+
return variant(*this, index, [](const Glyph* g) -> const Variants& {
|
|
107
|
+
return g->math().scriptsVariants();
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const GlyphAssembly& Char::vAssembly() const {
|
|
112
|
+
return glyph()->math().verticalAssembly();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const GlyphAssembly& Char::hAssembly() const {
|
|
116
|
+
return glyph()->math().horizontalAssembly();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const Char Char::assemblyPart(i32 id) const {
|
|
120
|
+
return onlyGlyph(fontId, id, scale);
|
|
121
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#ifndef MICROTEX_UNI_CHAR_H
|
|
2
|
+
#define MICROTEX_UNI_CHAR_H
|
|
3
|
+
|
|
4
|
+
#include "otf/glyph.h"
|
|
5
|
+
#include "utils/utils.h"
|
|
6
|
+
|
|
7
|
+
namespace microtex {
|
|
8
|
+
|
|
9
|
+
struct OtfFont;
|
|
10
|
+
|
|
11
|
+
/** Represents a character-glyph to be measured and drawn with its font, glyph id and scale */
|
|
12
|
+
struct Char final {
|
|
13
|
+
/** The original code point of the character */
|
|
14
|
+
const c32 code = 0;
|
|
15
|
+
/** The mapped code point (by math style) of the character */
|
|
16
|
+
const c32 mappedCode = 0;
|
|
17
|
+
/** The font id */
|
|
18
|
+
const i32 fontId = -1;
|
|
19
|
+
/** The glyph id, -1 if no corresponding glyph in the font */
|
|
20
|
+
const i32 glyphId = -1;
|
|
21
|
+
|
|
22
|
+
/** The glyph scale, can be modified during using */
|
|
23
|
+
float scale = 1.f;
|
|
24
|
+
|
|
25
|
+
Char() = default;
|
|
26
|
+
|
|
27
|
+
Char(c32 code, c32 mapped, i32 fid, i32 gid, float scale = 1.f);
|
|
28
|
+
|
|
29
|
+
Char(const Char& chr);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Create a char-glyph with only font and glyph, the Unicode code-point is 0.
|
|
33
|
+
* <p>
|
|
34
|
+
* Notice that the char-glyph is valid even if its Unicode is 0, because many glyph has no
|
|
35
|
+
* corresponding Unicode code-point.
|
|
36
|
+
*/
|
|
37
|
+
static inline Char onlyGlyph(i32 font, i32 glyph, float scale = 1.f) {
|
|
38
|
+
return {0, 0, font, glyph, scale};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Test if current glyph is valid, basically the #_glyph >= 0 */
|
|
42
|
+
inline bool isValid() const { return glyphId >= 0; }
|
|
43
|
+
|
|
44
|
+
/** The otf font spec the char belongs to */
|
|
45
|
+
sptr<const OtfFont> otfFont() const;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The glyph of this char-glyph, NOT NULL.
|
|
49
|
+
* If the char has no corresponding glyph was found, the '?' will be
|
|
50
|
+
* returned instead. You should test the validity of this object before
|
|
51
|
+
* call this function.
|
|
52
|
+
*/
|
|
53
|
+
const Glyph* glyph() const;
|
|
54
|
+
|
|
55
|
+
/** The fallback glyph id if is invalid */
|
|
56
|
+
i32 fallbackGlyphId() const;
|
|
57
|
+
|
|
58
|
+
/** The width of this char-glyph */
|
|
59
|
+
float width() const;
|
|
60
|
+
|
|
61
|
+
/** The height of this char-glyph */
|
|
62
|
+
float height() const;
|
|
63
|
+
|
|
64
|
+
/** The depth of this char-glyph, in positive */
|
|
65
|
+
float depth() const;
|
|
66
|
+
|
|
67
|
+
/** The italic correction of this char-glyph */
|
|
68
|
+
float italic() const;
|
|
69
|
+
|
|
70
|
+
/** Get the position (shift) to attach top accent */
|
|
71
|
+
float topAccentAttachment() const;
|
|
72
|
+
|
|
73
|
+
/** Get the number of vertical larger variants */
|
|
74
|
+
u16 vLargerCount() const;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Get the vertical larger version of this char-glyph, return the copy of
|
|
78
|
+
* this if no larger version was found. The index 0 is this itself.
|
|
79
|
+
*/
|
|
80
|
+
Char vLarger(u32 index) const;
|
|
81
|
+
|
|
82
|
+
/** Get the number of horizontal larger variants */
|
|
83
|
+
u16 hLargerCount() const;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get the horizontal larger version of this char-glyph, return the copy of
|
|
87
|
+
* this if no larger version was found. The index 0 is this itself.
|
|
88
|
+
*/
|
|
89
|
+
Char hLarger(u32 index) const;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get the script version of this char-glyph, return the copy of this if
|
|
93
|
+
* no script version was found.
|
|
94
|
+
*/
|
|
95
|
+
Char script(u32 index) const;
|
|
96
|
+
|
|
97
|
+
/** Get the glyph assembly in vertical direction */
|
|
98
|
+
const GlyphAssembly& vAssembly() const;
|
|
99
|
+
|
|
100
|
+
/** Get the glyph assembly in horizontal direction */
|
|
101
|
+
const GlyphAssembly& hAssembly() const;
|
|
102
|
+
|
|
103
|
+
/** Get the char of the assembly part */
|
|
104
|
+
const Char assemblyPart(i32 id) const;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
} // namespace microtex
|
|
108
|
+
|
|
109
|
+
#endif // MICROTEX_UNI_CHAR_H
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
#include "unimath/uni_font.h"
|
|
2
|
+
|
|
3
|
+
#include <utility>
|
|
4
|
+
|
|
5
|
+
#include "unimath/uni_symbol.h"
|
|
6
|
+
#include "utils/exceptions.h"
|
|
7
|
+
#include "utils/log.h"
|
|
8
|
+
#include "utils/utils.h"
|
|
9
|
+
|
|
10
|
+
using namespace std;
|
|
11
|
+
|
|
12
|
+
namespace microtex {
|
|
13
|
+
|
|
14
|
+
OtfFont::OtfFont(i32 id, sptr<const Otf> spec, std::string fontFile) noexcept
|
|
15
|
+
: id(id),
|
|
16
|
+
fontFile(fontFile.empty() ? spec->family() : std::move(fontFile)),
|
|
17
|
+
otfSpec(std::move(spec)) {}
|
|
18
|
+
|
|
19
|
+
/**************************************************************************************************/
|
|
20
|
+
|
|
21
|
+
const vector<FontStyle>& FontFamily::supportedStyles() {
|
|
22
|
+
static const vector<FontStyle> styles{
|
|
23
|
+
FontStyle::rm,
|
|
24
|
+
FontStyle::bf,
|
|
25
|
+
FontStyle::it,
|
|
26
|
+
FontStyle::sf,
|
|
27
|
+
FontStyle::tt,
|
|
28
|
+
FontStyle::cal,
|
|
29
|
+
FontStyle::frak,
|
|
30
|
+
FontStyle::bfit,
|
|
31
|
+
FontStyle::sfbfit,
|
|
32
|
+
};
|
|
33
|
+
return styles;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
FontStyle FontFamily::fontStyleOf(const std::string& name) {
|
|
37
|
+
// TODO: more composed styles
|
|
38
|
+
static const map<string, FontStyle> nameStyle{
|
|
39
|
+
{"", FontStyle::rm },
|
|
40
|
+
{"rm", FontStyle::rm },
|
|
41
|
+
{"bf", FontStyle::bf },
|
|
42
|
+
{"it", FontStyle::it },
|
|
43
|
+
{"sf", FontStyle::sf },
|
|
44
|
+
{"tt", FontStyle::tt },
|
|
45
|
+
{"cal", FontStyle::cal },
|
|
46
|
+
{"frak", FontStyle::frak},
|
|
47
|
+
{"bfit", FontStyle::bfit},
|
|
48
|
+
};
|
|
49
|
+
const auto it = nameStyle.find(name);
|
|
50
|
+
if (it == nameStyle.end()) return FontStyle::none;
|
|
51
|
+
return it->second;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
void FontFamily::add(const sptr<const OtfFont>& font) {
|
|
55
|
+
const auto style = static_cast<FontStyle>(font->otfSpec->style());
|
|
56
|
+
#ifdef HAVE_LOG
|
|
57
|
+
if (_styles.find(style) != _styles.end()) {
|
|
58
|
+
loge("the style '%hx' has a font already, but you can replace it anyway\n", style);
|
|
59
|
+
}
|
|
60
|
+
#endif
|
|
61
|
+
_styles[style] = font;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
sptr<const OtfFont> FontFamily::get(FontStyle style) const {
|
|
65
|
+
const auto it = _styles.find(style);
|
|
66
|
+
if (it == _styles.end()) {
|
|
67
|
+
FontStyle closest = findClosestStyle(style);
|
|
68
|
+
const auto t = _styles.find(closest);
|
|
69
|
+
if (t == _styles.end()) {
|
|
70
|
+
const auto rm = _styles.find(FontStyle::rm);
|
|
71
|
+
return rm == _styles.end() ? nullptr : rm->second;
|
|
72
|
+
}
|
|
73
|
+
return t->second;
|
|
74
|
+
}
|
|
75
|
+
return it->second;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**************************************************************************************************/
|
|
79
|
+
|
|
80
|
+
namespace {
|
|
81
|
+
|
|
82
|
+
int _lastId = 0;
|
|
83
|
+
vector<sptr<const OtfFont>> _fonts;
|
|
84
|
+
|
|
85
|
+
map<string, sptr<FontFamily>> _mainFonts;
|
|
86
|
+
map<string, sptr<const OtfFont>> _mathFonts;
|
|
87
|
+
|
|
88
|
+
sptr<FontFamily> getOrCreateFontFamily(const std::string& family) {
|
|
89
|
+
sptr<FontFamily> f;
|
|
90
|
+
auto it = _mainFonts.find(family);
|
|
91
|
+
if (it == _mainFonts.end()) {
|
|
92
|
+
f = sptrOf<FontFamily>();
|
|
93
|
+
_mainFonts[family] = f;
|
|
94
|
+
} else {
|
|
95
|
+
f = it->second;
|
|
96
|
+
}
|
|
97
|
+
return f;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
} // namespace
|
|
101
|
+
|
|
102
|
+
FontStyle FontContext::mathFontStyleOf(const std::string& name) {
|
|
103
|
+
static const map<string, FontStyle> nameStyle{
|
|
104
|
+
{"", FontStyle::none },
|
|
105
|
+
{"mathnormal", FontStyle::none },
|
|
106
|
+
{"mathrm", FontStyle::rm },
|
|
107
|
+
{"mathbf", FontStyle::bf },
|
|
108
|
+
{"mathit", FontStyle::it },
|
|
109
|
+
{"mathcal", FontStyle::cal },
|
|
110
|
+
{"mathscr", FontStyle::cal },
|
|
111
|
+
{"mathfrak", FontStyle::frak },
|
|
112
|
+
{"mathbb", FontStyle::bb },
|
|
113
|
+
{"mathsf", FontStyle::sf },
|
|
114
|
+
{"mathtt", FontStyle::tt },
|
|
115
|
+
{"mathbfit", FontStyle::bfit },
|
|
116
|
+
{"mathbfcal", FontStyle::bfcal },
|
|
117
|
+
{"mathbffrak", FontStyle::bffrak},
|
|
118
|
+
{"mathsfbf", FontStyle::sfbf },
|
|
119
|
+
{"mathbfsf", FontStyle::sfbf },
|
|
120
|
+
{"mathsfit", FontStyle::sfit },
|
|
121
|
+
{"mathsfbfit", FontStyle::sfbfit},
|
|
122
|
+
{"mathbfsfit", FontStyle::sfbfit},
|
|
123
|
+
};
|
|
124
|
+
const auto it = nameStyle.find(name);
|
|
125
|
+
if (it != nameStyle.end()) return it->second;
|
|
126
|
+
return FontStyle::none;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
FontStyle FontContext::mainFontStyleOf(const std::string& name) {
|
|
130
|
+
return FontFamily::fontStyleOf(name);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
FontMeta FontContext::addFont(const FontSrc& src) {
|
|
134
|
+
auto spec = src.loadOtf();
|
|
135
|
+
auto otf = sptrOf<OtfFont>(_lastId++, spec, src.fontFile);
|
|
136
|
+
_fonts.push_back(otf);
|
|
137
|
+
if (spec->isMathFont()) {
|
|
138
|
+
_mathFonts[spec->name()] = otf;
|
|
139
|
+
} else {
|
|
140
|
+
auto f = getOrCreateFontFamily(spec->family());
|
|
141
|
+
f->add(otf);
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
spec->family(),
|
|
145
|
+
spec->name(),
|
|
146
|
+
static_cast<const FontStyle>(spec->style()),
|
|
147
|
+
spec->isMathFont(),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
bool FontContext::hasMathFont() {
|
|
152
|
+
return !_mathFonts.empty();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
FontMeta FontContext::mathFontMetaOf(const std::string& name) {
|
|
156
|
+
auto it = _mathFonts.find(name);
|
|
157
|
+
if (it == _mathFonts.end()) {
|
|
158
|
+
return {};
|
|
159
|
+
}
|
|
160
|
+
const auto& spec = it->second->otf();
|
|
161
|
+
return {spec.family(), spec.name(), static_cast<FontStyle>(spec.style()), spec.isMathFont()};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
bool FontContext::isMathFontExists(const std::string& name) {
|
|
165
|
+
return _mathFonts.find(name) != _mathFonts.end();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
bool FontContext::isMainFontExists(const std::string& familyName) {
|
|
169
|
+
return _mainFonts.find(familyName) != _mainFonts.end();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
std::vector<std::string> FontContext::mathFontNames() {
|
|
173
|
+
return keys(_mathFonts);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
std::vector<std::string> FontContext::mainFontFamilies() {
|
|
177
|
+
return keys(_mainFonts);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
sptr<const OtfFont> FontContext::getFont(i32 id) {
|
|
181
|
+
if (id >= _fonts.size() || id < 0) return nullptr;
|
|
182
|
+
return _fonts[id];
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
bool FontContext::selectMathFont(const string& name) {
|
|
186
|
+
const auto it = _mathFonts.find(name);
|
|
187
|
+
if (it == _mathFonts.end()) {
|
|
188
|
+
#ifdef HAVE_LOG
|
|
189
|
+
loge("Math font '%s' does not exists!", name.c_str());
|
|
190
|
+
#endif
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
_mathFont = it->second;
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
bool FontContext::selectMainFont(const string& familyName) {
|
|
198
|
+
if (familyName.empty()) {
|
|
199
|
+
_mainFont = nullptr;
|
|
200
|
+
return false;
|
|
201
|
+
}
|
|
202
|
+
const auto it = _mainFonts.find(familyName);
|
|
203
|
+
if (it == _mainFonts.end()) {
|
|
204
|
+
#ifdef HAVE_LOG
|
|
205
|
+
loge("Main font '%s' does not exists!", familyName.c_str());
|
|
206
|
+
#endif
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
_mainFont = it->second;
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
u16 FontContext::mainSpace() {
|
|
214
|
+
if (_mainFont == nullptr) return mathFont().otf().space();
|
|
215
|
+
for (auto style : FontFamily::supportedStyles()) {
|
|
216
|
+
auto f = _mainFont->get(style);
|
|
217
|
+
if (f != nullptr) {
|
|
218
|
+
return f->otf().space();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return mathFont().otf().space();
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
Char FontContext::getChar(const Symbol& symbol, FontStyle style) const {
|
|
225
|
+
// TODO math mode?
|
|
226
|
+
const auto code = symbol.unicode;
|
|
227
|
+
return getChar(code, style, true);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
Char FontContext::getChar(c32 code, const string& styleName, bool isMathMode) const {
|
|
231
|
+
const auto style = isMathMode ? mathFontStyleOf(styleName) : mainFontStyleOf(styleName);
|
|
232
|
+
return getChar(code, style, isMathMode);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
Char FontContext::getChar(c32 code, FontStyle style, bool isMathMode) const {
|
|
236
|
+
if (isMathMode) {
|
|
237
|
+
const c32 unicode = MathVersion::map(style, code);
|
|
238
|
+
return {code, unicode, _mathFont->id, _mathFont->otf().glyphId(unicode)};
|
|
239
|
+
} else {
|
|
240
|
+
sptr<const OtfFont> font = _mainFont == nullptr ? nullptr : _mainFont->get(style);
|
|
241
|
+
if (font == nullptr && _mainFont != nullptr) font = _mainFont->get(FontStyle::none);
|
|
242
|
+
// fallback to math font, at least we have one
|
|
243
|
+
if (font == nullptr) font = _mathFont;
|
|
244
|
+
return {code, code, font->id, font->otf().glyphId(code)};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
} // namespace microtex
|