Expand description
C-ABI compatible types for FFI consumers.
This module provides #[repr(C)] types that can be safely passed across FFI
boundaries. These types mirror the internal Rust types but use C-compatible
layouts for integration with C, Python (via ctypes/cffi), and other languages.
§Memory Ownership
- Types ending in
Care C-ABI compatible copies - Slice views (
*const T,len) are borrowed - caller must not free - Owned arrays should be freed via the corresponding
_free()function
§Example (conceptual C usage)
TypfShapingResultC result;
int err = typf_shape_text("hb", "Hello", "/path/font.ttf", 24.0, &result);
if (err == 0) {
for (uint32_t i = 0; i < result.glyph_count; i++) {
printf("Glyph %u at (%.1f, %.1f)\n",
result.glyphs[i].glyph_id,
result.glyphs[i].x,
result.glyphs[i].y);
}
typf_shaping_result_free(&result);
}Structs§
- Glyph
Iterator - Glyph iterator for zero-copy consumption.
- Glyph
Mesh - A mesh of triangles for GPU rendering.
- Positioned
GlyphC - C-ABI compatible positioned glyph.
- Render
Mesh - A collection of glyph meshes ready for GPU rendering.
- Shaping
ResultC - C-ABI compatible shaping result.
- Vertex2D
- Vertex for GPU rendering (2D position only).
- Vertex
Color - Vertex with position and RGBA color.
- VertexUV
- Vertex with position and UV coordinates for textured rendering.
Enums§
- DirectionC
- Text direction as a C-compatible enum.