@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.
Files changed (529) hide show
  1. package/LICENSE +674 -0
  2. package/LICENSE-PROJECT +21 -0
  3. package/README.md +7 -0
  4. package/build.zig +112 -0
  5. package/build.zig.zon +12 -0
  6. package/native/lib.zig +280 -0
  7. package/native/nanosvg.c +4 -0
  8. package/native/vendor/.bootstrap-v5 +1 -0
  9. package/native/vendor/LICENSE-NANOSVG +18 -0
  10. package/native/vendor/microtex/.clang-format +26 -0
  11. package/native/vendor/microtex/.github/workflows/ubuntu.yml +92 -0
  12. package/native/vendor/microtex/.github/workflows/windows-gdi.yml +34 -0
  13. package/native/vendor/microtex/.github/workflows/windows-qt.yml +52 -0
  14. package/native/vendor/microtex/CMakeLists.txt +110 -0
  15. package/native/vendor/microtex/LICENSE +21 -0
  16. package/native/vendor/microtex/MicroTeXInstall.cmake +42 -0
  17. package/native/vendor/microtex/README.md +600 -0
  18. package/native/vendor/microtex/build.zig +209 -0
  19. package/native/vendor/microtex/clatexmath.wrap +6 -0
  20. package/native/vendor/microtex/doc/meson.build +38 -0
  21. package/native/vendor/microtex/doc/microtex-doc.toml.in +47 -0
  22. package/native/vendor/microtex/doc/microtex.svg +39 -0
  23. package/native/vendor/microtex/doc/urlmap.js +6 -0
  24. package/native/vendor/microtex/example/gtk/CMakeLists.txt +68 -0
  25. package/native/vendor/microtex/example/gtk/gtk_main.c +170 -0
  26. package/native/vendor/microtex/example/gtk/isamples.cpp +21 -0
  27. package/native/vendor/microtex/example/gtk/isamples.h +15 -0
  28. package/native/vendor/microtex/example/gtk/meson.build +27 -0
  29. package/native/vendor/microtex/example/gtk/microtex-gtk.gresource.xml +6 -0
  30. package/native/vendor/microtex/example/gtk/microtex-gtk.ui +117 -0
  31. package/native/vendor/microtex/example/gtkmm/CMakeLists.txt +19 -0
  32. package/native/vendor/microtex/example/gtkmm/gtkmm_main.cpp +531 -0
  33. package/native/vendor/microtex/example/gtkmm/meson.build +19 -0
  34. package/native/vendor/microtex/example/memcheck/CMakeLists.txt +12 -0
  35. package/native/vendor/microtex/example/memcheck/mem_check_main.cpp +154 -0
  36. package/native/vendor/microtex/example/qt/CMakeLists.txt +37 -0
  37. package/native/vendor/microtex/example/qt/meson.build +25 -0
  38. package/native/vendor/microtex/example/qt/qt_main.cpp +70 -0
  39. package/native/vendor/microtex/example/qt/qt_mainwindow.cpp +107 -0
  40. package/native/vendor/microtex/example/qt/qt_mainwindow.h +40 -0
  41. package/native/vendor/microtex/example/qt/qt_skiatexwidget.cpp +149 -0
  42. package/native/vendor/microtex/example/qt/qt_skiatexwidget.h +48 -0
  43. package/native/vendor/microtex/example/qt/qt_tex_render.h +15 -0
  44. package/native/vendor/microtex/example/qt/qt_texqmlitem.cpp +56 -0
  45. package/native/vendor/microtex/example/qt/qt_texqmlitem.h +31 -0
  46. package/native/vendor/microtex/example/qt/qt_texwidget.cpp +62 -0
  47. package/native/vendor/microtex/example/qt/qt_texwidget.h +31 -0
  48. package/native/vendor/microtex/example/qtpng/CMakeLists.txt +11 -0
  49. package/native/vendor/microtex/example/qtpng/latex2png.cpp +115 -0
  50. package/native/vendor/microtex/example/samples/samples.cpp +52 -0
  51. package/native/vendor/microtex/example/samples/samples.h +32 -0
  52. package/native/vendor/microtex/example/win32/CMakeLists.txt +15 -0
  53. package/native/vendor/microtex/example/win32/meson.build +18 -0
  54. package/native/vendor/microtex/example/win32/win32_main.cpp +375 -0
  55. package/native/vendor/microtex/githooks/pre-commit +19 -0
  56. package/native/vendor/microtex/githooks/pre-push +103 -0
  57. package/native/vendor/microtex/lib/CMakeLists.txt +234 -0
  58. package/native/vendor/microtex/lib/atom/atom.cpp +14 -0
  59. package/native/vendor/microtex/lib/atom/atom.h +96 -0
  60. package/native/vendor/microtex/lib/atom/atom_accent.cpp +115 -0
  61. package/native/vendor/microtex/lib/atom/atom_accent.h +53 -0
  62. package/native/vendor/microtex/lib/atom/atom_basic.cpp +146 -0
  63. package/native/vendor/microtex/lib/atom/atom_basic.h +273 -0
  64. package/native/vendor/microtex/lib/atom/atom_box.cpp +41 -0
  65. package/native/vendor/microtex/lib/atom/atom_box.h +70 -0
  66. package/native/vendor/microtex/lib/atom/atom_char.cpp +99 -0
  67. package/native/vendor/microtex/lib/atom/atom_char.h +147 -0
  68. package/native/vendor/microtex/lib/atom/atom_delim.cpp +65 -0
  69. package/native/vendor/microtex/lib/atom/atom_delim.h +58 -0
  70. package/native/vendor/microtex/lib/atom/atom_fence.cpp +65 -0
  71. package/native/vendor/microtex/lib/atom/atom_fence.h +56 -0
  72. package/native/vendor/microtex/lib/atom/atom_font.cpp +20 -0
  73. package/native/vendor/microtex/lib/atom/atom_font.h +49 -0
  74. package/native/vendor/microtex/lib/atom/atom_frac.cpp +101 -0
  75. package/native/vendor/microtex/lib/atom/atom_frac.h +42 -0
  76. package/native/vendor/microtex/lib/atom/atom_matrix.cpp +756 -0
  77. package/native/vendor/microtex/lib/atom/atom_matrix.h +268 -0
  78. package/native/vendor/microtex/lib/atom/atom_misc.cpp +230 -0
  79. package/native/vendor/microtex/lib/atom/atom_misc.h +200 -0
  80. package/native/vendor/microtex/lib/atom/atom_operator.cpp +51 -0
  81. package/native/vendor/microtex/lib/atom/atom_operator.h +41 -0
  82. package/native/vendor/microtex/lib/atom/atom_root.cpp +61 -0
  83. package/native/vendor/microtex/lib/atom/atom_root.h +27 -0
  84. package/native/vendor/microtex/lib/atom/atom_row.cpp +334 -0
  85. package/native/vendor/microtex/lib/atom/atom_row.h +176 -0
  86. package/native/vendor/microtex/lib/atom/atom_scripts.cpp +182 -0
  87. package/native/vendor/microtex/lib/atom/atom_scripts.h +52 -0
  88. package/native/vendor/microtex/lib/atom/atom_sideset.cpp +92 -0
  89. package/native/vendor/microtex/lib/atom/atom_sideset.h +24 -0
  90. package/native/vendor/microtex/lib/atom/atom_space.cpp +22 -0
  91. package/native/vendor/microtex/lib/atom/atom_space.h +38 -0
  92. package/native/vendor/microtex/lib/atom/atom_stack.cpp +117 -0
  93. package/native/vendor/microtex/lib/atom/atom_stack.h +103 -0
  94. package/native/vendor/microtex/lib/atom/atom_text.cpp +17 -0
  95. package/native/vendor/microtex/lib/atom/atom_text.h +33 -0
  96. package/native/vendor/microtex/lib/atom/atom_vrow.cpp +96 -0
  97. package/native/vendor/microtex/lib/atom/atom_vrow.h +47 -0
  98. package/native/vendor/microtex/lib/atom/atom_zstack.cpp +66 -0
  99. package/native/vendor/microtex/lib/atom/atom_zstack.h +37 -0
  100. package/native/vendor/microtex/lib/atom/colors_def.cpp +157 -0
  101. package/native/vendor/microtex/lib/atom/meson.build +50 -0
  102. package/native/vendor/microtex/lib/box/box.cpp +49 -0
  103. package/native/vendor/microtex/lib/box/box.h +184 -0
  104. package/native/vendor/microtex/lib/box/box_factory.cpp +162 -0
  105. package/native/vendor/microtex/lib/box/box_factory.h +24 -0
  106. package/native/vendor/microtex/lib/box/box_group.cpp +503 -0
  107. package/native/vendor/microtex/lib/box/box_group.h +285 -0
  108. package/native/vendor/microtex/lib/box/box_single.cpp +179 -0
  109. package/native/vendor/microtex/lib/box/box_single.h +157 -0
  110. package/native/vendor/microtex/lib/box/meson.build +15 -0
  111. package/native/vendor/microtex/lib/core/debug_config.cpp +3 -0
  112. package/native/vendor/microtex/lib/core/debug_config.h +24 -0
  113. package/native/vendor/microtex/lib/core/formula.cpp +180 -0
  114. package/native/vendor/microtex/lib/core/formula.h +137 -0
  115. package/native/vendor/microtex/lib/core/formula_def.cpp +167 -0
  116. package/native/vendor/microtex/lib/core/glue.cpp +108 -0
  117. package/native/vendor/microtex/lib/core/glue.h +55 -0
  118. package/native/vendor/microtex/lib/core/localized_num.cpp +51 -0
  119. package/native/vendor/microtex/lib/core/meson.build +19 -0
  120. package/native/vendor/microtex/lib/core/parser.cpp +874 -0
  121. package/native/vendor/microtex/lib/core/parser.h +306 -0
  122. package/native/vendor/microtex/lib/core/split.cpp +185 -0
  123. package/native/vendor/microtex/lib/core/split.h +40 -0
  124. package/native/vendor/microtex/lib/env/env.cpp +141 -0
  125. package/native/vendor/microtex/lib/env/env.h +221 -0
  126. package/native/vendor/microtex/lib/env/meson.build +11 -0
  127. package/native/vendor/microtex/lib/env/units.cpp +109 -0
  128. package/native/vendor/microtex/lib/env/units.h +61 -0
  129. package/native/vendor/microtex/lib/graphic/font_style.cpp +63 -0
  130. package/native/vendor/microtex/lib/graphic/font_style.h +61 -0
  131. package/native/vendor/microtex/lib/graphic/graphic.cpp +38 -0
  132. package/native/vendor/microtex/lib/graphic/graphic.h +314 -0
  133. package/native/vendor/microtex/lib/graphic/graphic_basic.cpp +44 -0
  134. package/native/vendor/microtex/lib/graphic/graphic_basic.h +131 -0
  135. package/native/vendor/microtex/lib/graphic/meson.build +13 -0
  136. package/native/vendor/microtex/lib/macro/macro.cpp +143 -0
  137. package/native/vendor/microtex/lib/macro/macro.h +155 -0
  138. package/native/vendor/microtex/lib/macro/macro_accent.cpp +50 -0
  139. package/native/vendor/microtex/lib/macro/macro_accent.h +61 -0
  140. package/native/vendor/microtex/lib/macro/macro_boxes.h +68 -0
  141. package/native/vendor/microtex/lib/macro/macro_colors.cpp +42 -0
  142. package/native/vendor/microtex/lib/macro/macro_colors.h +42 -0
  143. package/native/vendor/microtex/lib/macro/macro_decl.h +16 -0
  144. package/native/vendor/microtex/lib/macro/macro_def.cpp +418 -0
  145. package/native/vendor/microtex/lib/macro/macro_delims.cpp +56 -0
  146. package/native/vendor/microtex/lib/macro/macro_delims.h +73 -0
  147. package/native/vendor/microtex/lib/macro/macro_env.h +212 -0
  148. package/native/vendor/microtex/lib/macro/macro_fonts.cpp +53 -0
  149. package/native/vendor/microtex/lib/macro/macro_fonts.h +78 -0
  150. package/native/vendor/microtex/lib/macro/macro_frac.cpp +138 -0
  151. package/native/vendor/microtex/lib/macro/macro_frac.h +50 -0
  152. package/native/vendor/microtex/lib/macro/macro_misc.cpp +211 -0
  153. package/native/vendor/microtex/lib/macro/macro_misc.h +217 -0
  154. package/native/vendor/microtex/lib/macro/macro_scripts.cpp +32 -0
  155. package/native/vendor/microtex/lib/macro/macro_scripts.h +17 -0
  156. package/native/vendor/microtex/lib/macro/macro_sizes.h +110 -0
  157. package/native/vendor/microtex/lib/macro/macro_space.cpp +31 -0
  158. package/native/vendor/microtex/lib/macro/macro_space.h +17 -0
  159. package/native/vendor/microtex/lib/macro/macro_styles.cpp +45 -0
  160. package/native/vendor/microtex/lib/macro/macro_styles.h +22 -0
  161. package/native/vendor/microtex/lib/macro/macro_types.h +48 -0
  162. package/native/vendor/microtex/lib/macro/meson.build +33 -0
  163. package/native/vendor/microtex/lib/meson.build +102 -0
  164. package/native/vendor/microtex/lib/microtex.cpp +208 -0
  165. package/native/vendor/microtex/lib/microtex.h +225 -0
  166. package/native/vendor/microtex/lib/microtexConfig.cmake.in +2 -0
  167. package/native/vendor/microtex/lib/microtexapi.h +22 -0
  168. package/native/vendor/microtex/lib/microtexconfig.h.in +7 -0
  169. package/native/vendor/microtex/lib/microtexexport.h +31 -0
  170. package/native/vendor/microtex/lib/otf/clm.cpp +405 -0
  171. package/native/vendor/microtex/lib/otf/clm.h +61 -0
  172. package/native/vendor/microtex/lib/otf/fontsense.cpp +191 -0
  173. package/native/vendor/microtex/lib/otf/fontsense.h +20 -0
  174. package/native/vendor/microtex/lib/otf/glyph.cpp +53 -0
  175. package/native/vendor/microtex/lib/otf/glyph.h +384 -0
  176. package/native/vendor/microtex/lib/otf/math_consts.h +154 -0
  177. package/native/vendor/microtex/lib/otf/meson.build +18 -0
  178. package/native/vendor/microtex/lib/otf/otf.cpp +84 -0
  179. package/native/vendor/microtex/lib/otf/otf.h +177 -0
  180. package/native/vendor/microtex/lib/otf/otfconfig.h +32 -0
  181. package/native/vendor/microtex/lib/otf/path.cpp +187 -0
  182. package/native/vendor/microtex/lib/otf/path.h +120 -0
  183. package/native/vendor/microtex/lib/render/builder.cpp +68 -0
  184. package/native/vendor/microtex/lib/render/builder.h +73 -0
  185. package/native/vendor/microtex/lib/render/meson.build +11 -0
  186. package/native/vendor/microtex/lib/render/render.cpp +136 -0
  187. package/native/vendor/microtex/lib/render/render.h +59 -0
  188. package/native/vendor/microtex/lib/unimath/font_meta.h +22 -0
  189. package/native/vendor/microtex/lib/unimath/font_src.cpp +21 -0
  190. package/native/vendor/microtex/lib/unimath/font_src.h +61 -0
  191. package/native/vendor/microtex/lib/unimath/math_type.cpp +318 -0
  192. package/native/vendor/microtex/lib/unimath/math_type.h +105 -0
  193. package/native/vendor/microtex/lib/unimath/meson.build +18 -0
  194. package/native/vendor/microtex/lib/unimath/uni_char.cpp +121 -0
  195. package/native/vendor/microtex/lib/unimath/uni_char.h +109 -0
  196. package/native/vendor/microtex/lib/unimath/uni_font.cpp +248 -0
  197. package/native/vendor/microtex/lib/unimath/uni_font.h +139 -0
  198. package/native/vendor/microtex/lib/unimath/uni_symbol.cpp +2929 -0
  199. package/native/vendor/microtex/lib/unimath/uni_symbol.h +31 -0
  200. package/native/vendor/microtex/lib/utils/dict_tree.h +68 -0
  201. package/native/vendor/microtex/lib/utils/exceptions.h +61 -0
  202. package/native/vendor/microtex/lib/utils/log.h +34 -0
  203. package/native/vendor/microtex/lib/utils/meson.build +18 -0
  204. package/native/vendor/microtex/lib/utils/nums.h +24 -0
  205. package/native/vendor/microtex/lib/utils/string_utils.cpp +85 -0
  206. package/native/vendor/microtex/lib/utils/string_utils.h +130 -0
  207. package/native/vendor/microtex/lib/utils/types.h +152 -0
  208. package/native/vendor/microtex/lib/utils/utf.cpp +115 -0
  209. package/native/vendor/microtex/lib/utils/utf.h +58 -0
  210. package/native/vendor/microtex/lib/utils/utils.cpp +40 -0
  211. package/native/vendor/microtex/lib/utils/utils.h +88 -0
  212. package/native/vendor/microtex/lib/wrapper/byte_seq.cpp +46 -0
  213. package/native/vendor/microtex/lib/wrapper/byte_seq.h +70 -0
  214. package/native/vendor/microtex/lib/wrapper/callback.cpp +10 -0
  215. package/native/vendor/microtex/lib/wrapper/callback.h +72 -0
  216. package/native/vendor/microtex/lib/wrapper/cwrapper.cpp +206 -0
  217. package/native/vendor/microtex/lib/wrapper/cwrapper.h +305 -0
  218. package/native/vendor/microtex/lib/wrapper/graphic_wrapper.cpp +211 -0
  219. package/native/vendor/microtex/lib/wrapper/graphic_wrapper.h +159 -0
  220. package/native/vendor/microtex/lib/wrapper/meson.build +22 -0
  221. package/native/vendor/microtex/meson.build +75 -0
  222. package/native/vendor/microtex/meson_options.txt +29 -0
  223. package/native/vendor/microtex/platform/cairo/CMakeLists.txt +36 -0
  224. package/native/vendor/microtex/platform/cairo/graphic_cairo.cpp +384 -0
  225. package/native/vendor/microtex/platform/cairo/graphic_cairo.h +119 -0
  226. package/native/vendor/microtex/platform/cairo/meson.build +47 -0
  227. package/native/vendor/microtex/platform/cairo/microtex-cairoConfig.cmake.in +11 -0
  228. package/native/vendor/microtex/platform/flutter/microtex/.metadata +10 -0
  229. package/native/vendor/microtex/platform/flutter/microtex/CHANGELOG.md +3 -0
  230. package/native/vendor/microtex/platform/flutter/microtex/LICENSE +1 -0
  231. package/native/vendor/microtex/platform/flutter/microtex/README.md +15 -0
  232. package/native/vendor/microtex/platform/flutter/microtex/analysis_options.yaml +4 -0
  233. package/native/vendor/microtex/platform/flutter/microtex/android/build.gradle +56 -0
  234. package/native/vendor/microtex/platform/flutter/microtex/android/settings.gradle +1 -0
  235. package/native/vendor/microtex/platform/flutter/microtex/android/src/main/AndroidManifest.xml +3 -0
  236. package/native/vendor/microtex/platform/flutter/microtex/android/src/main/kotlin/io/nano/microtex/microtex/MicrotexPlugin.kt +35 -0
  237. package/native/vendor/microtex/platform/flutter/microtex/example/.metadata +10 -0
  238. package/native/vendor/microtex/platform/flutter/microtex/example/README.md +16 -0
  239. package/native/vendor/microtex/platform/flutter/microtex/example/analysis_options.yaml +31 -0
  240. package/native/vendor/microtex/platform/flutter/microtex/example/android/app/build.gradle +68 -0
  241. package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/debug/AndroidManifest.xml +7 -0
  242. package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/AndroidManifest.xml +34 -0
  243. package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/kotlin/io/nano/microtex/microtex_example/MainActivity.kt +6 -0
  244. package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/drawable/launch_background.xml +12 -0
  245. package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/drawable-v21/launch_background.xml +12 -0
  246. package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  247. package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  248. package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  249. package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  250. package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  251. package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/values/styles.xml +18 -0
  252. package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/main/res/values-night/styles.xml +18 -0
  253. package/native/vendor/microtex/platform/flutter/microtex/example/android/app/src/profile/AndroidManifest.xml +7 -0
  254. package/native/vendor/microtex/platform/flutter/microtex/example/android/build.gradle +31 -0
  255. package/native/vendor/microtex/platform/flutter/microtex/example/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  256. package/native/vendor/microtex/platform/flutter/microtex/example/android/gradle.properties +3 -0
  257. package/native/vendor/microtex/platform/flutter/microtex/example/android/settings.gradle +11 -0
  258. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Flutter/AppFrameworkInfo.plist +26 -0
  259. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Flutter/Debug.xcconfig +2 -0
  260. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Flutter/Release.xcconfig +2 -0
  261. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Podfile +41 -0
  262. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Podfile.lock +22 -0
  263. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/AppDelegate.swift +13 -0
  264. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +122 -0
  265. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png +0 -0
  266. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png +0 -0
  267. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png +0 -0
  268. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png +0 -0
  269. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png +0 -0
  270. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png +0 -0
  271. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png +0 -0
  272. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png +0 -0
  273. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png +0 -0
  274. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png +0 -0
  275. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png +0 -0
  276. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png +0 -0
  277. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png +0 -0
  278. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png +0 -0
  279. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png +0 -0
  280. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +23 -0
  281. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png +0 -0
  282. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png +0 -0
  283. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png +0 -0
  284. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +5 -0
  285. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Base.lproj/LaunchScreen.storyboard +37 -0
  286. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Base.lproj/Main.storyboard +26 -0
  287. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Info.plist +49 -0
  288. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner/Runner-Bridging-Header.h +1 -0
  289. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.pbxproj +549 -0
  290. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  291. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  292. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  293. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +87 -0
  294. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcworkspace/contents.xcworkspacedata +10 -0
  295. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  296. package/native/vendor/microtex/platform/flutter/microtex/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  297. package/native/vendor/microtex/platform/flutter/microtex/example/lib/main.dart +23 -0
  298. package/native/vendor/microtex/platform/flutter/microtex/example/lib/screen/edit_in_one.dart +0 -0
  299. package/native/vendor/microtex/platform/flutter/microtex/example/lib/screen/edit_screen.dart +208 -0
  300. package/native/vendor/microtex/platform/flutter/microtex/example/lib/utils/convert_spans.dart +63 -0
  301. package/native/vendor/microtex/platform/flutter/microtex/example/lib/utils/string_ext.dart +10 -0
  302. package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/cmp.dart +118 -0
  303. package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/draggable.dart +75 -0
  304. package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/rich.dart +23 -0
  305. package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/split.dart +72 -0
  306. package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/tex_highlight_controller.dart +66 -0
  307. package/native/vendor/microtex/platform/flutter/microtex/example/lib/widget/tex_input_controller.dart +19 -0
  308. package/native/vendor/microtex/platform/flutter/microtex/example/linux/CMakeLists.txt +116 -0
  309. package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/CMakeLists.txt +87 -0
  310. package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/generated_plugin_registrant.cc +15 -0
  311. package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/generated_plugin_registrant.h +15 -0
  312. package/native/vendor/microtex/platform/flutter/microtex/example/linux/flutter/generated_plugins.cmake +24 -0
  313. package/native/vendor/microtex/platform/flutter/microtex/example/linux/main.cc +6 -0
  314. package/native/vendor/microtex/platform/flutter/microtex/example/linux/my_application.cc +104 -0
  315. package/native/vendor/microtex/platform/flutter/microtex/example/linux/my_application.h +18 -0
  316. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Flutter/Flutter-Debug.xcconfig +2 -0
  317. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Flutter/Flutter-Release.xcconfig +2 -0
  318. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Flutter/GeneratedPluginRegistrant.swift +12 -0
  319. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Podfile +40 -0
  320. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Podfile.lock +22 -0
  321. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/AppDelegate.swift +9 -0
  322. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
  323. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
  324. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
  325. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
  326. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
  327. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
  328. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
  329. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
  330. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Base.lproj/MainMenu.xib +343 -0
  331. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/AppInfo.xcconfig +14 -0
  332. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/Debug.xcconfig +2 -0
  333. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/Release.xcconfig +2 -0
  334. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Configs/Warnings.xcconfig +13 -0
  335. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/DebugProfile.entitlements +12 -0
  336. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Info.plist +32 -0
  337. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/MainFlutterWindow.swift +15 -0
  338. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner/Release.entitlements +8 -0
  339. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcodeproj/project.pbxproj +633 -0
  340. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  341. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +87 -0
  342. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcworkspace/contents.xcworkspacedata +10 -0
  343. package/native/vendor/microtex/platform/flutter/microtex/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  344. package/native/vendor/microtex/platform/flutter/microtex/example/pubspec.lock +191 -0
  345. package/native/vendor/microtex/platform/flutter/microtex/example/pubspec.yaml +56 -0
  346. package/native/vendor/microtex/platform/flutter/microtex/example/test/widget_test.dart +26 -0
  347. package/native/vendor/microtex/platform/flutter/microtex/example/windows/CMakeLists.txt +95 -0
  348. package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/CMakeLists.txt +103 -0
  349. package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/generated_plugin_registrant.cc +14 -0
  350. package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/generated_plugin_registrant.h +15 -0
  351. package/native/vendor/microtex/platform/flutter/microtex/example/windows/flutter/generated_plugins.cmake +24 -0
  352. package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/CMakeLists.txt +17 -0
  353. package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/Runner.rc +121 -0
  354. package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/flutter_window.cpp +61 -0
  355. package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/flutter_window.h +33 -0
  356. package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/main.cpp +43 -0
  357. package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/resource.h +16 -0
  358. package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/resources/app_icon.ico +0 -0
  359. package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/runner.exe.manifest +20 -0
  360. package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/utils.cpp +64 -0
  361. package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/utils.h +19 -0
  362. package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/win32_window.cpp +245 -0
  363. package/native/vendor/microtex/platform/flutter/microtex/example/windows/runner/win32_window.h +98 -0
  364. package/native/vendor/microtex/platform/flutter/microtex/ios/Assets/.gitkeep +0 -0
  365. package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/MicrotexPlugin.h +4 -0
  366. package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/MicrotexPlugin.m +19 -0
  367. package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/SwiftMicrotexPlugin.swift +14 -0
  368. package/native/vendor/microtex/platform/flutter/microtex/ios/Classes/dummy.h +4 -0
  369. package/native/vendor/microtex/platform/flutter/microtex/ios/microtex.podspec +27 -0
  370. package/native/vendor/microtex/platform/flutter/microtex/lib/microtex.dart +7 -0
  371. package/native/vendor/microtex/platform/flutter/microtex/lib/src/bindings.dart +218 -0
  372. package/native/vendor/microtex/platform/flutter/microtex/lib/src/bounds.dart +10 -0
  373. package/native/vendor/microtex/platform/flutter/microtex/lib/src/context.dart +205 -0
  374. package/native/vendor/microtex/platform/flutter/microtex/lib/src/fontdesc.dart +14 -0
  375. package/native/vendor/microtex/platform/flutter/microtex/lib/src/fontmeta.dart +14 -0
  376. package/native/vendor/microtex/platform/flutter/microtex/lib/src/pathcache.dart +17 -0
  377. package/native/vendor/microtex/platform/flutter/microtex/lib/src/render.dart +291 -0
  378. package/native/vendor/microtex/platform/flutter/microtex/lib/src/texstyle.dart +11 -0
  379. package/native/vendor/microtex/platform/flutter/microtex/lib/src/textlayout.dart +93 -0
  380. package/native/vendor/microtex/platform/flutter/microtex/lib/src/widget.dart +163 -0
  381. package/native/vendor/microtex/platform/flutter/microtex/linux/CMakeLists.txt +33 -0
  382. package/native/vendor/microtex/platform/flutter/microtex/linux/include/microtex/microtex_plugin.h +26 -0
  383. package/native/vendor/microtex/platform/flutter/microtex/linux/microtex_plugin.cc +70 -0
  384. package/native/vendor/microtex/platform/flutter/microtex/macos/Classes/MicrotexPlugin.swift +20 -0
  385. package/native/vendor/microtex/platform/flutter/microtex/macos/Classes/dummy.h +4 -0
  386. package/native/vendor/microtex/platform/flutter/microtex/macos/Classes/microtex-Bridging-Header.h +1 -0
  387. package/native/vendor/microtex/platform/flutter/microtex/macos/microtex.podspec +26 -0
  388. package/native/vendor/microtex/platform/flutter/microtex/nativelib/CMakeLists.txt +44 -0
  389. package/native/vendor/microtex/platform/flutter/microtex/nativelib/builddarwin.sh +108 -0
  390. package/native/vendor/microtex/platform/flutter/microtex/pubspec.yaml +37 -0
  391. package/native/vendor/microtex/platform/flutter/microtex/test/microtex_test.dart +23 -0
  392. package/native/vendor/microtex/platform/flutter/microtex/windows/CMakeLists.txt +32 -0
  393. package/native/vendor/microtex/platform/flutter/microtex/windows/include/microtex/microtex_plugin.h +23 -0
  394. package/native/vendor/microtex/platform/flutter/microtex/windows/microtex_plugin.cpp +82 -0
  395. package/native/vendor/microtex/platform/gdi_win/CMakeLists.txt +20 -0
  396. package/native/vendor/microtex/platform/gdi_win/graphic_win32.cpp +352 -0
  397. package/native/vendor/microtex/platform/gdi_win/graphic_win32.h +137 -0
  398. package/native/vendor/microtex/platform/gdi_win/meson.build +39 -0
  399. package/native/vendor/microtex/platform/gtk/CMakeLists.txt +36 -0
  400. package/native/vendor/microtex/platform/gtk/meson.build +65 -0
  401. package/native/vendor/microtex/platform/gtk/microtex-gtkConfig.cmake.in +11 -0
  402. package/native/vendor/microtex/platform/gtk/microtexequation.cpp +708 -0
  403. package/native/vendor/microtex/platform/gtk/microtexequation.h +72 -0
  404. package/native/vendor/microtex/platform/qt/CMakeLists.txt +37 -0
  405. package/native/vendor/microtex/platform/qt/graphic_qt.cpp +355 -0
  406. package/native/vendor/microtex/platform/qt/graphic_qt.h +116 -0
  407. package/native/vendor/microtex/platform/qt/meson.build +38 -0
  408. package/native/vendor/microtex/platform/qt/microtex-qtConfig.cmake.in +7 -0
  409. package/native/vendor/microtex/platform/skia/CMakeLists.txt +46 -0
  410. package/native/vendor/microtex/platform/skia/graphic_skia.cpp +306 -0
  411. package/native/vendor/microtex/platform/skia/graphic_skia.h +125 -0
  412. package/native/vendor/microtex/platform/skia/microtex-skiaConfig.cmake.in +6 -0
  413. package/native/vendor/microtex/platform/wasm/CMakeLists.txt +38 -0
  414. package/native/vendor/microtex/platform/wasm/emscripten.cross +31 -0
  415. package/native/vendor/microtex/platform/wasm/main.cpp +15 -0
  416. package/native/vendor/microtex/platform/wasm/meson.build +8 -0
  417. package/native/vendor/microtex/platform/wasm/prebuild-example-meson.sh +21 -0
  418. package/native/vendor/microtex/platform/wasm/prebuild-example.sh +21 -0
  419. package/native/vendor/microtex/platform/wasm/prebuild-lib-meson.sh +28 -0
  420. package/native/vendor/microtex/platform/wasm/prebuild-lib.sh +31 -0
  421. package/native/vendor/microtex/platform/wasm/web/.babelrc +10 -0
  422. package/native/vendor/microtex/platform/wasm/web/example/examples.js +43 -0
  423. package/native/vendor/microtex/platform/wasm/web/example/hello.js +31 -0
  424. package/native/vendor/microtex/platform/wasm/web/example/index.html +55 -0
  425. package/native/vendor/microtex/platform/wasm/web/example/index.js +243 -0
  426. package/native/vendor/microtex/platform/wasm/web/example/styles.css +86 -0
  427. package/native/vendor/microtex/platform/wasm/web/example/utils.js +47 -0
  428. package/native/vendor/microtex/platform/wasm/web/lib/context.js +271 -0
  429. package/native/vendor/microtex/platform/wasm/web/lib/index.js +10 -0
  430. package/native/vendor/microtex/platform/wasm/web/lib/render.js +293 -0
  431. package/native/vendor/microtex/platform/wasm/web/lib/runtime.js +14 -0
  432. package/native/vendor/microtex/platform/wasm/web/lib/svg.js +237 -0
  433. package/native/vendor/microtex/platform/wasm/web/lib/textlayout.js +88 -0
  434. package/native/vendor/microtex/platform/wasm/web/package-lock.json +5931 -0
  435. package/native/vendor/microtex/platform/wasm/web/package.json +45 -0
  436. package/native/vendor/microtex/platform/wasm/web/publish-example.sh +17 -0
  437. package/native/vendor/microtex/platform/wasm/web/rollup.config.example.js +24 -0
  438. package/native/vendor/microtex/platform/wasm/web/rollup.config.lib.js +16 -0
  439. package/native/vendor/microtex/prebuilt/otf2clm.py +807 -0
  440. package/native/vendor/microtex/prebuilt/otf2clm.sh +9 -0
  441. package/native/vendor/microtex/prebuilt/preclms.sh +17 -0
  442. package/native/vendor/microtex/readme/example_bw_false.svg +680 -0
  443. package/native/vendor/microtex/readme/example_bw_true.svg +680 -0
  444. package/native/vendor/microtex/readme/example_cjk_trying.svg +54 -0
  445. package/native/vendor/microtex/readme/example_custom_symbols.svg +92 -0
  446. package/native/vendor/microtex/readme/example_debug.svg +764 -0
  447. package/native/vendor/microtex/readme/example_emoji.svg +199 -0
  448. package/native/vendor/microtex/readme/example_have_log.svg +79 -0
  449. package/native/vendor/microtex/readme/example_keep_trying.svg +101 -0
  450. package/native/vendor/microtex/readme/example_logos.svg +50 -0
  451. package/native/vendor/microtex/readme/example_ubuntu.png +0 -0
  452. package/native/vendor/microtex/readme/example_windows.png +0 -0
  453. package/native/vendor/microtex/readme/samples/sample_0.svg +665 -0
  454. package/native/vendor/microtex/readme/samples/sample_1.svg +1259 -0
  455. package/native/vendor/microtex/readme/samples/sample_10.svg +333 -0
  456. package/native/vendor/microtex/readme/samples/sample_11.svg +306 -0
  457. package/native/vendor/microtex/readme/samples/sample_2.svg +2461 -0
  458. package/native/vendor/microtex/readme/samples/sample_3.svg +2653 -0
  459. package/native/vendor/microtex/readme/samples/sample_4.svg +554 -0
  460. package/native/vendor/microtex/readme/samples/sample_5.svg +247 -0
  461. package/native/vendor/microtex/readme/samples/sample_6.svg +1082 -0
  462. package/native/vendor/microtex/readme/samples/sample_7.svg +518 -0
  463. package/native/vendor/microtex/readme/samples/sample_8.svg +529 -0
  464. package/native/vendor/microtex/readme/samples/sample_9.svg +1702 -0
  465. package/native/vendor/microtex/readme/samples.md +301 -0
  466. package/native/vendor/microtex/readme/tex_logo.svg +19 -0
  467. package/native/vendor/microtex/res/EXAMPLE.txt +25 -0
  468. package/native/vendor/microtex/res/SAMPLES.tex +946 -0
  469. package/native/vendor/microtex/res/firamath/FiraMath-Regular.clm1 +0 -0
  470. package/native/vendor/microtex/res/firamath/FiraMath-Regular.clm2 +0 -0
  471. package/native/vendor/microtex/res/firamath/FiraMath-Regular.otf +0 -0
  472. package/native/vendor/microtex/res/firamath/README.md +42 -0
  473. package/native/vendor/microtex/res/lm-math/README +92 -0
  474. package/native/vendor/microtex/res/lm-math/latinmodern-math.clm1 +0 -0
  475. package/native/vendor/microtex/res/lm-math/latinmodern-math.clm2 +0 -0
  476. package/native/vendor/microtex/res/lm-math/latinmodern-math.otf +0 -0
  477. package/native/vendor/microtex/res/tex-gyre/README-TeX-Gyre-DejaVu-Math.txt +82 -0
  478. package/native/vendor/microtex/res/tex-gyre/texgyredejavu-math.clm1 +0 -0
  479. package/native/vendor/microtex/res/tex-gyre/texgyredejavu-math.clm2 +0 -0
  480. package/native/vendor/microtex/res/tex-gyre/texgyredejavu-math.otf +0 -0
  481. package/native/vendor/microtex/res/xits/FONTLOG.txt +246 -0
  482. package/native/vendor/microtex/res/xits/OFL.txt +98 -0
  483. package/native/vendor/microtex/res/xits/README.txt +15 -0
  484. package/native/vendor/microtex/res/xits/XITS-Bold.clm1 +0 -0
  485. package/native/vendor/microtex/res/xits/XITS-Bold.clm2 +0 -0
  486. package/native/vendor/microtex/res/xits/XITS-Bold.otf +0 -0
  487. package/native/vendor/microtex/res/xits/XITS-BoldItalic.clm1 +0 -0
  488. package/native/vendor/microtex/res/xits/XITS-BoldItalic.clm2 +0 -0
  489. package/native/vendor/microtex/res/xits/XITS-BoldItalic.otf +0 -0
  490. package/native/vendor/microtex/res/xits/XITS-Italic.clm1 +0 -0
  491. package/native/vendor/microtex/res/xits/XITS-Italic.clm2 +0 -0
  492. package/native/vendor/microtex/res/xits/XITS-Italic.otf +0 -0
  493. package/native/vendor/microtex/res/xits/XITS-Regular.clm1 +0 -0
  494. package/native/vendor/microtex/res/xits/XITS-Regular.clm2 +0 -0
  495. package/native/vendor/microtex/res/xits/XITS-Regular.otf +0 -0
  496. package/native/vendor/microtex/res/xits/XITSMath-Bold.clm1 +0 -0
  497. package/native/vendor/microtex/res/xits/XITSMath-Bold.clm2 +0 -0
  498. package/native/vendor/microtex/res/xits/XITSMath-Bold.otf +0 -0
  499. package/native/vendor/microtex/res/xits/XITSMath-Regular.clm1 +0 -0
  500. package/native/vendor/microtex/res/xits/XITSMath-Regular.clm2 +0 -0
  501. package/native/vendor/microtex/res/xits/XITSMath-Regular.otf +0 -0
  502. package/native/vendor/microtex/test/clm/meson.build +10 -0
  503. package/native/vendor/microtex/test/clm/test_clm.cpp +140 -0
  504. package/native/vendor/microtex/test/env/meson.build +10 -0
  505. package/native/vendor/microtex/test/env/test_env.cpp +100 -0
  506. package/native/vendor/microtex/test/fuzzer/afl.native +20 -0
  507. package/native/vendor/microtex/test/fuzzer/fuzz.sh +135 -0
  508. package/native/vendor/microtex/test/fuzzer/fuzzer.cpp +61 -0
  509. package/native/vendor/microtex/test/fuzzer/generateSeed.java +33 -0
  510. package/native/vendor/microtex/test/fuzzer/meson.build +9 -0
  511. package/native/vendor/microtex/test/fuzzer/microtex.dict +3708 -0
  512. package/native/vendor/microtex/test/fuzzer/platform_none.cpp +100 -0
  513. package/native/vendor/microtex/test/has_filesystem.cpp +8 -0
  514. package/native/vendor/microtex/test/meson.build +6 -0
  515. package/native/vendor/nanosvg.h +3278 -0
  516. package/native/vendor/nanosvgrast.h +1472 -0
  517. package/native/vendor/zigtex/.github/assets/example.svg +27 -0
  518. package/native/vendor/zigtex/LICENSE +674 -0
  519. package/native/vendor/zigtex/README.md +52 -0
  520. package/native/vendor/zigtex/build.zig +52 -0
  521. package/native/vendor/zigtex/build.zig.zon +16 -0
  522. package/native/vendor/zigtex/fonts/latinmodern-math.clm2 +0 -0
  523. package/native/vendor/zigtex/src/main.zig +22 -0
  524. package/native/vendor/zigtex/src/root.zig +124 -0
  525. package/native/vendor/zigtex/src/svg.zig +273 -0
  526. package/native/vendor/zigtex/src/tex.zig +383 -0
  527. package/native/zigtex-0.16.patch +35 -0
  528. package/package.json +27 -0
  529. package/scripts/bootstrap-native +89 -0
