* ~graphemy-typst~ Use [[https://codeberg.org/zhuriel/graphemy][Graphemy]] scripts in your typst documents ** Build Dependencies - Cargo with the Rust =wasm32-unknown-unknown= toolchain installed Run ~build.sh~. ** Installation *** As a typst package The =typst= directory contains the typst package files that you can copy to your local package repository. See the [[https://github.com/typst/packages/blob/main/README.md#local-packages][typst package documentation]] for more information. *** As a standalone typst file Copy =typst/graphemy_typst.wasm= and =typst/graphemy.typ= to your project directory. (this is the method that will be used in the rest of this document.) ** Usage Import the ~load-gmy~ function from the package #+begin_src typst #import "graphemy.typ": load-gmy #+end_src Load your script, This will read the specified file. you can also add here options that should be set for all instances of your script, such as ~margin~ #+begin_src typst #let myscript = load-gmy("myscript.gmy").with(margin: 3) #+end_src Use your script as a function which formats strings #+begin_src typ #myscript("my sample text") #+end_src Available options are - ~width~ :: The width of the resulting text in absolute length, also informs the linewidth for the graphemy typesetter if it is not set separately. (default: auto) - height :: The height of the resulting text in absolute length. If both ~width~ and ~height~ are set, informs the shape of the bounding box for the text. (default: auto) - ~margin~ :: The margin left around the image by graphemy, useful in stroke-based scripts. (defaulut: 0) - ~comment~ :: Doesn’t do anything in practice, only added for completness of the Graphemy rendering options. (default: none) - ~fg~ :: the foreground color of the rendered text, specified as a Typst color value (default: color.black) - bg :: the background color of the rendered text, specified as a Typst color value (default: none) - ~linewidth~ :: the logical linewidth in absolute length, if it isn’t specified but ~width~ is, it is used instead, otherwise the default is 100pt. - scale :: overall scale factor of the text, doesn’t affect the typst bounding box, just the scaling. ** License Copyright © Annwan 2025 This project is licensed under the terms of the GNU General Public License version 3. A copy of the license can be found in [[LICENSE]] or obtained from the Free Software Fundation at [[https://www.gnu.org/licenses/gpl-3.0.en.html]]. Graphemy is Copyright © Zhuriel 2024-2025, licensed under the terms of the GNU General Public License version 3.