graphemy-typst
Use Graphemy scripts in your typst documents
Build
Dependencies
- Cargo with the Rust
wasm32-unknown-unknowntoolchain 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 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
#import "graphemy.typ": load-gmy
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
#let myscript = load-gmy("myscript.gmy").with(margin: 3)
Use your script as a function which formats strings
#myscript("my sample text")
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
widthandheightare 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
widthis, 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 /software/graphemy-typst/src/commit/6b5069e1240a683cc4f4d6e1aa3669d1859b8cd2/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.