VDTFont

A novel library for converting glyphs into triangulations which can be used when rendering text in Game and Application interfaces.
use ;
// Create a font
let font_data = include_bytes!;
let mut font = from_vec?;
// Obtain a glyph
let glyph = font.glyph;
// Outline the glyph
let outlined_glyph = font.outline_glyph;
// Triangulate th glyph
let triangulated_glyph = font.triangulate_glyph?;
// Use the resulting triangulation
triangulated_glyph
.triangles
.
.for_each
Full documentaion: https://docs.rs/vdtfont
Overview
VDTFont uses OpenCL to build Voronoi diagram and compute Delaunay triangulation with points from the glyph. The triangulation of the glyph can be used for its rendering.
Full algorithm of triangulation is described in the paper "Computing Two-dimensional Delaunay Triangulation Using Graphics Hardware".
What's new?
The original font_rasterizer wasn't competetive so it was decided to almost fully rewrite it.
A new library VDTFont doesn't use classical method of rasterizing every pixel, but triangulates glyphs using GPU.
Dependencies
On Debian 11:
- ocl-icd-libopencl1
- opencl-headers
- OpenCL drivers for your GPU (e.g. intel-opencl-icd for Intel GPU)
Usage
Run the following Cargo command in your Rust project directory:
Or add the following line to your Cargo.toml:
vdtfont = "0.3.2"
Build
Run the following Cargo command in the project directory:
Example
Run the following command:
# build it
# run it
)

Roadmap
- Realize basic glyph triangulation functionality
- Fix inserting edge algorithm
- Add C FFI
- Add function to fix self-intersecting outlines of glyphs