- It's pretty fast!
- Editor Integration
- Inherits all Functionality from
Sprite
- Adjustable Font Size
- Adjustable Font Color
- Anti-Aliasing (with Toggle)
The add-on is tested for Godot 4.3.x and is expected to run on > 4.1. There is also a branch for Godot 3, which was tested for 3.5.x and is expected to run on 3.x. It supports MacOS, Windows and Linux. Android is sadly not currently supported, although pertaining PRs are welcome.
A custom node LaTeX
() inheriting from Sprite
is provided and may be instanced like any other. It has the following properties, which may be updated in the editor or programmatically at runtime
- LatexExpression: A
string
containing the expression to be rendered. If invalid, the corresponding error message will be rendered instead. - FontSize: A
float
, the font size in points. It essentially controls the resolution of the rendered image. Decrease for better performance, increase for higher fidelity. - MathColor: A Godot
Color
, the typeface's color. - AntiAliasing: A
bool
. The renderer may or may not be instructed to anti-aliase the rendered typeface. Note that this is distinct from Godot's own anti-aliasing.
When updating these in the editor, the expression is automatically rendered anew. When updating properties programmatically, you decide yourself when to render by calling the .Render()
method - to save ressources. Rendering very often (several times a millisecond) may result in errors.
There is also a LaTeXButton
() node for clickable expressions. This behaves like a TextureButton
.
Further, a special node for usage in 3D is provided - LaTeX3D
().
For a list of LaTeX examples that can be rendered, see here.
A demo is available here.
- (Create a Godot Mono project.)
- Install GodoTeX from the AssetLib tab. When including in an existing project, you won't need the
*.godot
and*.sln
. (If warned about conflicts, untick "Ignore asset root directory". This will create a subfolder.) - The add-on depends on
CSharpMath.SkiaSharp
, licensed under MIT, as a nuget package. You integrate this into your existing Godot Mono project by copying the<ItemGroup>
-tags into your project's.csproj
-file fromGodoTeX.csproj
, directly below the<PropertyGroup>
tags.. (If you don't yet have a.csproj
file, create and build a C# script. That will throw errors before copying the tags, since we are fixing the issue in this step.) - Build the C# project.
- Enable the addon in the settings, at Project>Project Settings>Plugins. You can now create a
LaTeX
node and start your math excapades!
Licensed under MIT. © 2022-2023 fi-le