vdtfont/lib.rs
1//! A novel library for converting glyphs into triangulations which can be
2//! used to simplify text rendering in Game and Application Interfaces.
3//!
4//! ```
5//! use vdtfont::{*, delaunay::*};
6//!
7//! // Create a font
8//! let font_data = include_bytes!("/usr/share/fonts/truetype/open-sans/OpenSans-Regular.ttf");
9//! let mut font = Font::from_vec(font_data.to_vec()).unwrap();
10//!
11//! // Obtain a glyph
12//! let glyph = font.glyph('a');
13//! // Outline the glyph
14//! let outlined_glyph = font.outline_glyph(glyph);
15//! // Triangulate th glyph
16//! let triangulated_glyph = font.triangulate_glyph(outlined_glyph).unwrap();
17//!
18//! // Use the resulting triangulation
19//! triangulated_glyph
20//! .triangles()
21//! .handle_iter::<DelaunayTriangleHandle>(triangulated_glyph.points())
22//! .for_each(|triangle_handle| {
23//! // ...
24//! })
25//! ```
26
27pub extern crate arena_system;
28pub extern crate ocl;
29pub extern crate owned_ttf_parser as ttfp;
30
31pub mod delaunay;
32pub mod font;
33pub mod opencl;
34pub mod point;
35pub mod voronoi;
36
37pub use font::{Font, Glyph, OutlinedGlyph, TriangulatedGlyph};
38pub use point::{Point, PointHandle, PointId};