Expand description
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| {
// ...
})Re-exports
pub extern crate arena_system;pub extern crate ocl;pub extern crate owned_ttf_parser as ttfp;pub use point::Point;pub use point::PointHandle;pub use point::PointId;pub use font::Font;pub use font::Glyph;pub use font::OutlinedGlyph;pub use font::TriangulatedGlyph;