vdtfont 0.3.0

A library for converting glyphs into triangulations
Documentation

VDTFont

A novel library for converting glyphs into triangulations which can be used right in the Graphical APIs.

use vdtfont::{*, delaunay::*};

// Create a font
let font_data = include_bytes!("/usr/share/fonts/truetype/open-sans/OpenSans-Regular.ttf");
let mut font = Font::from_vec(font_data.to_vec())?;

// Obtain a glyph
let glyph = font.glyph('a');
// Outline the glyph
let outlined_glyph = font.outline_glyph(glyph);
// Triangulate th glyph
let triangulated_glyph = font.triangulate_glyph(outlined_glyph)?;

// Use the resulting triangulation
triangulated_glyph
    .triangles()
    .handle_iter::<DelaunayTriangleHandle>(triangulated_glyph.points())
    .for_each(|triangle_handle| {
        // ...
    })