@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,75 @@
|
|
|
1
|
+
project('microtex', 'cpp', 'c',
|
|
2
|
+
version : '1.0.0',
|
|
3
|
+
default_options : ['buildtype=release', 'warning_level=0', 'cpp_std=c++17']
|
|
4
|
+
)
|
|
5
|
+
|
|
6
|
+
cpp = meson.get_compiler('cpp')
|
|
7
|
+
|
|
8
|
+
# the API (and ABI) is compatiable if API version is the same
|
|
9
|
+
microtex_api_version = 1
|
|
10
|
+
|
|
11
|
+
if get_option('TARGET_DEVEL')
|
|
12
|
+
pkgconfig = import('pkgconfig')
|
|
13
|
+
endif
|
|
14
|
+
|
|
15
|
+
subdir('lib')
|
|
16
|
+
|
|
17
|
+
if get_option('CAIRO')
|
|
18
|
+
subdir('platform/cairo')
|
|
19
|
+
if get_option('EXAMPLE_GTKMM')
|
|
20
|
+
subdir('example/gtkmm')
|
|
21
|
+
endif
|
|
22
|
+
else
|
|
23
|
+
if get_option('EXAMPLE_GTKMM')
|
|
24
|
+
error('EXAMPLE_GTKMM was enabled, but it requires CAIRO platform')
|
|
25
|
+
endif
|
|
26
|
+
endif
|
|
27
|
+
|
|
28
|
+
if get_option('GTK')
|
|
29
|
+
if not get_option('CAIRO')
|
|
30
|
+
error('GTK was enabled, but it requires CAIRO platform')
|
|
31
|
+
endif
|
|
32
|
+
subdir('platform/gtk')
|
|
33
|
+
if get_option('EXAMPLE_GTK')
|
|
34
|
+
subdir('example/gtk')
|
|
35
|
+
endif
|
|
36
|
+
else
|
|
37
|
+
if get_option('EXAMPLE_GTK')
|
|
38
|
+
error('EXAMPLE_GTK was enabled, but it requires GTK platform')
|
|
39
|
+
endif
|
|
40
|
+
endif
|
|
41
|
+
|
|
42
|
+
if get_option('QT')
|
|
43
|
+
subdir('platform/qt')
|
|
44
|
+
if get_option('EXAMPLE_QT')
|
|
45
|
+
subdir('example/qt')
|
|
46
|
+
endif
|
|
47
|
+
else
|
|
48
|
+
if get_option('EXAMPLE_QT')
|
|
49
|
+
error('EXAMPLE_QT was enabled, but it requires QT platform')
|
|
50
|
+
endif
|
|
51
|
+
endif
|
|
52
|
+
|
|
53
|
+
gdi_dep = cpp.find_library('gdiplus', required: get_option('GDI'))
|
|
54
|
+
if gdi_dep.found() and cpp.has_header('windows.h')
|
|
55
|
+
subdir('platform/gdi_win')
|
|
56
|
+
if get_option('EXAMPLE_WIN32')
|
|
57
|
+
subdir('example/win32')
|
|
58
|
+
endif
|
|
59
|
+
else
|
|
60
|
+
if get_option('EXAMPLE_WIN32')
|
|
61
|
+
error('EXAMPLE_WIN32 was enabled, but it requires GDI platform')
|
|
62
|
+
endif
|
|
63
|
+
endif
|
|
64
|
+
|
|
65
|
+
if cpp.get_id() == 'emscripten'
|
|
66
|
+
subdir('platform/wasm')
|
|
67
|
+
endif
|
|
68
|
+
|
|
69
|
+
if get_option('TEST')
|
|
70
|
+
subdir('test')
|
|
71
|
+
endif
|
|
72
|
+
|
|
73
|
+
if get_option('TARGET_DOCUMENTATION')
|
|
74
|
+
subdir('doc')
|
|
75
|
+
endif
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
option('HAVE_AUTO_FONT_FIND', type: 'boolean', value: true)
|
|
2
|
+
|
|
3
|
+
# generate pkgconfig files & install headers
|
|
4
|
+
option('TARGET_DEVEL', type : 'boolean', value : true)
|
|
5
|
+
# generate documentation for gtk (requires TAGET_DEVEL)
|
|
6
|
+
option('TARGET_DOCUMENTATION', type: 'boolean', value: false)
|
|
7
|
+
|
|
8
|
+
# if build tests
|
|
9
|
+
option('TEST', type: 'boolean', value: true)
|
|
10
|
+
|
|
11
|
+
# if build cairo
|
|
12
|
+
option('CAIRO', type: 'boolean', value: true)
|
|
13
|
+
# if build gtkmm example
|
|
14
|
+
option('EXAMPLE_GTKMM', type : 'boolean', value: true)
|
|
15
|
+
|
|
16
|
+
# if build gtk (note: requires cairo)
|
|
17
|
+
option('GTK', type: 'boolean', value: true)
|
|
18
|
+
# if build gtk example
|
|
19
|
+
option('EXAMPLE_GTK', type : 'boolean', value: true)
|
|
20
|
+
|
|
21
|
+
# if build qt
|
|
22
|
+
option('QT', type: 'boolean', value: true)
|
|
23
|
+
# if build qt example
|
|
24
|
+
option('EXAMPLE_QT', type: 'boolean', value: true)
|
|
25
|
+
|
|
26
|
+
# if build gdi
|
|
27
|
+
option('GDI', type: 'feature')
|
|
28
|
+
# if build win32 example
|
|
29
|
+
option('EXAMPLE_WIN32', type: 'boolean', value: false)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
message(STATUS "Cross-building using GTK")
|
|
2
|
+
|
|
3
|
+
add_library(microtex-cairo SHARED graphic_cairo.cpp)
|
|
4
|
+
|
|
5
|
+
set_target_properties(
|
|
6
|
+
microtex-cairo PROPERTIES
|
|
7
|
+
VERSION ${PROJECT_VERSION}
|
|
8
|
+
SOVERSION ${MICROTEX_API_VERSION}
|
|
9
|
+
CXX_VISIBILITY_PRESET hidden
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
find_package(Fontconfig REQUIRED)
|
|
13
|
+
find_package(PkgConfig REQUIRED)
|
|
14
|
+
pkg_check_modules(Cairo REQUIRED IMPORTED_TARGET cairo)
|
|
15
|
+
pkg_check_modules(Pango REQUIRED IMPORTED_TARGET pango)
|
|
16
|
+
pkg_check_modules(Pangocairo REQUIRED IMPORTED_TARGET pangocairo)
|
|
17
|
+
|
|
18
|
+
target_include_directories(
|
|
19
|
+
microtex-cairo PUBLIC
|
|
20
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
|
21
|
+
$<INSTALL_INTERFACE:include/microtex-cairo>
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
# we need to export the library on Windows
|
|
25
|
+
target_compile_definitions(microtex-cairo PRIVATE -DMICROTEX_LIBRARY)
|
|
26
|
+
target_link_libraries(
|
|
27
|
+
microtex-cairo PRIVATE
|
|
28
|
+
microtex
|
|
29
|
+
Fontconfig::Fontconfig
|
|
30
|
+
PkgConfig::Cairo
|
|
31
|
+
PkgConfig::Pango
|
|
32
|
+
PkgConfig::Pangocairo
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
microtex_install_target(microtex-cairo)
|
|
36
|
+
microtex_install_headers(microtex-cairo HEADERS graphic_cairo.h)
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
#include <fontconfig/fontconfig.h>
|
|
2
|
+
// #include <cairo/cairo-ft.h>
|
|
3
|
+
#include <cairo-ft.h>
|
|
4
|
+
#include <pango/pangocairo.h>
|
|
5
|
+
|
|
6
|
+
#include <utility>
|
|
7
|
+
|
|
8
|
+
#include "graphic_cairo.h"
|
|
9
|
+
#include "utils/log.h"
|
|
10
|
+
#include "utils/utf.h"
|
|
11
|
+
|
|
12
|
+
using namespace microtex;
|
|
13
|
+
using namespace std;
|
|
14
|
+
|
|
15
|
+
namespace cairopp {
|
|
16
|
+
|
|
17
|
+
struct cairo_font_face_deleter {
|
|
18
|
+
void operator()(cairo_font_face_t* ptr) { cairo_font_face_destroy(ptr); }
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
struct cairo_ctx_deleter {
|
|
22
|
+
void operator()(cairo_t* ptr) { cairo_destroy(ptr); }
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
inline CairoFontFacePtr cairo_font_face_make_cairopp_ptr(cairo_font_face_t* ptr) {
|
|
26
|
+
return CairoFontFacePtr(ptr, cairo_font_face_deleter());
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
inline CairoCtxPtr cairo_ctx_make_cairopp_ptr(cairo_t* ptr) {
|
|
30
|
+
return CairoCtxPtr(ptr, cairo_ctx_deleter());
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
} // namespace cairopp
|
|
34
|
+
|
|
35
|
+
map<string, cairopp::CairoFontFacePtr> Font_cairo::_cairoFtFaces;
|
|
36
|
+
|
|
37
|
+
Font_cairo::Font_cairo(const string& file) {
|
|
38
|
+
loadFont(file);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
Font_cairo::~Font_cairo() {}
|
|
42
|
+
|
|
43
|
+
void Font_cairo::loadFont(const string& file) {
|
|
44
|
+
auto ffaceEntry = _cairoFtFaces.find(file);
|
|
45
|
+
if (ffaceEntry != _cairoFtFaces.end()) {
|
|
46
|
+
// already loaded
|
|
47
|
+
_fface = ffaceEntry->second.get();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// query font via fontconfig
|
|
52
|
+
const auto f = (const FcChar8*)file.c_str();
|
|
53
|
+
|
|
54
|
+
// get font family from file first
|
|
55
|
+
int count;
|
|
56
|
+
FcChar8* family = nullptr;
|
|
57
|
+
FcBlanks* blanks = FcConfigGetBlanks(nullptr);
|
|
58
|
+
FcPattern* p = FcFreeTypeQuery(f, 0, blanks, &count);
|
|
59
|
+
FcPatternGetString(p, FC_FAMILY, 0, &family);
|
|
60
|
+
#ifdef HAVE_LOG
|
|
61
|
+
dbg("Load font: %s, count: %d\n", file.c_str(), count);
|
|
62
|
+
FcPatternPrint(p);
|
|
63
|
+
#endif
|
|
64
|
+
|
|
65
|
+
// load font to fontconfig
|
|
66
|
+
FcBool status = FcConfigAppFontAddFile(nullptr, f);
|
|
67
|
+
#ifdef HAVE_LOG
|
|
68
|
+
if (!status) dbg(ANSI_COLOR_RED "Load %s failed\n" ANSI_RESET, file.c_str());
|
|
69
|
+
#endif
|
|
70
|
+
|
|
71
|
+
_fface = cairo_ft_font_face_create_for_pattern(p);
|
|
72
|
+
_cairoFtFaces.insert(std::pair<string, cairopp::CairoFontFacePtr>(
|
|
73
|
+
file,
|
|
74
|
+
cairopp::cairo_font_face_make_cairopp_ptr(_fface)
|
|
75
|
+
));
|
|
76
|
+
|
|
77
|
+
// release
|
|
78
|
+
FcPatternDestroy(p);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
cairo_font_face_t* Font_cairo::getCairoFontFace() const {
|
|
82
|
+
return _fface;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
bool Font_cairo::operator==(const Font& ft) const {
|
|
86
|
+
const auto& f = static_cast<const Font_cairo&>(ft);
|
|
87
|
+
return _fface == f._fface;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**************************************************************************************************/
|
|
91
|
+
|
|
92
|
+
cairopp::CairoCtxPtr TextLayout_cairo::_img_context;
|
|
93
|
+
|
|
94
|
+
TextLayout_cairo::TextLayout_cairo(const string& src, FontStyle style, float size) {
|
|
95
|
+
if (!_img_context) {
|
|
96
|
+
auto surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1);
|
|
97
|
+
_img_context = cairopp::cairo_ctx_make_cairopp_ptr(cairo_create(surface));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
_layout = pango_cairo_create_layout(_img_context.get());
|
|
101
|
+
|
|
102
|
+
PangoFontDescription* fd = pango_font_description_new();
|
|
103
|
+
pango_font_description_set_absolute_size(fd, size * PANGO_SCALE);
|
|
104
|
+
pango_font_description_set_style(fd, PANGO_STYLE_NORMAL);
|
|
105
|
+
pango_font_description_set_weight(fd, PANGO_WEIGHT_NORMAL);
|
|
106
|
+
pango_font_description_set_family_static(fd, "Serif");
|
|
107
|
+
|
|
108
|
+
if (microtex::isSansSerif(style)) {
|
|
109
|
+
pango_font_description_set_family_static(fd, "Sans-Serif");
|
|
110
|
+
}
|
|
111
|
+
if (microtex::isMono(style)) {
|
|
112
|
+
pango_font_description_set_family_static(fd, "Monospace");
|
|
113
|
+
}
|
|
114
|
+
if (microtex::isBold(style)) {
|
|
115
|
+
pango_font_description_set_weight(fd, PANGO_WEIGHT_BOLD);
|
|
116
|
+
}
|
|
117
|
+
if (microtex::isItalic(style)) {
|
|
118
|
+
pango_font_description_set_style(fd, PANGO_STYLE_ITALIC);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
pango_layout_set_text(_layout, src.c_str(), src.length());
|
|
122
|
+
pango_layout_set_font_description(_layout, fd);
|
|
123
|
+
pango_font_description_free(fd);
|
|
124
|
+
|
|
125
|
+
_ascent = (float)(pango_layout_get_baseline(_layout) / PANGO_SCALE);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
TextLayout_cairo::~TextLayout_cairo() {
|
|
129
|
+
g_object_unref(_layout);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
void TextLayout_cairo::getBounds(Rect& r) {
|
|
133
|
+
int w, h;
|
|
134
|
+
pango_layout_get_pixel_size(_layout, &w, &h);
|
|
135
|
+
r.x = 0;
|
|
136
|
+
r.w = (float)w;
|
|
137
|
+
PangoRectangle rect;
|
|
138
|
+
pango_layout_get_pixel_extents(_layout, &rect, NULL);
|
|
139
|
+
r.y = -_ascent + rect.y;
|
|
140
|
+
r.h = rect.height;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
void TextLayout_cairo::draw(Graphics2D& g2, float x, float y) {
|
|
144
|
+
// FIXME
|
|
145
|
+
// draw line, I don't know why the layout is shown in wrong position
|
|
146
|
+
// when line was not drawn
|
|
147
|
+
color old = g2.getColor();
|
|
148
|
+
g2.setColor(0x00000000);
|
|
149
|
+
g2.drawLine(x, y, x + 1, y);
|
|
150
|
+
// draw layout
|
|
151
|
+
g2.setColor(old);
|
|
152
|
+
g2.translate(x, y - _ascent);
|
|
153
|
+
auto& g = static_cast<Graphics2D_cairo&>(g2);
|
|
154
|
+
pango_cairo_show_layout(g.getCairoContext(), _layout);
|
|
155
|
+
g2.translate(-x, -y + _ascent);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**************************************************************************************************/
|
|
159
|
+
|
|
160
|
+
sptr<Font> PlatformFactory_cairo::createFont(const std::string& file) {
|
|
161
|
+
return sptrOf<Font_cairo>(file);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
sptr<TextLayout>
|
|
165
|
+
PlatformFactory_cairo::createTextLayout(const std::string& src, FontStyle style, float size) {
|
|
166
|
+
return sptrOf<TextLayout_cairo>(src, style, size);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**************************************************************************************************/
|
|
170
|
+
|
|
171
|
+
Graphics2D_cairo::Graphics2D_cairo(cairo_t* context) : _context(cairo_reference(context)), _font() {
|
|
172
|
+
_sx = _sy = 1.f;
|
|
173
|
+
setColor(BLACK);
|
|
174
|
+
setStroke(Stroke());
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
Graphics2D_cairo::~Graphics2D_cairo() {
|
|
178
|
+
unsigned int rc = cairo_get_reference_count(_context);
|
|
179
|
+
cairo_destroy(_context);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
cairo_t* Graphics2D_cairo::getCairoContext() const {
|
|
183
|
+
return _context;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
void Graphics2D_cairo::setColor(color c) {
|
|
187
|
+
_color = c;
|
|
188
|
+
const double a = color_a(c) / 255.;
|
|
189
|
+
const double r = color_r(c) / 255.;
|
|
190
|
+
const double g = color_g(c) / 255.;
|
|
191
|
+
const double b = color_b(c) / 255.;
|
|
192
|
+
cairo_set_source_rgba(_context, r, g, b, a);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
color Graphics2D_cairo::getColor() const {
|
|
196
|
+
return _color;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
void Graphics2D_cairo::setStroke(const Stroke& s) {
|
|
200
|
+
_stroke = s;
|
|
201
|
+
cairo_set_line_width(_context, (double)s.lineWidth);
|
|
202
|
+
|
|
203
|
+
// convert abstract line cap to platform line cap
|
|
204
|
+
cairo_line_cap_t c;
|
|
205
|
+
switch (s.cap) {
|
|
206
|
+
case CAP_BUTT: c = CAIRO_LINE_CAP_BUTT; break;
|
|
207
|
+
case CAP_ROUND: c = CAIRO_LINE_CAP_ROUND; break;
|
|
208
|
+
case CAP_SQUARE: c = CAIRO_LINE_CAP_SQUARE; break;
|
|
209
|
+
}
|
|
210
|
+
cairo_set_line_cap(_context, c);
|
|
211
|
+
|
|
212
|
+
// convert abstract line join to platform line join
|
|
213
|
+
cairo_line_join_t j;
|
|
214
|
+
switch (s.join) {
|
|
215
|
+
case JOIN_BEVEL: j = CAIRO_LINE_JOIN_BEVEL; break;
|
|
216
|
+
case JOIN_ROUND: j = CAIRO_LINE_JOIN_ROUND; break;
|
|
217
|
+
case JOIN_MITER: j = CAIRO_LINE_JOIN_MITER; break;
|
|
218
|
+
}
|
|
219
|
+
cairo_set_line_join(_context, j);
|
|
220
|
+
|
|
221
|
+
cairo_set_miter_limit(_context, (double)s.miterLimit);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const Stroke& Graphics2D_cairo::getStroke() const {
|
|
225
|
+
return _stroke;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
void Graphics2D_cairo::setStrokeWidth(float w) {
|
|
229
|
+
_stroke.lineWidth = w;
|
|
230
|
+
cairo_set_line_width(_context, (double)w);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
void Graphics2D_cairo::setDash(const std::vector<float>& dash) {
|
|
234
|
+
if (dash.empty()) {
|
|
235
|
+
cairo_set_dash(_context, nullptr, 0, 0.);
|
|
236
|
+
} else {
|
|
237
|
+
const vector<double> ddash(dash.begin(), dash.end());
|
|
238
|
+
cairo_set_dash(_context, ddash.data(), ddash.size(), 0.);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
std::vector<float> Graphics2D_cairo::getDash() {
|
|
243
|
+
vector<double> dash(cairo_get_dash_count(_context));
|
|
244
|
+
double offset;
|
|
245
|
+
cairo_get_dash(_context, dash.data(), &offset);
|
|
246
|
+
return vector<float>(dash.begin(), dash.end());
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
sptr<Font> Graphics2D_cairo::getFont() const {
|
|
250
|
+
return _font;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
void Graphics2D_cairo::setFont(const sptr<Font>& font) {
|
|
254
|
+
_font = static_pointer_cast<Font_cairo>(font);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
float Graphics2D_cairo::getFontSize() const {
|
|
258
|
+
return _fontSize;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
void Graphics2D_cairo::setFontSize(float size) {
|
|
262
|
+
_fontSize = size;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
void Graphics2D_cairo::translate(float dx, float dy) {
|
|
266
|
+
cairo_translate(_context, (double)dx, (double)dy);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
void Graphics2D_cairo::scale(float sx, float sy) {
|
|
270
|
+
_sx *= sx;
|
|
271
|
+
_sy *= sy;
|
|
272
|
+
cairo_scale(_context, (double)sx, (double)sy);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
void Graphics2D_cairo::rotate(float angle) {
|
|
276
|
+
cairo_rotate(_context, (double)angle);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
void Graphics2D_cairo::rotate(float angle, float px, float py) {
|
|
280
|
+
cairo_translate(_context, (double)px, (double)py);
|
|
281
|
+
cairo_rotate(_context, (double)angle);
|
|
282
|
+
cairo_translate(_context, (double)-px, (double)-py);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
void Graphics2D_cairo::reset() {
|
|
286
|
+
cairo_identity_matrix(_context);
|
|
287
|
+
_sx = _sy = 1.f;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
float Graphics2D_cairo::sx() const {
|
|
291
|
+
return _sx;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
float Graphics2D_cairo::sy() const {
|
|
295
|
+
return _sy;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
void Graphics2D_cairo::drawGlyph(u16 glyph, float x, float y) {
|
|
299
|
+
cairo_set_font_face(_context, _font->getCairoFontFace());
|
|
300
|
+
cairo_set_font_size(_context, _fontSize);
|
|
301
|
+
cairo_glyph_t g[1]{
|
|
302
|
+
{glyph, (double)x, (double)y}
|
|
303
|
+
};
|
|
304
|
+
cairo_show_glyphs(_context, g, 1);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
bool Graphics2D_cairo::beginPath(i32 id) {
|
|
308
|
+
cairo_new_path(_context);
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
void Graphics2D_cairo::moveTo(float x, float y) {
|
|
313
|
+
cairo_move_to(_context, (double)x, (double)y);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
void Graphics2D_cairo::lineTo(float x, float y) {
|
|
317
|
+
cairo_line_to(_context, x, y);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
void Graphics2D_cairo::cubicTo(float x1, float y1, float x2, float y2, float x3, float y3) {
|
|
321
|
+
cairo_curve_to(_context, x1, y1, x2, y2, x3, y3);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
void Graphics2D_cairo::quadTo(float x1, float y1, float x2, float y2) {
|
|
325
|
+
// See https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Degree_elevation
|
|
326
|
+
// and https://lists.cairographics.org/archives/cairo/2010-April/019691.html
|
|
327
|
+
// for details
|
|
328
|
+
double x0, y0;
|
|
329
|
+
cairo_get_current_point(_context, &x0, &y0);
|
|
330
|
+
cairo_curve_to(
|
|
331
|
+
_context,
|
|
332
|
+
2.0 / 3.0 * x1 + 1.0 / 3.0 * x0,
|
|
333
|
+
2.0 / 3.0 * y1 + 1.0 / 3.0 * y0,
|
|
334
|
+
2.0 / 3.0 * x1 + 1.0 / 3.0 * x2,
|
|
335
|
+
2.0 / 3.0 * y1 + 1.0 / 3.0 * y2,
|
|
336
|
+
y1,
|
|
337
|
+
y2
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
void Graphics2D_cairo::closePath() {
|
|
342
|
+
cairo_close_path(_context);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
void Graphics2D_cairo::fillPath(i32 id) {
|
|
346
|
+
cairo_fill(_context);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
void Graphics2D_cairo::drawLine(float x1, float y1, float x2, float y2) {
|
|
350
|
+
cairo_move_to(_context, x1, y1);
|
|
351
|
+
cairo_line_to(_context, x2, y2);
|
|
352
|
+
cairo_stroke(_context);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
void Graphics2D_cairo::drawRect(float x, float y, float w, float h) {
|
|
356
|
+
cairo_rectangle(_context, x, y, w, h);
|
|
357
|
+
cairo_stroke(_context);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
void Graphics2D_cairo::fillRect(float x, float y, float w, float h) {
|
|
361
|
+
cairo_rectangle(_context, x, y, w, h);
|
|
362
|
+
cairo_fill(_context);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
void Graphics2D_cairo::roundRect(float x, float y, float w, float h, float rx, float ry) {
|
|
366
|
+
double r = max(rx, ry);
|
|
367
|
+
double d = G_PI / 180.;
|
|
368
|
+
cairo_new_sub_path(_context);
|
|
369
|
+
cairo_arc(_context, x + r, y + r, r, 180 * d, 270 * d);
|
|
370
|
+
cairo_arc(_context, x + w - r, y + r, r, -90 * d, 0);
|
|
371
|
+
cairo_arc(_context, x + w - r, y + h - r, r, 0, 90 * d);
|
|
372
|
+
cairo_arc(_context, x + r, y + h - r, r, 90 * d, 180 * d);
|
|
373
|
+
cairo_close_path(_context);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
void Graphics2D_cairo::drawRoundRect(float x, float y, float w, float h, float rx, float ry) {
|
|
377
|
+
roundRect(x, y, w, h, rx, ry);
|
|
378
|
+
cairo_stroke(_context);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
void Graphics2D_cairo::fillRoundRect(float x, float y, float w, float h, float rx, float ry) {
|
|
382
|
+
roundRect(x, y, w, h, rx, ry);
|
|
383
|
+
cairo_fill(_context);
|
|
384
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#ifndef GRAPHIC_CAIRO_H_INCLUDED
|
|
2
|
+
#define GRAPHIC_CAIRO_H_INCLUDED
|
|
3
|
+
|
|
4
|
+
#include <cairo.h>
|
|
5
|
+
#include <pango/pango.h>
|
|
6
|
+
|
|
7
|
+
#include "graphic/graphic.h"
|
|
8
|
+
#include "microtexexport.h"
|
|
9
|
+
|
|
10
|
+
namespace cairopp {
|
|
11
|
+
|
|
12
|
+
typedef std::shared_ptr<cairo_font_face_t> CairoFontFacePtr;
|
|
13
|
+
typedef std::shared_ptr<cairo_t> CairoCtxPtr;
|
|
14
|
+
|
|
15
|
+
} // namespace cairopp
|
|
16
|
+
|
|
17
|
+
namespace microtex {
|
|
18
|
+
|
|
19
|
+
class MICROTEX_EXPORT Font_cairo : public Font {
|
|
20
|
+
private:
|
|
21
|
+
static std::map<std::string, cairopp::CairoFontFacePtr> _cairoFtFaces;
|
|
22
|
+
|
|
23
|
+
cairo_font_face_t* _fface;
|
|
24
|
+
|
|
25
|
+
void loadFont(const std::string& file);
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
explicit Font_cairo(const std::string& file);
|
|
29
|
+
|
|
30
|
+
~Font_cairo() override;
|
|
31
|
+
|
|
32
|
+
cairo_font_face_t* getCairoFontFace() const;
|
|
33
|
+
|
|
34
|
+
bool operator==(const Font& f) const override;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**************************************************************************************************/
|
|
38
|
+
|
|
39
|
+
class MICROTEX_EXPORT TextLayout_cairo : public TextLayout {
|
|
40
|
+
private:
|
|
41
|
+
static cairopp::CairoCtxPtr _img_context;
|
|
42
|
+
PangoLayout* _layout;
|
|
43
|
+
float _ascent;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
TextLayout_cairo(const std::string& src, FontStyle style, float size);
|
|
47
|
+
|
|
48
|
+
~TextLayout_cairo() override;
|
|
49
|
+
|
|
50
|
+
void getBounds(Rect& r) override;
|
|
51
|
+
|
|
52
|
+
void draw(Graphics2D& g2, float x, float y) override;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**************************************************************************************************/
|
|
56
|
+
|
|
57
|
+
class MICROTEX_EXPORT PlatformFactory_cairo : public PlatformFactory {
|
|
58
|
+
public:
|
|
59
|
+
sptr<Font> createFont(const std::string& file) override;
|
|
60
|
+
|
|
61
|
+
sptr<TextLayout> createTextLayout(const std::string& src, FontStyle style, float size) override;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**************************************************************************************************/
|
|
65
|
+
|
|
66
|
+
class MICROTEX_EXPORT Graphics2D_cairo : public Graphics2D {
|
|
67
|
+
private:
|
|
68
|
+
cairo_t* _context;
|
|
69
|
+
color _color;
|
|
70
|
+
Stroke _stroke;
|
|
71
|
+
sptr<Font_cairo> _font;
|
|
72
|
+
float _fontSize;
|
|
73
|
+
float _sx, _sy;
|
|
74
|
+
|
|
75
|
+
void roundRect(float x, float y, float w, float h, float rx, float ry);
|
|
76
|
+
|
|
77
|
+
public:
|
|
78
|
+
explicit Graphics2D_cairo(cairo_t* context);
|
|
79
|
+
|
|
80
|
+
~Graphics2D_cairo() override;
|
|
81
|
+
|
|
82
|
+
cairo_t* getCairoContext() const;
|
|
83
|
+
|
|
84
|
+
void setColor(color c) override;
|
|
85
|
+
color getColor() const override;
|
|
86
|
+
void setStroke(const Stroke& s) override;
|
|
87
|
+
const Stroke& getStroke() const override;
|
|
88
|
+
void setStrokeWidth(float w) override;
|
|
89
|
+
void setDash(const std::vector<float>& dash) override;
|
|
90
|
+
std::vector<float> getDash() override;
|
|
91
|
+
sptr<Font> getFont() const override;
|
|
92
|
+
void setFont(const sptr<Font>& font) override;
|
|
93
|
+
float getFontSize() const override;
|
|
94
|
+
void setFontSize(float size) override;
|
|
95
|
+
void translate(float dx, float dy) override;
|
|
96
|
+
void scale(float sx, float sy) override;
|
|
97
|
+
void rotate(float angle) override;
|
|
98
|
+
void rotate(float angle, float px, float py) override;
|
|
99
|
+
void reset() override;
|
|
100
|
+
float sx() const override;
|
|
101
|
+
float sy() const override;
|
|
102
|
+
void drawGlyph(u16 glyph, float x, float y) override;
|
|
103
|
+
bool beginPath(i32 id) override;
|
|
104
|
+
void moveTo(float x, float y) override;
|
|
105
|
+
void lineTo(float x, float y) override;
|
|
106
|
+
void cubicTo(float x1, float y1, float x2, float y2, float x3, float y3) override;
|
|
107
|
+
void quadTo(float x1, float y1, float x2, float y2) override;
|
|
108
|
+
void closePath() override;
|
|
109
|
+
void fillPath(i32 id) override;
|
|
110
|
+
void drawLine(float x, float y1, float x2, float y2) override;
|
|
111
|
+
void drawRect(float x, float y, float w, float h) override;
|
|
112
|
+
void fillRect(float x, float y, float w, float h) override;
|
|
113
|
+
void drawRoundRect(float x, float y, float w, float h, float rx, float ry) override;
|
|
114
|
+
void fillRoundRect(float x, float y, float w, float h, float rx, float ry) override;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
} // namespace microtex
|
|
118
|
+
|
|
119
|
+
#endif // GRAPHIC_CAIRO_H_INCLUDED
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
cairo_src = [
|
|
2
|
+
'graphic_cairo.cpp'
|
|
3
|
+
]
|
|
4
|
+
|
|
5
|
+
cairo_deps = [
|
|
6
|
+
dependency('fontconfig'),
|
|
7
|
+
dependency('cairo'),
|
|
8
|
+
dependency('cairo-ft'),
|
|
9
|
+
dependency('pango'),
|
|
10
|
+
dependency('pangocairo')
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
microtex_cairo_lib = library('microtex-cairo', cairo_src,
|
|
14
|
+
link_with: microtex_lib,
|
|
15
|
+
include_directories: inc,
|
|
16
|
+
dependencies: cairo_deps,
|
|
17
|
+
version: meson.project_version(),
|
|
18
|
+
soversion: microtex_api_version,
|
|
19
|
+
install: true
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
microtex_cairo_dep = declare_dependency(
|
|
23
|
+
link_with: [microtex_lib, microtex_cairo_lib],
|
|
24
|
+
include_directories: ['.', inc],
|
|
25
|
+
dependencies: [
|
|
26
|
+
dependency('cairo'),
|
|
27
|
+
dependency('pango'),
|
|
28
|
+
],
|
|
29
|
+
version: meson.project_version()
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
if get_option('TARGET_DEVEL')
|
|
33
|
+
pkgconfig.generate(microtex_cairo_lib,
|
|
34
|
+
libraries: microtex_lib,
|
|
35
|
+
version: meson.project_version(),
|
|
36
|
+
name: 'microtex-cairo',
|
|
37
|
+
filebase: 'microtex-cairo',
|
|
38
|
+
subdirs: ['microtex/platform/cairo'],
|
|
39
|
+
description: 'cairomm backend to microtex'
|
|
40
|
+
)
|
|
41
|
+
endif
|
|
42
|
+
|
|
43
|
+
if install_headerfiles
|
|
44
|
+
install_headers([
|
|
45
|
+
'graphic_cairo.h'
|
|
46
|
+
], subdir: 'microtex/platform/cairo')
|
|
47
|
+
endif
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
include(CMakeFindDependencyMacro)
|
|
2
|
+
|
|
3
|
+
find_dependency(microtex REQUIRED)
|
|
4
|
+
# FIXME is these really needed?
|
|
5
|
+
find_dependency(Fontconfig REQUIRED)
|
|
6
|
+
find_dependency(PkgConfig REQUIRED)
|
|
7
|
+
pkg_check_modules(Cairo REQUIRED IMPORTED_TARGET cairo)
|
|
8
|
+
pkg_check_modules(Pango REQUIRED IMPORTED_TARGET pango)
|
|
9
|
+
pkg_check_modules(Pangocairo REQUIRED IMPORTED_TARGET pangocairo)
|
|
10
|
+
|
|
11
|
+
include("${CMAKE_CURRENT_LIST_DIR}/microtex-cairoTargets.cmake")
|