@@ -0,0 +1,117 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <template class="MicroTexGtkDemoWin" parent="GtkApplicationWindow">
4
+ <property name="title">µTeX GTK Demo</property>
5
+ <property name="child">
6
+ <object class="GtkPaned" id="pane">
7
+ <property name="orientation">horizontal</property>
8
+ <property name="wide-handle">true</property>
9
+ <child>
10
+ <object class="GtkBox">
11
+ <property name="orientation">vertical</property>
12
+ <child>
13
+ <object class="GtkBox">
14
+ <property name="orientation">horizontal</property>
15
+ <property name="spacing">4</property>
16
+ <child>
17
+ <object class="GtkButton" id="sample_btn">
18
+ <property name="label">Next</property>
19
+ <property name="sensitive">false</property>
20
+ <property name="tooltip-text">Next sample</property>
21
+ <style>
22
+ <class name="suggested-action"/>
23
+ </style>
24
+ </object>
25
+ </child>
26
+ <child>
27
+ <object class="GtkSeparator">
28
+ <property name="orientation">vertical</property>
29
+ </object>
30
+ </child>
31
+ <child>
32
+ <object class="GtkSpinButton">
33
+ <property name="adjustment">
34
+ <object class="GtkAdjustment" id="font_size">
35
+ <property name="lower">6.0</property>
36
+ <property name="upper">340282346638528859811704183484516925440.0</property>
37
+ <property name="value">18.0</property>
38
+ <property name="step-increment">0.1</property>
39
+ <property name="page-increment">1.0</property>
40
+ <property name="page-size">1.0</property>
41
+ </object>
42
+ </property>
43
+ <property name="climb-rate">1.5</property>
44
+ <property name="digits">1</property>
45
+ <property name="width-chars">4</property>
46
+ <property name="tooltip-text">Font size</property>
47
+ </object>
48
+ </child>
49
+ <child>
50
+ <object class="GtkColorButton" id="color_btn">
51
+ <property name="tooltip-text">Text color</property>
52
+ </object>
53
+ </child>
54
+ <style>
55
+ <class name="toolbar"/>
56
+ </style>
57
+ </object>
58
+ </child>
59
+ <child>
60
+ <object class="GtkScrolledWindow">
61
+ <property name="vexpand">true</property>
62
+ <property name="child">
63
+ <object class="GtkSourceView">
64
+ <property name="buffer">
65
+ <object class="GtkSourceBuffer" id="buffer"/>
66
+ </property>
67
+ </object>
68
+ </property>
69
+ </object>
70
+ </child>
71
+ </object>
72
+ </child>
73
+ <child>
74
+ <object class="GtkBox">
75
+ <property name="orientation">vertical</property>
76
+ <child>
77
+ <object class="GtkScrolledWindow">
78
+ <property name="vexpand">true</property>
79
+ <property name="child">
80
+ <object class="MicroTexEquation" id="equation">
81
+ <property name="latex"
82
+ bind-source="buffer"
83
+ bind-property="text"
84
+ bind-flags="sync-create|bidirectional"/>
85
+ <property name="text-size"
86
+ bind-source="font_size"
87
+ bind-property="value"
88
+ bind-flags="sync-create|bidirectional"/>
89
+ </object>
90
+ </property>
91
+ </object>
92
+ </child>
93
+ <child>
94
+ <object class="GtkBox">
95
+ <property name="orientation">horizontal</property>
96
+ <property name="spacing">4</property>
97
+ <child>
98
+ <object class="GtkButton" id="save_btn">
99
+ <property name="label">Save as SVG</property>
100
+ <property name="halign">end</property>
101
+ <property name="hexpand">true</property>
102
+ <style>
103
+ <class name="suggested-action"/>
104
+ </style>
105
+ </object>
106
+ </child>
107
+ <style>
108
+ <class name="toolbar"/>
109
+ </style>
110
+ </object>
111
+ </child>
112
+ </object>
113
+ </child>
114
+ </object>
115
+ </property>
116
+ </template>
117
+ </interface>
@@ -0,0 +1,19 @@
1
+ add_executable(
2
+ microtex-gtkmm-example
3
+ ../samples/samples.cpp
4
+ gtkmm_main.cpp
5
+ )
6
+
7
+ target_include_directories(microtex-gtkmm-example PUBLIC ../samples)
8
+
9
+ add_definitions(-DBUILD_EXAMPLE_GTKMM)
10
+
11
+ find_package(PkgConfig REQUIRED)
12
+ pkg_check_modules(GSVMM REQUIRED IMPORTED_TARGET gtksourceviewmm-3.0)
13
+
14
+ target_link_libraries(
15
+ microtex-gtkmm-example PRIVATE
16
+ PkgConfig::GSVMM
17
+ microtex
18
+ microtex-cairo
19
+ )
@@ -0,0 +1,531 @@
1
+ #include <gdkmm/rgba.h>
2
+ #include <gtkmm/adjustment.h>
3
+ #include <gtkmm/application.h>
4
+ #include <gtkmm/box.h>
5
+ #include <gtkmm/button.h>
6
+ #include <gtkmm/drawingarea.h>
7
+ #include <gtkmm/filechooserdialog.h>
8
+ #include <gtkmm/paned.h>
9
+ #include <gtkmm/scrolledwindow.h>
10
+ #include <gtkmm/spinbutton.h>
11
+ #include <gtkmm/window.h>
12
+ #include <gtksourceviewmm/init.h>
13
+ #include <gtksourceviewmm/languagemanager.h>
14
+ #include <gtksourceviewmm/view.h>
15
+ #include <pangomm/init.h>
16
+
17
+ #include <chrono>
18
+ #include <optional>
19
+
20
+ #include "graphic_cairo.h"
21
+ #include "microtex.h"
22
+ #include "samples.h"
23
+ #include "utils/log.h"
24
+ #include "utils/string_utils.h"
25
+
26
+ using namespace std;
27
+ using namespace microtex;
28
+
29
+ class TeXDrawingArea : public Gtk::DrawingArea {
30
+ private:
31
+ Render* _render;
32
+ float _text_size;
33
+ int _padding;
34
+
35
+ void checkInvalidate() {
36
+ if (_render == nullptr) return;
37
+
38
+ int parent_width = get_parent()->get_width();
39
+ int parent_height = get_parent()->get_height();
40
+ int target_width = parent_width;
41
+ int target_height = parent_height;
42
+
43
+ int extra = (int)(_padding * 2);
44
+ if (parent_width < _render->getWidth() + extra) {
45
+ target_width = _render->getWidth() + extra;
46
+ }
47
+ if (parent_height < _render->getHeight() + extra) {
48
+ target_height = _render->getHeight() + extra;
49
+ }
50
+
51
+ set_size_request(target_width, target_height);
52
+
53
+ auto win = get_window();
54
+ if (win) {
55
+ auto al = get_allocation();
56
+ Gdk::Rectangle r(0, 0, al.get_width(), al.get_height());
57
+ win->invalidate_rect(r, false);
58
+ }
59
+ }
60
+
61
+ public:
62
+ TeXDrawingArea() : _render(nullptr), _text_size(20.f), _padding(10) {
63
+ override_background_color(Gdk::RGBA("White"));
64
+ }
65
+
66
+ float getTextSize() { return _text_size; }
67
+
68
+ void setTextSize(float size) {
69
+ if (size == _text_size) return;
70
+ _text_size = size;
71
+ if (_render != nullptr) {
72
+ _render->setTextSize(_text_size);
73
+ checkInvalidate();
74
+ }
75
+ }
76
+
77
+ void setLaTeX(const string& latex) {
78
+ delete _render;
79
+ auto start = std::chrono::high_resolution_clock::now();
80
+ _render = MicroTeX::parse(
81
+ latex,
82
+ get_allocated_width() - _padding * 2,
83
+ _text_size,
84
+ _text_size / 3.f,
85
+ 0xff424242
86
+ );
87
+ auto stop = std::chrono::high_resolution_clock::now();
88
+ auto duration = std::chrono::duration_cast<std::chrono::microseconds>(stop - start);
89
+ printf("parse duration: %ld(us)\n", duration.count());
90
+
91
+ checkInvalidate();
92
+ }
93
+
94
+ bool isRenderDisplayed() { return _render != nullptr; }
95
+
96
+ int getRenderWidth() { return _render == nullptr ? 0 : _render->getWidth() + _padding * 2; }
97
+
98
+ int getRenderHeight() { return _render == nullptr ? 0 : _render->getHeight() + _padding * 2; }
99
+
100
+ void drawInContext(const Cairo::RefPtr<Cairo::Context>& cr) {
101
+ if (_render == nullptr) return;
102
+ Graphics2D_cairo g2(cr->cobj());
103
+ _render->draw(g2, _padding, _padding);
104
+ }
105
+
106
+ ~TeXDrawingArea() override { delete _render; }
107
+
108
+ protected:
109
+ bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr) override {
110
+ cr->set_source_rgb(1, 1, 1);
111
+ cr->rectangle(0, 0, get_width(), get_height());
112
+ cr->fill();
113
+ if (_render == nullptr) return true;
114
+ auto start = std::chrono::high_resolution_clock::now();
115
+ Graphics2D_cairo g2(cr->cobj());
116
+ _render->draw(g2, _padding, _padding);
117
+ auto stop = std::chrono::high_resolution_clock::now();
118
+ auto duration = std::chrono::duration_cast<std::chrono::microseconds>(stop - start);
119
+ printf("render duration: %ld(us)\n", duration.count());
120
+ return true;
121
+ }
122
+ };
123
+
124
+ class MainWindow : public Gtk::Window {
125
+ protected:
126
+ Gsv::View _tex_editor;
127
+ Gtk::SpinButton _size_spin;
128
+ TeXDrawingArea _tex;
129
+
130
+ Gtk::Label _size_change_info;
131
+ Gtk::Button _next, _rendering, _save;
132
+
133
+ Gtk::ScrolledWindow _text_scroller, _drawing_scroller;
134
+ Gtk::Box _side_box, _bottom_box;
135
+ Gtk::Paned _main_box;
136
+
137
+ Samples _samples;
138
+
139
+ public:
140
+ MainWindow(const std::string& samplesFile)
141
+ : _size_change_info("change text size: "),
142
+ _next("Next Example"),
143
+ _rendering("Rendering"),
144
+ _save("Save as SVG"),
145
+ _side_box(Gtk::ORIENTATION_VERTICAL),
146
+ _samples(samplesFile) {
147
+ // init before use
148
+ Gsv::init();
149
+
150
+ set_border_width(10);
151
+ set_size_request(1220, 640);
152
+
153
+ _drawing_scroller.set_size_request(720);
154
+ _drawing_scroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
155
+ _drawing_scroller.add(_tex);
156
+
157
+ auto lang = Gsv::LanguageManager::get_default()->get_language("latex");
158
+ auto buffer = Gsv::Buffer::create(lang);
159
+ buffer->set_highlight_syntax(true);
160
+ _tex_editor.set_source_buffer(buffer);
161
+ _tex_editor.set_show_line_numbers(true);
162
+ _tex_editor.set_highlight_current_line(true);
163
+ _tex_editor.set_tab_width(4);
164
+ _tex_editor.override_font(Pango::FontDescription("Monospace 12"));
165
+ _tex_editor.signal_key_press_event().connect(
166
+ sigc::mem_fun(*this, &MainWindow::on_text_key_press),
167
+ false
168
+ );
169
+ _tex_editor.set_border_width(5);
170
+
171
+ _text_scroller.set_size_request(480);
172
+ _text_scroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
173
+ _text_scroller.add(_tex_editor);
174
+
175
+ Glib::RefPtr<Gtk::Adjustment> adj = Gtk::Adjustment::create(_tex.getTextSize(), 1, 300);
176
+ adj->signal_value_changed().connect(sigc::mem_fun(*this, &MainWindow::on_text_size_changed));
177
+ _size_spin.set_adjustment(adj);
178
+ _next.set_sensitive(!_samples.isEmpty());
179
+ _next.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::on_next_clicked));
180
+ _rendering.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::on_rendering_clicked));
181
+ _save.signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::on_save_clicked));
182
+ _save.set_sensitive(_tex.isRenderDisplayed());
183
+
184
+ _bottom_box.set_spacing(10);
185
+ _bottom_box.pack_start(_size_change_info, Gtk::PACK_SHRINK);
186
+ _bottom_box.pack_start(_size_spin);
187
+ _bottom_box.pack_start(_next, Gtk::PACK_SHRINK);
188
+ _bottom_box.pack_start(_rendering, Gtk::PACK_SHRINK);
189
+ _bottom_box.pack_start(_save, Gtk::PACK_SHRINK);
190
+
191
+ _side_box.set_spacing(5);
192
+ _side_box.set_size_request(480);
193
+ _side_box.pack_start(_text_scroller);
194
+ _side_box.pack_start(_bottom_box, Gtk::PACK_SHRINK);
195
+
196
+ _main_box.pack1(_drawing_scroller, true, false);
197
+ _main_box.pack2(_side_box, true, false);
198
+
199
+ add(_main_box);
200
+
201
+ show_all_children();
202
+ }
203
+
204
+ ~MainWindow() override = default;
205
+
206
+ protected:
207
+ void on_next_clicked() {
208
+ const auto& sample = _samples.next();
209
+ _tex_editor.get_buffer()->set_text(sample);
210
+ _tex.setLaTeX(sample);
211
+ _save.set_sensitive(_tex.isRenderDisplayed());
212
+ }
213
+
214
+ void on_save_clicked() {
215
+ Gtk::FileChooserDialog dialog(*this, "Save as SVG", Gtk::FILE_CHOOSER_ACTION_SAVE);
216
+ dialog.add_button("Cancel", Gtk::RESPONSE_CANCEL);
217
+ dialog.add_button("Confirm", Gtk::RESPONSE_OK);
218
+ int result = dialog.run();
219
+ if (result == Gtk::RESPONSE_OK) {
220
+ auto file = dialog.get_filename();
221
+ auto surface = Cairo::SvgSurface::create(file, _tex.getRenderWidth(), _tex.getRenderHeight());
222
+ auto context = Cairo::Context::create(surface);
223
+ _tex.drawInContext(context);
224
+ }
225
+ }
226
+
227
+ void on_rendering_clicked() {
228
+ string x = _tex_editor.get_buffer()->get_text();
229
+ _tex.setLaTeX(x);
230
+ _save.set_sensitive(_tex.isRenderDisplayed());
231
+ }
232
+
233
+ void on_text_size_changed() {
234
+ float size = _size_spin.get_adjustment()->get_value();
235
+ _tex.setTextSize(size);
236
+ }
237
+
238
+ bool on_text_key_press(GdkEventKey* e) {
239
+ if (e->keyval == GDK_KEY_Return && e->state & GDK_CONTROL_MASK) {
240
+ on_rendering_clicked();
241
+ return true;
242
+ }
243
+ return false;
244
+ }
245
+ };
246
+
247
+ #define BOLD_ANSI "\x1b[1m"
248
+ #define RESET_ANSI "\x1b[0m"
249
+ #define RED_ANSI "\x1b[31m"
250
+ #define GREEN_ANSI "\x1b[32m"
251
+
252
+ class Headless {
253
+ public:
254
+ string _outputDir;
255
+ string _samplesFile;
256
+ string _prefix;
257
+
258
+ string _input;
259
+ string _outputFile;
260
+
261
+ float _textSize = 20.f;
262
+ color _foreground = BLACK;
263
+ color _background = TRANSPARENT;
264
+ float _padding = 10.f;
265
+ float _maxWidth = 720.f;
266
+
267
+ void generateSingle(const string& code, const string& file) const {
268
+ auto r = MicroTeX::parse(code, _maxWidth, _textSize, _textSize / 3.f, _foreground);
269
+ const float w = r->getWidth() + _padding * 2;
270
+ const float h = r->getHeight() + _padding * 2;
271
+ auto surface = Cairo::SvgSurface::create(file, w, h);
272
+ auto context = Cairo::Context::create(surface);
273
+ Graphics2D_cairo g2(context->cobj());
274
+ if (!isTransparent(_background)) {
275
+ g2.setColor(_background);
276
+ g2.fillRect(0, 0, w, h);
277
+ }
278
+ r->draw(g2, _padding, _padding);
279
+ delete r;
280
+ }
281
+
282
+ int runBatch() const {
283
+ if (_samplesFile.empty()) {
284
+ printf(RED_ANSI "Error: the option '-samples' must be specified\n" RESET_ANSI);
285
+ return 1;
286
+ }
287
+ if (_outputDir.empty()) {
288
+ printf(RED_ANSI "Error: the option '-outputdir' must be specified\n" RESET_ANSI);
289
+ return 1;
290
+ }
291
+ Samples samples(_samplesFile);
292
+ if (samples.isEmpty()) {
293
+ printf(RED_ANSI "Error: no samples was loaded\n" RESET_ANSI);
294
+ return 1;
295
+ }
296
+ if (samples.count() == 0) return 1;
297
+ for (int i = 0; i < samples.count(); i++) {
298
+ generateSingle(samples.next(), _outputDir + "/" + _prefix + toString(i) + ".svg");
299
+ }
300
+ return 0;
301
+ }
302
+
303
+ int runSingle() const {
304
+ if (_outputFile.empty()) {
305
+ printf(RED_ANSI "Error: the option '-output' must be specified\n" RESET_ANSI);
306
+ return 1;
307
+ }
308
+ const string& code = _input;
309
+ generateSingle(code, _outputFile);
310
+ return 0;
311
+ }
312
+
313
+ int run() {
314
+ if (_textSize <= 0.f) _textSize = 20.f;
315
+ if (isTransparent(_foreground)) _foreground = BLACK;
316
+ if (_maxWidth <= 0.f) _maxWidth = 720.f;
317
+ if (!_input.empty()) return runSingle();
318
+ return runBatch();
319
+ }
320
+ };
321
+
322
+ template <typename F>
323
+ void getOpt(const std::string& opt, F&& f) {
324
+ size_t i = opt.find('=');
325
+ if (i != 0) {
326
+ auto key = opt.substr(0, i);
327
+ auto value = opt.substr(i + 1);
328
+ f(key, value);
329
+ }
330
+ }
331
+
332
+ void getHeadlessOpt(Headless& h, const std::string& key, const std::string& value) {
333
+ if (key == "-outputdir") {
334
+ h._outputDir = value;
335
+ } else if (key == "-samples") {
336
+ h._samplesFile = value;
337
+ } else if (key == "-prefix") {
338
+ h._prefix = value;
339
+ } else if (key == "-textsize") {
340
+ valueOf(value, h._textSize);
341
+ } else if (key == "-foreground") {
342
+ h._foreground = microtex::getColor(value);
343
+ } else if (key == "-background") {
344
+ h._background = microtex::getColor(value);
345
+ } else if (key == "-input") {
346
+ h._input = value;
347
+ } else if (key == "-output") {
348
+ h._outputFile = value;
349
+ } else if (key == "-padding") {
350
+ valueOf(value, h._padding);
351
+ } else if (key == "-maxwidth") {
352
+ valueOf(value, h._maxWidth);
353
+ }
354
+ }
355
+
356
+ int runWindow(const std::string& samplesFile, char* argv[]) {
357
+ int cnt = 0;
358
+ auto app = Gtk::Application::create(cnt, argv, "io.nano.LaTeX");
359
+ MainWindow win(samplesFile);
360
+ int result = app->run(win);
361
+ return result;
362
+ }
363
+
364
+ int runHelp() {
365
+ #define B BOLD_ANSI
366
+ #define R RESET_ANSI
367
+ const char* msg =
368
+ "Application to parse and display LaTeX code. The application will run with the headless\n"
369
+ "mode if the option '-headless' has given, otherwise, it will run with the GUI mode.\n\n" B
370
+ "NOTICE\n" R
371
+ " If both '-outputdir' and '-input' are specified, the '-input' option wins.\n\n" B
372
+ " COMMON OPTIONS\n\n"
373
+ " -h\n" R " show usages and exit\n\n" B " -headless\n" R
374
+ " run the application with the headless mode (no GUI), that converts the input LaTeX\n"
375
+ " code into SVG file\n\n" B " -textsize=[VALUE]\n" R
376
+ " a float value to config the text size (in point) to display formulas, the default\n"
377
+ " is 20\n\n" B " -foreground=[COLOR]\n" R
378
+ " config the foreground color to display formulas; the value can be a color name or\n"
379
+ " in the form of #AARRGGBB; default is black\n\n" B " -background=[COLOR]\n" R
380
+ " config the background color to display formulas; the value can be a color name or\n"
381
+ " in the form of #AARRGGBB; default is transparent\n\n" B " -padding=[VALUE]\n" R
382
+ " a float value to config spaces (in pixel) to add to the SVG images, the default is "
383
+ "10\n\n" B " -maxwidth=[VALUE]\n" R
384
+ " config the max width of the graphics context, the default is 720 pixels; this option\n"
385
+ " has weak limits on the SVG images, thus the width of the SVG image may be wider than\n"
386
+ " the value defined by this option\n\n" B " -mathfont=<FILE>\n" R
387
+ " the math font file to display formulas\n\n" B " -clm=<FILE>\n" R
388
+ " the clm file to display formulas\n\n" B "BATCH MODE\n" R
389
+ "The application will save the SVG images produced by the LaTeX codes that parsed from the\n"
390
+ "given file (specified by the option '-samples') into the directory specified by the option\n"
391
+ "'-outputdir'.\n\n" B " -outputdir=[WHERE]\n" R
392
+ " indicates the directory to save the SVG images\n\n" B " -samples=<FILE>\n" R
393
+ " specifies the file that contains various LaTeX codes split by a line that consists of\n"
394
+ " the character '\%' only\n\n" B " -prefix=[VALUE]\n" R
395
+ " specifies the prefix of the filename of the SVG images, the default is ''; for "
396
+ "example,\n"
397
+ " if 2 pieces of code has given with the option '-prefix=a_', the filename of the SVG\n"
398
+ " images will be 'a_0.svg' and 'a_1.svg'\n\n" B
399
+ "SINGLE MODE\n\n"
400
+ " -input=[CODE]\n" R " the source code that is written in LaTeX\n\n" B
401
+ " -output=[FILE]\n" R
402
+ " indicates where to save the produced SVG image, only works if the option '-input' has "
403
+ "given\n\n";
404
+ printf("%s", msg);
405
+ return 0;
406
+ }
407
+
408
+ template <typename F>
409
+ long countDuration(F f) {
410
+ auto start = std::chrono::high_resolution_clock::now();
411
+ f();
412
+ auto stop = std::chrono::high_resolution_clock::now();
413
+ return std::chrono::duration_cast<std::chrono::microseconds>(stop - start).count();
414
+ }
415
+
416
+ int runPerf(const std::string& samplesFilePath) {
417
+ Samples samples(samplesFilePath);
418
+ auto surface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, 1024, 1024);
419
+ auto ctx = Cairo::Context::create(surface);
420
+ Graphics2D_cairo g2(ctx->cobj());
421
+
422
+ auto run = [&](const std::string& sample) {
423
+ auto render = MicroTeX::parse(sample, 1024, 20.f, 20.f / 3.f, 0xff424242);
424
+ long d = 0;
425
+ for (int j = 0; j < 10; j++) {
426
+ d += countDuration([&] { render->draw(g2, 0, 0); });
427
+ }
428
+ delete render;
429
+ return d / 10;
430
+ };
431
+
432
+ for (int i = 0; i < samples.count(); i++) {
433
+ const auto& sample = samples.next();
434
+ MicroTeX::setRenderGlyphUsePath(false);
435
+ const auto d1 = run(sample);
436
+ printf("%ld, ", d1);
437
+ MicroTeX::setRenderGlyphUsePath(true);
438
+ const auto d2 = run(sample);
439
+ printf("%ld\n", d2);
440
+ }
441
+
442
+ return 0;
443
+ }
444
+
445
+ int main(int argc, char* argv[]) {
446
+ bool isHeadless = false;
447
+ bool isPerf = false;
448
+ bool usePath = false;
449
+ Headless h;
450
+ std::optional<std::string> fontsense;
451
+ std::string mathFont, clmFile;
452
+ std::string samplesFile;
453
+ auto f = [&](const std::string& key, const std::string& value) {
454
+ if (key == "-mathfont") {
455
+ mathFont = value;
456
+ } else if (key == "-clm") {
457
+ clmFile = value;
458
+ } else if (key == "-samples") {
459
+ samplesFile = value;
460
+ h._samplesFile = value;
461
+ } else if (key == "-fontsense") {
462
+ fontsense = value;
463
+ } else if (key == "-usepath") {
464
+ usePath = value == "true";
465
+ } else {
466
+ getHeadlessOpt(h, key, value);
467
+ }
468
+ };
469
+ for (int i = 0; i < argc; i++) {
470
+ const string opt = argv[i];
471
+ if (opt == "-h") return runHelp();
472
+ if (opt == "-headless") {
473
+ isHeadless = true;
474
+ } else if (opt == "-perf") {
475
+ isPerf = true;
476
+ } else {
477
+ getOpt(opt, f);
478
+ }
479
+ }
480
+
481
+ if (!fontsense.has_value() && (mathFont.empty() || clmFile.empty())) {
482
+ printf(RED_ANSI "No math font or clm file was given, exit...\n" GREEN_ANSI
483
+ "You can specify it by option -mathfont and -clm\n");
484
+ return 1;
485
+ }
486
+
487
+ Pango::init();
488
+ if (fontsense.has_value()) {
489
+ if (fontsense.value().empty()) {
490
+ Init init = InitFontSenseAuto{};
491
+ MicroTeX::init(init);
492
+ } else {
493
+ Init init;
494
+ init.emplace<1>(fontsense.value());
495
+ MicroTeX::init(init);
496
+ }
497
+ } else {
498
+ const FontSrcFile font = FontSrcFile{clmFile, mathFont};
499
+ Init init = &font;
500
+ MicroTeX::init(init);
501
+ }
502
+
503
+ printf("loaded math fonts:\n\t");
504
+ for (auto& str : MicroTeX::mathFontNames()) {
505
+ printf("%s, ", str.c_str());
506
+ }
507
+ printf("\n");
508
+
509
+ printf("loaded main fonts:\n\t");
510
+ for (auto& str : MicroTeX::mainFontFamilies()) {
511
+ printf("%s, ", str.c_str());
512
+ }
513
+ printf("\n");
514
+
515
+ PlatformFactory::registerFactory("gtk", std::make_unique<PlatformFactory_cairo>());
516
+ PlatformFactory::activate("gtk");
517
+
518
+ MicroTeX::setRenderGlyphUsePath(usePath);
519
+
520
+ int result = 0;
521
+ if (isHeadless) {
522
+ result = h.run();
523
+ } else if (isPerf) {
524
+ result = runPerf(samplesFile);
525
+ } else {
526
+ result = runWindow(samplesFile, argv);
527
+ }
528
+
529
+ MicroTeX::release();
530
+ return result;
531
+ }
@@ -0,0 +1,19 @@
1
+ example_gtkmm_src = [
2
+ 'gtkmm_main.cpp',
3
+ '../samples/samples.cpp'
4
+ ]
5
+ example_gtkmm_inc = '../samples'
6
+
7
+ example_gtkmm_deps = [
8
+ dependency('gtkmm-3.0'),
9
+ dependency('gtksourceviewmm-3.0'),
10
+ microtex_cairo_dep
11
+ ]
12
+
13
+ executable(
14
+ 'microtex-gtkmm-example', example_gtkmm_src,
15
+ include_directories: example_gtkmm_inc,
16
+ link_with: [microtex_cairo_lib, microtex_lib],
17
+ dependencies: example_gtkmm_deps,
18
+ install: true
19
+ )
@@ -0,0 +1,12 @@
1
+ add_executable(
2
+ microtex-memcheck
3
+ ../samples/samples.cpp
4
+ mem_check_main.cpp
5
+ )
6
+
7
+ target_include_directories(microtex-memcheck PUBLIC ../samples)
8
+
9
+ target_link_libraries(
10
+ microtex-memcheck PRIVATE
11
+ microtex
12
+ )